CodeGraph

What It Is

CodeGraph (colbymchenry/codegraph) is a repo-navigation tool for AI coding agents: it builds a local map of a codebase — symbols, what calls what, and how files depend on each other — so the agent can ask once and get the right code back instead of grepping around and opening files one by one. Repo confirma suporte a 11 clientes e 100% local com auto sync on code changes. ^[raw/prompts/articles/reduce-wasted-tokens.md]

Claims (confidence: high — re-measured 2026-08-05, harness blocks CLI in both arms)

  • Throughput win (median of 4 runs × 7 repos, Claude Opus 4.8): 88% fewer tool calls · 53% faster · 62% fewer tokens · 44% cheaper · file reads cut to zero on all seven repos (VS Code 2 vs 28, Excalidraw 2 vs 43, Django 3 vs 14, Tokio 3 vs 29, OkHttp 1 vs 6, Gin 1 vs 7, Alamofire 4 vs 33). Earlier 58%/22% from reduce-wasted-tokens.md superseded by this re-measurement. ^[/raw/external/github-com-codegraph-99cb30cd.md]
  • Variance by discovery cost: 57–78% cheaper on repos where the no-graph agent needed 28–43 tool calls; only 13% on Django (14 calls) and ~even on Gin (7 calls) — win tracks how much discovery the question demands, not repo size.
  • Residual context cost: same harness shows CodeGraph leaves ~80% more retrieval context resident at session end (VS Code 67k vs 18k tokens) — one dense verbatim payload stays in-window while grep-and-read churn evicts. Budget for small windows in multi-turn sessions.
  • Savings still depend on repo size and usage volume, but the threshold is lower than before: even ~110-file Gin wins on tool calls and file reads, just not on cost.

Relationship to Other Tools (confidence: medium)

CodeGraph addresses the same input-waste problem class as tool-search-tool and code-mode-orchestration but from the navigation side: instead of deferring or scripting tool access, it makes repo navigation a single graph query. It is conceptually adjacent to the vault’s codebase-memory (tree-sitter knowledge-graph memory over MCP) — both replace grep-plus-open with graph-backed lookup. Where rtk-rust-token-killer compresses terminal output and headroom compresses arbitrary context, CodeGraph cuts the number of retrieval actions the agent takes.

Implications

For large-codebase agent workflows, repo-navigation maps are a distinct token lever: they reduce tool calls and file reads (the repetitive-grep waste documented in token-usage-reduction) rather than compressing bytes. Re-measurement with CLI-blocked harness makes the 88%/44% figures more defensible than the earlier 58%/22%, but they remain vendor-reported — treat as direction, not guarantee. The new trade-off is throughput vs residency: you pay fewer tokens processed but keep more tokens resident (~80% more). This matters for context-window budgeting in long sessions — choose CodeGraph for precision, budget 60–70k resident on large repos.

Open Questions

  • Staleness is now answered: file watcher (FSEvents/inotify, 2000ms debounce) + ⚠️ staleness banner + connect-time (size, mtime) catch-up keep the graph fresh; manual codegraph sync only needed when watcher disabled.
  • Whether the 88%/44% median replicates independently outside vendor harness and on non-Opus models.
  • Resident-context cost vs throughput gain in 100k-window vs 200k-window models.

tool-search-tool — definition deferral, the query-side cousin of graph navigation code-mode-orchestration — gateway-side scripting of tool calls codebase-memory — tree-sitter graph memory over MCP, adjacent mechanism token-usage-reduction — the cost-lever space this tool operates in rtk-rust-token-killer — different waste source (terminal output), same family

Sources

  • raw/prompts/articles/reduce-wasted-tokens.md
  • raw/external/github-com-codegraph-99cb30cd.md