# CodeGraph
**CodeGraph pre-computes a knowledge graph of your codebase so AI agents stop grep/find/read-cycling to understand structure.** It exposes the graph over [[Model Context Protocol (MCP)]] to [[Claude Code]], [[Cursor.com|Cursor]], and Codex. Fully local, MIT.
The waste it removes: an agent dropped into unfamiliar code spawns sub-agents that repeatedly grep, find, and read files to rediscover relationships, burning tokens and tool calls every time. CodeGraph indexes symbols, call graphs, and dependencies once, then answers those questions instantly. Benchmarks across seven real codebases: **~16% cheaper, ~58% fewer tool calls, 100% local.**
## How it works
1. **Extraction.** [[Tree-sitter]] parses source into ASTs (20+ languages).
2. **Storage.** A local SQLite database (`.codegraph/codegraph.db`) with FTS5 full-text indexes.
3. **Resolution.** Cross-file references resolved after extraction.
4. **MCP server.** Tools like `codegraph_explore`, `codegraph_node`, `codegraph_search`, `codegraph_callers`.
No embeddings. It's pure syntactic AST analysis plus resolved symbol references, which is the sharp contrast with embedding-based tools like [[CocoIndexCode]]. Cheaper and deterministic, but it matches by structure, not meaning.
## Features worth noting
- **Impact analysis** tracing callers, callees, and change radius.
- **Framework-aware routing** for 17+ web frameworks (Django, FastAPI, Express, Rails, ...).
- **Cross-language bridging** (Swift↔ObjC, React Native↔native, Expo modules).
- **Auto-sync** via native OS file watchers with debounced incremental updates.
## Usage
```bash
npm i -g @colbymchenry/codegraph
codegraph install # wire into agents
codegraph init # build the index
```
Bundled Node.js and SQLite (WAL mode); zero external API calls; self-contained binaries for Windows, macOS, Linux.
## References
- https://github.com/colbymchenry/codegraph
## Related
- [[CocoIndexCode]]
- [[Tree-sitter]]
- [[Model Context Protocol (MCP)]]
- [[AI Retrieval Patterns]]
- [[Semantic Search]]
- [[Claude Code]]
- [[Cursor.com]]