MCPcopy
hub / github.com/colbymchenry/codegraph

github.com/colbymchenry/codegraph @v1.2.0 sqlite

repository ↗ · DeepWiki ↗ · release v1.2.0 ↗
2,403 symbols 8,841 edges 301 files 925 documented · 38%
README

CodeGraph

🎉 1.0 Released!

Already installed? Run codegraph upgrade

Follow @getcodegraph on X for updates.

Supercharge Claude Code, Cursor, Codex, OpenCode, Hermes Agent, Gemini, Antigravity, and Kiro with Semantic Code Intelligence

Surgical context · fewer tool calls · faster answers · 100% local

Documentation & Website →

npm version License: MIT Self-contained

Windows macOS Linux

Claude Code Cursor Codex opencode Hermes Agent Gemini Antigravity Kiro

The CodeGraph platform is coming — for every PR, know exactly what to test, what could break, which flows are affected, and whether business logic is compromised.

Join the waitlist for early beta access

Get early beta access to the hosted product · getcodegraph.com

Get Started

1. Install the CLI

No Node.js required — one command grabs the right build for your OS:

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

# Windows (PowerShell)
irm https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.ps1 | iex

Already have Node? Use npm instead (works on any version)

npm i -g @colbymchenry/codegraph

CodeGraph bundles its own runtime — nothing to compile, no native build, works the same everywhere. The installer puts codegraph on your PATH but doesn't change your current shell — open a new terminal before the next step so the command resolves.

Upgrade any time with codegraph upgrade — it detects how you installed (bundle, npm, or npx) and updates in place. Add --check to see if an update is available, or codegraph upgrade <version> to pin one.

2. Wire up your agent(s)

In a new terminal, run the installer to connect CodeGraph to the agents you use:

codegraph install

Detects and auto-configures Claude Code, Cursor, Codex CLI, opencode, Hermes Agent, Gemini CLI, Antigravity IDE, and Kiro — wiring the CodeGraph MCP server into each. This is the step that connects CodeGraph to your agent; installing the CLI in step 1 does not do it on its own. It only wires up your agent — it does not index any code; building each project's graph is the separate codegraph init in step 3. (Shortcut: npx @colbymchenry/codegraph downloads and runs this in one go.)

3. Initialize each project

cd your-project
codegraph init

codegraph init creates the local .codegraph/ directory and builds the full graph in the same step — one command, done.

1_C_VYnhpys0UHrOuOgpgoyw

4. No more syncing!

Auto-sync is enabled by default. CodeGraph watches the project and updates the graph on every file change — while your agent edits code, or you add, modify, or delete files. The index is never stale, and there is nothing to re-run.

Uninstall

Changed your mind? One command removes CodeGraph from every agent it configured:

codegraph uninstall

Reverses the installer — strips CodeGraph's MCP server config, instructions, and permissions from each configured agent. Your project indexes (.codegraph/) are left untouched; remove those per-project with codegraph uninit. Use --target to remove from specific agents, or --yes to run non-interactively.


Why CodeGraph?

When an AI agent needs to understand code — to answer a question or make a change — it discovers structure the slow way: grep, glob, and Read, one file at a time, rebuilding call paths and dependencies by hand. That's a pile of tool calls and round-trips before it even starts the real work.

CodeGraph hands the agent the exact code it needs in one call. It's a pre-built knowledge graph of every symbol, call edge, and dependency in your codebase — so instead of crawling files, the agent asks one question and gets back the relevant source, the call paths between those symbols (including dynamic-dispatch hops grep can't follow), and the blast radius of a change. Surgical context, not a file-by-file search — which means fewer tool calls and faster answers on every codebase, large or small.

token-cost-savings-scale

A note on cost: CodeGraph's win on every codebase is precision and speed — fewer tool calls, faster answers. It cuts token and dollar cost too, but those savings are scale-dependent: small and noisy on a modest codebase, and material only once a repo is large and tangled — at the scale of a Google or Microsoft monorepo, multiplied by a whole team's daily agent usage — for them to compound into a real line item. On a 500-file project, adopt CodeGraph for the speed; the cost savings show up when the codebase (and the team) gets big.

Benchmark Results

Tested across 7 real-world open-source codebases spanning 7 languages, comparing an agent (Claude Code, headless) answering one architecture question with and without CodeGraph, at the median of 4 runs per arm. Re-validated on Opus 4.8 (2026-06-02), on the current build (codegraph_explore as the primary tool).

The universal win — every repo, every size: 58% fewer tool calls · 22% faster · file reads cut to ~zero.

The reliable, universal payoff is surgical context and speed: CodeGraph collapses the agent's grep/find/Read crawl into a few direct queries — returning the exact methods you asked about even when they're buried in a multi-thousand-line file — so it answers with near-zero file reads while the no-CodeGraph agent spends its budget on discovery. The Tokens and Cost columns are real too, but — as noted above — they're scale-dependent: small and noisy per query, compounding into real money only at large-codebase, high-volume scale.

Codebase Language Tool calls Time File reads Tokens Cost
VS Code TypeScript · ~10k files 81% fewer 11% faster 0 vs 9 64% fewer 18% cheaper
Excalidraw TypeScript · ~640 40% fewer 27% faster 0 vs 7 25% fewer even
Django Python · ~3k 77% fewer 13% faster 0 vs 9 60% fewer 8% cheaper
Tokio Rust · ~790 57% fewer 18% faster 0 vs 8 38% fewer even
OkHttp Java · ~645 50% fewer 31% faster 0 vs 4 54% fewer 25% cheaper
Gin Go · ~110 44% fewer 24% faster 1 vs 6 23% fewer 19% cheaper
Alamofire Swift · ~110 58% fewer 33% faster 0 vs 9 64% fewer 40% cheaper

File reads = median files the agent opened with vs without CodeGraph — the surgical-context win in one column. Tokens and Cost are the same with-vs-without deltas; they're directional (they move run-to-run) and, per query, small in absolute terms — which is why they only become a line item at scale. codegraph_explore also collapses redundant interchangeable implementations to signatures, so a response is sized to the answer rather than the file count.

Per-repo breakdown — WITH vs WITHOUT (median of 4)

VS Code · ~10k files | Metric | WITH cg | WITHOUT cg | Δ | |---|---|---|---| | Time | 1m 59s | 2m 13s | 11% faster | | File Reads | 0 | 9 | −9 | | Grep/Bash | 0 | 11 | −11 | | Tool calls | 4 | 21 | 81% fewer | | Total tokens | 640k | 1.79M | 64% fewer | | Cost | $0.68 | $0.83 | 18% cheaper |

Excalidraw · ~640 files | Metric | WITH cg | WITHOUT cg | Δ | |---|---|---|---| | Time | 1m 32s | 2m 6s | 27% faster | | File Reads | 0 | 7 | −7 | | Grep/Bash | 1 | 8 | −7 | | Tool calls | 9 | 15 | 40% fewer | | Total tokens | 1.27M | 1.69M | 25% fewer | | Cost | $0.78 | $0.78 | even |

Django · ~3k files | Metric | WITH cg | WITHOUT cg | Δ | |---|---|---|---| | Time | 1m 43s | 1m 58s | 13% faster | | File Reads | 0 | 9 | −9 | | Grep/Bash | 0 | 5 | −5 | | Tool calls | 3 | 13 | 77% fewer | | Total tokens | 559k | 1.41M | 60% fewer | | Cost | $0.57 | $0.62 | 8% cheaper |

Tokio · ~790 files | Metric | WITH cg | WITHOUT cg | Δ | |---|---|---|---| | Time | 1m 55s | 2m 20s | 18% faster | | File Reads | 0 | 8 | −8 | | Grep/Bash | 0 | 6 | −6 | | Tool calls | 6 | 14 | 57% fewer | | Total tokens | 1.08M | 1.73M | 38% fewer | | Cost | $0.82 | $0.82 | even |

OkHttp · ~645 files | Metric | WITH cg | WITHOUT cg | Δ | |---|---|---|---| | Time | 1m 1s | 1m 29s | 31% faster | | File Reads | 0 | 4 | −4 | | Grep/Bash | 2 | 6 | −4 | | Tool calls | 5 | 10 | 50% fewer | | Total tokens | 502k | 1.10M | 54% fewer | | Cost | $0.41 | $0.55 | 25% cheaper |

Gin · ~110 files | Metric | WITH cg | WITHOUT cg | Δ | |---|---|---|---| | Time | 1m 14s | 1m 37s | 24% faster | | File Reads | 1 | 6 | −5 | | Grep/Bash | 1 | 2 | −1 | | Tool calls | 5 | 9 | 44% fewer | | Total tokens | 651k | 847k | 23% fewer | | Cost | $0.46 | $0.57 | 19% cheaper |

Alamofire · ~110 files | Metric | WITH cg | WITHOUT cg | Δ | |---|---|---|---| | Time | 1m 35s | 2m 21s | 33% faster | | File Reads | 0 | 9 | −9 | | Grep/Bash | 0 | 4 | −4 | | Tool calls | 5 | 12 | 58% fewer | | Total tokens | 766k | 2.10M | 64% fewer | | Cost | $0.57 | $0.95 | 40% cheaper |

Full benchmark details

Methodology. Each arm is claude -p (Claude Opus 4.8) run headlessly against the repo with --strict-mcp-config: WITH = CodeGraph's MCP server enabled, WITHOUT = an empty MCP config. Built-in Read/Grep/Bash stay available to both. Same question per repo, 4 runs per arm, median reported. Cost = the run's total_cost_usd; Tokens = total tokens processed (input incl. cached + output); Time = wall-clock; Tool calls = every tool invocation, including those inside any sub-agents the model spawns. Repos cloned at --depth 1 and indexed by the same CodeGraph build that served them. Re-validated 2026-06-02 on the current build. These numbers are lower than the prior Opus 4.7 validation — not a CodeGraph regression but a stronger native baseline: Opus 4.8 greps/reads efficiently on the main thread instead of fanning out into large Explore-subagent sweeps, so the no-CodeGraph arm is leaner than it used to be. Per-repo numbers move run-to-run with how hard the without-arm thrashes (the median-of-4 smooths it, but tails remain — e.g. Django's without-arm hit $2.71/14m one batch).

Queries: | Codebase | Query | |----------|-------| | VS Code | "How does the extension host communicate with the main process?" | | Excalidraw | "How does Excalidraw render and update canvas elements?" | | Django | "How does Django's ORM build and execute a query from a QuerySet?" | | Tokio | "How does tokio schedule and run async tasks on its runtime?" | | OkHttp | "How does OkHttp process a request through its interceptor chain?" | | Gin | "How does gin route requests through its middleware chain?" | | Alamofire | "How does Alamofire build, send, and validate a request?" |

Why CodeGraph wins: with the index available, the agent answers directly — usually one codegraph_explore returns the relevant source — and stops, usually with zero file reads. Without it, the agent spends most of its budget on discovery (find/ls/grep) before reading the right code. CodeGraph only helps when queried directly, so its instructions steer agents to answer directly rather than delegate exploration to file-reading sub-agents — otherwise a sub-agent reads files regardless and CodeGraph becomes overhead.


Key Features

Surgical Context One tool call returns entry points, related symbols, and code snippets — no slow file-by-file exploration
Full-Text Search Find code by name instantly across your entire codebase, powered by FTS5
Impact Analysis Trace callers, callees, and the full impact radius of any symbol before making changes
Always Fresh File watcher uses native OS events (FSEvents/inotify/ReadDirectoryChangesW) with debounced auto-sync — the graph stays current as you code, zero config
20+ Languages TypeScript, JavaScript, Python, Go, Rust, Java, C#, PHP, Ruby, C,

Extension points exported contracts — how you extend this code

WatchdogHandle (Interface)
(no doc) [8 implementers]
src/mcp/liveness-watchdog.ts
AgentTarget (Interface)
(no doc) [16 implementers]
src/installer/targets/types.ts
CommandSupervision (Interface)
(no doc) [8 implementers]
src/bin/command-supervision.ts
ParsedConfig (Interface)
Parsed, validated view of a project's `codegraph.json`.
src/project-config.ts
GitChanges (Interface)
* Result of git-based change detection. * Returns null when git is unavailable (non-git project or command failure), *
src/extraction/index.ts
FieldInfo (Interface)
A struct field, in declaration order, flagged when it is a function pointer.
src/resolution/c-fnptr-synthesizer.ts
CountLine (Interface)
One buffered line: either a usage-count delta or a lifecycle event.
src/telemetry/index.ts
TraversalStep (Interface)
* Result of a single traversal step
src/graph/traversal.ts

Core symbols most depended-on inside this repo

join
called by 1933
src/extraction/tree-sitter.ts
has
called by 503
src/resolution/lru-cache.ts
extractFromSource
called by 302
src/extraction/tree-sitter.ts
get
called by 298
src/db/sqlite-adapter.ts
getNodeText
called by 291
src/extraction/tree-sitter-helpers.ts
getChildByField
called by 254
src/extraction/tree-sitter-helpers.ts
indexAll
called by 224
src/index.ts
set
called by 221
src/resolution/lru-cache.ts

Shape

Function 1,360
Method 773
Interface 153
Class 117

Languages

TypeScript100%

Modules by API surface

src/extraction/tree-sitter.ts110 symbols
src/mcp/tools.ts107 symbols
src/index.ts74 symbols
src/db/queries.ts74 symbols
src/resolution/callback-synthesizer.ts69 symbols
src/extraction/index.ts52 symbols
src/resolution/import-resolver.ts45 symbols
src/mcp/transport.ts41 symbols
src/resolution/c-fnptr-synthesizer.ts39 symbols
src/telemetry/index.ts38 symbols
src/resolution/name-matcher.ts37 symbols
src/sync/watcher.ts36 symbols

Dependencies from manifests, versioned

@astrojs/starlight0.39.2 · 1×
@clack/prompts1.3.0 · 1×
@fontsource-variable/archivo5.2.8 · 1×
@fontsource/ibm-plex-mono5.2.7 · 1×
@types/node20.19.30 · 1×
@types/picomatch4.0.2 · 1×
astro6.3.1 · 1×
commander14.0.2 · 1×
fast-string-width3.0.2 · 1×
fast-wrap-ansi0.2.0 · 1×
ignore7.0.5 · 1×

Datastores touched

(mysql)Database · 1 repos
mydbDatabase · 1 repos

For agents

$ claude mcp add codegraph \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact