← all repositories
colbymchenry/codegraph

Stop Paying Agents to Grep Your Own Codebase

CodeGraph builds a local, auto-syncing knowledge graph of your codebase so AI agents can query structure directly instead of burning tokens on grep and file reads.

61.7k stars C Coding Assistants
codegraph
Velocity · 7d
+217
★ / day
Trend
cooling
star history

What it does

CodeGraph is an MCP server that indexes your codebase into a semantic knowledge graph—symbols, call graphs, and relationships—and keeps it in sync as you edit. When an AI agent like Claude Code or Cursor needs to understand architecture, it queries the graph instead of spawning sub-agents to grep, glob, and read files. The whole index lives in a local SQLite database; no code leaves your machine.

The interesting bit

The README is admirably honest about the mechanism: the win comes from preventing agents from delegating exploration to file-reading sub-agents. If the agent ignores the graph and reads files anyway, CodeGraph just adds overhead. When it works, codegraph_explore returns the relevant symbols and collapses redundant implementations so the response is sized to the answer, not the file count.

Key highlights

  • Benchmarks across seven real-world repos (including VS Code, Django, and Tokio) claim double-digit savings in cost and tokens, with tool-call counts dropping by roughly half or more—though the exact margins vary by codebase and model version.
  • Auto-sync uses native OS file watchers (FSEvents, inotify, ReadDirectoryChangesW) with debouncing, so the index stays current without manual steps.
  • Supports 20+ languages and framework-aware routing for 14 web frameworks, plus cross-language bridging for React Native, Expo, and mixed iOS stacks.
  • Bundles its own Node.js runtime and runs fully offline with no API keys or external services.

Caveats

  • The README explicitly warns that CodeGraph only helps when the agent queries the graph directly; if sub-agents fall back to grep and file reads, the tool becomes dead weight.
  • Benchmark margins shrink on smaller repos and improved model baselines—Opus 4.8 already greps more efficiently than earlier versions, so the delta is narrower than it used to be.

Verdict

Worth a look if you’re running Claude Code, Cursor, Codex, or another supported agent against a medium-to-large codebase and want to trim your token bill. Probably overkill for a handful of files where native agent search is already cheap.

Frequently asked

What is colbymchenry/codegraph?
CodeGraph builds a local, auto-syncing knowledge graph of your codebase so AI agents can query structure directly instead of burning tokens on grep and file reads.
Is codegraph open source?
Yes — colbymchenry/codegraph is open source, released under the MIT license.
What language is codegraph written in?
colbymchenry/codegraph is primarily written in C.
How popular is codegraph?
colbymchenry/codegraph has 61.7k stars on GitHub and is currently cooling off.
Where can I find codegraph?
colbymchenry/codegraph is on GitHub at https://github.com/colbymchenry/codegraph.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.