Code Review Graph

Code Review Graph: Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.

Last verified:

Visit Code Review Graph

What is Code Review Graph?

Code Review Graph is a tool that code-review-graph is a local-first code intelligence tool that builds a persistent knowledge graph of your codebase using Tree-sitter, enabling AI coding assistants like Claude Code to read only the files that matter during code reviews. It parses your entire repository into an AST-based graph of nodes (functions, classes, imports) and edges (calls, inheritance, test coverage), then uses blast-radius analysis to identify exactly which files are affected by a change.

Key features include incremental updates that re-parse only changed files in under 2 seconds, support for 25+ programming languages including Jupyter notebooks, 30 MCP tools for AI assistants, semantic search with vector embeddings, interactive D3.js visualizations, community detection via the Leiden algorithm, and multi-repo daemon support for background watching. The tool delivers 38x–528x fewer tokens per question compared to naive full-corpus approaches, with benchmarked 6.8× fewer tokens on reviews and up to 49× on daily coding tasks.

This tool is designed for developers using AI coding tools (Claude Code, Cursor, Windsurf, Codex, GitHub Copilot, Gemini CLI, Kiro, Zed, Continue) who work with large codebases or monorepos where token waste is most painful. It's fully open-source under MIT license, requires Python 3.10+, stores everything locally in a SQLite file with no cloud or telemetry, and is particularly valuable for teams reviewing commits, doing PR reviews, onboarding to new repos, or refactoring large codebases.

Code Review Graph pricing

Pricing model: Freemium

100% free and open-source under MIT license. No paid plans, no free tier limitations - all features are available. The tool is installed via pip (pip install code-review-graph) or pipx with no subscription required. Optional dependency groups for embeddings, communities, enrichment, eval benchmarks, and wiki generation are also free. The only cost is your own AI API usage (Claude, OpenAI, etc.) which the tool actually reduces by 38x–528x.

Code Review Graph pros

  • Cuts token usage by 38x–528x compared to naive full-corpus approaches
  • Achieves 6.8× fewer tokens on code reviews and up to 49× on daily coding tasks
  • Incremental updates re-parse only changed files in under 2 seconds
  • 100% recall on blast-radius analysis across all evaluated commits
  • Supports 25+ languages including Python, JavaScript/TypeScript, Go, Rust, Java, C/C++, and Jupyter notebooks
  • 100% local storage with SQLite - no cloud, no telemetry, no sign-ups
  • 30 MCP tools automatically available to AI assistants once graph is built
  • Auto-detects and configures all supported AI platforms with one command
  • Interactive D3.js force-directed graph visualization with search and community toggles
  • Multi-repo daemon watches multiple repos in background with auto-restart health checks
  • Semantic search with optional vector embeddings via sentence-transformers or OpenAI-compatible endpoints
  • Community detection via Leiden algorithm with automatic splitting of oversized communities
  • Risk-scored reviews that map diffs to affected functions, flows, and test gaps
  • Export to GraphML, Neo4j Cypher, Obsidian vault with wikilinks, and SVG formats
  • Token Savings panel shows exact context saved per call with ~1% calibration accuracy

Code Review Graph cons

  • Graph context can exceed naive file reads for small single-file changes
  • Search quality MRR of 0.35 - ranking needs improvement
  • Flow detection has only 33% recall - only reliably detects entry points in Python repos
  • Impact analysis deliberately over-predicts with false positives in large dependency graphs
  • Requires Python 3.10+ which may not be available in all environments
  • Initial build takes ~10 seconds for a 500-file project
  • Some optional features require installing extra dependency groups
  • Windows users may encounter MCP connection issues requiring manual config fixes

Frequently asked questions about Code Review Graph

What is code-review-graph and what problem does it solve?

code-review-graph is a local-first code intelligence graph that builds a persistent structural map of your codebase using Tree-sitter. It solves the problem of AI coding tools reading thousands of irrelevant files during code reviews, which wastes tokens and produces worse reviews. By tracking which files actually depend on changed code (blast-radius analysis), it ensures your AI assistant reads only the minimal set of relevant files, achieving 6.8× fewer tokens on reviews and up to 49× on daily coding tasks.

How do I install and set up code-review-graph?

Installation takes about 30 seconds: run 'pip install code-review-graph' (or 'pipx install code-review-graph'), then 'code-review-graph install' to auto-detect and configure all supported AI platforms (Claude Code, Cursor, Windsurf, Codex, etc.). Finally run 'code-review-graph build' to parse your codebase. The install command writes the correct MCP configuration, installs platform-native hooks where supported, and injects graph-aware instructions into your platform rules. Restart your editor after installing.

Which programming languages does code-review-graph support?

It supports 25+ languages: Python, JavaScript/TypeScript/TSX, Go, Rust, Java, C/C++, C#, 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, Vue/Svelte SFCs, Astro files, Jupyter/Databricks notebooks (.ipynb), and Perl XS files (.xs). Parser support covers functions, classes, imports, call sites, inheritance, and test detection.

How does the blast-radius analysis work?

When a file changes, the graph traces every caller, dependent, and test that could be affected. This is the 'blast radius' of the change. The tool uses the AST graph to follow call edges, inheritance edges, and import relationships to find all nodes that transitively depend on the changed code. It achieves 100% recall on evaluated commits, deliberately over-predicting as a conservative trade-off to avoid missing broken dependencies.

What MCP tools does code-review-graph provide?

It provides 30 MCP tools including: build_or_update_graph_tool, get_minimal_context_tool (~100 tokens), get_impact_radius_tool for blast radius, get_review_context_tool for token-optimized reviews, query_graph_tool for callers/callees/tests/imports, traverse_graph_tool for BFS/DFS exploration, semantic_search_nodes_tool, list_communities_tool, get_architecture_overview_tool, detect_changes_tool for risk-scored impact analysis, get_hub_nodes_tool, get_bridge_nodes_tool, get_knowledge_gaps_tool, refactor_tool, generate_wiki_tool, cross_repo_search_tool, and 15 more for flow detection, community analysis, and execution traces.

How does incremental updating work and how fast is it?

When hooks or watch mode are enabled, file saves and commit hooks trigger incremental updates. The graph diffs changed files using SHA-256 hash checks, finds their dependents, and re-parses only what changed. A 2,900-file project (FastAPI) re-indexes in under 2 seconds. PostEdit and PostGit hooks keep the graph current automatically without you rebuilding anything. The daemon option (crg-daemon) watches multiple repos in the background with health checks every 30 seconds.

Is my code sent to the cloud?

No. code-review-graph is 100% local-first. No cloud, no telemetry, no sign-ups. The entire graph is stored in a single SQLite file in .code-review-graph/ directory in your project. Core graph storage needs no external database or cloud service. The only time external APIs are used is optionally for cloud embeddings (if you enable Google Gemini or OpenAI embeddings), but the core functionality works entirely offline with local sentence-transformers models.

What are the known limitations of code-review-graph?

Known weaknesses include: (1) For small single-file changes, graph context can exceed naive file reads due to structural metadata overhead; (2) Search quality has MRR of 0.35 - ranking needs improvement, and Express queries return 0 hits due to module-pattern naming; (3) Flow detection has only 33% recall and only reliably detects entry points in Python repos where framework patterns are recognized - JavaScript and Go need work; (4) Impact analysis is deliberately conservative with false positives in large dependency graphs.

Can I use code-review-graph with multiple repositories?

Yes. It has multi-repo support with a registry system. Use 'code-review-graph register <path>' to register multiple repos, then 'code-review-graph repos' to list them. The crg-daemon (code-review-graph daemon start) watches multiple repos as child processes with health checks and auto-restart, keeping all graphs fresh in the background. You can also use cross_repo_search_tool to search across all registered repositories.

How do I visualize my codebase graph?

Run 'code-review-graph visualize' to generate an interactive HTML graph using D3.js with force-directed layout, search, community legend toggles, and degree-scaled nodes. You can also export to other formats: '--format graphml' for Gephi/yEd, '--format svg' for static SVG, '--format obsidian' for Obsidian vault with wikilinks, or '--format cypher' for Neo4j. The visualization shows communities (code clusters), hub nodes (most-connected), bridge nodes (architectural chokepoints), and surprising connections.

Categories

Use cases

Browse all AI tools on NeedAnAI