Graft

The context layer for large codebases.

$npm install -g @nanonets/graft
$graft init

Quick start

Two commands, then nothing to run.

Install, run graft init once, and Graft rides along in every Claude Code session. It rebuilds the graph in the background after each turn, so the map stays in sync on its own. No daemon, no MCP server, no re-indexing.

shop — zsh
$npm install -g @nanonets/graft
$graft init
built the graph · wired into Claude Code — that's the whole setup
$claude
Claude Code
Welcome back
Fable 5 (1M context)
~/graft
Graft is active
Each prompt pulls the matching nodes into the session, so the agent starts oriented.
Try "where does capture happen?"
graft · 402 nodes / 977 edges · 79% enriched · ✓ synced

Works with

A map up front beats grepping from cold.

23%
fewer tokens per answer
17%
less time per answer
12 pts
higher on SWE-bench

Same agent, same tasks: cold vs. graph read first. A separate model checks each answer is actually right, so speed can't fake it. Reproduce with npm run bench. SWE-bench is provisional.

Your coding agent reads 30 files to change 3.

The amber trail is an agent with no map: grep, open, back out, retry, on every single task. Graft hands it the map instead, and the wandering stops.

Your agent starts oriented.

graft build turns 247 files into 12 plain-English pages, one per system. The agent reads the map first and skips the wandering.

−31% tool calls · −23% cost · −17% latency

Edges speak the code's language.

Every link is a verb from the code, and each one answers a question a reviewer actually asks: what breaks if I change this?

uses · produces · configures · validates. Never "related to".

Pick a node. See the blast radius.

Your agent knows what payments touches before it opens a single file.

what it depends on what depends on it

It's just markdown, in git.

Commit graft/ and every clone, human or agent, starts already knowing how the repo fits together. No plugin, no server: if it can read files, it can read the map.

Claude Code · Codex · Cursor · Kiro
$ npm install -g @nanonets/graft
no map · 0/30 files opened · 0 changed
usesusesusesusesusesusesusesusesusesproducesproducesusesusesconfiguresconfiguresconfiguresvalidatesvalidatesvalidatesapiauthdbcachesearchpaymentsqueuemailerconfigtestseventswebhooks
Scroll

What's in a node

Three depths in one file.

Summary · what it does
Plain English, written by the model, regenerated when the source changes. There whether or not anyone wrote docs.
Crux · how it works
The handful of lines that carry the logic, stored as code instead of line numbers, so it survives drift.
Sources · where to go deeper
Exact files, each tracked by content hash, so staleness is detectable.
Links · how it connects
Typed wikilinks your agent follows like any other file.
graft/payments.mdnode · system
---
type: system
sources:
  - src/payments/capture.ts  # a41f9c
  - src/payments/refund.ts   # 77d0e2
---
summary
Handles card capture and refunds. Captures are deferred to the queue so a slow processor never blocks checkout; refunds are idempotent by charge id.
crux
if (charge.capturedAt) return charge; // idempotent: never double-capture
await queue.push("capture", { chargeId }); // deferred, retried 3×
links

Four commands

No server. No database. No embeddings.

The graph is files in your repo. Git does the syncing.

graft buildBuild the graph. Reads your code and writes the plain-English nodes, one per system. Cached, so re-runs only touch what changed.
graft ask "<task>"Query the map. Ranked nodes plus exact file:line for the task at hand. No LLM, no key, no network.
graft checkKeep it honest.Fails CI if the graph drifted from the code. A stale map can't merge.
graft vizSee it. A local interactive viewer: the same graph your agent reads, on localhost.

Drift fails the build

A stale map is worse than no map.

Every node tracks its sources by content hash. When code moves, graft check catches it in the same pull request. The graph diff sits right next to the code that caused it.

$ graft check
✗ payments: src/payments/capture.ts changed since last build
  run `graft build` to regenerate 1 stale node
$graft build && graft check
✓ 12 nodes current · graph matches code

Two minutes to a mapped repo

Onboard your agents once, not every session.

$ npm install -g @nanonets/graft
Star on GitHub

Claude Code · Codex · Cursor · Kiro · any agent that reads files