How Graphify works
Concepts · from AST to answer
Last updated July 1, 2026
A code knowledge graph isa machine-readable map of a codebase: functions, classes, files, database tables, and docs become nodes; calls, imports, definitions, and references become typed, directed edges. Because the relationships are stored explicitly, an AI assistant can answer structural questions by traversing edges instead of searching text — the same "things, not strings" idea Google introduced for web search in 2012, applied to code.
Graphify builds that graph on-device and hands it to your coding assistant to query instead of grepping. This page explains the machinery: how the graph gets built, what an edge really is, why traversal beats similarity search for code, and how your assistant talks to it. New to the vocabulary? Keep the glossary open alongside.
How the graph is built
Everything happens on your machine. When you run /graphify . in your assistant (or graphify from the terminal), the pipeline has two distinct stages, and the distinction matters:
- Code is parsed, not read by a model. Graphify bundles 36 grammars for tree-sitter — in its own words, "a parser generator tool and an incremental parsing library" — and walks the AST of every source file locally. Functions, classes, imports, and calls become nodes and edges because the parser found them — deterministic, no API call, no hallucination.
- Everything else is read by your model.Docs, PDFs, SQL schemas, Terraform — the things an AST can't capture — are connected into the graph using whichever model backend you configure (Claude, OpenAI, Gemini, DeepSeek, Ollama, and others). These edges are labeled as inferred, never passed off as parsed fact.
The output is three local files: an interactive graph.html, a GRAPH_REPORT.md that surfaces god nodes, communities, and surprising connections, and the raw graph.json. Nothing is uploaded anywhere. The full walkthrough is in the docs.
What an edge is — and why provenance matters
An edge is a typed, directed claim about your codebase: this function calls that one, this module imports that one, this doc describes that service. Any tool can make claims; the question is whether you can tell which ones to trust. Graphify attaches a confidence tag to every edge:
- EXTRACTED — straight from the AST. The parser found it.
- INFERRED — a model connected the dots. Usually right, labeled as a judgment call.
- AMBIGUOUS— evidence Graphify couldn't fully resolve (dynamic dispatch, reflection, string-built imports). Kept, and flagged as uncertain rather than silently guessed.
This provenance model is the quiet backbone of the whole product: when your assistant answers a question by traversing the graph, you can see exactly which hops are parsed facts and which are inferences. A similarity score can't offer that.
Why a graph beats embeddings and grep
Grep finds strings. Embeddings find lookalikes. Neither finds connections— and connections are what most hard questions about code are made of. "What breaks if I change this?" is a multi-hop question: caller of a caller of a caller. Chunk-based retrieval breaks past one or two hops because chunking severed the links before retrieval ever started; grep answers only the single hop you can express as a string. The retrieval literature has converged on the same diagnosis — approaches like GraphRAG (Edge et al., 2024) add a knowledge graph on top of chunk retrieval to recover exactly this lost structure.
A graph answers by traversal. graphify query pulls everything connected to a symbol; graphify path walks the exact route between two entities; graphify explain tells you why an edge exists. The answer arrives as a path through your real code — traceable, inspectable, and cheap to keep fresh, since changing a file updates its nodes without re-indexing the world. The detailed head-to-heads are at Graphify vs RAG and Graphify vs vector databases. (And the honest limit: for fuzzy search over large volumes of prose, embeddings are still the right tool.)
How your assistant queries it
Two doors into the same graph:
- As a skill.
graphify installregisters Graphify in the assistants you use — 17 of them, including Claude Code, Cursor, Codex, Copilot, Gemini CLI, and Aider (full list). The assistant runs the CLI commands itself when it needs codebase context. - Over MCP. Graphify ships a Model Context Protocol server (stdio or HTTP). MCP describes itself as "an open-source standard for connecting AI applications to external systems," and that's exactly the role the graph plays here: any MCP-capable assistant calls it as a native tool instead of shelling out. Setup is in the MCP section of the docs.
Either way, the payoff is the same: instead of pasting whole files into the context window, the assistant receives the relevant subgraph — the entities and relationships on the path to the answer — and spends its tokens on the task rather than on retrieval. Git-hook integration keeps the graph rebuilt as the code changes.
On-device by design
Graphify's privacy model is structural, not a policy promise. Parsing runs locally with bundled grammars; the graph lives in files on your disk; there is no account, no hosted index, and no telemetry. The one honest caveat: your assistant's own model calls work the way they always did — Graphify adds no new place your code travels, but it doesn't change where your assistant sends its prompts. Details on the security page. Teams that want this same graph powering PR review inside their own VPC should look at Graphify Enterprise.
Where to go next
See the concrete scenarios this enables in use cases, look up any term in the glossary, or skip straight to the quickstart — the whole thing is open source under MIT, and free means free.