Why Graft Exists
The problem
Section titled “The problem”A code map is supposed to tell an agent what it needs to know so it doesn’t have to read every file. But standard RAG just returns excerpts of source code, and plain embeddings lose the structure — who calls what, what depends on what.
So the agent still has to write a script or use grep to figure out how things wire together, blowing through its token budget and your time as it wanders the repo.

What Graft does
Section titled “What Graft does”Graft solves this by writing the map down instead of leaving it in an opaque vector database. It uses tree-sitter (the same C-based parser behind syntax highlighting in your editor) to parse the AST of every file. It extracts every function, class, and method, resolves where they are called from across the entire codebase, and maps the dependencies.
Then it hands those files to an LLM to summarize what they do.
The result is a graph of nodes — one node per subsystem or key concept — connected by typed links (depends_on, uses, implements), all saved as plain markdown files in a graft/ directory.
When an agent needs context, it isn’t guessing which files to read. It enters the graph at a relevant node, reads the summary, and follows the links directly to the dependencies it actually needs.
