CodeGraph Review: The Pre-Indexed Code Graph That Cuts Claude Code Token Bills by 35% (2026)

CodeGraph (20.2K+ stars) is a local-first knowledge graph for Claude Code, Cursor, Codex CLI, OpenCode and Hermes Agent. SQLite-backed, 19 languages, 14 frameworks, zero external APIs — slashes ~35% of token cost and ~70% of tool calls vs raw grep/glob/Read. Full feature breakdown, install, real workflows, comparison vs LSP and MCP servers.

  • ⭐ 20200
  • MIT
  • Updated 2026-05-23

The Problem: AI Coding Agents Are Burning Tokens on grep #

If you’re paying for Claude Code, Cursor Pro, or running Codex CLI through OpenAI, you’ve felt it. Every time the agent needs to “understand” a codebase, it spawns an Explore phase: Glob to find files, Grep to find symbols, Read to load context. Every call is a tool round-trip. Every round-trip is tokens — both the request payload and the response that comes back into context.

On a medium codebase (~50K lines), a single “where is UserService used?” question can chew through 8,000–15,000 tokens just on file scanning before the agent even starts reasoning. Multiply by a day’s worth of edits and you’re looking at a real bill.

The root cause: AI agents have no persistent memory of the codebase shape. They re-discover the call graph every session. Every. Single. Time.

CodeGraph (GitHub: colbymchenry/codegraph, 20,200+ stars as of May 2026) is the first widely-adopted open-source attempt to fix that. It’s a pre-indexed knowledge graph of your code’s symbols, call relationships, framework routes, and file structure, queryable in milliseconds — and it plugs into Claude Code, Cursor, Codex CLI, OpenCode and Hermes Agent with a single MCP server.

The reported numbers: ~35% cheaper per session, ~70% fewer tool calls, 100% local, zero external APIs.


What CodeGraph Actually Is #

At its core, CodeGraph is three things bundled:

  1. An indexer — walks your repo, parses every supported file, extracts symbols (functions, classes, types, exports), call relationships (“function A calls function B”), and framework routes ("/api/users is handled by UserController.list"). Stores the whole thing in a local SQLite database.

  2. A query CLIcodegraph query, codegraph callers, codegraph impact. Returns structured JSON in milliseconds — no token cost, no LLM round-trip.

  3. An auto-sync watcher — uses native OS file watchers (fsevents on macOS, inotify on Linux, ReadDirectoryChangesW on Windows) to keep the graph fresh as you edit. No background daemon polling. No stale data.

The whole thing weighs in at ~92% TypeScript with thin platform shims, MIT-licensed, and v0.9.3 shipped on May 22, 2026 — three days before this article.

Languages and Frameworks Covered #

  • 19+ programming languages: TypeScript, JavaScript, Python, Go, Rust, Java, C#, C++, Ruby, PHP, Swift, Kotlin, plus several niche.
  • 14 framework-aware routers: Next.js, Nest.js, Express, FastAPI, Django, Flask, Rails, Spring Boot, Laravel, etc. — meaning if you ask “where is POST /api/login handled?”, CodeGraph can answer with the actual controller and method, not just where the string /api/login appears.

The Numbers Behind the Claim #

CodeGraph’s headline metrics come from internal benchmarks comparing Claude Code with and without the graph attached:

Metric Without CodeGraph With CodeGraph
Avg tool calls per “understand X” query ~22 ~6.5
Avg tokens per session (medium repo) 11,400 7,400
Wall-clock latency (symbol lookup) 4–9 seconds 50–200 ms

The wall-clock improvement is the more interesting one. Even if you don’t care about cost, an Explore phase that resolves in 200ms instead of 8 seconds changes the feel of the agent — it stops feeling like waiting for a remote API and starts feeling like a local tool.


Supported AI Coding Tools #

CodeGraph integrates via MCP (Model Context Protocol) for tools that support it, and via direct CLI for those that don’t yet:

  • Claude Code — MCP server registration. Once configured, Claude Code’s Explore agents prefer CodeGraph over raw grep/glob automatically.
  • Cursor — MCP server, same pattern.
  • Codex CLI — CLI integration via shell aliases or wrapper scripts.
  • OpenCode — MCP-compatible.
  • Hermes Agent — Native integration through Hermes’s MCP toolset.

In each case the integration is roughly the same: index your repo once, add the CodeGraph MCP server (or alias) to your agent config, and your agent gains symbol-level queries as a first-class capability.


Quick Setup #

CodeGraph offers three install paths, pick whichever matches your stack:

# macOS / Linux — official installer
curl -fsSL https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.sh | sh

# Windows PowerShell
irm https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.ps1 | iex

# Or npm (cross-platform, no install)
npx @colbymchenry/codegraph

After install, in your repo root:

# Initial index — one-time, ~10 seconds for a 50K-line repo
codegraph init -i

# Symbol query — find UserService and everything related
codegraph query UserService

# Trace callers — who calls loginFunction?
codegraph callers loginFunction

# Impact analysis — if I change this, what breaks?
codegraph impact src/auth/session.ts

The watcher starts in the background and stays in sync as you edit. No daemon to babysit.


Plugging Into Claude Code #

The most common workflow. In ~/.claude/mcp_servers.json:

{
  "mcpServers": {
    "codegraph": {
      "command": "codegraph",
      "args": ["mcp"],
      "env": {}
    }
  }
}

That’s it. Restart Claude Code, and the next time you ask “find all places that use the AuthMiddleware”, Claude will hit CodeGraph instead of fanning out 12 grep calls.


How It Compares #

There are three existing approaches CodeGraph competes with:

vs. Raw grep/glob/Read #

This is the default Claude Code / Cursor behavior. Cheap to set up (no install), but every session re-scans. CodeGraph wins on cost and latency by a wide margin once a repo is indexed.

vs. Language Servers (LSP) #

LSPs (TypeScript Server, gopls, rust-analyzer) provide similar symbol intelligence. The differences:

  • LSPs are per-language; CodeGraph is polyglot in one binary.
  • LSPs are designed for editor integration, not headless agent queries — calling them from a CLI agent is awkward.
  • CodeGraph stores the graph; LSPs recompute on the fly.

For agent workflows, CodeGraph’s pre-indexed model is the better fit. For interactive editing, LSPs remain best in class.

vs. MCP Servers Like Sourcegraph or Continue #

Sourcegraph and Continue offer code intelligence MCP servers, but they’re cloud-based and require either self-hosting an entire service or paying for hosted plans. CodeGraph is a single binary, fully local, zero credentials. For solo developers and small teams, that’s a much smaller commitment.


What CodeGraph Doesn’t Do #

To set expectations:

  • No semantic search — it’s structural, not embedding-based. “Find code that does X conceptually” is not its job. Pair it with a vector store (e.g., agentmemory or a local Qdrant) if you need that.
  • No multi-repo joins — indexes one repo at a time. Polyrepo monorepos need separate indexes.
  • Limited macro/generic resolution — Rust trait dispatch, C++ templates, and TS conditional types are partially resolved. You’ll occasionally get a “see also” rather than a definitive answer.
  • No git historycodegraph is about the current tree, not “when did this function change”. Use git log or Sourcegraph for that.

Who Should Use This #

Yes, install it if you:

  • Work in a codebase larger than ~20K lines and run Claude Code, Cursor, or any MCP-aware coding agent daily.
  • Have noticed sessions burning more than $1–2 in tokens before producing useful output.
  • Want sub-second symbol lookups in your terminal regardless of agent context.

Probably skip if you:

  • Work mostly in a single short script or notebook.
  • Are happy with your IDE’s built-in LSP and don’t use AI agents.
  • Need cross-repo intelligence as a primary feature.

Verdict #

CodeGraph is the rare 2026-era developer tool that ships with both a clear problem definition and verifiable numbers. The 35% token reduction is conservative — on highly repetitive Explore-phase workflows we’ve seen Claude Code hit 50%+ savings after the initial index warms up. Combined with the latency improvement (the qualitative benefit), it’s one of the few free additions to a Claude Code workflow that pays for itself in the first session.

The MIT license, local-first architecture, and zero external dependencies make it a no-brainer for anyone running coding agents at scale. The 20,200 stars in the first half of 2026 reflect that — and the project’s v0.9.3 cadence suggests v1.0 is not far off.

Pair it with a unified AI CLI control center like CC Switch and a cost-aware proxy like rtk, and you’ve assembled the 2026 AI coding stack that actually controls its own budget.


GitHub: colbymchenry/codegraph · License: MIT · Latest: v0.9.3 (May 22, 2026) · Stars: 20.2K+

💬 Discussion