tirth8205 / code-review-graph

· Source: Github Trending: All languages · Field: Technology & Digital — Software Development & Engineering, Artificial Intelligence & Machine Learning, Cloud Computing & IT Infrastructure · Depth: Intermediate, extended

Summary

code-review-graph is a Python 3.10+ tool designed to optimize AI code review by significantly reducing token consumption. It constructs a structural map of a codebase using Tree-sitter, storing it as a graph of nodes and edges. This graph enables incremental updates and provides AI assistants with precise context via the Model Context Protocol (MCP), ensuring they only review relevant code. Benchmarks show a median per-question token reduction of approximately 82x, with a maximum of 528x, across six real repositories. The tool supports a wide array of programming languages, including Python, JavaScript, Go, Rust, Java, PHP, and Jupyter notebooks, and integrates with platforms like Codex, Claude Code, Cursor, and GitHub Copilot. Key functionalities include blast-radius analysis, sub-2-second incremental updates for large projects, monorepo optimization, custom language definitions, and risk-scored pull request reviews through a GitHub Action.

Key takeaway

For AI Engineers or MLOps teams managing large codebases and AI-assisted reviews, code-review-graph offers a critical solution to reduce token costs and improve review accuracy. You should integrate this tool to provide your AI assistants with precise, graph-derived context, drastically cutting down on unnecessary token consumption. This enables faster, more focused reviews and ensures your models analyze only the most relevant code changes, enhancing efficiency and reducing operational expenses.

Key insights

AI code review efficiency hinges on providing precise, minimal context to large language models.

Principles

Method

code-review-graph parses a repository into an AST using Tree-sitter, storing it as a graph. This graph is incrementally updated and queried at review time to compute a minimal set of files for AI assistants, delivered via MCP.

In practice

Topics

Code references

Best for: Machine Learning Engineer, AI Architect, Software Engineer, AI Engineer, MLOps Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Github Trending: All languages.