← 所有精選

★ GitHub Trending 精選

每日一個爆紅開源專案

日榜 #22026-08-10

vitali87/code-graph-rag

The ultimate RAG for your monorepo. Query, understand, and edit multi-language codebases with the power of AI and knowledge graphs

★ 3.0k stars · ▲ +96 今日 · 🔶 Python · 📜 MIT · 官網在 GitHub 開啟 ↗
aiastclaude-codecode-analysiscode-understandingcodebase-searchdeveloper-toolsgraph-databaseknowledge-graphllmmcpmcp-server
ℹ️ 今日 trending #1 是 PrimeIntellect-ai/prime-agent(已於 2026-08-08 推過),故改推第 2 名。
🔄 PrimeIntellect-ai/prime-agent 已連續霸榜 3 天,當初在 2026-08-08 推過,值得回頭再看一眼。

這是什麼

code-graph-rag 是一套面向大型程式碼庫的 RAG + 知識圖譜 工具。它不是只把檔案切塊丟進向量庫,而是先用 Tree-sitter 讀取 repository,抽出 functions、classes、methods、modules,以及呼叫、引用、匯入等關係,寫進 Memgraph 形成可查詢的程式碼圖。使用者之後可以用自然語言詢問程式碼庫,系統會把問題轉成 Cypher 查詢,取回真實結構與原始碼片段,再輔助回答、搜尋、修改或最佳化。README 也提到它支援結構化搜尋與替換、dead code 偵測、AST-based patching,並在修改前提供 diff preview;這讓它比較像「懂 codebase 結構的 agent 工具層」,而不是一般全文搜尋。

為什麼上榜

這個專案今天在日榜拿到 96 顆星、累積約 2,971 stars,熱點很明顯:AI coding 工具正在從「單檔補全」走向「整個 monorepo 的理解與編輯」。code-graph-rag 的差異在於把自然語言、Cypher、AST 分析、圖資料庫與 MCP 串在一起,讓 AI 不只憑文字相似度猜答案,而能沿著函式、類別、模組、引用關係找證據,也比較容易說明答案從何而來。README 最新消息也強調 Ruby support、AST 結構化搜尋替換,以及 FLOWS_TO taint/data-flow tracing;這些更新指向一個更工程化的方向:讓 agent 能跨語言理解結構、追蹤資料流,並做更精準的 code rewrite。

適合誰,可以拿來做什麼

它最適合要處理 大型、多語言程式碼庫 的團隊或個人:例如接手陌生 monorepo、查某個功能從入口到實作的路徑、找 dead code、根據 coding standard 做最佳化,或讓 Claude Code 等 MCP client 直接查詢與編輯程式碼庫。README 列出完整支援 Python、TypeScript、TSX、JavaScript、Rust、Go、Java、C、C++、C#、PHP、Lua、Dart;Scala 開發中,Ruby 目前有結構支援。上手門檻不算零,因為除了 Python 套件外還需要 Docker 跑 Memgraph,也需要 cmake、ripgrep;但對已經在使用 AI coding agent、又希望它更懂專案結構的人,這類成本是合理的。

上手

README 提供明確安裝與 quick start。cgr 發佈在 PyPI,建議安裝包含所有語言 Tree-sitter 與 semantic/vector search 的 extras,並準備 Docker、cmake、ripgrep。

# with uv (recommended)
uv tool install "code-graph-rag[treesitter-full,semantic]"

# or with pipx
pipx install "code-graph-rag[treesitter-full,semantic]"

# Start the packaged Memgraph + Qdrant stack
cgr daemon up

# Parse a repository into the graph, then query it
cgr start --repo-path /path/to/repo --update-graph
cgr start --repo-path /path/to/repo

README 也指出它可作為 MCP Server 執行,讓 Claude Code 與其他 MCP client 直接查詢、編輯 codebase;完整設定需看專案的 MCP guide。

README 重點摘要