What if your AI coding assistant could read 2,000 tokens instead of 200,000 to understand a change in your codebase? That is what Code-Review-Graph delivers. The numbers are almost hard to believe: a median per-question token reduction of 82x across six real-world repositories, with a maximum of 528x on the largest codebase tested. For any developer paying per-token for AI assistance, this changes the math entirely.

The project, created by developer Tirth Patel and published under the MIT license, has exploded to over 20,000 GitHub stars since its initial release in February 2026. It sits at number four on GitHub's trending Python repositories as of this writing. The reason is straightforward: the single biggest operational cost for teams using AI coding assistants at scale is token consumption, and Code-Review-Graph attacks that problem at the architectural level rather than through prompt engineering tricks.

How It Works: Structural Graphs Instead of Raw Text

Existing AI coding tools like Claude Code, Cursor, and Windsurf have a fundamental blind spot. When you ask them to review a pull request or understand how a function fits into the broader codebase, they tend to re-read large portions of your project from scratch. The assistant has no persistent memory of your code's structure between sessions, so every question burns token budget on files it has already seen.

Code-Review-Graph solves this by building a persistent, local-first structural map of your entire codebase. It uses Tree-sitter, a widely adopted parser library, to analyze every file and produce an AST (Abstract Syntax Tree) that captures functions, classes, imports, call sites, inheritance relationships, and test coverage. This graph is stored locally in SQLite and updated incrementally as you edit. When your AI assistant needs to understand a change, it queries the graph instead of scanning source files. The graph returns only the blast radius: the specific files and functions affected by a change, along with their callers, dependents, and tests.

The key innovation here is incremental updates. A 2,900-file project re-indexes in under two seconds because Code-Review-Graph diffs changed files, finds their dependents via SHA-256 hash checks, and re-parses only what actually changed. For monorepos with 27,000+ files, the graph can exclude everything except the approximately 15 files relevant to a given review question.

One Command to Set Up Every Platform

The install experience is unusually polished for an open-source tool. Running pip install code-review-graph followed by code-review-graph install auto-detects which AI coding tools you already have installed and writes the correct MCP configuration for each one. It supports Claude Code, Cursor, Windsurf, GitHub Copilot, GitHub Copilot CLI, Gemini CLI, Zed, Continue, OpenCode, Antigravity, Qoder, Kiro, and CodeBuddy Code. It also detects whether you use pip or uvx and generates the right config accordingly.

After installation, you run code-review-graph build to parse your codebase, then ask your assistant to use the code review graph. The initial build takes roughly 10 seconds for a 500-file project. After that, watch mode and supported hooks keep the graph updated automatically in the background.

The tool also ships as a GitHub Action for CI. On each pull request, it posts a single sticky comment with risk-scored functions, affected execution flows, and test gaps. The analysis runs entirely on the CI runner with zero source code sent to any external service. An optional fail-on-risk input turns the review into a merge gate.

Benchmarks You Can Reproduce

The headline numbers are not marketing claims. Code-Review-Graph ships a complete automated evaluation runner that produces deterministic results across different machines. Every config pins an upstream SHA, the Leiden community detector runs with a fixed seed, and embeddings are CPU-based and deterministic. The full reproduction recipe is documented in the repository.

Across six repositories (fastapi, code-review-graph itself, gin, flask, express, and httpx), the median per-question token reduction is approximately 82x. The best case is fastapi, where 951,071 source tokens are reduced to 2,169 tokens of graph response, producing the 528x figure. The worst case is httpx, still delivering a 38x reduction. The impact accuracy benchmark reports an average F1 score of 0.71 against graph-derived ground truth, meaning the blast radius analysis is both precise and broad enough to capture genuinely affected code.

The project also adds a context_savings estimate to each MCP call so clients can see the approximate context saved. Since v2.3.5, this surfaces as a boxed token savings panel in the CLI, with optional --verify to cross-check against OpenAI's cl100k_base tokenizer. Calibration shows the estimate is within approximately 1 percent of real GPT-4 tokens across 222 sample files.

Language Coverage and Custom Extensions

Tree-sitter parsers give Code-Review-Graph support for over 100 languages including Python, JavaScript, TypeScript, Go, Rust, Java, C, C++, Ruby, Kotlin, Swift, PHP, Scala, Solidity, Dart, R, Perl, Lua, Elixir, Zig, Julia, SQL, Terraform, and more. It also handles Jupyter and Databricks notebooks, Vue and Svelte single-file components, Astro files, and Blade templates with Laravel-specific semantic edges.

If your project uses a language not in the built-in list, you can add it without forking the repository. Drop a languages.toml into .code-review-graph/ mapping file extensions to any grammar bundled in the tree-sitter language pack, plus the AST node types for functions, classes, imports, and calls. The generic Tree-sitter walker handles extraction from there.

Who This Is For

Code-Review-Graph is for any developer or team using AI coding assistants at scale who has noticed that their token bill keeps climbing while the quality of responses stays flat. It is especially valuable for developers working in large monorepos where the blast radius of a single change can be enormous. The GitHub Action integration makes it immediately useful for teams that already use AI-assisted code review in CI.

For solo founders, the impact is even more direct. If you are paying for Claude Code or Cursor Pro and your monthly usage involves significant code review and refactoring work, a 38x to 528x reduction in context consumption translates directly into lower costs and faster responses. The tool is free, open source, and runs entirely locally. There is no API key, no cloud dependency, and no data leaving your machine.

The project is actively maintained with frequent releases, an active Discord community, and a public roadmap. For anyone who has felt the friction of AI assistants that keep re-reading files they should already understand, Code-Review-Graph provides the missing persistent memory layer that makes the economics of AI-assisted development actually work.