Stop paying AI agents to grep your own codebase
A local knowledge graph that cuts agent tool calls by ~60% and token costs by ~25% by replacing file exploration with pre-indexed symbol queries.

What it does
CodeGraph is a local CLI tool that builds a SQLite-backed knowledge graph of your codebase — symbols, call graphs, relationships — and exposes it to AI coding agents via an MCP server. Instead of spawning “Explore agents” that burn tokens on grep and file reads, Claude Code, Cursor, Codex, and six other agents can query the graph directly. You install it once, run codegraph init -i per project, and the index stays fresh via native OS file watchers.
The interesting bit
The README includes unusually detailed head-to-head benchmarks across seven real repos (VS Code, Django, Tokio, etc.) — and openly notes when the margin narrows. The latest Opus 4.8 validation shows the “without CodeGraph” baseline got leaner because the model itself improved at grepping, yet CodeGraph still won on every repo. That kind of self-aware benchmarking is rare.
Key highlights
- ~25% cheaper, ~62% fewer tool calls, ~23% faster — median across 7 repos per the latest Opus 4.8 runs (4 runs per arm, reported 2026-05-29)
- Zero file reads on most queries — agents get symbol context directly instead of hunting through files
- 20+ languages including cross-language tracing for React Native/Expo/Swift bridging
- 100% local — SQLite only, no API keys, no network calls
- Self-contained binary — bundles its own Node.js runtime, or install via npm if you prefer
Caveats
- The benchmark notes per-repo variance is real: Django’s “without” arm once hit $2.71/14 min in a single run, so the medians smooth over noisy tails
- Benefits shrink on smaller repos where native agent search is already cheap (Alamofire saw only 13% fewer tool calls in the latest run)
- Requires agents to actually query the graph; if a sub-agent ignores it and reads files anyway, CodeGraph becomes pure overhead
Verdict
Worth it if you’re burning tokens on Claude Code or Cursor across medium-to-large codebases, or working in multi-language mobile stacks where cross-file tracing matters. Probably overkill for a fresh Next.js starter with twelve files.