codegraph

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

codegraph

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
    references/spike.md
    for per-repo numbers)
  • Repo not initialized AND no cached
    .codegraph/
    AND short session
  • 单文件编辑或简单查询
  • 会话时长可能低于冷启动成本(详见
    references/spike.md
    中的仓库相关数据)
  • 仓库未初始化且无缓存的
    .codegraph/
    目录,同时会话时长较短

Prerequisites

前置条件

  • Node 18+ on PATH
  • Project has
    .codegraph/
    (run
    codegraph init
    if not)
  • For cloud sessions: cold-start cost verified via
    references/spike.md
    for the target repo
  • PATH中包含Node 18+
  • 项目存在
    .codegraph/
    目录(若没有,运行
    codegraph init
  • 云会话场景:已通过
    references/spike.md
    验证目标仓库的冷启动成本

Files

文件说明

  • references/install.md
    — installation for local / Claude Code Cloud / devcontainer
  • references/usage.md
    — which of the 8 MCP tools to use when, with main-session vs subagent rules
  • references/spike.md
    — cold-start measurement protocol; run once per new target repo before relying on codegraph in cloud sessions
  • references/install.md
    —— 本地 / Claude Code Cloud / devcontainer的安装指南
  • references/usage.md
    —— 8个MCP工具的适用场景,以及主会话与子代理的使用规则
  • references/spike.md
    —— 冷启动测量协议;在云会话中使用codegraph之前,需针对新目标仓库运行一次

Known integration targets

已知集成目标

Cold-start measured locally (Node 22, 4 cores). Cloud cold-start still pending — re-run
references/spike.md
in a cloud session before relying on these numbers there.
RepoIndexed filesNodes / edgesDB sizeCold init+indexQuery wall
onsager-ai/onsager578 (rust + tsx/ts)8.6k / 20k24 MB12s~0.9s
crawlab-team/crawlab644 (go)6.8k / 15k11 MB6s~0.9s
codervisor/leanspec695 (tsx/rust/ts)8.9k / 21k23 MB10s~0.9s
Per-query wall is dominated by Node startup — the SQLite work itself is milliseconds. End-to-end cold-start including one-shot
npx install
is ~13–19s for repos in this size class.
冷启动时长已在本地环境(Node 22,4核)下测量完成。云环境的冷启动时长仍在测试中——在云环境中依赖这些数据之前,请在云会话中重新运行
references/spike.md
仓库已索引文件数节点/边数数据库大小冷启动初始化+索引时长查询耗时
onsager-ai/onsager578(rust + tsx/ts)8.6k / 20k24 MB12s~0.9s
crawlab-team/crawlab644(go)6.8k / 15k11 MB6s~0.9s
codervisor/leanspec695(tsx/rust/ts)8.9k / 21k23 MB10s~0.9s
单次查询耗时主要受Node启动影响——SQLite本身的操作仅需数毫秒。对于此类规模的仓库,包括一次性
npx install
在内的端到端冷启动时长约为13–19秒。