gitmyhub

code-review-graph

Python ★ 19k updated 6d ago

Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.

A Python tool that maps your codebase as a knowledge graph so AI coding assistants like Claude Code or Cursor only read the files they actually need, cutting token costs and making code reviews faster and more focused.

PythonSQLiteTree-sitterMCPsetup: moderatecomplexity 3/5

code-review-graph is a Python tool that solves a specific problem with AI coding assistants: by default they re-read large chunks of your codebase every time you ask them to review or change something, which burns through a lot of tokens (the unit those models bill in). This project builds a structural map — a "knowledge graph" — of your code once, keeps it up to date in the background, and then hands the AI just the slice of files that actually matter for the current task.

Under the hood it uses Tree-sitter, a parsing library that understands code in many languages, to break your repository into nodes (functions, classes, imports) and edges (which function calls which, what inherits from what, which tests cover which code). The graph is stored in SQLite, and a "blast radius" query figures out, for any changed file, all the callers, dependents and tests that could be affected — so only that minimal set has to be read. A git hook re-parses just the changed files on every commit or save, which the README says keeps a 2,900-file project re-indexing in under two seconds. The graph is exposed to the AI assistant through the Model Context Protocol (MCP), and the install command auto-configures the integration for a long list of AI coding tools including Claude Code, Cursor, Codex, Windsurf, Zed, Continue, GitHub Copilot, Gemini CLI and others. It supports 24 languages plus Jupyter notebooks.

You would use it when you work in a sizeable repository — especially a monorepo — and want your AI assistant's code reviews and edits to be cheaper, faster and more focused. Installation is via pip or pipx and requires Python 3.10+. The full README is longer than what was provided.

Where it fits