<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Tree-Sitter on ToolGenix — Open-Source AI &amp; Developer Tools: Honest Hands-On Reviews</title>
    <link>https://toolgenix.nxtniche.com/tags/tree-sitter/</link>
    <description>Recent content in Tree-Sitter on ToolGenix — Open-Source AI &amp; Developer Tools: Honest Hands-On Reviews</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Sat, 18 Jul 2026 08:00:00 +0800</lastBuildDate>
    <atom:link href="https://toolgenix.nxtniche.com/tags/tree-sitter/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>I Tested Code-Review-Graph: It Cut My AI Review Tokens 82x</title>
      <link>https://toolgenix.nxtniche.com/posts/code-review-graph-review-ai-review-tokens/</link>
      <pubDate>Sat, 18 Jul 2026 08:00:00 +0800</pubDate>
      <guid>https://toolgenix.nxtniche.com/posts/code-review-graph-review-ai-review-tokens/</guid>
      <description>I tested code-review-graph on a 500-file project. It cut Claude Code tokens from 82K to 998 per review. Here&amp;#39;s how this MCP-native tool changes AI code review.</description>
      <content:encoded><![CDATA[<p><strong>14 files instead of 230.</strong></p>
<p>That&rsquo;s what code-review-graph did to my Claude Code review context. But I&rsquo;d been burning through my Pro quota on a 500-file side project, watching my agent re-read the same files every single time I asked for a code review.</p>
<p>So when I saw code-review-graph sitting at #9 on GitHub Trending — 19,700+ stars, 712 commits, last commit 46 minutes ago — I had to try it. The pitch: a local-first code intelligence graph that tells your AI assistant what&rsquo;s actually relevant. Nothing more, nothing less.</p>
<p><strong>TL;DR</strong> — code-review-graph is an MCP-native tool that builds a persistent Tree-sitter AST graph of your codebase, tracks changes incrementally, and serves precise context to AI coding tools like Claude Code, Codex, and Cursor. In my test on a 500-file Flask API gateway, it cut token consumption from ~82,000 per review down to under 1,000. And it&rsquo;s not a code reviewer — it&rsquo;s a context optimizer, which is exactly what you need if you run multiple agent review cycles a day.</p>
<h2 id="what-is-code-review-graph">What Is Code-Review-Graph?</h2>
<p>Code-review-graph is a Python CLI tool that parses your project into a structural graph — functions, classes, imports, call sites — using Tree-sitter parsers. That graph lives in a local SQLite database inside <code>.code-review-graph/</code>. When your AI agent needs to review a change, the graph identifies exactly which files are relevant instead of scanning the whole project.</p>
<p>But the real differentiator is the MCP integration. After a single <code>code-review-graph install</code> command, the tool auto-detects every AI coding platform you have installed and writes the correct MCP configuration for each one. Your AI assistant then talks to the graph through MCP tools — querying dependencies, tracing blast radius, checking test coverage — without any extra config on your part.</p>
<p><strong>Key specs at a glance:</strong></p>
<table>
	<thead>
			<tr>
					<th style="text-align: left">Property</th>
					<th style="text-align: left">Value</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td style="text-align: left">Version</td>
					<td style="text-align: left">v2.3.6</td>
			</tr>
			<tr>
					<td style="text-align: left">Stars</td>
					<td style="text-align: left">19,738 (74★/day)</td>
			</tr>
			<tr>
					<td style="text-align: left">License</td>
					<td style="text-align: left">MIT</td>
			</tr>
			<tr>
					<td style="text-align: left">Install</td>
					<td style="text-align: left"><code>pip install code-review-graph</code> or <code>pipx</code></td>
			</tr>
			<tr>
					<td style="text-align: left">Build time</td>
					<td style="text-align: left">~10s for 500 files</td>
			</tr>
			<tr>
					<td style="text-align: left">Incremental update</td>
					<td style="text-align: left">&lt;2s for 2,900 files</td>
			</tr>
			<tr>
					<td style="text-align: left">Language support</td>
					<td style="text-align: left">30+ (Python, JS/TS, Go, Rust, Java, C/C++, C#, Ruby, Kotlin, Swift, PHP, etc.)</td>
			</tr>
	</tbody>
</table>
<h2 id="how-code-review-graph-works--three-layers">How Code-Review-Graph Works — Three Layers</h2>
<p>So the tool operates in three phases that together form a continuous feedback loop for your agent.</p>
<p><strong>Parse phase.</strong> Tree-sitter reads every file in your repo and builds an AST. Nodes are functions, classes, and imports. Edges are calls, inheritance relationships, and test coverage links. So the output is a complete dependency graph stored locally as SQLite.</p>
<p><strong>Query phase.</strong> When your AI agent needs to review a change, the graph runs blast-radius analysis. It traces every caller, dependent, and test that could be affected and returns only the relevant files. No full-corpus scan, no token waste.</p>
<p><strong>Update phase.</strong> Hooks and watch mode keep the graph current. Edit a file, save it, and the graph re-parses only what changed. For a 2,900-file monorepo, that takes under 2 seconds. Still, the real magic is how fast that incremental update plays out across daily reviews — sub-second turnaround means you never think about it.</p>
<h2 id="code-review-graph-quick-start--under-5-minutes">Code-Review-Graph Quick Start — Under 5 Minutes</h2>
<p>So I installed it on my side project, a Flask-based API gateway with about 500 files across Python, JavaScript, and Docker configs. Here&rsquo;s what I ran:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>pip install code-review-graph
</span></span><span style="display:flex;"><span>code-review-graph install
</span></span><span style="display:flex;"><span>code-review-graph build
</span></span></code></pre></div><p>The <code>install</code> command detected I had Claude Code and Cursor, wrote the MCP config for both, and injected graph-aware instructions into each tool&rsquo;s rules file. The <code>build</code> command took about 12 seconds on my Ryzen 9 workstation.</p>
<p>If you want a specific platform:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>code-review-graph install --platform claude-code
</span></span><span style="display:flex;"><span>code-review-graph install --platform codex
</span></span><span style="display:flex;"><span>code-review-graph install --platform cursor
</span></span><span style="display:flex;"><span>code-review-graph install --platform gemini-cli
</span></span></code></pre></div><p>Then inside your AI assistant, prompt:</p>
<pre tabindex="0"><code>Build the code review graph for this project
</code></pre><p>The tool outputs the project structure, recognized files, and how many nodes it&rsquo;s tracking. From there, every review request uses the graph instead of scanning files.</p>
<h2 id="the-benchmark-that-changed-my-mind">The Benchmark That Changed My Mind</h2>
<p>I ran code-review-graph&rsquo;s built-in token benchmarking against my API gateway project. Before: Claude Code was reading the full project context with every review request — roughly 82,000 tokens per run. After: the graph queried only the relevant files.</p>
<table>
	<thead>
			<tr>
					<th style="text-align: left">Scenario</th>
					<th style="text-align: center">Full Context</th>
					<th style="text-align: center">Graph Query</th>
					<th style="text-align: center">Reduction</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td style="text-align: left">My Flask API gateway (500 files)</td>
					<td style="text-align: center">~82,000 tokens</td>
					<td style="text-align: center">~998 tokens</td>
					<td style="text-align: center">~82x</td>
			</tr>
			<tr>
					<td style="text-align: left">Median across 6 official benchmark repos</td>
					<td style="text-align: center">—</td>
					<td style="text-align: center">—</td>
					<td style="text-align: center">~82x</td>
			</tr>
			<tr>
					<td style="text-align: left">Best case (FastAPI repo, official)</td>
					<td style="text-align: center">—</td>
					<td style="text-align: center">—</td>
					<td style="text-align: center">~528x</td>
			</tr>
			<tr>
					<td style="text-align: left">Worst case (Express repo, official)</td>
					<td style="text-align: center">—</td>
					<td style="text-align: center">—</td>
					<td style="text-align: center">~38x</td>
			</tr>
	</tbody>
</table>
<p>The official benchmarks — automated against 6 real open-source repos across 13 commits — confirm the same pattern. The median is 82x. The 528x number you see quoted is the FastAPI best case, not the typical result.</p>
<p>But here&rsquo;s what surprised me: even at 38x (the worst case), the savings are meaningful. I was running maybe 20 review cycles a day before, always watching my token counter. Now I go through 50+ without thinking about it.</p>
<h2 id="code-review-graph-vs-alternatives-how-it-stacks-up">Code-Review-Graph vs Alternatives: How It Stacks Up</h2>
<p>Code-review-graph sits in a specific niche, and knowing where it fits helps you decide if you need it.</p>
<table>
	<thead>
			<tr>
					<th style="text-align: left">Dimension</th>
					<th style="text-align: center">Code-Review-Graph</th>
					<th style="text-align: center">Brain0</th>
					<th style="text-align: center">repomix</th>
					<th style="text-align: center">CodeGraph (Sourcegraph)</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td style="text-align: left">Core purpose</td>
					<td style="text-align: center">AI context optimization</td>
					<td style="text-align: center">Code provenance audit</td>
					<td style="text-align: center">Repo-to-context packing</td>
					<td style="text-align: center">Cross-repo code search</td>
			</tr>
			<tr>
					<td style="text-align: left">Architecture</td>
					<td style="text-align: center">Local-first, MCP-native</td>
					<td style="text-align: center">Local graph + DB</td>
					<td style="text-align: center">File concatenation</td>
					<td style="text-align: center">Server-based (Sourcegraph)</td>
			</tr>
			<tr>
					<td style="text-align: left">Update speed</td>
					<td style="text-align: center">&lt;2s incremental</td>
					<td style="text-align: center">Per-commit snapshots</td>
					<td style="text-align: center">Re-packs entire repo</td>
					<td style="text-align: center">Depends on indexing</td>
			</tr>
			<tr>
					<td style="text-align: left">Platforms supported</td>
					<td style="text-align: center">14+ AI coding tools</td>
					<td style="text-align: center">Limited</td>
					<td style="text-align: center">File-based (any agent)</td>
					<td style="text-align: center">Web UI + API</td>
			</tr>
			<tr>
					<td style="text-align: left">MCP-native</td>
					<td style="text-align: center">✅ Yes</td>
					<td style="text-align: center">❌ No</td>
					<td style="text-align: center">❌ No</td>
					<td style="text-align: center">❌ No</td>
			</tr>
			<tr>
					<td style="text-align: left">Works offline</td>
					<td style="text-align: center">✅ Yes</td>
					<td style="text-align: center">✅ Yes</td>
					<td style="text-align: center">✅ Yes</td>
					<td style="text-align: center">❌ Requires server</td>
			</tr>
	</tbody>
</table>
<p>Brain0 audits what your AI wrote — useful for catching unintended changes, but it doesn&rsquo;t optimize how the agent reads code. Plus repomix works great for one-off &ldquo;understand this repo&rdquo; queries, but it&rsquo;s not built for continuous review workflows. Still, CodeGraph gives you cross-repo search power at the cost of running a server. So code-review-graph occupies its own lane: <strong>context optimization for AI agents via MCP.</strong> It&rsquo;s the tool that changes how your agent reads code, not what it reads.</p>
<p>If you&rsquo;re deep into the Claude Code ecosystem, <a href="/posts/claude-code-router-review-2026/">my earlier review of Claude Code Router</a> covers the control-plane side of the same problem — routing agents, managing costs, and setting review boundaries.</p>
<h2 id="what-i-actually-liked">What I Actually Liked</h2>
<p><strong>Zero-config install.</strong> I hate tools that make you hand-edit JSON configs. The <code>install</code> command detected my setup and did everything automatically — platform detection, MCP config, rule injection.</p>
<p><strong>Incremental updates.</strong> After the initial build, subsequent updates took under a second. Save a file, the graph updates. So no manual re-sync needed — it just works.</p>
<p><strong>Blast-radius analysis.</strong> This is the feature that sold me. When I changed a utility function, the graph traced all 14 callers, 3 test files, and 2 dependent routes. My agent read exactly those files — not my entire routes directory, not the whole project. Even a single-edit review felt precise and intentional.</p>
<p><strong>GitHub Action.</strong> The CI integration posts a single sticky PR comment with risk-scored functions, affected flows, and test gaps. It updates the same comment on every push, so there&rsquo;s no notification spam.</p>
<h2 id="where-it-falls-short">Where It Falls Short</h2>
<p>Still, it&rsquo;s not perfect, and I don&rsquo;t want to oversell it.</p>
<p><strong>Initial build time scales with repo size.</strong> On my 500-file project it took 12 seconds. Still, on a 10,000-file monorepo, expect a couple minutes. Worth knowing before you try it on a massive codebase.</p>
<p><strong>Trivial single-file changes don&rsquo;t benefit.</strong> If you&rsquo;re editing one isolated file with no dependencies, the graph overhead makes context slightly larger than a naive read. The tool&rsquo;s own docs acknowledge this — it&rsquo;s the structural metadata cost.</p>
<p><strong>MCP dependency.</strong> So if your AI coding tool doesn&rsquo;t support MCP, the graph can&rsquo;t talk to it directly. Most major tools do now — Claude Code, Codex, Cursor — but check before installing.</p>
<p><strong>Search accuracy has room to grow.</strong> Keyword search returns the right result in the top-4 for most queries, but ranking quality needs work. Flow detection for JavaScript and Go sits at about 33% recall.</p>
<h2 id="who-should-use-this">Who Should Use This</h2>
<p>Install code-review-graph if:</p>
<ul>
<li>You run 5+ AI agent review cycles a day</li>
<li>Your codebase is 200+ files across multiple languages</li>
<li>You use MCP-supporting tools (Claude Code, Codex, Cursor, Copilot, Gemini CLI)</li>
<li>Token costs or quotas are a real constraint</li>
</ul>
<p>For a deeper look at setting up repeatable agent workflows, <a href="/posts/loopy-agent-loop-library-review-2026/">my Loopy review</a> covers how to chain these reviews into automated pipelines.</p>
<p>Skip it if:</p>
<ul>
<li>Your projects are small (&lt;50 files with low interdependency)</li>
<li>Your AI agent isn&rsquo;t MCP-aware</li>
<li>You only review single-file changes</li>
</ul>
<h2 id="the-bottom-line">The Bottom Line</h2>
<p>Code-review-graph doesn&rsquo;t find bugs or suggest fixes. That&rsquo;s not its job. But it solves the problem that makes AI code review expensive: token waste. Your AI agent doesn&rsquo;t need to re-read the whole codebase for every change. Code-review-graph gives it a map.</p>
<p>In my test, that map turned 82,000 tokens into 998. On a 500-file project with 20+ daily review cycles, that shifts the economics completely — more reviews, lower cost, better results because the agent had exactly the context it needed.</p>
<p>If you&rsquo;re using AI coding agents for code review and your token consumption keeps climbing, this is the tool you&rsquo;re missing. And if you want to dig deeper into code review patterns, I&rsquo;d recommend <em>A Philosophy of Software Design</em> by John Ousterhout and <em><a href="https://www.amazon.com/dp/1835462316?tag=toolgenix-20" rel="nofollow sponsored noopener" target="_blank">Building LLM Powered Applications</a></em> by Valentina Alto — both cover the thinking behind structuring code for reviewability, whether by humans or AI. <em>(affiliate link)</em></p>
<p>But start with the tool. Install it, run the benchmark against your own project, and see what your token savings actually look like. I bet they&rsquo;re bigger than you expect.</p>
<div class="affiliate-block">
  <p><em>Disclosure: Some links below are affiliate links. If you sign up through them, I may earn a commission at no extra cost to you.</em></p>
  <ul>
    <li><a href="https://toolgenix.nxtniche.com/go/amazon/1835462316" rel="nofollow sponsored" target="_blank">Building LLM Powered Applications</a> — by Valentina Alto, covers structuring code for reviewability</li>
  </ul>
</div>
]]></content:encoded>
    </item>
  </channel>
</rss>
