code-review-graph parses your repository into a graph of functions, classes, imports, calls and tests, and lets a coding agent query that graph instead of grepping and reading files to find its way around.
What it is
An open-source (MIT) Python tool. It parses code with tree-sitter (a parser library that builds syntax trees for many languages) and stores the result in one SQLite file in .code-review-graph/ in the repo. Nodes are functions, classes and imports; edges are calls, inheritance and which tests cover what. Nothing leaves your machine, and it has no telemetry.
It reaches Claude Code as an MCP server with about 30 tools, for example semantic_search_nodes_tool (find code by meaning), query_graph_tool (callers, callees, importers, tests for a symbol), get_impact_radius_tool (what a change touches) and get_minimal_context_tool. The same queries exist as CLI commands.
Incremental updates re-parse only files whose hash changed, and the installer adds hooks so the graph updates as the agent edits files.
What problem it solves
Finding the right code is one of the most token-hungry parts of agent work. To answer “what calls useAuth?” an agent typically greps, reads several candidate files whole, and keeps all of that in the context window for the rest of the session. A graph query returns the call sites directly, in a few hundred tokens.
The authors report a median of about 63 times fewer tokens per question across six open-source repos. They also say this compares against reading the whole relevant corpus, an upper bound no real agent pays, and that on small commits the graph can cost more than a plain file read.
How to try it
pipx install code-review-graph
code-review-graph install --platform claude-code # MCP entry, hooks, skills, CLAUDE.md instructions
code-review-graph build # first full build of the graph
code-review-graph status # nodes, files, branch and commit it was built onRestart Claude Code afterwards. install writes graph instructions into CLAUDE.md unless you pass --no-instructions, and skills and hooks unless you pass --no-skills / --no-hooks. code-review-graph uninstall --dry-run shows what removal would undo.
Usage example
Frontend
In a React app you are about to change the signature of a useAuth hook. Ask Claude “what calls useAuth and which tests cover it?”. With the graph it can call query_graph_tool with callers_of and tests_for instead of grepping and opening every component. The same from the CLI:
code-review-graph query callers_of useAuth
code-review-graph query tests_for src/hooks/useAuth.tsBackend
In a Node service, before a refactor of src/billing/invoice.ts, ask for the blast radius: the callers, dependents and tests the change can break. The agent calls get_impact_radius_tool; from the shell it is:
code-review-graph impact --files src/billing/invoice.tsThe authors call impact analysis conservative: expect some false positives.
Who it’s for and when
Mid-size and large repos where the agent spends a lot of each session searching and reading, and review or refactor tasks where you want the blast radius of a change. The FAQ itself advises against it for small repos and one-off questions.
Gotchas
- The agent may not use it. Having the server connected and an instruction in
CLAUDE.mddoes not make the model call it. The post author’s own transcripts for a month on a pet project (442 files, instruction to use the graph first) showed 3 graph calls in 2 of 18 sessions, against 1,930Readcalls. This is one person’s observation, not a documented limit. Check your own transcripts or/usagebefore you count on the savings. - The graph goes stale. It is built on a branch and commit. After a branch switch
code-review-graph statuswarns that it was built elsewhere, and an interrupted build leaves files out. Rebuild withcode-review-graph build. - Tool definitions cost context when tool search is off. With MCP tool search on (the default), its 30 tools cost almost nothing until used. Behind a proxy set through
ANTHROPIC_BASE_URL, tool search is off by default and every definition loads up front (see Custom base URL).--toolsorCRG_TOOLSlimits which tools the server exposes. - Uneven quality by language. Flow detection is strongest for Python and PHP; search ranking can miss.