Ad

code-review-graph: Local knowledge graph for AI code review

code-review-graph builds a persistent map of your codebase, enabling AI assistants to focus on relevant code and significantly reduce token consumption during reviews and coding tasks.
Screenshot of tirth8205/code-review-graph homepage

code-review-graph builds a local knowledge graph of your codebase using Tree-sitter. It addresses the problem of AI coding tools rereading entire codebases for each task, leading to high token consumption. By creating a structural map of code, it allows AI assistants to access only the necessary context, improving efficiency and accuracy. It leverages the Model Context Protocol (MCP) to provide precise context to AI assistants.

This project is notable for its ability to significantly reduce token usage during AI code review, particularly in large codebases. It achieves this by constructing an incremental knowledge graph that updates on demand rather than re-parsing the entire project. The tool supports a wide range of programming languages and integrates with popular AI coding assistants through the MCP protocol, enabling efficient context delivery.

  • Knowledge Graph Construction: Parses code using Tree-sitter to build a structural graph of code elements (functions, classes, imports, etc.) and their relationships.
  • Incremental Updates: Efficiently updates the graph on file changes, only re-parsing affected files and dependencies, resulting in fast update times.
  • Blast Radius Analysis: Calculates the 'blast radius' of code changes, identifying only the files and tests that need to be reviewed based on dependencies and calls.
  • MCP Integration: Leverages the Model Context Protocol to deliver sparse, relevant code context to AI assistants, reducing unnecessary token usage.
  • Broad Language Support: Supports a wide variety of programming languages and notebook formats, including Python, JavaScript, TypeScript, SQL, and more.
  • Platform Compatibility: Designed to work with various AI coding tools and platforms.
  • Developer Experience: Provides a simple command-line interface for building and managing the knowledge graph.

The project is actively developed with recent commits and a clear release history. Good documentation, including installation and usage guides, is provided. A vibrant Discord community offers support, and automated tests are in place. The project is mature enough for production use, with a focus on practical application and performance optimization.

This project benefits developers by reducing the cost and improving the efficiency of AI-assisted code review. It is especially valuable for large monorepos where context switching is a significant problem. It lowers token costs, enhances review accuracy, and improves developer workflow by providing targeted context to AI coding assistants.

Summarize:
Share:
Stars
19,565
Forks
2,093
Issues
186
Created
4 months ago
Commit
1 month ago
License
MIT
Archived
No
Updated 6 days ago

Similar Repositories