# Code Review Graph code-review-graph (CRG) builds a persistent structural map of your codebase so AI coding tools read only what matters. Local-first, exposed over [[Model Context Protocol (MCP)|MCP]] and a CLI. By tirth8205, [[MIT License]], [[Python]]. Its tagline: *"Stop burning tokens. Start reviewing smarter."* ## The problem it targets Ask a coding agent "how does authentication work" and it greps, reads a dozen files, follows imports, reads a dozen more. Every review task re-derives structure the repository already encodes. You pay for that rediscovery on every question, in tokens and in latency. CRG parses the repo once into an AST with [[Tree-sitter]], stores it as a graph of nodes (functions, classes, imports) and edges (calls, inheritance, test coverage), then queries that graph at review time to compute the minimal set of files the agent actually needs. ## How it works **Blast-radius analysis.** When a file changes, the graph traces every caller, dependent and test that could be affected. The agent reads that set rather than scanning the project. **Incremental updates.** Hooks and watch mode re-index on save. It diffs changed files, finds dependents through its own import and call edges, and re-parses only files whose SHA-256 actually changed. On a ~3,000-file project a two-file edit re-indexes in about 2.5 seconds, of which ~1.4s is process start-up. **Broad language coverage.** Tree-sitter across roughly 30 languages, plus Jupyter notebooks, Vue/Svelte SFCs, Terraform, Ansible, and PHP extras like Composer PSR-4 resolution and Laravel Route/Eloquent edges. If your language isn't covered, a `languages.toml` maps extensions to any bundled grammar with no fork required. **One-command setup across tools.** `code-review-graph install` auto-detects your AI coding tools and writes the right MCP config for each: [[Claude Code]], [[Codex CLI]], Cursor, Gemini CLI, [[Windsurf]], Zed, Continue, [[OpenCode]], Qwen, Qoder, Kiro, GitHub Copilot, CodeBuddy. The `uninstall` is symmetric, supports `--dry-run`, and touches only CRG-owned entries. ```bash pip install code-review-graph code-review-graph install code-review-graph build ``` **CI reviews.** The same analysis runs as a composite [[GitHub Actions|GitHub Action]] that posts one sticky comment per PR with risk-scored functions, affected execution flows and test gaps, updated in place. `fail-on-risk` turns it into a merge gate. The graph is built and queried entirely on your runner; no source leaves it. The caveat: it's another daemon-ish thing to install, an index to keep fresh, and a dependency in your review path. ## References - [tirth8205/code-review-graph](https://github.com/tirth8205/code-review-graph) — source - [Reproducing the benchmarks](https://github.com/tirth8205/code-review-graph/blob/main/docs/REPRODUCING.md) — full methodology - [GitHub Action docs](https://github.com/tirth8205/code-review-graph/blob/main/docs/GITHUB_ACTION.md) - [Custom languages](https://github.com/tirth8205/code-review-graph/blob/main/docs/CUSTOM_LANGUAGES.md) - [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) ## Related - [[Model Context Protocol (MCP)]] - [[Tree-sitter]] - [[Context Engineering]] - [[Context Window]] - [[Claude Code]] - [[Codex CLI]] - [[OpenCode]] - [[Windsurf]] - [[GitHub Actions]] - [[AI Agents]] - [[Python]] - [[Open Source]] - [[MIT License]]