Graft: Claude Code Hooks Cut grep Tokens by 42%

✍️ OpenClawRadar📅 Published: August 16, 2026🔗 Source
Graft: Claude Code Hooks Cut grep Tokens by 42%
Ad

Graft (github.com/NanoNets/Graft) is a CLI tool that builds a persistent knowledge graph for coding agents like Claude Code, Cursor, Codex, and Gemini. It pre-computes codebase context so agents skip the repetitive grep-and-open exploration loop.

Concrete wins from the benchmark

  • 42% token reduction (grep tokens specifically)
  • 46% tool-call reduction
  • 60% time savings
  • Correctness jumps from 54% to 66% on SWE-bench Verified

The controlled benchmark ran 162 trials with the same agent and file tools — only the context differed. SWE-bench results were graded by the official harness.

Why it works

Coding agents re-explore the repo from scratch on every task. Graft builds an understanding once and writes it into your repo as a folder of linked markdown files — one node per system, API, or concept. These are real explanations, not symbol lists. No embeddings, no similarity search, no daemon.

Ad

Quick start

npm install -g @nanonets/graft
# install the CLI, once
graft init
# builds the graph + wires it into Claude Code

graft init asks which agents to wire up, builds graft/ from your code, and drops a statusline and hooks into .claude/. The graph is just files — commit it and teammates get it via git. Run graft init --dry-run to preview changes.

What you commit is the .claude/ wiring; each teammate runs graft build to generate their own graph. The graph is gitignored by default as a local cache.

Extra features

  • MCP server for agent integration
  • Deep Claude Code integration (statusline + hooks)
  • graft grep and graft map for search and orientation
  • Monorepo and multi-repo support
  • graft viz for browsing the graph
  • Works with Cursor, Codex, Gemini, and more

Who it's for: Teams using AI coding agents in large codebases who are tired of paying tokens for context they've already explored.

📖 Read the full source: HN AI Agents

Ad

👀 See Also