安装时需带上 treesitter-full、ast-grep、semantic 等 extras,否则部分语言解析和向量搜索不可用;--clean 会删除共享图谱中的所有项目而非仅当前项目;默认图谱写在 ~/.cgr/graph.sqlite,需用 SQLITE_GRAPH_PATH 改路径。

code-graph-rag
vitali87MIT活跃维护面向 monorepo 的代码检索增强生成工具,用知识图谱和 AST 解析多语言代码库,支持自然语言查询、理解与编辑代码。
The ultimate RAG for your monorepo. Query, understand, and edit multi-language codebases with the power of AI and knowledge graphs
uv tool install "code-graph-rag[treesitter-full,ast-grep,semantic]"
cgr start --repo-path /path/to/repo --update-graphREADME 未说明显存或 GPU 要求;图谱默认存为本地嵌入式 SQLite 文件,无需额外服务器。
用知识图谱索引多语言 monorepo,让你用自然语言查询和修改代码
面向 monorepo 的代码检索增强生成工具,用知识图谱和 AST 解析多语言代码库,支持自然语言查询、理解与编辑代码。
核心能力
- 用 Tree-sitter 解析多语言代码并构建统一知识图谱
- 把自然语言转成 Cypher 查询,检索真实代码结构
- 基于 AST 做精准补丁编辑,改动前先预览 diff
- 从入口点沿调用边遍历,找出死代码
- 用 cgr trace 把运行时调用合并进图谱
容易踩的坑
- v0.6.30最新正式版2026-11-09 · 2026-11-09 16:53 UTC
🔒 Security
Pydantic AI: Concurrency-limited models can keep their slot when a streamed request ends early (high severity, CVSS 7.5), dependency advisory GHSA-6fqq-452j-qhrp / CVE-2026-107286.
Upgrading is strongly recommended.
Highlights
- Type Handling: Improved handling of type context managers, walrus operators, and match binding targets in both Python and TypeScript.
- Rename Refinement: Prevented Go renames from unexporting names used by other packages.
- Profile Naming: Corrected the naming of pprof profiles to avoid "malformed" errors when no samples are present.
- Output Budget: Increased the Anthropic output budget to improve the default thinking experience.
- Module Resolution: Resolved issues with module resolution in various scenarios, including ES module default imports and bare name bindings.
- Dead Code Elimination: Removed dead code roots associated with IPython rich-display methods.
- Incremental Refresh: Improved incremental refresh to ensure callers are updated when dispatch targets change.
What's Changed
- fix(py): type contextmanager, walrus and match binding targets by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3585
- fix(py): type contextmanager, walrus and match binding targets by @AdityaxDeore in https://github.com/vitali87/code-graph-rag/pull/3528
- fix(java): calls on an enum constant or a new expression resolve by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3125
- fix(trace): name a pprof profile with no samples instead of calling it malformed by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3040
- fix(rename): refuse a Go rename that unexports a name another package uses by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3093
- fix(dead-code): a pub trait's methods are exported by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/2950
- docs(trace): pass the JVM agent to Maven tests through Surefire's argLine by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3057
- fix(incremental): refresh callers when dispatch targets change by @AdityaxDeore in https://github.com/vitali87/code-graph-rag/pull/3527
- fix(schema): Resource declares the project its ENDPOINT kind carries by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3120
- fix(findings): str.format() queries and os.system f-strings are injection by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3077
- fix(providers): raise the Anthropic output budget so default thinking fits by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/2980
- fix(python): bind a bare name to no function its module cannot see by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/2968
- fix(ts): bind a method called on a free function's result by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/2962
- fix(csharp): a call on an
as-cast receiver binds the cast's type by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/2960 - fix(dead-code): IPython rich-display methods are dead-code roots by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/2956
- fix(dart): locate call sites at the callee so rename can rewrite them by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/2782
- fix(js-ts): resolve a call through an ES-module default import to the default export by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/2743
- build(deps-dev): bump pytest from 9.1.1 to 9.2.0 by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3549
- build(deps): bump pyo3 in /rust/cgr_graph_rs by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3554
- chore(deps): bump the codeql-action group with 3 updates by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3586
- feat(move): graph-aware move of a module-level definition (#1534) by @vitali87 in https://gi
- v0.6.02026-11-08 · 2026-11-08 13:07 UTC
查看更新说明
⚠️ Breaking changes
code-graph-rag now requires its Rust extension,
cgr-graph-rs, on every platform, and no longer runs without it:import codebase_ragstops with an error that says how to get it. The extension ships as wheels for CPython 3.12 or newer on Linux x86_64 and aarch64 (glibc and musl), macOS (Intel and Apple silicon) and Windows x64. On any other platform (PyPy, 32-bit or other architectures such as armv7, s390x and ppc64le, Windows on ARM), installing code-graph-rag now fails, where it used to install and run the pure-Python engine.There is no setting that keeps the old behaviour on those platforms. To keep using cgr there, pin
code-graph-ragbelow this release.Existing installs on the supported platforms already have the extension and see no change in behaviour. They install fewer packages:
defusedxmlandtomli-ware gone (cgr reads XML project files and writes workspace files in the extension now), andhuggingface-hub, withhf-xet,fsspec,tqdm,filelockandpackaging, is installed only by thesemanticextra, the one part of cgr that uses it. See The Rust extension.Highlights
- Continuous Integration Improvements: Enhanced release cadence tracking and ensured accurate green status for deferred releases.
- Dependency Updates: Updated Golang version in the /.oss-scanner dependency and declared httpx in the codebase.
- Code Quality & Clarity: Resolved several code style and correctness issues including foreach loop variable typing and Python method receiver handling.
- Build Process Refinement: Reduced the default install package count and improved makefile functionality for host/port watching.
- Feature Control: Prevented the use of
--no-endpoint-rootswhen endpoint data is absent.
What's Changed
- fix(ci): keep Deferred Release green when the API allowance is spent by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3572
- ci(release): move the version once per merge and count the release cadence in merges by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3570
- build(deps): bump golang from
fbb7ae4toc65ecfein /.oss-scanner by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3542 - ci(release): count a version set by hand by its merges, not the numbers it skips by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3574
- fix(csharp): type a foreach loop variable by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/2990
- fix(flow): bind Python taint through unpacking, chains and the walrus by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/2764
- fix(dead-code): an arrow const is not a use of itself by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3078
- fix(deps): declare httpx, which the code imports directly by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3582
- fix(js-ts): a baseUrl import names the project module it resolves to by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3100
- fix(go): a Go call's build-variant siblings are Go functions only by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3211
- fix(python): never type a method's receiver from its name by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3067
- fix(make): let make watch follow MEMGRAPH_HOST/MEMGRAPH_PORT by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3041
- fix(dead-code): refuse --no-endpoint-roots on a project without endpoint data by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3032
- fix(watch): stop re-reading the ignore rules on a read of their files by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3584
- refactor(deps)!: cut the default install from 82 to 74 packages and require the Rust extension by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3571
**Full Changel
- v0.5.02026-11-03 · 2026-11-03 03:26 UTC
查看更新说明
⚠️ Breaking changes
The MCP server and the agent's file tools refuse three things they used to do:
- No file tool writes inside a
.gitdirectory any more, or inside the git directory a.gitfile points to (git init --separate-git-dir, a worktree), in the CLI or over MCP. Git runs the commands its config and hooks name, so a write there could run code on your machine. Change git's own files with git. - MCP
write_fileandsurgical_replace_codeno longer change files that look like credentials (.env,.env.*, private keys,.aws/credentials, and the rest of the list MCPread_filealready refuses)..env.exampleand other templates are still written. To keep the old behaviour, exportCGR_ALLOW_SENSITIVE_WRITES=truein the environment the server starts with (a.envfile cannot set it). The CLI agent already asks before every write and is unchanged. cgr mcp-serverno longer starts in a directory that holds your home directory, or in a disk root such as/, unlessTARGET_REPO_PATHnames it (a client that names a narrower project inCLAUDE_PROJECT_ROOTgets that project served instead). A client that launches the server withoutTARGET_REPO_PATHfrom such a directory now gets a configuration error at start-up. SetTARGET_REPO_PATHto the project's directory in the client's server configuration, as the MCP setup guide shows.
The HTTP transport without
MCP_HTTP_AUTH_TOKENnow also refuses requests whoseHostorOriginheader names anything other than127.0.0.1,localhostor[::1]on the server's port. Local clients are unaffected. With a token nothing changes.Existing installs: a server configured with
TARGET_REPO_PATHset to a project, as the setup guide shows, starts as before. See Credential files and the MCP server guide.Highlights
- Rust Upgrade: Updated Rust to version 1.99.1-slim-trixie.
- Security Improvements: Enhanced security by determining the target Git directory for writes and hardening the MCP server's file tools and HTTP transport.
- Signature Functionality: Added support for reading and writing JavaScript headers for change signatures, including the ability to change the signature of JavaScript functions or methods.
- Benchmark Enhancement: Added ColGrep to the retrieval benchmark for improved evaluation.
- Dependency Updates: Updated several dependencies including anthropics/claude-code-action, click, zensical, ty and eclipse-temurin.
- CI Improvements: Introduced a check to fail the merge if Greptile scores the head commit below 5/5.
- macOS Compatibility: The build now leaves macOS-14 support.
What's Changed
- fix(release): build the image with a pinned Rust and leave macos-14 by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3559
- feat(evals): add ColGrep as a third arm in the retrieval benchmark by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3539
- ci: fail the merge when Greptile scores the head commit below 5/5 by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3558
- feat(signature): read JavaScript headers for change_signature by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3511
- feat(signature): write JavaScript headers and call sites by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3512
- feat(signature): change the signature of a JavaScript function or method by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3513
- build(deps): bump anthropics/claude-code-action from 1.0.264 to 1.0.265 by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3561
- build(deps): bump rust from 1.97.0-slim-trixie to 1.99.1-slim-trixie by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3562
- build(deps-dev): bump maturin from 1.15.0 to 1.16.0 by @dependabot[bot] in https://github.com/vit
- No file tool writes inside a
- v0.4.192026-11-01 · 2026-11-01 20:01 UTC
查看更新说明
🔒 Security
This release contains a security fix; see the Security Advisories page.
Upgrading is strongly recommended.
Highlights
- Dependency Updates: Several dependencies have been updated, including
protobufto 7.36.2,transformersto 5.21.0, andpythonto 3.15-slim, bringing in various bug fixes and new features. - Quiet Mode Enhancement: The
--quietflag for the CLI now suppresses the scanning line for dead code and duplicates, providing a cleaner output. - Signature Change Tests: Comprehensive acceptance, transaction, and mapping tests have been added for the
change_signaturefeature, ensuring robust functionality. - Context Budget Fix: The system now correctly handles cases where a target doesn't fit within the allocated budget, preventing unexpected behaviour.
- Performance Improvements: Optimisations have been made to improve performance, including indexing file definitions and returning registry trie results directly.
- Code Quality: Changes have been made to report decorator and modifier changes that affect method calls and to ensure submodule grammars are loaded correctly.
- CGR Prune Feature: A new
cgr prunefunctionality has been added to remove projects where the root no longer exists.
New Contributors
- @AdityaxDeore made their first contribution in https://github.com/vitali87/code-graph-rag/pull/3524
- @mdpant made their first contribution in https://github.com/vitali87/code-graph-rag/pull/3221
Full Changelog: https://github.com/vitali87/code-graph-rag/compare/v0.4.5...v0.4.19
What's Changed
- build(deps): bump pytest-asyncio from 1.4.0 to 1.4.1 by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3519
- build(deps): bump jedi from 0.20.0 to 0.20.1 by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3518
- build(deps-dev): bump ty from 0.0.91 to 0.0.92 by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3517
- build(deps-dev): bump ruff from 0.17.2 to 0.17.3 by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3516
- build(deps): bump protobuf from 6.33.6 to 7.36.2 by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3515
- fix(cli): --quiet hides the scanning line of dead-code and duplicates by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3505
- test(signature): acceptance, transaction and MCP tests for change_signature (#1533, 6/9) by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/2169
- test(signature): mapping tests for change_signature (#1533, 7/9) by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/2168
- test(signature): definition and renamed-parameter tests for change_signature (#1533, 8/9) by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/2165
- ci: correct the pull_request_target enforcement date in the split-score comment by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3520
- ci: publish release assets with gh and gate the workflows on zizmor by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3503
- feat(py): resolve calls through the bindings that reach them, and the with protocol by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3521
- fix(context): return no pieces when the target does not fit the budget by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3506
- build(deps): bump pyasn1 from 0.6.4 to 0.6.5 in the uv group across 1 directory by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3522
- fix(gloss): anchor a note's mentions the way its subject is anchored by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3329
- test(signature): hierarchy, receiver and default guards for change_signature (#1533, 9/9) by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/2167
- perf(java): return the registry trie result instead o
- Dependency Updates: Several dependencies have been updated, including
- v0.4.52026-10-30 · 2026-10-30 11:01 UTC
查看更新说明
⚠️ Breaking changes
A repository's
.cgr.mdno longer reaches the agent's system prompt until you approve its content.cgr startandcgr optimizeshow the file and ask (the default is no), and remember the approval until the file changes.cgr start -aand the MCP server'sask_agentcannot ask, so they skip a.cgr.mdyou have not approved and log why. Your own~/.cgr.mdloads as before.To keep the old behaviour, approve each repository's file once in
cgr start, or exportCGR_TRUST_PROJECT_INSTRUCTIONS=truein your shell or CI environment to load every repository's file without asking (a.envfile cannot set it, since it usually belongs to the repository). Use the variable only for repositories you control, such as CI on your own code.Existing installs: nothing is approved yet, so the first
cgr startin each repository with a.cgr.mdasks once. Until then, non-interactive runs work without the file. See Project instructions.Highlights
- Dependencies Updated: Several dependencies have been updated to the latest versions, including neo4j, qdrant-client, and memgraph/lab, bringing in bug fixes and new features.
- Rust Performance Improvements: Optimisations have been made to the Rust indexer, including hashing definitions and computing interface fingerprints more efficiently.
- CLI Enhancements: The
change_signatureoperation is now accessible through the CLI and MCP, with improved handling for partial graphs. - Security Focus: Enhanced security measures include approving .cgr.md files, prompting before reading credential files, and annotating MCP tools.
- Graph-RS Testing: Expanded fuzz testing for the Graph-RS component with new targets and improved input decoding.
- MiniMax Models Added: Current MiniMax text models have been included.
- CI Improvements: Various CI updates include running CodeQL on all pull requests and streamlining cache management.
What's Changed
- fix(build): pin the last pip installs and base images by hash by @vitali87 in https://github.com/vitali87/code-graph-rag/pull/3449
- build(deps): bump neo4j from 6.3.1 to 6.4.1 by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3470
- build(deps-dev): bump semgrep from 1.181.0 to 1.182.1 by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3469
- build(deps): bump qdrant-client from 1.19.1 to 1.20.0 by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3468
- build(deps-dev): bump ruff from 0.16.10 to 0.17.2 by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3467
- build(deps): bump regex from 2026.9.10 to 2026.9.29 by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3466
- build(deps): bump memgraph/lab from 3.13.2 to 3.14.0 in /codebase_rag by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3463
- build(deps): bump qdrant/qdrant from v1.19.2 to v1.20.0 in /codebase_rag by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3462
- build(deps): bump golang from 1.27.2-trixie to 1.27.3-trixie in /.oss-scanner by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3460
- build(deps): bump google/osv-scanner-action/.github/workflows/osv-scanner-reusable-pr.yml from 2.6.0 to 2.7.0 by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3454
- build(deps): bump actions/setup-python from 7.0.0 to 7.1.0 by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3453
- build(deps): bump astral-sh/setup-uv from 10.3.0 to 10.3.2 by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3452
- build(deps): bump github/codeql-action/upload-sarif from 4.39.0 to 4.39.1 by @dependabot[bot] in https://github.com/vitali87/code-graph-rag/pull/3451
- chore: ignore every .env.* file except .env.example by @vitali87 in https://github.com/vitali87/code-graph-r
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Code-Graph-RAG
Code-Graph-RAG parses a multi-language codebase with Tree-sitter, sharpened by compiler-grade frontends and runtime traces where available, builds a knowledge graph of its structure in an embedded graph database that needs no server, and lets you query, edit, and optimise that code in plain English. It works across a monorepo of mixed languages under one unified graph schema.
Latest News 🔥
- Continuous Integration Improvements: Enhanced release cadence tracking and ensured accurate green status for deferred releases.
- Code Quality & Clarity: Resolved several code style and correctness issues including foreach loop variable typing and Python method receiver handling.
- Build Process Refinement: Reduced the default install package count and improved makefile functionality for host/port watching.
- Feature Control: Prevented the use of
--no-endpoint-rootswhen endpoint data is absent.
See NEWS.md for the full history.
What It Does
Point Code-Graph-RAG at a repository and it reads every source file, extracts functions, classes, methods, modules, and the relationships between them, and stores the result as an interconnected graph. Once the graph exists you can:
- Ask questions about the codebase in natural language and get answers grounded in the real structure.
- Retrieve the actual source of any function, class, or method by name or by intent.
- Edit code through the agent with AST-based surgical patching and a diff preview before anything changes.
- Optimise code against language best practices or your own coding standards.
- Find dead code by walking call and reference edges from entry points.
- Search and rewrite structurally by AST pattern with ast-grep.
- Overlay runtime behaviour: trace a test run (or pull production eBPF profiles) with
cgr traceand merge the calls that actually happened into the graph, exposing dispatch that static analysis cannot see.
How It Works
The system has two components:
- Multi-language parser. A Tree-sitter based parser reads the codebase and ingests functions, classes, methods, modules, and their relationships into the graph under a single language-agnostic schema. Where a toolchain is available, compiler-grade frontends layer exact facts on top (libclang for C/C++,
go/typesfor Go, and opt-in Roslyn,javacand Jedi for C#, Java and Python), and dynamic tracing merges calls observed at runtime. Tree-sitter stays the backbone: a trace only sees code that ran, and a compiler frontend only covers what its toolchain can build. - RAG system (
codebase_rag/). An interactive CLI that turns natural language into Cypher queries, retrieves matching code, and drives AI-powered editing and optimisation.
Source Code -> Tree-sitter Parser -> AST Analysis -> Knowledge Graph
|
User Query -> AI Model (Cypher Gen) -> Cypher Query -> Graph Results -> Response
The graph is stored in an embedded SQLite file by default. Memgraph and Neo4j are opt-in backends that run the same Cypher; Graph Backends compares them.
See the Architecture Overview and Graph Schema for the full picture.
Supported Languages
Python, TypeScript, TSX, JavaScript, Rust, Go, Java, C, C++, C#, PHP, Lua, Dart, and Julia are fully supported. Scala is in development, and Ruby, Kotlin, Swift, Elixir, Haskell, Solidity, Bash, and Nix have structural support (modules, functions, classes where the language has them, and imports) through the pluggable ast-grep tier. See the Language Support matrix for per-language capabilities.
Installation
cgr is published to PyPI. Install it system-wide with the treesitter-full (tree-sitter grammars), ast-grep (Ruby, Kotlin, Swift, Elixir, Haskell, Solidity, Bash, Nix) and semantic (vector search) extras:
# with uv (recommended)
uv tool install "code-graph-rag[treesitter-full,ast-grep,semantic]"
# or with pipx
pipx install "code-graph-rag[treesitter-full,ast-grep,semantic]"
Which version am I getting?
Three version lines exist and they intentionally differ:
| where | what it tracks |
|---|---|
| git tags | every version, one per merge |
| GitHub Releases (binaries, signatures) | every 50th version, plus any security fix, breaking change or merge labelled release now |
| PyPI | every 50th version, plus any security fix, breaking change or merge labelled release now |
So the newest tag on main usually runs ahead of the newest release, often by
tens of patch versions; they coincide only just after a release. Nothing is
stuck, the cadences differ by design. A security fix, a breaking change or a
merge a maintainer labels release now does NOT wait for the cadence: each ships
a release and a PyPI upload immediately.
uv tool install and pipx install give you the newest PyPI version, which is the
newest RELEASE, not the newest tag. Interim tags exist so every merge is
addressable; binaries and PyPI uploads follow the cadence above.
To run code newer than the latest release, install from git:
uv tool install "code-graph-rag[treesitter-full,ast-grep,semantic] @ git+https://github.com/vitali87/code-graph-rag@main"
To upgrade an existing install, run uv tool upgrade code-graph-rag (with pipx, pipx upgrade code-graph-rag, or pipx reinstall code-graph-rag for a git install). Upgrade covers the other install methods.
You also need Python 3.12+ and ripgrep. The graph lives in an embedded SQLite file by default, so there is no database server to run: no Docker and no cmake. Memgraph and Neo4j remain available as opt-in backends (Graph Backends). Full prerequisites, source installs, and environment setup are in the Installation guide.
[!NOTE] cgr requires its native extension,
cgr-graph-rs, which ships for CPython 3.12 or newer on Linux (x86_64, aarch64), macOS and Windows x64, so it installs on those platforms only. Older system interpreters (Debian Bookworm ships 3.11) need the interpreter pinned explicitly; see Installation for the commands.
Quick Start
# 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
The graph is written to ~/.cgr/graph.sqlite (set SQLITE_GRAPH_PATH to move it).
To use Memgraph instead, install the driver with the memgraph extra, set
GRAPH_BACKEND=memgraph, and start the packaged Memgraph + Qdrant stack with
cgr daemon up.
Repeat the first command for each repository you want indexed; the graph is
shared, and syncing one project leaves the others alone. To start over from an
empty graph, add --clean — it deletes every project in the shared graph,
not just this one, and asks for confirmation first when other
projects would be destroyed.
A default index leaves out the opt-in capture groups; add them with --capture or CGR_CAPTURE.
The Quick Start guide walks through parsing, querying, and exporting in five minutes.
MCP Server
Code-Graph-RAG runs as an MCP server so Claude Code and other MCP clients can query and edit your codebase directly. See the MCP Server guide for setup.
Documentation
Getting Started
User Guide
- CLI Reference
- Interactive Querying
- Code Optimisation
- Dead Code Detection
- Dynamic Call Tracing
- Graph Export
- Real-Time Updates
- C/C++ Semantic Mode
- MCP Server
- Porting Between Languages
Architecture
Python SDK
Advanced
Enterprise Services
Code-Graph-RAG is open source and free to use. For organisations that need more, we offer fully managed cloud-hosted solutions and on-premise deployments:
- Cloud-Hosted Deployment: Managed cloud infrastructure for both the graph database and the AI agent connection. Zero infrastructure overhead, so we handle scaling, updates, and availability while your team focuses on building.
- On-Premise & Air-Gapped Deployment: Deploy Code-Graph-RAG entirely within your own environment, including air-gapped networks. Full data sovereignty for regulated industries and security-sensitive organisations.
We also offer custom development, integration consulting, technical support contracts, and team training.
View plans & pricing at code-graph-rag.com
Contributing
Please see CONTRIBUTING.md for contribution guidelines. Good first PRs come from the TODO issues.
Support
For issues or questions, check the Troubleshooting guide first, then open an issue.
If cgr is useful to you, please consider pledging support on GitHub Sponsors. cgr links the page under cgr --version and, in a terminal, after most commands finish; set CGR_SPONSOR_PLEDGE=false to hide that line.
Accessibility
ACCESSIBILITY.md describes what cgr and its documentation support for people using assistive technology or alternative settings, the known limitations and their workarounds, and how to report a barrier.
License
MIT. See LICENSE.
Third-party components and their licences are credited on the Credits page.