codegraph is a local-first MCP server that builds a SQLite-backed knowledge graph of your codebase using Tree-sitter parsing, then exposes nine query tools (search, context, callers, callees, impact, explore, node, files, status) that any MCP-speaking coding agent can call. Because the index is shared across agents, switching from Claude Code to Codex to Cursor doesn't re-trigger codebase exploration — the graph is already there. Native OS file watchers (FSEvents/inotify/ReadDirectoryChangesW) keep the index current with 2-second debouncing. The Swift compiler (25,874 files, 272,898 nodes) indexes in under 4 minutes; agents answer complex questions with 6 explore calls and zero file reads in 35 seconds. 100% local — no embeddings sent to a cloud service, no telemetry.
codegraph is a pre-indexed code knowledge graph that solves the single biggest cost driver in production coding-agent setups: tokens spent re-discovering codebase structure on every task. Instead of letting Claude Code or Codex grep and read 5–15 files just to understand what calls what, codegraph builds a persistent SQLite-backed graph during a one-time indexing pass, then exposes it as an MCP server that any modern coding agent can query.
The benchmarks aren’t subtle: a 59% reduction in token consumption, 70% fewer tool calls, 49% faster responses across seven real-world codebase tests. On the Swift Compiler (25,874 files, 272,898 nodes), agents answer complex questions with 6 explore calls and zero file reads in 35 seconds — a workload that routinely takes 90–180 seconds and 200K+ tokens through vanilla agent tooling.
The architecture is what makes codegraph different from one-off code-RAG attempts. Tree-sitter parses your source into ASTs; language-specific queries extract typed nodes (functions, classes, files) and edges (calls, imports, inheritance); a post-extraction resolution pass links function calls to definitions, imports to their sources, and class hierarchies to their parents. The result lives in .codegraph/codegraph.db with FTS5 full-text search.
The MCP surface is the multiplier. Nine tools — codegraph_search, codegraph_context, codegraph_callers, codegraph_callees, codegraph_impact, codegraph_explore, codegraph_node, codegraph_files, codegraph_status — give agents structured queries instead of ad-hoc grep. Because the surface is standard MCP, the same graph database works for Claude Code, Codex CLI, Cursor, OpenCode, and Hermes Agent. Switch agents, keep the graph; no re-indexing.
codegraph belongs in production setups where codebase size pushes vanilla agent tooling into expensive exploration loops — typically 5,000+ files, or any monorepo with established naming conventions and cross-package call graphs. It’s a strong fit for teams running multi-agent workflows (Claude Code for review + Codex for implementation, for example) where re-indexing per agent would be prohibitive. The 100% local architecture makes it the default choice for codebases under NDA, regulatory constraint, or simply where sending embeddings to a third-party cloud service isn’t acceptable. Install via npx @colbymchenry/codegraph and codegraph init -i in your project root.
Persistent memory layer for AI coding agents — benchmark-backed (95.2% on LongMemEval-S), 92% fewer tokens per session vs full-context pasting, zero manual memory.add() calls.
Open-source AI pair programming tool that works in your terminal to edit code across your entire repository.
AWS's AI-powered coding assistant that helps developers build, deploy, and optimize applications on AWS with code generation and transformation.