Every AI coding tool review has a dirty secret: the LLM reads the entire repository to understand a single file change. Code-review-graph just proved that overhead is 82 times higher than it needs to be. The open-source project, built by developer Tirth Patel, hit nearly 20,000 GitHub stars in its first weeks by solving one of the most expensive problems in AI-assisted development. Instead of dumping entire codebases into context windows, it builds a persistent, incrementally updated structural graph of every function, class, import, and dependency. The result: AI coding tools read only what matters, and token waste drops by a median of 82x across real repositories.
The project is local-first by design. No data leaves the machine. The graph lives in a SQLite database on the developer's filesystem and communicates with AI tools through the Model Context Protocol (MCP). For founders burning thousands of dollars a month on AI coding subscriptions, this is the first tool that directly attacks the cost side of the equation.
How the Code Graph Works
Code-review-graph uses Tree-sitter, the same parsing library that powers GitHub's syntax highlighting and many modern IDEs, to build an abstract syntax tree (AST) of the entire repository. It stores this as a directed graph of nodes (functions, classes, imports, exports) connected by edges (call sites, inheritance chains, test coverage relationships). When a file changes, the graph traces every caller, dependent, and test that could be affected and computes the minimal set of files the AI assistant needs to read.
The incremental update engine is where the engineering gets impressive. A 2,900-file project re-indexes in under two seconds. The graph diffs changed files using SHA-256 hashes, finds their dependents, and re-parses only the modified subset. In monorepos with 27,000+ files, the graph trims review context to roughly 15 files. The token savings compound: on the FastAPI repository, the reduction hit 528x. On six benchmarked repos, the median per-question token reduction was 82x, with an average impact F1 of 0.71 against the graph-derived ground truth.
Supported Platforms and Languages
The tool ships with auto-detection for 14 AI coding platforms: Codex, Claude Code, CodeBuddy Code, Cursor, Windsurf, Zed, Continue, OpenCode, Antigravity, Gemini CLI, Qwen, Qoder, Kiro, and GitHub Copilot. A single code-review-graph install command detects which ones you use, writes the correct MCP configuration, installs platform-native hooks and skills, and injects graph-aware instructions into your platform rules. Restart the editor, ask the AI to build the graph, and the savings start immediately.
Language support spans Python, JavaScript, TypeScript, TSX, Go, Rust, Java, C, C++, C#, VB.NET, Ruby, Kotlin, Swift, PHP, Scala, Solidity, Dart, R, Perl, Lua, Luau, Objective-C, shell scripts, Elixir, Zig, PowerShell, Julia, ReScript, GDScript, Nix, Verilog, SystemVerilog, SQL, Terraform, OpenTofu, Ansible, Vue, Svelte, Astro, and even Jupyter and Databricks notebooks. If the parser does not cover a language, developers can drop a languages.toml config file into .code-review-graph/ to add support without forking the repository.
Quick Start and CI Integration
Getting started takes three commands:
pip install code-review-graph
code-review-graph install
code-review-graph buildThe install command is the clever part. It auto-detects which AI coding tools you have installed, writes the correct MCP server configuration for each one, hooks into git commit events for incremental updates, and makes the graph available as a tool your AI assistant can query. The initial build for a 500-file project takes about 10 seconds. After that, supported hooks and watch mode keep the graph updated automatically.
For teams, the project ships as a composite GitHub Action that runs entirely on the CI runner. No source code ever leaves the machine. On each pull request, the action posts a single sticky comment with risk-scored functions, affected execution flows, and test coverage gaps. An optional fail-on-risk input turns the review into a merge gate. This makes it feasible for teams to enforce code review quality standards without the per-seat cost of enterprise AI coding tools.
Who This Is For
Code-review-graph is for any developer or team using AI coding assistants on medium-to-large codebases. If your team spends $50 per seat per month on GitHub Copilot or Claude Code and watches those tokens evaporate on irrelevant context, this tool directly improves the return on that spend. It is especially effective for monorepo teams where the context window inefficiency is most painful, and for offshore or distributed engineering teams where every API call to an AI provider carries both latency and cost.
For solo developers and indie founders, the token savings translate directly to money. A developer who runs 50 AI code reviews per day at current API pricing could save hundreds of dollars per month. For engineering teams at scale, the savings multiply across every developer and every pull request. The project is MIT-licensed, runs entirely on local hardware, and has no external dependencies beyond Python 3.10 and the Tree-sitter language pack. It is the rare open-source tool that pays for itself in the first day of use.




