# code-review-graph

> Builds a Tree-sitter map of your codebase and serves it to AI coding tools over MCP, so they read only the code a task needs

- Category: Retrieval & Knowledge (RAG) / Code Indexing & Search
- Language: Python
- Licence: MIT
- Repository: https://github.com/tirth8205/code-review-graph
- Website: https://code-review-graph.com
- Canonical page: https://ai-tldr.dev/tools/code-review-graph/

## In short

code-review-graph is Builds a Tree-sitter map of your codebase and serves it to AI coding tools over MCP, so they read only the code a task needs. It sits in the Code Indexing & Search category of the Retrieval & Knowledge (RAG) tools and is open-source, written in Python and licensed MIT.

## Overview

AI coding tools handle review tasks by reading large parts of a repository, and the token bill scales with the repository rather than the change. code-review-graph attacks that directly: it parses your code with Tree-sitter into a structural map, tracks changes incrementally as you work, and exposes that map to your assistant over the Model Context Protocol, so the assistant asks the graph a question instead of reading files until it finds the answer.

The project's headline illustration is a Flask example: reading the whole corpus costs 143,594 tokens where a graph answer costs 2,196 — 71× fewer. The repository ships a reproduction guide for its benchmarks, so the numbers are checkable rather than asserted.

Setup is deliberately one command. code-review-graph install auto-detects which AI coding tools are present on the machine, writes the correct MCP configuration for each, installs platform-native hooks and skills where the platform supports them, and injects graph-aware instructions into that platform's rules file. It detects whether you installed via uvx or pip/pipx and generates the matching configuration. Supported platforms span Codex, Claude Code, CodeBuddy Code, Cursor, Windsurf, Zed, Continue, OpenCode, Antigravity, Gemini CLI, Qwen, Qoder, Kiro, GitHub Copilot and the Copilot CLI; --platform narrows it to one.

It is MIT-licensed Python (3.10+), published on PyPI, runs entirely locally, and also ships a GitHub Action for using the same graph in CI.

## What it does

- Tree-sitter parsing into a persistent structural graph of the codebase, updated incrementally as code changes
- MCP server so any MCP-capable coding tool can query the graph instead of reading whole files
- One-command install that configures every supported AI coding tool it detects, including hooks, skills and rules injection
- Local-first: the graph is built and queried on your machine
- Benchmarked context reductions with a published reproduction guide
- A GitHub Action for running the same graph-backed review in CI

## Getting started

Python 3.10 or newer. The three commands below are the project's own quick start; restart your editor or tool after installing so it picks up the new MCP configuration.

1. Install

```bash
pip install code-review-graph
# or: pipx install code-review-graph
```

2. Configure your tools and build the graph

   install auto-detects the supported AI coding tools on your machine and writes each one's MCP configuration; build parses the repository.

```bash
code-review-graph install
code-review-graph build
```

3. Or target one platform

```bash
code-review-graph install --platform codex
code-review-graph install --platform cursor
```

## When to use it

- Cutting the token cost of AI code review on a large repository by serving structure instead of whole files
- Giving a coding assistant a stable, incrementally-updated map of an unfamiliar codebase
- Standardising the same context layer across several AI coding tools with one install step
- Running graph-backed review in CI through the shipped GitHub Action
