codegraph
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesecodegraph
codegraph
Local code graph exposed as 8 MCP tools. Replaces grep + Read loops for exploration with O(1) SQLite lookups and FTS5 search.
本地代码图谱以8个MCP工具的形式提供。将用于代码探索的grep + 读取循环替换为O(1)的SQLite查询和FTS5搜索。
When to use
适用场景
- Brownfield repo where structure is non-obvious
- Task involves: "where is X used", "what breaks if I change Y", "trace flow from A to B"
- Long-running session — cold-start cost amortizes over multiple queries
- 代码结构不清晰的遗留代码仓库
- 任务涉及:“X在哪里被使用”、“修改Y会影响什么”、“追踪从A到B的流程”
- 长时间运行的会话——冷启动成本可通过多次查询摊销
When NOT to use
不适用场景
- Single-file edits or trivial lookups
- Session likely shorter than cold-start cost (see for per-repo numbers)
references/spike.md - Repo not initialized AND no cached AND short session
.codegraph/
- 单文件编辑或简单查询
- 会话时长可能低于冷启动成本(详见中的仓库相关数据)
references/spike.md - 仓库未初始化且无缓存的目录,同时会话时长较短
.codegraph/
Prerequisites
前置条件
- Node 18+ on PATH
- Project has (run
.codegraph/if not)codegraph init - For cloud sessions: cold-start cost verified via for the target repo
references/spike.md
- PATH中包含Node 18+
- 项目存在目录(若没有,运行
.codegraph/)codegraph init - 云会话场景:已通过验证目标仓库的冷启动成本
references/spike.md
Files
文件说明
- — installation for local / Claude Code Cloud / devcontainer
references/install.md - — which of the 8 MCP tools to use when, with main-session vs subagent rules
references/usage.md - — cold-start measurement protocol; run once per new target repo before relying on codegraph in cloud sessions
references/spike.md
- —— 本地 / Claude Code Cloud / devcontainer的安装指南
references/install.md - —— 8个MCP工具的适用场景,以及主会话与子代理的使用规则
references/usage.md - —— 冷启动测量协议;在云会话中使用codegraph之前,需针对新目标仓库运行一次
references/spike.md
Known integration targets
已知集成目标
Cold-start measured locally (Node 22, 4 cores). Cloud cold-start still pending — re-run in a cloud session before relying on these numbers there.
references/spike.md| Repo | Indexed files | Nodes / edges | DB size | Cold init+index | Query wall |
|---|---|---|---|---|---|
| onsager-ai/onsager | 578 (rust + tsx/ts) | 8.6k / 20k | 24 MB | 12s | ~0.9s |
| crawlab-team/crawlab | 644 (go) | 6.8k / 15k | 11 MB | 6s | ~0.9s |
| codervisor/leanspec | 695 (tsx/rust/ts) | 8.9k / 21k | 23 MB | 10s | ~0.9s |
Per-query wall is dominated by Node startup — the SQLite work itself is milliseconds. End-to-end cold-start including one-shot is ~13–19s for repos in this size class.
npx install冷启动时长已在本地环境(Node 22,4核)下测量完成。云环境的冷启动时长仍在测试中——在云环境中依赖这些数据之前,请在云会话中重新运行。
references/spike.md| 仓库 | 已索引文件数 | 节点/边数 | 数据库大小 | 冷启动初始化+索引时长 | 查询耗时 |
|---|---|---|---|---|---|
| onsager-ai/onsager | 578(rust + tsx/ts) | 8.6k / 20k | 24 MB | 12s | ~0.9s |
| crawlab-team/crawlab | 644(go) | 6.8k / 15k | 11 MB | 6s | ~0.9s |
| codervisor/leanspec | 695(tsx/rust/ts) | 8.9k / 21k | 23 MB | 10s | ~0.9s |
单次查询耗时主要受Node启动影响——SQLite本身的操作仅需数毫秒。对于此类规模的仓库,包括一次性在内的端到端冷启动时长约为13–19秒。
npx install