Code Review Graph logo

Code Review Graph

CommunityPopular
vudovn
code-review-graph

Token-efficient code review using Tree-sitter AST graphs and MCP. Cuts AI token usage on large codebases by computing the blast radius of changes instead of reading entire codebases. Uses a SQLite graph database for structural analysis.

Overview

Publishervudovn
Repositoryag-kit
Skill namecode-review-graph
Stars
8.2K
Forks
1.5K
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by vudovn on GitHub. Read the source before you install it.

Installation

Install the Code Review Graph AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/vudovn/ag-kit/tree/main/.agents/skills/code-review-graph
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/vudovn/ag-kit.git /tmp/ag-kit
mkdir -p .claude/skills
cp -r /tmp/ag-kit/.agents/skills/code-review-graph .claude/skills/code-review-graph
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Code Review Graph in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Code Review Graph on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Code Review Graph is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Code Review Graph — Token-Efficient Codebase Context via MCP

Cut AI token usage substantially on large codebases by giving the AI a structural map instead of letting it read everything. Savings scale with codebase size — marginal on small projects, large on monorepos.

Overview

code-review-graph is an MCP server that uses Tree-sitter to parse your codebase into an AST graph stored in SQLite. When your AI assistant needs context for a task, it queries the graph first — getting only the files in the blast radius of your change — instead of reading every file in the directory.

Token Impact (illustrative — varies by codebase):

Codebase TypePattern
Large monorepo (10K+ files)Biggest savings — graph reads a small fraction of files
Mid-size app (1-5K files)Meaningful reduction on multi-file changes
Small project (<200 files)Little benefit — graph overhead can exceed savings

Quality angle: scoping the AI to the blast radius reduces noise, which tends to improve review focus. Measure on your own repo rather than relying on a fixed multiplier.

Bootstrap Protocol (opt-in)

When invoked during /plan or standard usage on a mid-to-large project, check whether graph analysis is available before relying on it:

  1. Step 1: Check if the tool is installed: Get-Command code-review-graph (Windows) or which code-review-graph (macOS/Linux).
  2. Step 2: Check if a .code-review-graph/ directory exists in the workspace.
  3. Step 3: If installed but the index is missing, ask the user before running code-review-graph build (it scans the whole project).
  4. Step 4: If not installed and the project is large, ask the user: "Would you like to pip install code-review-graph and build a local map to cut token usage for this project?" Never install or run build without confirmation.

When to Use vs When to Skip

✅ Install it if:

  • Codebase is 500+ files
  • You make multi-file changes with cross-module dependencies
  • You spend $20+/month on AI assistant tokens
  • You work with monorepos, microservices, or cross-package TypeScript
  • You want better review quality in addition to cost savings

❌ Skip it if:

  • Codebase is under ~200 files with isolated single-file changes
  • Heavy use of dynamic patterns (reflection, runtime code gen, dynamic imports)
  • You want zero-maintenance — the graph needs to stay in sync
  • Team hasn't standardized on an AI coding tool yet

⚠️ Evaluate first if:

  • Codebase is 200–500 files — benchmark before committing
  • Mix of static and dynamic patterns — test on representative commits

How It Works (4 Layers)

Layer 1: PARSE    → Tree-sitter builds ASTs from 19 languages
Layer 2: STORE    → Nodes + edges saved in SQLite graph
Layer 3: TRACE    → BFS computes blast radius of changes
Layer 4: SERVE    → MCP exposes graph to AI assistants

What the Graph Contains

  • Nodes: Files, functions, methods, classes, imports, tests
  • Edges: "A calls B", "X imports Y", "TestZ covers FunctionW", "ClassA extends ClassB"
  • Metadata: Name, type, file path, line range per node
  • Privacy: Structural metadata only — NO source code content in the graph

Supported Languages (19)

Python, TypeScript, JavaScript, Go, Rust, Java, C#, Ruby, Kotlin, Swift, PHP, C/C++, Vue SFC, Solidity, Dart, R, Perl, Lua, Jupyter/Databricks notebooks.


Installation

Prerequisites

  • Python 3.9+ (python3 --version)
  • pip or pipx installed
  • An MCP-compatible AI client (AG Kit, Claude Code, Cursor, Windsurf, Zed)
  • Git-tracked codebase (for incremental updates)

Step 1: Install the Package

bash
# Recommended: isolated environment
pipx install code-review-graph

# Alternative: fastest, no permanent install
uvx code-review-graph install

# Alternative: global pip
pip install code-review-graph

Step 2: Configure MCP Client

bash
# Auto-detect all supported tools
code-review-graph install

# Or target a specific platform
code-review-graph install --platform claude-code
code-review-graph install --platform cursor
code-review-graph install --platform windsurf

Restart your editor after this step. The MCP server activates on restart.

Step 3: Build the Initial Graph

bash
cd /your/project
code-review-graph build
Codebase SizeExpected Build Time
500 files10–30 seconds
5,000 files2–5 minutes
27,000 files5–10 minutes

Step 4: Enable Watch Mode (Recommended)

bash
# Keep graph current as you work
code-review-graph watch

Incremental updates complete in under 2 seconds. If you prefer manual updates:

bash
code-review-graph update

Step 5: Verify Integration

Open your AI client and check MCP connection. For Claude Code: run /mcp and confirm code-review-graph appears.


Configuration

Ignore File

Create .code-review-graphignore at project root (uses .gitignore syntax):

# Build artifacts
dist/**
.next/**
build/**

# Dependencies
node_modules/**
vendor/**

# Generated files
generated/**
*.generated.ts
*.min.js

# Test fixtures (if large)
__fixtures__/**

Excluding generated files and build artifacts is critical — they inflate the graph with meaningless nodes.

Multi-Repo Setup

For microservice architectures:

bash
# Register additional repos
code-review-graph register /path/to/other/repo

# List all registered repos
code-review-graph repos

The MCP server serves context across all registered repositories.


Core Workflows

1. Blast Radius Analysis (Primary Use)

This is automatic when the MCP server is active. Your AI assistant queries the graph before reading files, getting only the impacted files instead of everything.

Without graph:  Changed auth/middleware.py → AI reads 200+ files → 8,200 tokens
With graph:     Changed auth/middleware.py → Graph returns 12 impacted files → 1,000 tokens

2. Risk-Scored Change Analysis

bash
code-review-graph detect-changes

Scores each uncommitted change by risk level:

  • Number of dependents
  • Test coverage gaps
  • Whether changed functions are on critical paths
  • High-risk changes flagged before you ask for review

3. Dead Code Detection

The graph finds nodes with no incoming edges — no callers, no importers, no test coverage:

bash
# Surfaces functions/classes that are candidates for removal
# Useful on mature codebases to reduce cruft

4. Refactoring Preview

bash
code-review-graph rename preview --from OldClassName --to NewClassName

Shows every file affected by a rename, and flags edge cases (dynamic string references that static analysis can't catch).

5. Architecture Visualization

bash
code-review-graph visualize

Generates interactive visualization showing module clusters using community detection (Leiden algorithm). Useful for:

  • Onboarding new contributors
  • Identifying architectural drift
  • Spotting overly-coupled modules

6. Wiki Generation

bash
code-review-graph wiki

Generates markdown wiki of codebase structure — every module, its public API, dependencies, and test coverage.


Known Limitations

LimitationImpactMitigation
Dynamic imports (require(variable), import(buildPath()))Dependencies invisible to parserManually note in .code-review-graphignore or accept over-prediction
Reflection-based calls (Django signals, getattr(), Java reflection)Missed edges in graphSerena (LSP-based) is better for these codebases
Runtime-generated code (eval, template engines)Not parseable at static timeAccept limitation or exclude from graph
Cross-language boundaries (Python calling TypeScript API)No edges between language runtimesUse multi-repo registration as partial workaround
Stale graph (without watch mode)Claude queries outdated relationshipsAlways run code-review-graph update before tasks, or use watch mode
TypeScript path aliases (@/components/...)May require tsconfig resolution configCheck tsconfig_resolver.py handles your setup

Alternatives Comparison

ToolApproachProsConsBest For
code-review-graphTree-sitter + SQLiteFast, 19 languages, local, no depsStatic analysis onlyGeneral use, large codebases
ClaudetteGo rewriteSingle binary, no PythonFewer languages, simplerPython-averse teams
SerenaLSP-basedDeep semantic precision, type resolutionHeavy setup, slowerPolymorphism-heavy codebases
code-graph-ragRAG + vector searchNatural language queriesComplex setupCodebase exploration
Native IDE contextEditor built-inZero setupNo explicit blast radiusSimple projects

Integration with AG Kit

Complementary Skills

AG Kit SkillHow It Complements
context-compressionGraph reduces input context; compression reduces output verbosity
coordinator-modeGraph-aware workers can be dispatched with precise file lists
verify-changesAfter graph-informed review, verify changes via execution
batch-operationsGraph's blast radius informs which files need batch updates

Recommended Session Architecture

1. Start fresh session for each distinct task
2. Graph pre-filters context → AI reads only blast radius
3. Context compression summarizes completed phases
4. Memory system saves key decisions for next session
5. Result: minimum tokens, maximum quality

Best Practices

  1. Always run watch mode in development — stale graphs produce stale context
  2. Exclude generated files — they inflate the graph with noise
  3. Benchmark first — measure token usage for 1 week without, 1 week with
  4. Combine with output constraints — graph reduces input, prompt engineering reduces output
  5. Use .code-review-graphignore for build artifacts, node_modules, dist/
  6. Keep sessions short — fresh sessions + graph = optimal token efficiency
  7. Multi-repo registration for microservice architectures

Frequently asked questions

What does the Code Review Graph AI skill do?

Token-efficient code review using Tree-sitter AST graphs and MCP. Cuts AI token usage on large codebases by computing the blast radius of changes instead of reading entire codebases. Uses a SQLite graph database for structural analysis.

Why use Code Review Graph on TypingMind?

Because you install it once and use it with any model. Code Review Graph is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Code Review Graph in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/vudovn/ag-kit/tree/main/.agents/skills/code-review-graph. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Code Review Graph?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Code Review Graph?

As many as you like. As long as a model supports skills, you can use Code Review Graph with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Code Review Graph AI skill free?

Yes. It is published on GitHub by vudovn under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇