Code Review Graph
A local Tree-sitter code graph and MCP surface for focused review context, impact analysis, and architecture queries when Kevin needs a project-owned graph rather than the default Graphify sidecar.
Why
AI coding tools re-read the entire codebase on every task. Code-review-graph fixes that by parsing your repo into an AST with Tree-sitter, storing it as a graph of nodes (functions, classes, imports) and edges (calls, inheritance, test coverage), then querying at review time to compute the minimal set of files the assistant needs. Local SQLite storage, no cloud dependency. Source: https://github.com/tirth8205/code-review-graph
Install
pip install code-review-graph
code-review-graph install # auto-detects Cursor, Claude Code, Windsurf, Zed, etc.
code-review-graph build # initial parse (~10s for 500 files)
install writes MCP config and injects graph-aware rules for each detected platform. Target a specific platform with --platform cursor or --platform claude-code. Requires Python 3.10+. Prefers uv/uvx if available.
Routing and Adoption Boundary
Use Graphify first for repo topology, path, explain, affected-node, and PR-risk questions when its sidecar is available and current. Use Code Review Graph when a project specifically benefits from a repository-local Tree-sitter graph, an MCP query surface, incremental watch mode, or its review prompts and impact tools. Use rg and direct reads for exact text and final source verification. Neither graph replaces tests or source inspection.
code-review-graph install is a mutating operation: it can write MCP configuration, install platform hooks or skills, and inject graph-aware instructions. Inspect the target project and harness before installation, prefer a single explicit --platform, and verify the diff. The current CLI provides a symmetric uninstall --dry-run and scoped cleanup options; keep those receipts with any adoption. Do not install it in every project by default. Source: current upstream README, reviewed 2026-08-10
| Need | Route |
|---|---|
| Existing Graphify sidecar answers the topology question | Graphify, then verify with source |
| Project-owned local structural graph or MCP interface is useful | Evaluate Code Review Graph in that project |
| Exact string, config value, or implementation fact | rg / direct file read |
| Small or one-off repository | Skip the graph unless measured context or impact needs justify it |
Key Capabilities
Blast-radius analysis - When a file changes, the graph traces every caller, dependent, and test that could be affected. The AI reads only these files instead of scanning the whole project.
Incremental updates - On every git commit or file save, a hook re-indexes only changed files. A 2,900-file project re-indexes in under 2 seconds.
19 languages + Jupyter notebooks - Full Tree-sitter grammar support: Python, TypeScript/TSX, JavaScript, Vue, Go, Rust, Java, Scala, C#, Ruby, Kotlin, Swift, PHP, Solidity, C/C++, Dart, R, Perl, Lua, .ipynb.
22 MCP tools - build_or_update_graph_tool, get_impact_radius_tool, get_review_context_tool, query_graph_tool, semantic_search_nodes_tool, detect_changes_tool, refactor_tool, get_architecture_overview_tool, and more. The AI assistant uses these automatically once the graph is built.
5 MCP prompts - review_changes, architecture_map, debug_issue, onboard_developer, pre_merge_check.
Current Benchmark Boundary
Upstream's current reproducible board reports a roughly 65x median per-question token reduction across six repository snapshots when comparing whole-corpus context with graph-query context; its maximum is a single best-case repository, not a typical guarantee. The README's Flask example is 143,594 naive corpus tokens versus 2,196 graph tokens, or 71x. These are project-reported task measurements, not proof that every repository or question will improve. Measure retrieval quality, missed dependencies, latency, and total successful-task cost on the target project before promotion. Source: upstream benchmark and reproduction docs at HEAD 1a010de, reviewed 2026-08-10
| Repo snapshot | Whole-corpus tokens | Average graph tokens | Reported reduction |
|---|---|---|---|
| fastapi | 948,793 | 2,653 | 375.6x |
| flask | 143,594 | 2,196 | 71.0x |
| code-review-graph | 208,821 | 3,190 | 68.1x |
| gin | 166,868 | 2,766 | 61.9x |
| httpx | 142,356 | 2,661 | 60.6x |
| express | 136,052 | 3,936 | 36.0x |
Current Snapshot
As captured on 2026-08-10, the MIT repository had 29,711 stars and main HEAD 1a010deed6c283d4aa1e7e949e78fe3a7bcdfbb3. The snapshot supports Python 3.10+, Tree-sitter parsing, local graph storage, MCP tools, incremental updates, platform-specific installation, and symmetric uninstall. Treat versions, supported platforms, and benchmark results as time-bound upstream facts. Source: preserved GitHub repository metadata and README, 2026-08-10
CLI Reference
code-review-graph build # full parse
code-review-graph update # incremental (changed files only)
code-review-graph status # graph stats
code-review-graph watch # auto-update on file changes
code-review-graph visualize # interactive D3.js force graph
code-review-graph detect-changes # risk-scored change impact
code-review-graph wiki # generate markdown wiki from communities
Configuration
Exclude paths via .code-review-graphignore in repo root:
generated/**
*.generated.ts
vendor/**
node_modules/**
Optional extras: [embeddings] for local vector search, [google-embeddings] for Gemini, [communities] for Leiden clustering, [wiki] for LLM-powered wiki generation.
Timeline
- 2026-08-10 | Replaced the stale mandatory-install rule and old 8.2x benchmark with a conditional Graphify-first route, current upstream benchmark boundary, explicit config/hook mutation warning, and reversible uninstall requirement. Source: GitHub
tirth8205/code-review-graphHEAD1a010de - 2026-06-17 | Added inline source trail and timeline so benchmark claims point back to the upstream project. Source: https://github.com/tirth8205/code-review-graph
- 2026-04-07 | Created tool page for code-review-graph and the graph-assisted review workflow. Source: https://github.com/tirth8205/code-review-graph