code-review-graph: a structural codebase mapper that reduces AI token usage by providing precise blast-radius context for code reviews

code-review-graph: a structural codebase mapper that reduces AI token usage by providing precise blast-radius context for code reviews

What it solves

AI coding assistants often waste tokens and context window space by re-reading large portions of a codebase during review tasks. code-review-graph reduces this waste by providing a structural map of the code, ensuring the AI reads only the files and functions that are actually affected by a change.

How it works

The tool uses Tree-sitter to parse repositories into an Abstract Syntax Tree (AST), which is then stored as a graph of nodes (functions, classes, imports) and edges (calls, inheritance, test coverage) in a SQLite database.

When a file is changed, the system performs a "blast-radius analysis" to trace every caller, dependent, and test that could be affected. This minimal set of files is then provided to the AI assistant via the Model Context Protocol (MCP), allowing the AI to ignore irrelevant files. The graph is updated incrementally, re-parsing only changed files to keep indexing times low.

Who it’s for

Developers using AI coding tools (such as Cursor, Claude Code, Windsurf, or GitHub Copilot) who want to reduce token usage and improve the precision of AI-driven code reviews, especially in large monorepos.

Highlights

  • Broad Language Support: Supports a vast array of languages including Python, JS/TS, Go, Rust, Java, C++, PHP, and even Jupyter/Databricks notebooks.
  • MCP Integration: Native compatibility with the Model Context Protocol for seamless integration with various AI editors.
  • Incremental Updates: Re-indexes changed files in under 2 seconds for large projects.
  • CI/CD Integration: Includes a GitHub Action that provides risk-scored PR reviews without sending source code to external services.
  • Custom Language Support: Allows users to add new languages via a languages.toml file without needing to fork the project.
  • Blast-Radius Analysis: Precisely identifies affected execution flows and test gaps caused by a specific change.

Sources