Graft is a context layer for large codebases. It builds an understanding of a repository once and writes it as a folder of linked markdown files, one node per subsystem, API or concept, so that Claude Code, Cursor, Codex, Gemini and other coding agents start a task oriented instead of re-exploring the repository with grep and file reads. The graph is a set of plain files the agent opens, greps and follows like any other file: no embeddings, no similarity search, no database and no server. The generated graph is a regenerable local cache, and only the small agent wiring is committed.
Each node holds a plain-English summary of what the code does, a crux (the handful of source lines that carry the logic, stored as text rather than line numbers so it stays correct as the file shifts), the source files it was built from tracked by content hash, typed wikilinks to other nodes (depends_on, part_of, uses, implements, produces), and a notes section that is preserved across regenerations. Alongside the markdown graph, a per-symbol code graph records every function, class and call edge, with a per-file wiring card mirroring the source tree.
Building runs in tiers. The structural code graph is deterministic tree-sitter that needs no model or key and runs locally, and covers 23 languages, nine of them with full-fidelity extractors (scope-aware, cross-file call and import resolution) and the rest with a broader symbol-and-call tier. An opt-in pass adds compiler-grade call edges from a language server when one is installed. The deep pass uses a model of your choice (OpenAI, Anthropic, OpenRouter, Fireworks, Groq, OrcaRouter, a LiteLLM proxy, or a local model) to summarize each file and group the summaries into nodes with typed links. Every pass is cached by content hash, and every query refreshes the graph against the working tree first, so answers describe the code as it is now, uncommitted edits included.
One init command detects the coding agents in use, writes each one's native instruction file, registers an MCP server with six tools (ranked code search with source inlined, a file's API surface without bodies, call tracing in either direction for blast radius, regex search grouped by enclosing symbol, a repo map, and a freshness check), and installs a post-edit hook that prints blast-radius warnings and re-syncs the graph. Claude Code additionally gets a live statusline, matching nodes pulled into each prompt, and the repo map at session start. The CLI covers ask, skeleton, callers, grep, map and blast, a viewer shows the architecture graph, the per-symbol graph and a file outline with edges labeled by a closed set of verbs, and monorepos, submodules and multi-repo folders are supported. The only network calls are the configured model requests, a daily version check and an anonymous, opt-out usage ping.
The project reports two benchmarks: a controlled sweep (162 runs over two repositories, Claude Sonnet 5 on both arms, an Opus 4.8 judge with a required-keyword floor) and SWE-bench Verified (50 instances, same model and turn limits, graded by the official harness).
| Metric | Cold Claude Code | With Graft |
|---|---|---|
| Sweep: cost per task | $0.0429 | $0.0292 |
| Sweep: tokens per task | 8,070 | 4,650 |
| Sweep: tool calls per task | 4.2 | 2.3 |
| Sweep: latency per task | 39.8 s | 15.8 s |
| Sweep: correctness | 93% | 93% |
| SWE-bench Verified: resolved | 27/50 (54%) | 33/50 (66%) |
| SWE-bench Verified: tokens | 142.0M | 109.4M |
| SWE-bench Verified: wall clock | 13,094 s | 8,922 s |
Features
- Markdown node graph: one linked file per subsystem, API or concept, with a summary, crux lines, hashed sources, typed wikilinks and preserved notes
- Per-symbol code graph: every function, class and call edge from deterministic tree-sitter, with no model or key required
- 23 languages: full-fidelity extractors for TypeScript, JavaScript, Python, Go, Java, Kotlin, PHP, Swift and R, and a broad tier for Rust, C, C++, C#, Ruby, Scala, Elixir, Solidity, OCaml, Zig, Dart, Clojure, Nix and Lua
- Language-server edges: an opt-in pass adds compiler-grade call edges from rust-analyzer, clangd, gopls, pyright or typescript-language-server when present
- Provider choice: file summaries and node synthesis through OpenAI, Anthropic, OpenRouter, Fireworks, Groq, OrcaRouter, a LiteLLM proxy or a local model, under your own key
- Content-hash caching: rebuilds touch only changed files, and every query refreshes the graph against the working tree before answering
- MCP server: six tools for ranked code search, a file's API surface, call tracing, grouped regex search, a repo map and a freshness check
- Agent wiring: one init writes native instruction files for detected agents and installs a post-edit hook with blast-radius warnings and automatic re-sync
- Claude Code integration: live statusline with graph size and staleness, context pulled into each prompt, and a repo map at session start
- Search and orient: exhaustive regex search grouped by symbol and ranked by coupling, and a token-budgeted repo map of directory clusters, hubs and hotspots
- Interactive viewer: architecture, code and outline tabs with directional dependency highlighting and verb-filtered edges, live-reloading on changes
- Repository layouts: monorepos, submodules and multi-repo folders

