CodeGraph: The Local Memory Layer That Lets AI Agents Stop Re-reading Your Codebase
A deep look at the SQLite graph, detached daemon, and blast-radius engine that turn code exploration into a reusable system instead of a token leak.

CodeGraph gives Claude Code a pre-built understanding of your code instead of making it explore from scratch every session
- CodeGraph’s core move is not smarter prompting. It is durable local memory for codebases that agents can reuse across sessions.
- The project’s real product is operational trust. A detached daemon, proxy bridge, locking, and watchdog logic make the graph stable enough for real agent workloads.
- Blast radius turns the graph from a lookup tool into decision support by showing what may break when a symbol changes.
- Compared with grep-heavy exploration or cloud-first retrieval, CodeGraph trades disposable context for persistent, local, reusable structure.
AI coding agents have a predictable failure mode. They rediscover the same repo every time, burn tokens on the same file reads, and act like they have no memory. CodeGraph is interesting because it does not try to fix that with better phrasing. It changes the substrate.
CodeGraph is a local-first MCP server that pre-indexes a codebase into a SQLite-backed knowledge graph. The point is simple: let an agent ask for structure, not re-learn it from scratch.
The agent problem CodeGraph is actually solving
The cost of naive exploration is not only latency. It is repetition. A coding agent starts with almost nothing, then reconstructs the same understanding by grepping, reading, and cross-checking file after file. That is a discovery tax, and it hits twice: once in token spend, once in attention.
CodeGraph treats that tax as a systems problem. If the codebase can be parsed once into symbols, references, and dependencies, then future sessions can query the result instead of replaying the search.
Why persistence beats prompting
The conceptual leap is not subtle. CodeGraph does not try to make the model smarter in the moment. It makes the codebase legible ahead of time, so the next session starts with durable context instead of amnesia.
That matters because agents are not just search tools. They are decision systems. When the environment tells them what is connected to what, they can spend fewer tokens rediscovering the shape of the code and more tokens changing it.
How CodeGraph builds a local code graph
Under the hood, the pipeline is straightforward in the best way. Tree-sitter parses source into syntax trees. Symbol extraction turns those trees into definitions and references. Resolution links those references across files. SQLite stores the result locally, where it can be queried fast and reused often.
// Conceptual flow
const graph = await CodeGraph.open({ root: repoPath });
await graph.index();
const context = await graph.contextBuilder
.forSymbol('UserService.createUser')
.includeBlastRadius()
.build();
console.log(context.definitions);
console.log(context.callers);
console.log(context.affectedFiles);
The interesting part is not the parsing itself. It is what the parsing enables. Once the repository is represented as a graph, the system can answer questions like: where is this symbol defined, who calls it, and what else should be checked if it changes?
The part that makes it feel production-grade
This is where CodeGraph stops feeling like a clever indexer and starts feeling like infrastructure. The detached daemon keeps the shared state alive. The proxy lets fresh agent sessions connect without paying the cold-start cost every time. The mutexes and file locks keep concurrent indexing from trampling the database.
| Layer | What it solves | Why it matters |
|---|---|---|
| Detached daemon | Avoids starting a full server for every session | Cuts cold-start overhead and keeps the graph hot |
| Proxy bridge | Connects short-lived agent sessions to shared state | Preserves a simple stdio experience for clients |
| Mutex and file lock | Prevents concurrent corruption during indexing | Makes SQLite viable under real agent churn |
| PPID watchdog | Kills orphaned processes when the parent IDE dies | Stops zombie servers from lingering after crashes |
That operational hardening is the product. If the tool only worked in ideal conditions, agents would abandon it quickly. CodeGraph’s reliability choices are what make the graph feel like a shared memory layer instead of a demo.
Your AI coding agent has a dirty secret: It doesn't understand your codebase. It greps it. Over and over. Burning your tokens on every search. Watch Claude Code on a big repo — it spawns Explore agents that grep, glob, and Read files in loops just to figure out what calls what.
Blast radius is the killer feature
The most useful move in CodeGraph is not answering where a function lives. It is telling you what might break if you move it. That is a different kind of question, and it is closer to how real engineering decisions happen.
Blast radius takes the graph from passive index to decision support. The agent can expand from a symbol to callers, dependent functions, and affected files before making a change. That is especially valuable during refactors, where the cost of missing one dependency can be higher than the cost of a few extra queries.
CodeGraph versus the old way
| Approach | Setup friction | Persistence | Token efficiency | Privacy | Impact analysis |
|---|---|---|---|---|---|
| Manual grep and reading | None | None | Low | Local | Weak |
| Cloud semantic retrieval | Moderate | Shared, not local | Better | Depends on service | Variable |
| Plain MCP server without daemonization | Low at first | Often per session | Better than grep | Local | Basic |
| CodeGraph | Moderate once, then reusable | Persistent across sessions | High | Local-first | Strong |
The tradeoff is clear. Grep is cheap to start and expensive to repeat. Cloud retrieval can be powerful, but it pushes context out of the machine. CodeGraph sits in the middle with a local, persistent graph that agents can keep using.
What this says about agent tooling
CodeGraph points to a bigger shift in AI tooling. The winning abstraction may not be endless retrieval from scratch. It may be durable local memory that sits close to the code, survives across sessions, and does the boring infrastructural work that makes agents reliable.
That is why the project is more than a search tool. It is a small operating system for agent context. And in a world where every session is tempted to start over, that is a real product insight.





