Graft: Claude Code Hooks Cut grep Tokens by 42%

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.
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 grepandgraft mapfor search and orientation- Monorepo and multi-repo support
graft vizfor 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
👀 See Also

Multi-Agent Loop Failures Are Org-Design Failures, Not Prompt Failures
Agent loops bouncing between peers aren't prompt bugs—they're org-chart problems. Treat agent networks as hierarchies with clear stop authority.

Four ClawHub Skills for Real-Time Search Data in AI Agents
Four ClawHub skills provide structured search capabilities for AI agents: Google (web, news, images, maps), Amazon (product search across 12 marketplaces), Walmart (product search with delivery filters), and YouTube (video search with transcripts). Install via clawhub install commands with one API key.

Routing Claude API traffic to control costs after Max subscription change
Anthropic's Max subscription no longer covers third-party tool usage, forcing OpenClaw users to API billing. A routing proxy directs simple tasks to Claude Sonnet ($3/M input, $15/M output) and complex ones to Opus ($5/M input, $25/M output), cutting costs without quality loss.

Cold Validation Architecture: Dual-Agent Code Review System Open-Sourced
Open-sourced system uses two separate AI agents for code validation: one builds code, another reviews it with zero context about the builder's reasoning. The reviewer only sees plan documents, code diffs, and test outputs.