← All Labs
GristleOpen Sourcegithub.com/Alchemy-Agentic/gristle

Graphs, not chunks.

Most AI tools flatten a codebase into vector chunks and lose the structure that matters. Gristle parses a repo into a graph — function calls, imports, inheritance, data flow as first-class edges — so an agent can query code the way you actually think about it.

View on GitHub →
FIG. 03 CODE AS GRAPH Graph() CALLS IMPORTS INHERITS NOT CHUNKS

The reframe

TENET 02

Relationships as edges. Most tools throw them away.

A codebase is a graph — we kept it instead of flattening it into chunks. All four tenets →

The problem

Point an AI agent at your codebase and it usually reads it as a pile of text chunks in a vector database. “Function A calls B, which inherits from C” becomes three unrelated snippets. The relationships — the part that tells you what breaks when you change something — are exactly what gets thrown away.

The solution

Gristle keeps the relationships as edges, not afterthoughts. It runs as an MCP server, so an agent can ask real structural questions — what breaks if I change this, how data flows from handler to database, what conventions a project follows — and get answers grounded in the actual structure.

How it works

Read code as a graph.

1
Parse the repo

Gristle ingests Python, TypeScript, and JavaScript into a graph database — functions, classes, imports, routes, and tests.

2
Relationships as edges

Calls, imports, inheritance, and data flow are first-class, not flattened into text. The structure survives.

3
Agents query it

Exposed over MCP: impact analysis, call tracing, convention and security checks — 28 tools an agent can call directly.

Under the hood

Typed edges, not chunks
(parse_module)  ─CALLS─▶     (build_graph)
(cli.py)        ─IMPORTS─▶   (parse_module)
(PyParser)      ─INHERITS─▶  (BaseParser)
(build_graph)   ─CALLS─▶     (upsert_nodes)

Illustrative — every relationship an agent needs is a queryable edge.

At a glance28 MCP TOOLSGRAPH-FIRSTPYTHONTYPESCRIPTJAVASCRIPTOPEN SOURCE

The build story

"Everyone was chunking code into a vector DB and losing the structure. We kept it."

Gristle came out of a simple frustration: AI agents are great at reading code and bad at understanding how it connects. Vectors throw away the graph that was right there. We built the graph instead and open-sourced it — because the idea is worth more spread than owned, and the same structure-first thinking (tenet 02) runs under our bigger bets. See Mentat.

Map your codebase.

It's open source — grab it on GitHub and point it at your repo. Or talk to us about putting graph-first code intelligence to work on your systems.

View on GitHub →