Illustration of what codegraph does: A local code knowledge graph that lets AI coding agents look up code in one call

colbymchenry /

codegraph

A local code knowledge graph that lets AI coding agents look up code in one call

AI coding agents usually learn a codebase the slow way. They grep, glob and read files one at a time, then piece together who calls what. That takes many tool calls and uses a lot of tokens before the real work starts.

CodeGraph indexes your project ahead of time into a knowledge graph of symbols, call edges and dependencies. The graph lives in a local .codegraph/ folder and is served to the agent as an MCP server. The agent asks one question and gets back the relevant source, the call paths between symbols, and what a change could affect. A file watcher keeps the graph current as files change.

The README reports its own benchmarks on seven repos: 44% lower cost and 62% fewer tokens on average, with the biggest gains on questions that needed many tool calls. These are the author's numbers, so check them on your own code. Everything runs locally.

What it does

  • Pre-built code graph

    Indexes every symbol, call edge and dependency in the project, so the agent doesn't have to crawl files with grep and Read.

  • Works with many agents

    codegraph install detects and configures Claude Code, Cursor, Codex CLI, opencode, Hermes Agent, Gemini CLI, Antigravity, Kiro and GitHub Copilot by wiring in an MCP server.

  • Auto-sync on changes

    It watches the project and updates the graph when files are added, edited or deleted, so there is nothing to re-run.

  • Broad language support

    It extracts structure and resolves cross-file links for over 30 languages, including TypeScript, Python, Go, Rust, Java, C#, Swift and Kotlin.

  • Local, with a clean uninstall

    The index stays in your project's .codegraph/ folder. codegraph uninstall removes the agent configs and the CLI, and codegraph uninit removes a project's index.

What you could build

  • Ask your coding agent who calls a function and get the answer from the graph instead of a long file search.
  • Check what a planned change could break before editing, using the dependency and call paths.
  • Cut token use and tool calls when working with an agent on a large codebase.
  • Give several agents, such as Claude Code and Cursor, the same code index on one project.
  • Explore an unfamiliar repo by asking an agent to trace how its parts connect.

Get started

Install the CLI (the README also gives a Windows PowerShell command and an npm option), then open a new terminal and run codegraph install to connect your agents. Then go into each project and run codegraph init to build its graph.

curl -fsSL https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.sh | sh
codegraph install
codegraph init

Commands are copied from the project's README. Read it on GitHub for the full setup.

More in Token & cost savings

    ↑↓ to move, Enter to open, Esc to close