Favicon of Code Review Graph

Code Review Graph

Open-source Python tool that maps your codebase with Tree-sitter and MCP, cutting the context AI coding tools need to review changes.

Code Review Graph website screenshot
Code Review Graph GitHub repository preview

code-review-graph (CRG) is a local-first tool that parses your codebase into a structural graph and exposes it to AI coding assistants through MCP, plus a CLI for direct use. It's built for developers using AI tools like Claude Code, Cursor, Codex, or GitHub Copilot who are tired of watching those tools re-read entire repositories just to review a small change.

Instead of letting an AI assistant scan every file, CRG uses Tree-sitter to build a graph of functions, classes, imports, and their relationships (calls, inheritance, test coverage). When a file changes, it computes the "blast radius": every caller, dependent, and test that could be affected. The assistant then reads only that minimal set of files instead of the whole project.

Key features

  • Blast-radius analysis: traces callers, dependents, and tests affected by a change and returns only the relevant files to the AI assistant.
  • Incremental updates: diffs changed files via SHA-256 checks and re-parses only what changed; a 2,900-file project re-indexes in under 2 seconds.
  • MCP integration: install auto-detects supported AI coding platforms (Codex, Claude Code, Cursor, Windsurf, Zed, Gemini CLI, Kiro, GitHub Copilot, and others) and writes the correct MCP config for each.
  • Broad language coverage: Tree-sitter parsing across Python, JavaScript/TypeScript, Go, Rust, Java, C/C++, Ruby, Kotlin, Swift, PHP, and dozens more, plus Jupyter/Databricks notebooks.
  • Custom language support: add a languages.toml file mapping extensions and node types to any grammar bundled in tree_sitter_language_pack, no fork needed.
  • GitHub Action: runs the same analysis in CI, posts a sticky PR comment with risk-scored functions and test gaps, with an optional merge gate on high risk.
  • Local-first: the graph is built and queried entirely on your machine or CI runner; no source code is sent to an external service.
  • Clean uninstall: a symmetric uninstall command removes only CRG-owned config and hooks, leaving other MCP servers and settings untouched.

Ideal use cases

CRG fits teams running AI coding assistants against medium-to-large codebases or monorepos, where an assistant re-reading the whole repo on every review burns tokens and time. It's especially useful for PR review workflows: hook it into CI via the GitHub Action to get risk-scored comments on pull requests without shipping code to a third-party service.

It also helps in day-to-day editor use with tools like Claude Code or Cursor: once installed and built, the assistant can ask the graph for blast-radius context instead of grepping the repo itself.

It's not a good fit for small scripts or single-file projects, where the overhead of building and maintaining a graph isn't worth it. It also assumes you're using an AI coding tool that supports MCP or the GitHub Action; if you don't use AI assistants for review, there's little reason to install it. Note the benchmark numbers: the ~82x median token reduction is measured against a whole-corpus baseline, not against what a competent agent already does with grep, so real-world savings will vary by workflow.

Installation

Requires Python 3.10+. Installing uv is recommended; the MCP config prefers uvx when available and falls back to the code-review-graph command otherwise.

pip install code-review-graph                     # or: pipx install code-review-graph
code-review-graph install          # auto-detects and configures all supported platforms
code-review-graph build            # parse your codebase

To target one platform specifically:

code-review-graph install --platform cursor
code-review-graph install --platform claude-code
code-review-graph install --platform copilot

Restart your editor or AI tool after installing. Then, inside your project, ask your assistant to "Build the code review graph for this project." A 500-file project builds in about 10 seconds; watch mode and supported hooks keep it updated after that.

To remove it cleanly:

code-review-graph uninstall --dry-run    # preview actions, write nothing
code-review-graph uninstall --yes        # apply without prompting

For CI, add the GitHub Action to a workflow:

on:
  pull_request:
permissions:
  contents: read
  pull-requests: write
jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: tirth8205/[email protected]
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}

Frequently asked questions

Share:

Stars
26.7K
Forks
2.5K
Last commit
9 hours ago
Repository age
5 months
License
MIT
Self-hosted
No
Activity score
83/100
View Repository
Ad
Favicon

 

  
 

Similar to Code Review Graph

Favicon

 

  
 
Favicon

 

  
 
Favicon