SkillAgentSearch skills...

Codegraph

Pre-indexed code knowledge graph for Claude Code — fewer tokens, fewer tool calls, 100% local

Install / Use

/learn @colbymchenry/Codegraph
About this skill

Quality Score

0/100

Supported Platforms

Claude Code
Claude Desktop

README

<div align="center">

🔮 CodeGraph

Supercharge Claude Code with Semantic Code Intelligence

30% fewer tokens • 25% fewer tool calls • 100% local

npm version License: MIT Node.js

Windows macOS Linux

<br />

Get Started

npx @colbymchenry/codegraph

<sub>Interactive installer configures Claude Code automatically</sub>

</div>

🚀 Why CodeGraph?

When you ask Claude Code to work on a complex task, it spawns Explore agents that scan your codebase using grep, glob, and file reads. These agents consume tokens with every tool call.

CodeGraph gives those agents a semantic knowledge graph — pre-indexed symbol relationships, call graphs, and code structure. Instead of scanning files, agents query the graph instantly.

📊 Benchmark Results

We ran the same complex task 3 times with and without CodeGraph:

| Metric | Without CodeGraph | With CodeGraph | Improvement | |--------|-------------------|----------------|-------------| | Explore tokens | 157.8k | 111.7k | 29% fewer | | Per-agent tokens | 74.0k | 46.4k | 37% fewer | | Tool calls | 60 | 45 | 25% fewer | | Main context usage | 28.7% | 24.0% | 4.7% less |

<details> <summary><strong>Full benchmark data</strong></summary>

With CodeGraph: | Test | Agents | Tool Uses | Explore Tokens | Plan Tokens | Time | |------|--------|-----------|----------------|-------------|------| | 1 | 3 | 54 | 149.7k | 76.4k | 1m 43s | | 2 | 2 | 41 | 102.1k | 74.8k | 1m 29s | | 3 | 2 | 40 | 83.3k | 63.3k | 1m 25s | | Avg | 2.3 | 45 | 111.7k | 71.5k | 1m 32s |

Without CodeGraph: | Test | Agents | Tool Uses | Explore Tokens | Plan Tokens | Time | |------|--------|-----------|----------------|-------------|------| | 1 | 3 | 74 | 177.3k | 80.5k | 1m 54s | | 2 | 2 | 55 | 149.3k | 64.0k | 1m 27s | | 3 | 2 | 51 | 146.7k | 62.3k | 1m 17s | | Avg | 2.3 | 60 | 157.8k | 68.9k | 1m 33s |

</details>

🔄 How It Works

┌─────────────────────────────────────────────────────────────────┐
│                        Claude Code                               │
│                                                                  │
│  "Implement user authentication"                                 │
│           │                                                      │
│           ▼                                                      │
│  ┌─────────────────┐      ┌─────────────────┐                   │
│  │  Explore Agent  │ ──── │  Explore Agent  │                   │
│  └────────┬────────┘      └────────┬────────┘                   │
│           │                        │                             │
└───────────┼────────────────────────┼─────────────────────────────┘
            │                        │
            ▼                        ▼
┌───────────────────────────────────────────────────────────────────┐
│                     CodeGraph MCP Server                          │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐               │
│  │   Search    │  │   Callers   │  │   Context   │               │
│  │  "auth"     │  │  "login()"  │  │  for task   │               │
│  └──────┬──────┘  └──────┬──────┘  └──────┬──────┘               │
│         │                │                │                       │
│         └────────────────┼────────────────┘                       │
│                          ▼                                        │
│              ┌───────────────────────┐                            │
│              │   SQLite Graph DB     │                            │
│              │   • 387 symbols       │                            │
│              │   • 1,204 edges       │                            │
│              │   • Instant lookups   │                            │
│              └───────────────────────┘                            │
└───────────────────────────────────────────────────────────────────┘

Without CodeGraph: Explore agents use grep, glob, and Read to scan files → many API calls, high token usage

With CodeGraph: Explore agents query the graph via MCP tools → instant results, local processing, fewer tokens


✨ Key Features

<table> <tr> <td width="33%" valign="top">

🧠 Smart Context Building

One tool call returns everything Claude needs—entry points, related symbols, and code snippets. No more expensive exploration agents.

</td> <td width="33%" valign="top">

🔍 Semantic Search

Find code by meaning, not just text. Search for "authentication" and find login, validateToken, AuthService—even with different naming conventions.

</td> <td width="33%" valign="top">

📈 Impact Analysis

Know exactly what breaks before you change it. Trace callers, callees, and the full impact radius of any symbol.

</td> </tr> <tr> <td width="33%" valign="top">

🌍 19+ Languages

TypeScript, JavaScript, Python, Go, Rust, Java, C#, PHP, Ruby, C, C++, Swift, Kotlin, Dart, Svelte, Liquid, Pascal/Delphi—all with the same API.

</td> <td width="33%" valign="top">

🔒 100% Local

No data leaves your machine. No API keys. No external services. Everything runs on your local SQLite database.

</td> <td width="33%" valign="top">

⚡ Always Fresh

Claude Code hooks automatically sync the index as you work. Your code intelligence is always up to date.

</td> </tr> </table>

🎯 Quick Start

1. Run the Installer

npx @colbymchenry/codegraph

The interactive installer will:

  • Configure the MCP server in ~/.claude.json
  • Set up auto-allow permissions for CodeGraph tools
  • Add global instructions to ~/.claude/CLAUDE.md (teaches Claude how to use CodeGraph)
  • Install Claude Code hooks for automatic index syncing
  • Optionally initialize your current project

2. Restart Claude Code

Restart Claude Code for the MCP server to load.

3. Initialize Projects

For each project you want to use CodeGraph with:

cd your-project
codegraph init -i

That's it! Claude Code will now use CodeGraph tools automatically when a .codegraph/ directory exists.

<details> <summary><strong>Manual Setup (Alternative)</strong></summary>

If you prefer manual configuration:

Install globally:

npm install -g @colbymchenry/codegraph

Add to ~/.claude.json:

{
  "mcpServers": {
    "codegraph": {
      "type": "stdio",
      "command": "codegraph",
      "args": ["serve", "--mcp"]
    }
  }
}

Add to ~/.claude/settings.json (optional, for auto-allow):

{
  "permissions": {
    "allow": [
      "mcp__codegraph__codegraph_search",
      "mcp__codegraph__codegraph_context",
      "mcp__codegraph__codegraph_callers",
      "mcp__codegraph__codegraph_callees",
      "mcp__codegraph__codegraph_impact",
      "mcp__codegraph__codegraph_node",
      "mcp__codegraph__codegraph_status",
      "mcp__codegraph__codegraph_files"
    ]
  }
}
</details> <details> <summary><strong>Global Instructions Reference</strong></summary>

The installer automatically adds these instructions to ~/.claude/CLAUDE.md. This is provided here for reference:

## CodeGraph

CodeGraph builds a semantic knowledge graph of codebases for faster, smarter code exploration.

### If `.codegraph/` exists in the project

**Use codegraph tools for faster exploration.** These tools provide instant lookups via the code graph instead of scanning files:

| Tool | Use For |
|------|---------|
| `codegraph_search` | Find symbols by name (functions, classes, types) |
| `codegraph_context` | Get relevant code context for a task |
| `codegraph_callers` | Find what calls a function |
| `codegraph_callees` | Find what a function calls |
| `codegraph_impact` | See what's affected by changing a symbol |
| `codegraph_node` | Get details + source code for a symbol |
| `codegraph_files` | Get project file structure from the index |

**When spawning Explore agents in a codegraph-enabled project:**

Tell the Explore agent to use codegraph tools for faster exploration.

**For quick lookups in the main session:**
- Use `codegraph_search` instead of grep for finding symbols
- Use `codegraph_callers`/`codegraph_callees` to trace code flow
- Use `codegraph_impact` before making changes to see what's affected

### If `.codegraph/` does NOT exist

At the start of a session, ask the user if they'd like to initialize CodeGraph:

"I notice this project doesn't have CodeGraph initialized. Would you like me to run `codegraph init -i` to build a code knowledge graph?"
</details>

📋 Requirements

  • Node.js >= 18.0.0

💻 CLI Usage

codegraph                   # Run interactive installer
codegraph install           # Run interactive installer (explicit)
codegraph init [path]       # Initialize in a project
codegraph uninit [path]     # Remove CodeGraph from a project
codegraph index [path]      # Full index
codegraph sync [path]       # Incremental update
codegraph status [path]     # Show statistics
codegraph query <search>    # Search symbols
codegraph files [path]      # Show project file structure
codegraph context <task>    # Build context for AI
codegraph affected [files]  # Find test files affected by changes
codegraph serve --mcp       # Start MCP server

📖 CLI Commands

codegraph / codegraph install

Run the interactive installer for Claude Code integration. Configures MCP server and permissions automatically.

codegraph                         # Run installer (when no a
View on GitHub
GitHub Stars362
CategoryDevelopment
Updated1h ago
Forks55

Languages

TypeScript

Security Score

95/100

Audited on Apr 1, 2026

No findings