Graft
Open-source context layer for large codebases that builds a graph of your code so AI coding agents run faster, cheaper, and more accurately.
At a Glance
Fully free and open-source under MIT license. Install via npm and run locally with no cost.
Engagement
Available On
Alternatives
Listed Aug 2026
About Graft
Graft is an open-source CLI tool built by Nanonets that creates a persistent context graph for large codebases, enabling AI coding agents like Claude Code, Cursor, Codex, and Gemini to work faster and more accurately without re-exploring the repo from scratch on every task. It is licensed under MIT, runs 100% locally with no telemetry, and requires no vector embeddings or external database. The project is published on npm as @nanonets/graft and the source lives at github.com/NanoNets/context-graph-engine.
What It Is
Graft solves a specific problem: every time an AI coding agent starts a task, it re-explores the codebase from zero — grepping files, following imports, and rebuilding a mental map it already built an hour ago. Graft builds that understanding once and writes it into the repo as a folder of linked markdown files (graft/), one node per system, API, or concept. The graph is just files your agent reads, not a running server or warm index. Because it lives in git, every teammate and their agent inherits it automatically.
How the Graph Gets Built
Graft uses two passes to construct its context layer:
- Structural pass (free, no model): Tree-sitter parses 20+ languages deterministically, extracting functions, classes, call edges, and imports into
graft/.graph/wiring.json. This never calls an LLM and needs no API key. - LLM enrichment pass (
--deep): A second pass summarizes each file and groups them into plain-English concept nodes with typed links (uses,produces,validates,configures,extends). Any provider works — OpenAI, Anthropic, OpenRouter, Fireworks, Groq, LiteLLM, or a local model — under your own key.
Every pass is cached by content hash, so rebuilds only touch changed files. On the Graft repo itself (124 files), a cold build takes 0.74s; a rebuild after one edit takes 0.18s.
Benchmark Results
The Graft README reports a 162-run controlled benchmark comparing cold Claude Code against Claude Code with Graft, using the same agent and file tools with only the context differing:
- 46% fewer tool calls per task
- 42% fewer tokens consumed
- 60% less latency per task
- +12 correctness points on SWE-bench Verified (66% vs 54% on 50 instances)
On popular open-source repos like PocketBase, the README claims Graft runs "up to 4× cheaper and 3× faster" while reproducing all five tested merged PRs by touching the same files the maintainers did.
Agent Integration and MCP Server
graft init wires Graft into whichever coding agents you use. Supported agents include Claude Code, Cursor, Codex, Gemini, Kiro, Windsurf, GitHub Copilot, and AdaL. Claude Code gets the deepest integration: a live statusline showing graph size and staleness, auto-sync after every edit, and context injection at each prompt.
Graft also ships an MCP server with six tools available to any MCP-compatible agent:
graft_find_code— ranked nodes with file:line for a natural-language questiongraft_file_api— every signature in a file without bodiesgraft_trace_calls— blast radius for any symbolgraft_find_all— exhaustive regex search grouped by enclosing symbolgraft_repo_map— directory clusters, hubs, and hotspotsgraft_check_freshness— drift detection between graph and working tree
Architecture and Deployment Model
Graft is entirely local. The graph is a folder of markdown files committed alongside your code — no daemon, no database, no embeddings server to keep warm. The structural graph (graft build) is deterministic and costs nothing to run. The LLM-enriched layer (graft build --deep) calls your chosen provider under your own key; Graft itself never sees your API key or code. There is no telemetry. The graft viz command serves an interactive local graph viewer (prebuilt, no dev server needed) showing both the architecture graph and the per-symbol code graph with directional edge highlighting.
Update: Active Development as of Mid-2026
The GitHub repository (NanoNets/Graft, also mirrored as context-graph-engine) was created in July 2026 and last pushed in August 2026, with 2,844 stars and 248 forks at time of indexing. The npm package is @nanonets/graft. The project is under active development; the README notes that inlining crux excerpts into markdown nodes is a planned next step, and the SWE-bench Verified results are described as provisional.
Community Discussions
Be the first to start a conversation about Graft
Share your experience with Graft, ask questions, or help others learn from your insights.
Pricing
Open Source
Fully free and open-source under MIT license. Install via npm and run locally with no cost.
- Full CLI access
- Tree-sitter structural graph (no LLM, no key)
- MCP server with 6 tools
- Agent wiring for Claude Code, Cursor, Codex, Gemini, Kiro, Windsurf, Copilot, AdaL
- Interactive graph visualizer (graft viz)
Capabilities
Key Features
- Open-source context graph for large codebases
- Tree-sitter parsing across 20+ languages (no LLM, no key)
- LLM-enriched concept nodes with plain-English summaries (--deep)
- MCP server with 6 tools for any MCP-compatible agent
- Claude Code deep integration with live statusline and auto-sync
- Blast radius analysis before changing any symbol
- Interactive local graph visualizer (graft viz)
- Monorepo and multi-repo folder support
- Vendor-neutral LLM support (OpenAI, Anthropic, OpenRouter, Groq, local)
- No telemetry, no embeddings, no external database
- Runs 100% locally
- Git-native: graph lives in graft/ folder alongside code
- Content-hash caching for fast incremental rebuilds
- graft grep: exhaustive regex search grouped by enclosing symbol
- graft map: token-budgeted repo orientation
- graft callers: transitive call/dependency tracing
- graft skeleton: file API surface without bodies
- Supports Claude Code, Cursor, Codex, Gemini, Kiro, Windsurf, Copilot, AdaL
