CodeGraph
A local-first, open-source code intelligence tool that turns any codebase into a queryable knowledge graph for AI coding agents, reducing tool calls and token usage.
At a Glance
About CodeGraph
CodeGraph is a local-first, open-source code intelligence tool created by Colby McHenry that converts any codebase into a queryable knowledge graph for AI coding agents. It runs entirely on your machine — no API keys, no external services — and exposes the graph to agents like Claude Code, Cursor, Codex, Gemini, and GitHub Copilot via an MCP server. The project is licensed under MIT and available on GitHub, where it has accumulated over 65,000 stars as of mid-2026.
What It Is
CodeGraph is a pre-built, always-fresh code knowledge graph that gives AI coding agents surgical context instead of forcing them to crawl files one by one. When an agent needs to understand a codebase, it normally uses grep, glob, and file reads — rebuilding call paths and dependencies from scratch on every query. CodeGraph replaces that loop with a single tool call: codegraph_explore returns the relevant symbols' verbatim source, the call paths between them (including dynamic-dispatch hops that grep cannot follow), and a blast-radius summary of what a change would affect. The graph is stored in a local SQLite database with FTS5 full-text search and is kept current by a native OS file watcher that debounces and incrementally syncs on every save.
Architecture: Rust Kernel and Tree-Sitter Parsing
The parsing engine is a native Rust kernel that uses tree-sitter grammars compiled directly into it. Twenty languages — TypeScript, JavaScript, Java, Python, Go, C, C++, Rust, C#, Ruby, PHP, Swift, Kotlin, Scala, Dart, R, Lua, Luau, Metal, and CUDA — parse in compiled code with one boundary crossing per file. The README states that every language shipped only after its graphs proved byte-for-byte identical to the reference engine on real repositories, from small libraries up to the Linux kernel. Files with syntax errors or platforms without a prebuilt binary fall back per-file automatically, producing the same graph shape. Beyond the 20 Rust-kernel languages, CodeGraph also supports ArkTS, VB.NET, Erlang, CFML, COBOL, Solidity, Terraform/OpenTofu, Nix, Svelte, Vue, Astro, Liquid, and Pascal/Delphi — over 34 languages total.
MCP Integration and Agent Support
CodeGraph exposes a single MCP tool — codegraph_explore — to the agents it connects to. The installer (codegraph install) auto-detects and configures Claude Code, Cursor, Codex CLI, opencode, Hermes Agent, Gemini CLI, Antigravity IDE, Kiro, and GitHub Copilot (VS Code, CLI, and JetBrains). It writes each agent's MCP server config and a marker-fenced section in the agent's instructions file so subagents and non-MCP harnesses also learn the codegraph explore CLI equivalent. Additional tools (codegraph_node, codegraph_search, codegraph_callers, codegraph_callees, codegraph_impact, codegraph_files, codegraph_status) remain functional but are unlisted by default, re-enableable via the CODEGRAPH_MCP_TOOLS environment variable.
Benchmark Results and Performance Claims
The README publishes benchmark results measured across seven real-world open-source codebases (VS Code, Excalidraw, Django, Tokio, OkHttp, Gin, Alamofire) spanning seven languages, comparing Claude Opus 4.8 answering architecture questions with and without CodeGraph. According to the vendor-published figures from a 2026-08-05 re-measurement, the with-CodeGraph arm showed 88% fewer tool calls, 53% faster wall-clock time, 62% fewer tokens processed, and 44% lower cost on average, with zero file reads on all seven repos. The README also notes a tradeoff: CodeGraph's dense verbatim payloads leave roughly 80% more retrieval context resident in the context window at session end compared to a file-reading agent, which matters in long sessions with small context windows.
Setup Path and Zero-Config Design
Getting started requires three steps: install the CLI (via a one-line shell installer or npm i -g @colbymchenry/codegraph), run codegraph install to wire up agents, and run codegraph init in each project to build the graph. After initialization, auto-sync is on by default — the watcher fires within 300ms of a save and syncs only what changed. The tool is zero-config by default: it automatically excludes node_modules, vendor, dist, build, and other dependency/build directories, honors .gitignore, and skips files over 1 MB. Custom file extension mappings and explicit include/exclude overrides are available via an optional codegraph.json at the project root.
Update: v1.5.0
The latest release is v1.5.0, published on 2026-07-21, with the repository last updated on 2026-08-08. The README notes that the benchmark harness was re-measured on 2026-08-05 against Claude Opus 4.8 on the current build, with a contamination fix that blocks the codegraph CLI in both benchmark arms. Releases published before July 2026 predate the signed build attestation pipeline and do not carry npm provenance or GitHub SLSA attestations. The hosted CodeGraph platform — described in the README as "coming" — is accepting waitlist signups at getcodegraph.com for early beta access.
Community Discussions
Be the first to start a conversation about CodeGraph
Share your experience with CodeGraph, ask questions, or help others learn from your insights.
Pricing
Open Source
Fully free and open-source under the MIT license. Self-host via npm or shell installer.
- Full code knowledge graph for any codebase
- MCP server for Claude Code, Cursor, Codex, Gemini, GitHub Copilot, and more
- 34+ language support
- 100% local — no data leaves your machine
- Auto-sync via native OS file watcher
Capabilities
Key Features
- Local-first code knowledge graph with no external services or API keys
- Native Rust kernel for fast, incremental parsing across 20+ languages
- MCP server exposing codegraph_explore to AI coding agents
- Tree-sitter AST-based symbol and edge extraction
- Full-text search powered by FTS5 SQLite
- Impact analysis: trace callers, callees, and blast radius of any symbol
- Auto-sync via native OS file watcher (FSEvents/inotify/ReadDirectoryChangesW)
- Framework-aware route detection across 17 web frameworks
- Mixed iOS/React Native/Expo cross-language bridge resolution
- 34+ supported languages including TypeScript, Python, Go, Rust, Java, Swift, Kotlin, and more
- Zero-config setup with automatic exclusion of node_modules, dist, and gitignored paths
- Programmatic library API for embedding in Node.js/Electron apps
- codegraph affected command for tracing test impact from changed files
- Signed and attested npm releases with SLSA v1.0 Build Level 2
- Container-aware worker pool and cache sizing based on real core counts and available RAM
- Per-file staleness banner during debounce window to prevent stale agent answers
- codegraph upgrade command for in-place CLI updates
