
CGIS Code Graph
io.github.zaebee由 GitHub 帳號 zaebee 發布v0.39.2更新於 Nov 7, 2026
Code graph for AI agents: impact, call tracing in Python, TypeScript, Go; opt-in JSON and YAML keys
發布方自己的服務:BrainDog
概覽
為程式碼倉庫建立 SQLite 程式碼圖,讓 AI 助理直接查詢呼叫方、被呼叫方、結構與指標,不必用 grep 翻檔案。
- 可以做什麼
- 將倉庫匯入為程式碼圖,支援首次建立與增量更新
- 依部分名稱尋找符號,並檢視套件規模與整體概況
- 分析變更影響並追蹤符號的傳遞呼叫鏈
- 檢視類別與模組階層、耦合度、上帝類別與 PageRank
- 為單一符號產生精簡的圖形上下文包
- 稽核授權可達性、架構漂移與圖形完整性
- 適用情境
- 適合需要回答「改動這個函式會影響什麼」「哪條呼叫路徑會到達某個處理函式」這類問題的情境,對象為 Python、TypeScript 與 Go 倉庫。相較於通讀整個檔案更節省上下文,適合跨倉庫的多跳影響分析。
- 執行需求
- 透過 uvx 從 PyPI 套件 codegraph-brain 以 stdio 在本機執行,或以 pip 安裝並需要 Python 3.12+。使用前需先從原始碼目錄建立 SQLite 圖檔。圖形相關工具無需帳號、API 金鑰或遙測。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 CGIS Code Graph,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
🧠 CGIS: Code Graph Intelligence System
A code graph your AI agent can query instead of guess
[Continuous Integration] [Graph Integrity] [PyPI]
Ask "what breaks if I change this?" and get the call chain, not a guess.
CGIS parses a repository with tree-sitter into a graph of fully qualified symbols and the calls, imports and containment between them, stores it in SQLite, and serves it to AI agents over MCP. An agent that would otherwise grep and read whole files asks the graph instead.
- Languages: Python · TypeScript / TSX · Go (structure and metrics only; its impact answers are a lead to confirm by reading — exp4, measured on one library, golang/crypto, mostly its ssh package; not measured on applications) · JSON and YAML (data key declarations only, when data keys are enabled with
--data-keys: no symbols, calls or impact) - Runs: locally — no account, no telemetry; the graph never leaves your disk (the one opt-in exception)
Real output — CGIS run on its own source.
🚀 Quickstart
In Claude Code (fastest)
That ships the MCP server, a skill that teaches the agent when to query the graph instead of reading files, and /cgis:ingest to build the graph on first use. The server is pulled from PyPI on demand via uvx, so there is nothing to clone or build.
Any other MCP client (Cursor, Claude Desktop, …)
From the terminal
Or install it for good: pip install codegraph-brain (Python 3.12+), then use cgis directly. The full command list is in CLI_USAGE.md.
📈 Proof at Real Scale
CGIS runs on a working twelve-repository estate — four languages, 8,146 commits, shipping daily. On its FastAPI backend it classifies 82.7% of 87,845 edges definitively and prints the remaining 17.3% rather than inventing targets for them — including the part that is CGIS's own gap.
That share rose from 11.4% in #459, which stopped counting calls to missing symbols as resolved. About 4 points of what is left is a known resolver gap, not something undiscoverable: ingesting app/ strips the app. prefix its imports carry, and the import path does not yet reconcile the two — the same backend ingested at its package root reports 13.2%. The number is what the tool admits it cannot place today, and it is allowed to move the unflattering way.
Read the case study → — every figure measured and reproducible, including what CGIS doesn't cover.
🤔 Why a graph, and how this differs
Text retrieval hands an agent chunks that look related. It cannot say which of three functions named save a call reaches, or what sits five callers up. CGIS resolves every call site to a fully qualified name when the source allows it — and when it does not, the edge stays marked unresolved and is counted, never filled with a plausible guess.
🤖 MCP Tools
The main tools:
All 16 tools, with parameters: MCP_REFERENCE.md.
🏗️ How It Works
- Extract — tree-sitter parsers turn each file into nodes and raw call edges.
- Resolve — the
ResolverEnginemaps raw calls to fully qualified names, or leaves them explicitly unresolved. - Store — SQLite holds the graph; queries are breadth-first traversals over it.
The details — and a pipeline graph CGIS regenerates from its own source on every change — are in HOW_IT_WORKS.md, and the full map of every document with its generated cross-references to the code is in docs/INDEX.md.
🛡️ Guardian: Graph-Aware Code Review
Guardian is CGIS's built-in LLM reviewer — it reviews pull requests using the graph as context, not just the diff text. It runs in CI and posts inline comments anchored to the exact line.
- Two-stage, recall-first: a finder surfaces every plausible defect (optimised for recall), then a separate skeptic pass filters false positives — closer to how human reviewers work, and far more reliable than a single precision-gated prompt.
- Local or cloud, no lock-in: point it at Ollama (
qwen2.5-coder,llama3.1,granite-code, …) for free local inference, or at Mistral / Gemini / Claude / OpenCode Go (DeepSeek) in the cloud. You can even mix them — a strong cloud finder with a free local cross-model skeptic. - Graph-aware context: the reviewer sees impact graphs, architectural drift, and project ontology — so it catches structural and convention defects a flat-diff reviewer can't.
- Deterministic anchoring: every inline comment is positioned by a verbatim quote from the diff, not the model's (often wrong) line guess.
- Dogfooded & measured: Guardian reviews CGIS's own pull requests, and a benchmark harness scores it against curated ground truth — so prompt changes are validated, not guessed.
In GitHub Actions, opencode-go needs no static key: the reusable workflow exchanges a short-lived GitHub OIDC token for inference access immediately before the review. Enable OIDC for GitHub Actions in the Opencode console, set the calling repository's OPENCODE_CLIENT_ID variable, and grant the review job id-token: write. OPENCODE_API_KEY is then minted at run time and never stored as a secret. Sign-in happens when GUARDIAN_PROVIDER is opencode-go, opencode, or unset (unset means the minted key makes opencode the auto-detected provider); an explicit other provider skips it.
No GPU on hand? Benchmark it on a notebook GPU → — free end to end, since the fixtures score without an LLM judge. Or point Guardian at a remote Ollama → — over an frp stcp tunnel, no public port, and a guard that refuses a review of a silently truncated prompt.
🔒 Privacy
CGIS collects nothing: no telemetry, no analytics, no account. Your code and the graph built from it stay on your machine. The one exception is opt-in: Guardian, if you run it with a cloud model, sends the reviewed diff to the provider you chose. See PRIVACY.md.
🛠️ Development
Requires Python 3.12+ and uv.
See CONTRIBUTING.md for the standards: strict MyPy, linting, ontology compliance.
💼 Architecture Audit
CGIS is free and you can run it yourself. If you would rather have the analysis than the tool, I run a fixed-price audit of your codebase's structure — authorisation coverage, blast radius, coupling, architectural drift — delivered in five working days, $2,400 fixed, with an explicit list of what the analysis cannot see. Read what's included →
來源:README.md,提交 5ed805b
工具
0版本歷史
16- v0.39.2最新Oct 31, 2026
- v0.38.0Oct 23, 2026
- v0.36.0Oct 22, 2026
- v0.35.0Oct 21, 2026
- v0.34.0Oct 19, 2026
- v0.33.0Oct 18, 2026
- v0.32.0Oct 16, 2026
- v0.31.0Oct 16, 2026
- v0.30.0Oct 15, 2026
- v0.29.0Oct 14, 2026
- v0.28.0Oct 8, 2026
- v0.27.0Oct 2, 2026
- v0.25.4Sep 26, 2026
- v0.25.3Sep 18, 2026
- v0.25.2Sep 18, 2026
- v0.23.3Sep 17, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
其他 Brain 整合

BrainDog
dog.brain官方發布者
BrainDog 是一個託管記錄庫,集中保存專案、決策與金錢,接入的 AI 代理在開工前讀取、結束後寫入。

Codebase Brain
由 GitHub 帳號 Nomannazir 發布
為本機或公開 git 程式碼庫建立索引,讓助理能檢索程式碼、追溯 git 歷史、分析變更影響並找出過時文件,結果都附上檔案路徑與行號引用。

Personal Brain
由 GitHub 帳號 zhang-liz 發布
為 AI 助理提供職場人脈記憶,資料以圖的形式存放在 FalkorDB,可查詢聯絡人、依主題找人並記錄你見過的人。

Second Brain
由 GitHub 帳號 ara-5 發布
面向AI代理程式的共享Graph-RAG記憶:markdown vault、wikilink召回、任務、訊息傳遞。AI 翻譯

Make0 Brain
由 GitHub 帳號 make0-official 發布
在本機離線執行的記憶伺服器,讓 Claude Code、Cursor、Codex 等 MCP 代理共用一份具版本紀錄的長期事實庫。