Burning Too Many Tokens Using Claude Code on Large Codebases? This Open-Source Tool Cuts Tool Calls by 92%

Developers using Claude Code on large projects often run into the same issue: once the codebase reaches a certain size, every AI-driven exploration of the structure takes ages, scanning files endlessly, piling up tool calls, and guzzling tokens. You get little work done, but your costs spike first.

An open-source tool called CodeGraph takes a different approach: it builds a semantic knowledge graph for the codebase upfront. Claude Code queries the graph directly, eliminating the need to scan files one by one.

Image

The team behind it ran comparative tests on six real-world open-source codebases, covering multi-language projects like TypeScript, Python, Rust, Java, Swift, and C++. This included massive projects like VS Code and the Swift compiler. The result is an average 92% reduction in tool calls and a 71% boost in exploration speed.

The improvements are even more striking when you look at individual projects:

  • VS Code (4,002 TypeScript files): Without CodeGraph, it took 52 tool calls and 1 minute 37 seconds to trace origins. With it, just 3 calls and 17 seconds—an 82% speed increase.
  • Swift Compiler (25,874 Swift/C++ files): Without the tool, it used 37 calls and took 2 minutes 8 seconds to answer a question. With it, it used only 6 calls, taking just 35 seconds, with zero file reads the entire time.
  • Claude Code's own project (Python + Rust): A cross-language query took 40 calls and 1 minute 8 seconds without the graph. With it, the task finished in 3 calls and 39 seconds, and it could directly identify the cross-language call chain.

All tests used Claude Opus 4.6 (1M context window) and the same queries, so the results are reproducible. For example, the test question for VS Code was about "the communication logic between the extension host and the main process," for Excalidraw it was "the implementation principle of collaborative editing and real-time sync," and for Alamofire it was "the request flow path from Session.request() to the URLSession layer."

CodeGraph can automatically identify function call chains, class inheritance relationships, and module references. Before making a change, you can also run an impact analysis to avoid the classic "fix one thing, break everywhere" scenario.

It currently supports 19 mainstream programming languages, covering TypeScript, Python, Go, Rust, Java, C++, Swift, Dart, Svelte, Vue, and more. It also recognizes routing rules for 13 front-end and back-end frameworks, directly linking URL paths to their corresponding handler functions.

All data is stored in a local SQLite database. Nothing is uploaded to any external service, and no additional API keys are needed. Once installed, it automatically watches for file modifications and incrementally syncs the graph when you save, requiring essentially no extra maintenance.

Image

Installation and setup take just three steps:

  1. Run the install command:
npx @colbymchenry/codegraph

The interactive installer automatically completes the global installation, configures the MCP service for Claude Code, and sets up the necessary permissions.

  1. Restart Claude Code to load the MCP service.
  2. Navigate to your target project directory and run the initialization command:
codegraph init -i

After initialization, whenever Claude Code detects the .codegraph directory within a project, it will automatically use CodeGraph's tools for code exploration—no need to give the AI extra instructions.

Some users have asked if the tool only works with Claude Code. Currently, the official team has only built the adapter for Claude Code and hasn't yet made it compatible with other AI coding tools. Others have wondered about the reliability of the evaluation data, but all testing details, environments, queries, and resulting data are publicly available in the open-source repository for independent reproduction.

There's also user feedback about slow indexing speeds, and the official team has offered a solution: if you're using the WASM version of SQLite, performance can be 5 to 10 times slower than the native version. Installing a C compilation toolchain for your operating system and rebuilding better-sqlite3 will switch it to the native backend, massively boosting indexing speed.

The project's open-source repo is here: https://github.com/colbymchenry/codegraph. It's a great fit for developers who frequently use Claude Code on large codebases and perform refactoring, saving both time and tokens.

Related Articles

分享網址
AINews·AI 新聞聚合平台
© 2026 AINews. All rights reserved.