Graft: Open-Source Context Graph Solves Coding Agent Amnesia, Lifts SWE-bench by 12%p
Graft (@nanonets/graft) builds markdown context graphs without vector DBs, lifting Claude Sonnet 5's SWE-bench solve rate from 54% to 66% while cutting token co
Graft (@nanonets/graft), an open-source codebase context graph tool designed to address the persistent issue of "codebase amnesia" in AI coding agents, was officially unveiled in September 2026. Rather than forcing agents to consume valuable context windows by repetitively executing grep scans and tracing import chains from scratch in every session, Graft automatically builds a structured markdown graph (graft/*.md) connected by wikilinks ([[wikilinks]]) directly inside the repository, allowing agents to comprehend project architecture through standard file-reading operations.

Image source: Ryan Hart (@thisdudelikesAI) / NanoNets
In benchmark evaluations conducted on 50 problem instances from SWE-bench Verified under identical conditions (Claude Sonnet 5), integrating Graft increased the task resolution rate from 54% (27/50) to 66% (33/50)—a 12 percentage point improvement. The setup simultaneously decreased total token consumption by 23% and reduced tool calls by 25%, demonstrating measurable gains in both agent efficiency and operational costs.
Vector-Free Markdown Graphs: Agent-Native Architecture
The defining characteristic of Graft is that it operates without requiring vector databases, external embedding pipelines, or specialized indexing infrastructure.
While conventional AI code search approaches rely heavily on RAG (retrieval-augmented generation) over vector similarity, Graft models a codebase's systems, APIs, and key domain abstractions as markdown nodes stored in a graft/ directory interconnected via wikilinks ([[wikilinks]]).
- Native File Navigation: Agents do not need custom API clients or vector query tool endpoints. They traverse architectural relationships by reading standard markdown files and following explicit wikilinks, leveraging existing file-system inspection tooling.
- Tree-sitter Parsing at Zero Cost: Static code structure is analyzed entirely on the local machine via Tree-sitter parsers, requiring neither LLM inference tokens nor external network requests. Over 20 programming languages are supported out of the box, including TypeScript, Python, Go, Rust, and C++.
- Version Control Compatibility: Because graph documents reside as plain markdown files within the Git repository, human developers and automated agents share an identical, version-tracked architectural view that can be audited through routine code reviews.
SWE-bench Verified 50-Instance Results: 66% Solve Rate and Resource Reductions
In head-to-head testing across 50 SWE-bench Verified problem instances using Claude Sonnet 5, Graft delivered tangible improvements in patch accuracy alongside substantial resource savings.
| Metric | Claude Sonnet 5 Baseline | Claude Sonnet 5 + Graft | Relative Change |
|---|---|---|---|
| Solve Rate | 27 / 50 (54%) | 33 / 50 (66%) | +12%p |
| Token Consumption | 142.0M | 109.4M | -23% |
| Tool Invocations | 1,370 | 1,031 | -25% |
| Wall-Clock Time | 13,094s | 8,922s | -32% |
| Total API Cost | $52.34 | $42.43 | -19% |
The observed gain in solve rate is largely attributable to mitigating a well-documented weakness of coding agents: single-file edit bias. Unassisted agents frequently edit only the single file explicitly referenced in an issue report, neglecting related dependent modules and subsequently failing comprehensive regression suites.
A notable instance occurred in django-11532: the unassisted Claude Code baseline edited only 1 of 5 interdependent files, triggering 18 test failures. Under the Graft configuration, the agent identified the full cluster of interdependent files through the graph's link topology, successfully modifying all five files and passing the verification suite.
Two-Step Setup and Operational Considerations
Graft integrates into existing development workflows through two simple commands without complex configuration:
# Install the global CLI
npm install -g @nanonets/graft
# Initialize the repository context graph
graft init
Once initialized, the graph is immediately usable by any agent harness with file-reading permissions, including Claude Code, Cursor, and Codex.
For practical engineering workflows, several operational limits and caveats should be noted:
- Benchmark Scope and Sample Bias: The reported SWE-bench Verified metrics originate from a single test pass across a 50-instance sample set without variance reporting. Furthermore, one of the two benchmarked repositories in the controlled evaluation was Graft's own codebase.
- Inference Costs for Deep Summaries: While local Tree-sitter static structural maps (
wiring.json) are free to generate, runninggraft build --deepto generate enriched per-file natural language summaries requires LLM API calls, which incur token costs. - Stale Context Management During Refactors: In codebases undergoing rapid structural refactoring or frequent file reorganizations, markdown graph nodes can become misaligned with current source files. Development teams should incorporate periodic
graft buildruns or cache-fingerprint invalidation into their development routines.
Sources
- NanoNets Graft GitHub Repository: NanoNets/Graft — Official open-source repository containing CLI installation instructions, architecture documentation, Tree-sitter parsers, and reproduction logs.
- Ryan Hart (@thisdudelikesAI) on X: Graft Release and SWE-bench Benchmark Breakdown — Technical breakdown covering benchmark methodology, resource consumption metrics, and single-file modification case studies.