Code-Graph-RAG reads a multi-language codebase, builds a Memgraph-backed knowledge graph via Tree-sitter, and enables querying, editing, and optimization of code using natural language and AST-based patches.
Collecting history — the radar snapshots this repo daily. The trend line appears after 3 days of data (1 so far).
What it is
Code-Graph-RAG parses a multi-language codebase with Tree-sitter, builds a knowledge graph of its structure in Memgraph, 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.
How it works
Two components:
- Multi-language parser: Tree-sitter based parser ingests functions, classes, methods, modules, and relationships into Memgraph.
- 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 -> Memgraph Knowledge Graph | User Query -> AI Model (Cypher Gen) -> Cypher Query -> Graph Results -> Response
See Architecture Overview and Graph Schema for details.
Getting started
Installation is PyPI-based. Install with extras:
# with uv (recommended)
uv tool install "code-graph-rag[treesitter-full,semantic]"
# or with pipx
pipx install "code-graph-rag[treesitter-full,semantic]"
You also need Docker (for Memgraph), cmake, and ripgrep. Full prerequisites and environment setup are in the Installation guide.
Quick Start:
# Start the packaged Memgraph + Qdrant stack (no compose file needed)
cgr daemon up
# Parse a repository into the graph, then query it
cgr start --repo-path /path/to/repo --update-graph --clean
cgr start --repo-path /path/to/repo
Recent releases
Latest 5 releases include:
- v0.0.534 (2026-08-02): Automated tagging and release generation improved with enhanced workflow triggering; Docker build process updates include Git installation in the Docker builder stage.
- v0.0.484 (2026-07-23): Cross-project endpoint linking resolving client request URLs to server routes across projects; gateway and proxy prefix rewrites; options-object routing.
- v0.0.421 (2026-07-21): C# enhancements to Roslyn frontend with exact overloads, extension binding, and LINQ query call fixes.
- v0.0.345 (2026-07-14): Security update addressing path traversal vulnerability in MCP read_file tool; C++ frontend updates.
- v0.0.246 (2026-07-07): Binary support via PyInstaller; CI improvements including a binary smoke-test.
Traction
Stars: 2510 Forks: 413 Open issues: 42
License
MIT
Getting started (concise commands)
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 (no compose file needed)
cgr daemon up
# Parse a repository into the graph, then query it
cgr start --repo-path /path/to/repo --update-graph --clean
cgr start --repo-path /path/to/repo






