CodeGraph

Indexes your codebase into a local knowledge graph to make AI coding agents faster and cheaper by replacing file exploration with efficient graph queries.

Indexes your codebase into a local knowledge graph to make AI coding agents faster and cheaper by replacing file exploration with efficient graph queries.

The gist

CodeGraph is a command-line tool by Colby McHenry that accelerates AI coding agents like Claude Code and Cursor. It solves the problem of slow and expensive codebase exploration by creating a pre-indexed, local knowledge graph of a project's symbols, call graphs, and code structure. This allows agents to query the codebase's architecture instantly instead of performing numerous token-consuming file scans, saving cost and time.

What it does

  • Indexes a codebase to create a local knowledge graph of symbols and relationships.
  • Allows AI agents to query code structure, callers, and callees with single tool calls.
  • Provides full-text search to find code by name instantly across an entire project.
  • Traces the full impact radius of a symbol to analyze potential changes.
  • Automatically syncs the knowledge graph in the background as you code, using native file-system events.

How it works

CodeGraph is a zero-config CLI tool that runs entirely on your local machine. After running codegraph init in a project, it parses the source code using tree-sitter and stores a knowledge graph in a local SQLite database. A local server then exposes this graph to configured AI agents, allowing them to query it for context instead of scanning files. The tool is open-source and respects your project's .gitignore file to exclude unwanted directories.

Best for

This tool is best for developers using AI coding agents like Claude Code or Cursor to navigate and understand large, unfamiliar codebases. It is particularly effective for answering architectural questions or analyzing the impact of changes efficiently.

Watch out for

The tool's performance relies on SQLite's WAL mode, which may not be available on network shares or certain WSL2 mount configurations, potentially causing database lock issues. Files larger than 1 MB are skipped during indexing.