CodeGraph: Supercharge AI Coding Agents with Semantic Code Intelligence

CodeGraph: Supercharge AI Coding Agents with Semantic Code Intelligence

Summary

CodeGraph is a powerful, pre-indexed code knowledge graph designed to enhance AI coding agents like Claude Code, Cursor, and Codex. It significantly reduces token usage and tool calls, offering a faster and more cost-effective way for agents to understand codebases. This 100% local solution provides semantic code intelligence, improving agent efficiency and accuracy.

Repository Info

Updated on May 25, 2026
View on GitHub

Introduction

CodeGraph is a powerful, pre-indexed code knowledge graph designed to supercharge AI coding agents such as Claude Code, Cursor, Codex, OpenCode, and Hermes Agent. By providing semantic code intelligence, CodeGraph allows these agents to understand codebases more efficiently, leading to significantly fewer tokens consumed and fewer tool calls. This 100% local solution processes symbol relationships, call graphs, and code structure, enabling agents to query an instant knowledge graph rather than scanning files.

Installation

Getting started with CodeGraph is straightforward, with no Node.js required for the bundled runtime.

For macOS / Linux:

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

For Windows (PowerShell):

irm https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.ps1 | iex

If you already have Node.js, you can use npm:

npx @colbymchenry/codegraph        # zero-install
# or
npm i -g @colbymchenry/codegraph

After installation, initialize your project:

cd your-project
codegraph init -i

This command builds the per-project knowledge graph index and configures any project-local agent surfaces.

Examples

CodeGraph provides a rich command-line interface for interacting with your codebase's knowledge graph.

Initialize a project:

codegraph init -i

Search for symbols by name:

codegraph query UserService --kind class --json

Build context for AI agents based on a task:

codegraph context "fix login bug" --format markdown --max-nodes 20

Find test files affected by changes:

git diff --name-only | codegraph affected --stdin --quiet

Why Use CodeGraph

CodeGraph dramatically improves the efficiency and cost-effectiveness of AI coding agents. When an agent like Claude Code explores a codebase, it typically spawns "Explore agents" that scan files, consuming tokens with every tool call. CodeGraph replaces this with a pre-indexed knowledge graph, allowing agents to query instantly.

Key Benefits from Benchmarks:
Across 7 real-world open-source codebases, CodeGraph delivered an average of:

  • 35% cheaper
  • 57% fewer tokens
  • 46% faster
  • 71% fewer tool calls

Key Features:

  • Smart Context Building: Returns entry points, related symbols, and code snippets in one tool call, eliminating expensive exploration.
  • Full-Text Search: Instantly find code by name across your entire codebase.
  • Impact Analysis: Trace callers, callees, and the full impact radius of any symbol before making changes.
  • Always Fresh: Uses native OS file events for debounced auto-sync, keeping the graph current as you code with zero configuration.
  • 19+ Languages: Supports a wide array of languages including TypeScript, Python, Go, Rust, Java, C#, and many more.
  • Framework-aware Routes: Recognizes web-framework routing files and links URL patterns to their handlers across 14 frameworks.
  • 100% Local: No data leaves your machine, no API keys, no external services, relying solely on a local SQLite database.

Links