The code-review-graph repository is a Python-based tool that builds a local-first code intelligence graph designed to reduce token consumption for AI coding assistants during code review tasks. The project addresses a core problem in AI-assisted development: large language models often re-read substantial portions of a codebase unnecessarily, wasting tokens and context window space. By constructing a persistent structural map of code and tracking changes incrementally, the tool enables AI assistants to access only the most relevant files for any given review task.
The repository uses Tree-sitter to parse source code into abstract syntax trees and builds a graph representation of code structure, including nodes for functions, classes, and imports, along with edges representing calls, inheritance relationships, and test coverage. This graph is stored in SQLite and queried at review time to compute the minimal set of files needed for analysis. The tool operates as both a Model Context Protocol server and a command-line interface, making it compatible with multiple AI coding platforms including Claude Code, Cursor, Windsurf, Zed, Continue, and others. A single install command auto-detects which platforms are present and configures the appropriate MCP integration for each.
The core technical innovation is blast-radius analysis. When a file changes, the graph traces every caller, dependent, and test that could be affected by that change, allowing the AI assistant to focus review scope precisely. Incremental updates keep the graph current in under two seconds for large projects by diffing changed files and re-parsing only what has actually changed, leaving thousands of unchanged files untouched. This capability is particularly valuable in monorepo environments where token waste is most acute. The benchmarks demonstrate median token reductions of approximately 82x across six real repositories, with maximum reductions reaching 528x in best-case scenarios.
The tool supports broad language coverage including Python, JavaScript, TypeScript, Go, Rust, Java, C/C++, C#, Ruby, Kotlin, Swift, PHP, Scala, Solidity, Dart, R, Perl, Lua, Objective-C, shell scripts, Elixir, Zig, PowerShell, Julia, ReScript, GDScript, Nix, Verilog, SQL, Terraform, Ansible, Vue, Svelte, Astro, and Jupyter notebooks. Users can extend language support by adding custom language definitions in a languages.toml configuration file without forking the repository.
The repository includes a GitHub Action for risk-scored pull request reviews that runs entirely locally on CI runners without sending source code to external services. The action posts sticky comments with risk-scored functions, affected execution flows, and test gaps, with optional merge-gate functionality based on risk levels.
The repository shares contributors with openemr/openemr, anthropics/claude-code, and microsoft/vscode.