# Code Review Graph — Local-First Code Intelligence for AI Agents > Build a persistent knowledge graph of your codebase so AI coding tools read only what matters, reducing context by up to 90%. ## Install Save as a script file and run: # Code Review Graph — Local-First Code Intelligence for AI Agents ## Quick Use ```bash pip install code-review-graph crg index . crg serve --port 8080 # Connect your AI coding agent to the MCP server at localhost:8080 ``` ## Introduction Code Review Graph is a local-first code intelligence tool that builds a persistent map of your codebase as a knowledge graph. It indexes code structure, dependencies, and relationships so AI coding tools can query only the relevant context instead of processing entire repositories. The result is faster, more accurate AI-assisted code reviews and large-repo workflows. ## What Code Review Graph Does - Indexes codebases into a persistent knowledge graph using tree-sitter parsing - Serves as an MCP server for AI agents to query code context - Reduces token consumption by surfacing only relevant code sections - Incrementally updates the graph as files change - Provides a CLI for querying code relationships directly ## Architecture Overview Code Review Graph uses tree-sitter for language-agnostic parsing and builds a graph database that captures functions, classes, imports, call sites, and type relationships. The graph is stored locally and updated incrementally on file changes. An MCP server layer exposes query tools that let AI agents traverse the graph to find relevant context without reading entire files. ## Self-Hosting & Configuration - Install via pip and index your repository with a single command - Supports Python, TypeScript, JavaScript, Go, Rust, and more via tree-sitter grammars - Configure indexing scope with .crgignore patterns similar to .gitignore - Run the MCP server locally and register it with your AI coding CLI - Graph data is stored in a local SQLite database for portability ## Key Features - Incremental indexing that re-parses only changed files - Multi-language support through tree-sitter grammar plugins - MCP-native server for seamless integration with AI coding agents - CLI tools for direct graph queries and exploration - Benchmarked context reductions on code review workflows ## Comparison with Similar Tools - **Sourcegraph** — cloud-hosted code search; Code Review Graph is local-first and graph-based - **ctags/LSP** — symbol indexing without the relationship graph or MCP integration - **Repomix** — packs repos into single files; Code Review Graph provides selective context - **GitIngest** — converts repos to LLM prompts without persistent graph state - **GraphRAG** — general-purpose knowledge graph; Code Review Graph is purpose-built for codebases ## FAQ **Q: Which programming languages are supported?** A: Any language with a tree-sitter grammar. Python, TypeScript, JavaScript, Go, Rust, Java, and C/C++ are supported out of the box. **Q: How large a codebase can it handle?** A: It is designed for large repositories. Incremental indexing means initial indexing is the only slow step; subsequent updates are fast. **Q: Does it send code to any external service?** A: No. All indexing and graph storage happens locally. The MCP server runs on localhost. **Q: Can it work without an AI agent?** A: Yes, the CLI provides direct query commands for exploring code relationships independently. ## Sources - https://github.com/tirth8205/code-review-graph - https://github.com/tirth8205/code-review-graph#readme --- Source: https://tokrepo.com/en/workflows/asset-60043562 Author: Script Depot