tirth8205/code-review-graph · 27 Jul 2026 · Feature

A Structural Memory Layer for AI Assistants That Runs on Your Laptop

Marcus Reed
Marcus Reed
Senior Editor

code-review-graph builds a persistent, queryable map of your codebase so AI assistants stop burning tokens re-reading files they already saw.

tirth8205/code-review-graph
26.6k stars Velocity · 7d +762 ★/day accelerating
star history

The Token Economics of Re-Reading

tirth8205/code-review-graph

Every time you ask an AI coding assistant to review a change, explain a module, or trace a bug, there is a good chance it is re-ingesting large swaths of your repository from scratch. In a monorepo with tens of thousands of files, this is not just slow; it is expensive. The project claims token reductions between 38× and 528× across six real open-source repositories when using its graph versus a naive full-corpus prompt. A Hacker News discussion citing the project noted a 49× reduction during live coding on a 27,732-file Next.js repository, with review quality scores reportedly rising from 7.2 to 8.8 out of ten. Those are not marginal gains; they are the difference between a sub-second query and a context-window meltdown.

The problem is structural. Current AI assistants—whether Claude Code, Cursor, GitHub Copilot, or Gemini CLI—operate file-by-file. They grep, they embed, they guess. When a developer asks “will this change break anything,” the assistant often lacks an explicit map of call chains, test dependencies, or inheritance. It compensates by reading more. The result is reviewer fatigue, slower pull request cycles, and a quiet hemorrhage of API spend, a dynamic SonarSource describes as scaling faster than human review capacity.

ASTs, SQLite, and the Anti-Cloud

The technical response is not another vector database or cloud service. It is a SQLite file in a hidden directory. code-review-graph uses Tree-sitter to parse the repository into an abstract syntax tree, then collapses that structure into a local graph of functions, classes, imports, calls, and inheritance edges. The choice of SQLite is deliberate: it requires no daemon, no Docker container, no network egress, and no signup. The database runs in WAL mode for concurrent reads, uses qualified names to avoid collisions, and skips unchanged files via SHA-256 hash checks [12].

This local-first stance is increasingly rare. Enterprise graph-intelligence systems often lean on Neo4j or Amazon Neptune, with LLM orchestration layers and multi-microservice crawlers [1]. Those systems are built for Fortune 100 monoliths. code-review-graph is built for a laptop. It indexes 56 file extensions and incrementally re-parses only changed files in under two seconds, according to its own site.

The graph is not merely a storage format. It is a computation layer. When a file changes, the tool performs “blast-radius analysis,” tracing every caller, dependent, and test that could be affected. It clusters related code via the Leiden community detection algorithm, scores architectural chokepoints with betweenness centrality, and flags unexpected cross-community coupling as “surprises.” The result is a structural memory that knows the codebase better than a bag-of-files embedding ever could.

MCP as the Integration Layer

If the graph is the brain, the Model Context Protocol is the nervous system. code-review-graph exposes thirty MCP tools and five workflow prompts that plug into Claude Code, Cursor, Windsurf, Zed, and a dozen other platforms [3]. The assistant does not need to understand graph theory; it simply calls the review or impact tools, and the graph returns a token-budgeted payload of exactly the nodes and edges that matter.

This integration strategy is where the project diverges from earlier code-graph experiments. FalkorDB’s CodeGraph and Memgraph’s Graph-Code also map repositories into queryable graphs, but they emphasize Cypher queries and visual exploration in dedicated graph labs. code-review-graph has no interest in teaching developers Cypher. It wants to be invisible infrastructure, translating natural-language intent into graph traversals behind the scenes. A comparison with Graphify—another open-source Tree-sitter graph tool—highlighted the difference in speed: code-review-graph updated incrementally in 0.425 seconds versus Graphify’s roughly ten seconds on a similar monorepo.

The MCP layer also surfaces a compact context_savings estimate after each call, calibrated to within one percent of OpenAI’s tokenizer. This turns token efficiency from a vague marketing claim into a measurable side effect of every review.

Benchmarks and the Honesty Tax

The project’s documentation contains a section titled “Limitations and known weaknesses.” In an era of AI tooling hype, this is almost an act of rebellion. The maintainers admit that for small single-file changes, the graph’s structural metadata can exceed the token cost of simply reading the file raw. They report a mean reciprocal rank of 0.35 on keyword search, and flow-detection recall of only 33 percent—reliable mainly for Python frameworks, with JavaScript and Go still needing work.

The impact-analysis numbers are more flattering: 100 percent recall across thirteen evaluation commits, meaning the blast radius never misses a genuinely affected file. Precision is lower, averaging 0.578, because the graph deliberately over-predicts. The trade-off is conservative: flagging too many files is preferable to missing a broken dependency. This is the kind of engineering honesty that makes the 38×–528× token-reduction figures credible rather than suspicious.

The GraphRAG Landscape

code-review-graph sits at the intersection of two trends: GraphRAG and AI code review. GraphRAG—augmenting retrieval with structured relationships—has been shown to outperform vector-only approaches on codebases because relationships like CALLS and INHERITS_FROM let large language models reason precisely over multi-hop dependencies and blast radii [4]. Meanwhile, the code-review tool market is bifurcating between deterministic static analyzers that enforce rules for compliance, and AI-powered agents that send diffs to LLMs for semantic feedback [2].

code-review-graph is neither. It is not a linter, and it does not send your code to a cloud LLM. It is a local context broker, a structural pre-processor that sits between your repository and whichever assistant you already use. It aligns with the argument that the best tools analyze full repository context rather than isolated diffs, identifying cross-file regressions and architectural drift [8]. But it does so without the enterprise weight of multi-repo agent workflows or the infrastructure overhead of a managed graph database [2].

What It Does Not Fix

For all its ambition, the tool is still roughly 3,700 lines of typed Python with a modest test suite [12]. One Hacker News user reported installation errors via the recommended Claude plugin path [12]. Windows users have hit JSON encoding issues requiring explicit UTF-8 environment flags. The thirty-tool MCP surface, while comprehensive, may overwhelm clients with tight token budgets—though the project now supports tool filtering to limit exposure.

More fundamentally, the graph is only as good as its parser. Tree-sitter covers an impressive language surface, but dynamic dispatch, runtime reflection, and certain module patterns remain opaque to static analysis. The “execution flows” feature, which traces call chains from entry points, is currently reliable mainly in Python repos where framework patterns are recognized.

Outlook

The project points toward a future where AI assistants do not merely have large context windows, but structured context maps. The documentation hints at this with a “memory loop” feature that persists Q&A results as markdown for re-ingestion, allowing the graph to grow from human-AI conversation, not just static source. A multi-repo daemon can watch several projects simultaneously, suggesting the ambition to become ambient infrastructure.

Whether code-review-graph becomes a standard layer in the AI-assisted stack or gets absorbed into IDEs and platform-native tools is an open question. For now, it offers a pragmatic, local-first answer to a genuinely hard problem: stopping your assistant from reading the entire codebase every time you change a single import. In an ecosystem that often solves complexity by adding more cloud, more vectors, and more tokens, the radical move was to build something small, graph-shaped, and stubbornly offline.

Sources

  1. Reimagining Code Understanding with Graph Intelligence ...
  2. 13 Best Automated Code Review Tools in 2026: AI and Static Analysis ...
  3. code-review-graph — Local code intelligence for MCP
  4. CodeGraph: Build Queryable Knowledge Graphs from Code
  5. 10 Open Source AI Code Review Tools Tested on a 450K-File Monorepo ...
  6. Graphify vs. code-review-graph: Which is better for context-mapping ...
  7. is there any AI tool that can analyze big code base and ...
  8. What are the best AI Code Review Tools to Trust in 2026? Enterprise ...
  9. Graphify + code-review-graph: Build a Self-Updating Knowledge ...
  10. GraphRAG for Devs: Graph-Code Demo Overview
  11. New research followed 500 devs at 4 orgs rolling out AI Coding Tools over ...
  12. persistent code graph that cuts Claude Code token usage

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.