← 返回
未分类 中文

Codegraph Tool

CodeGraph — Pre-indexed code knowledge graph tool. Provides semantic code intelligence for Claude Code, Cursor, Codex, Gemini, OpenCode, Hermes, Antigravity,...
CodeGraph — 预索引代码知识图谱工具。为 Claude Code、Cursor、Codex、Gemini、OpenCode、Hermes、Antigravity 等提供语义代码智能。
openlark openlark 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 55
下载
💾 0
安装
1
版本
#latest

概述

CodeGraph Tool

Local-first code intelligence tool. tree-sitter parsing → SQLite (FTS5) storage → MCP exposes knowledge graph.

Use Cases

Use when users need to install CodeGraph, initialize code graph, index projects, understand code structure, trace call chains, evaluate change impact.

Installation

npx @colbymchenry/codegraph          # Recommended: one-click install + auto-configure Agent
curl -fsSL https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.sh | sh  # No Node required
npm i -g @colbymchenry/codegraph     # npm

Non-interactive: codegraph install --yes [--target=claude,cursor] [--location=local]

Project Initialization

cd your-project
codegraph init -i    # Create .codegraph/ + build index
codegraph index      # Full index (or rebuild: --force)
codegraph sync       # Incremental sync (changed files only)
codegraph status     # Check status

MCP Tools (8)

> Tool selection guide is automatically sent to Agent in MCP initialize response.

IntentToolKey Parameters
------------------------------
Almost any question — architecture, flow, bug, investigationcodegraph_explorequery (natural language or symbol names)
Locate symbol by namecodegraph_searchquery, kind, limit
Call chaincodegraph_callers / codegraph_calleessymbol, limit
Change impactcodegraph_impactsymbol, depth
Single symbol full source / overload disambiguationcodegraph_nodesymbol, includeCode, file, line
File structurecodegraph_files
Index healthcodegraph_status

Core Principles

  • codegraph_explore is the PRIMARY tool — call it first, usually the only call needed. Returns relevant symbol source code (grouped by file), with line numbers.
  • Answer directly, don't delegate to sub-Agent for file exploration — CodeGraph IS the pre-built index, grep/read loops are redundant work.
  • One explore > search + node chained calls.

Anti-patterns

❌ Don't use grep to verify codegraph results (AST is more accurate than grep)

❌ Don't chain search + node to understand an area (one explore does it)

❌ Don't loop node over multiple symbols (one explore returns all)

⚠️ Check staleness banner after edits — pending files need direct Read

Auto-sync

Three-layer protection: ① Native FS events + 2s debounce auto-sync ② Per-file staleness banner (pending files prefixed with ⚠️) ③ Auto-reconciliation on MCP reconnect.

Manual sync only needed in sandbox (CODEGRAPH_NO_DAEMON=1) or CI pre-flight.

CLI Queries

codegraph query <symbol> [--kind class] [--limit 10] [--json]
codegraph callers <symbol> [--limit 20] [--json]
codegraph callees <symbol> [--limit 20] [--json]
codegraph impact <symbol> [--depth 2] [--json]
codegraph context "<task>" [--max-nodes 20]
codegraph affected <files...> [--stdin] [--depth 5] [--filter "e2e/*"] [--quiet]

Configuration

Zero-config — no config files. Auto-excludes node_modules/vendor/dist/build/target/.venv/Pods/.next + .gitignore entries + >1MB files. Exclude more: add to .gitignore; bring back: !vendor/.

Environment variables: CODEGRAPH_WATCH_DEBOUNCE_MS(2000) CODEGRAPH_NO_DAEMON CODEGRAPH_EXPLORE_LINENUMS(1) CODEGRAPH_ADAPTIVE_EXPLORE(1)

Supported Languages (21)

TS/JS/Python/Go/Rust/Java/C#/PHP/Ruby/C/C++/Swift/Kotlin/Scala/Dart/Svelte/Vue/Liquid/Pascal-Delphi/Lua/Luau

Framework Routes (14)

Django/Flask/FastAPI/Express/NestJS/Laravel/Drupal/Rails/Spring/Gin-chi-gorilla-mux/Axum-actix-Rocket/ASP.NET/Vapor/ReactRouter-SvelteKit — auto-recognize route files and generate route nodes.

Cross-language Bridging

Swift↔ObjC / RN legacy bridge / TurboModules / RN events / Expo Modules / Fabric-Paper views. Synthesized edges marked provenance:'heuristic'.

Uninstall

codegraph uninstall    # Remove MCP config
codegraph uninit       # Delete .codegraph/

References

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-06-09 19:47 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 681 📥 328,913
dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 196 📥 67,878
dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 75 📥 182,297