Cut 92% of Claude Code Tool Calls for Large Codebases with CodeGraph
CodeGraph builds a semantic knowledge graph of a codebase so Claude Code can query the graph instead of scanning files, reducing tool calls by an average of 92% and speeding up exploration by 71% across multiple large, multi‑language projects.
Claude Code scans every file in large codebases, causing many tool calls, high token consumption, and long response times.
CodeGraph builds a semantic knowledge graph of the entire repository beforehand; Claude Code queries this graph directly, eliminating per‑file scanning.
Benchmark results
Official tests on six real open‑source repositories covering TypeScript, Python, Rust, Java, Swift, and C++ (including VS Code and the Swift compiler) used Claude Opus 4.6 (≈1 M context) with identical query sentences. Across the set, tool calls dropped by an average of 92 % and exploration speed increased by 71 %.
VS Code (4,002 TypeScript files): tool calls reduced from 52 to 3; execution time fell from 1 min 37 s to 17 s (≈82 % faster).
Swift compiler (25,874 Swift/C++ files): tool calls reduced from 37 to 6; execution time fell from 2 min 8 s to 35 s, with zero file reads.
Cross‑language Claude Code project (Python + Rust): tool calls reduced from 40 to 3; execution time fell from 1 min 8 s to 39 s, and cross‑language call chains were recognized directly.
Sample queries used in the tests:
VS Code – “communication logic between extension host and main process”.
Excalidraw – “implementation of collaborative editing and real‑time sync”.
Alamofire – “request flow from Session.request() to URLSession”.
Key capabilities
Automatic detection of function call chains, class inheritance, and module imports.
Impact analysis before code changes to avoid unintended side effects.
Support for 19 major languages (e.g., TypeScript, Python, Go, Rust, Java, C++, Swift, Dart, Svelte, Vue) and routing rules for 13 front‑end/back‑end frameworks, linking URLs to handler functions.
Local storage of the graph in an SQLite database; no data is uploaded and no extra API keys are required.
File‑watcher increments the graph on changes, requiring minimal maintenance.
Installation and usage
Run npx @colbymchenry/codegraph to install globally and configure Claude Code’s MCP service.
Restart Claude Code to load the MCP service.
In the project directory, execute codegraph init -i to initialize the graph.
After initialization, Claude Code detects the .codegraph directory and automatically uses CodeGraph for code exploration without additional prompts.
Limitations and performance tuning
Currently compatible only with Claude Code; other AI coding assistants are not supported.
The WASM build of SQLite can be 5–10× slower than the native version. Installing system C‑compilation tools and rebuilding better-sqlite3 switches to the native backend, dramatically improving indexing speed.
All testing details, environment specifications, query sentences, and result data are publicly available in the open‑source repository for independent verification.
Project repository: https://github.com/colbymchenry/codegraph
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
AI Engineering
Focused on cutting‑edge product and technology information and practical experience sharing in the AI field (large models, MLOps/LLMOps, AI application development, AI infrastructure).
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
