R134 · Knowledge for agents › Code knowledge graphs for agents

CodeGraph: a local code graph agents query over MCP, and what its benchmark does and doesn't show

Read the original

code-knowledge-graphmcpcoding-agentsbenchmarkscontext-economics

Source: github.com/colbymchenry/codegraph (MIT; benchmark re-measured 2026-08-05); highlighted by Mayank A. on LinkedIn (2026-11-17).

What it is

CodeGraph builds a persistent knowledge graph of a repository: symbols, call edges, imports, inheritance and dependencies, parsed by a native Rust kernel with tree-sitter, and stored in a local SQLite database with FTS5 full-text search. Coding agents (Claude Code, Codex, Cursor, Copilot, Gemini CLI and about twenty others) query it over MCP. Instead of grep, glob and file reads, one codegraph_explore call returns entry points, related symbols, call paths and source snippets. It is fully local: no LLM calls to index, no API keys, no external services.

Other features: impact analysis (callers, callees, blast radius of a change), framework-aware routes for more than 20 web frameworks (URL patterns linked to handlers), cross-language bridging for Swift/Objective-C, React Native and Expo, and navigation edges for client-side routers.

Freshness design

Stale indexes are the classic failure of code-search tools. CodeGraph uses three layers:

  1. A native file watcher with a debounced re-sync (2 s by default) on every create, modify or delete.

  2. A per-file staleness banner. During the debounce window, any tool response that references a still-pending file is prefixed with a warning telling the agent to read the file directly.

  3. Connect-time catch-up. When the MCP server reconnects, it reconciles size, mtime and content hash against the working tree before answering, so edits from git pulls or other editors aren't missed.

Incremental sync takes well under a second on a single-file save. Reported fresh indexes: the 27k-file Swift compiler repo in about 100 seconds on a workstation; the Linux kernel (70k files, 2M symbols) in under 12 minutes on a 2-core, 6 GB VPS.

The benchmark

Seven open-source repos in seven languages (VS Code, Excalidraw, Django, Tokio, OkHttp, Gin, Alamofire), one architecture question each, Claude Opus 4.8 headless, median of 4 runs per arm, with and without the CodeGraph MCP server. Built-in read, grep and bash tools are available in both arms.

How to read it

Tradeoffs

Review checklist for adopting a code graph

Connections

See R134 on the knowledge map

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.