Pre-Indexed Code Knowledge Graphs Slash Agent Tool Calls by 94 Percent
CodeGraph compiles your repository's Abstract Syntax Tree into a structured graph, letting coding agents resolve project structures instantly instead of running slow file search tools.
Why it matters
You can massively speed up your Claude Code execution times and slash your API bill by providing your agents with instant structural maps of your code.
TL;DR
- 01Generate a local CodeGraph index for your repository before starting your CLI coding agent
- 02Settle complex code refactoring loops faster by resolving dependencies in a single query
- 03Set up an automatic git hook to rebuild the code graph on major commits
Architecture & Performance
CodeGraph replaces manual grep, glob, and read discovery with a pre-indexed graph. In tests across 7 codebases, it delivered ~16% lower costs, ~58% fewer tool calls, and was ~22% faster. It achieves this by providing agents structural relationships (call graphs, imports) via codegraph_explore instead of fanning out sub-agents to scan files.
Installation & Sync
Installation is platform-agnostic, requiring no Node.js: curl -fsSL https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.sh | sh
It features a native file watcher that keeps the SQLite-based index current. During sync debouncing (default 2000ms), the tool provides a ⚠️ banner if a file is stale, ensuring the agent remains accurate.
Agent Compatibility
CodeGraph wires its MCP server into agents like Cursor, Gemini CLI, and Claude Code. Installing the CLI alone does not connect it; you must use codegraph init or codegraph init -i to build the graph and configure the agent's MCP setup.