(:Project)

Code-Graph-RAG

Code-Graph-RAG is an open source tool that parses a multi-language codebase into one knowledge graph, which AI agents query and edit instead of grepping and patching text.

Built by
me
Since
June 2025
Language
Python
Licence
MIT
GitHub stars
5,400+ as of 28 November 2026

WebsiteDocsGitHubPyPI

Why a graph

An agent that works on code as text has to guess. It greps for a name, reads whatever matches and patches strings. In a large monorepo that guess is expensive and often wrong, because the call that matters goes through an interface, a re-export or another language.

Code-Graph-RAG reads every source file once and stores functions, classes, methods, modules and the relationships between them as one graph. A question such as "what calls this function" becomes a graph query with an exact answer.

What you can do with it

How it works

A Tree-sitter parser reads the codebase and writes it into the graph under a single schema shared by every language. Where a toolchain is available, compiler frontends add exact facts on top. That means libclang for C and C++, go/types for Go, and opt-in Roslyn, javac and Jedi for C#, Java and Python.

The graph lives in an embedded database, so there is no server to run. An interactive CLI turns a question in plain English into a graph query and answers from the result.

Built for AI agents

Code-Graph-RAG runs as an MCP server, so Claude Code and other MCP clients can query and edit a codebase through it. Edits go through the graph edit algebra. The agent resolves a name, transforms the graph, reads the delta, then commits or reverts.

Install

uv tool install "code-graph-rag[treesitter-full,ast-grep,semantic]"

Then index a repository and start asking.

cgr start --update-graph
cgr start

The documentation has the quick start and the MCP setup.

Languages

Python, TypeScript, TSX, JavaScript, Rust, Go, Java, C, C++, C#, PHP, Lua, Dart and Julia are fully supported. Ruby, Kotlin, Swift, Elixir, Haskell, Solidity, Bash and Nix have structural support, and Scala is in development.

Questions people ask

Who created Code-Graph-RAG?

I did. I started Code-Graph-RAG in June 2025 and I still maintain it.

Is Code-Graph-RAG open source?

Yes. I release it under the MIT licence, and the source is on GitHub at github.com/vitali87/code-graph-rag.

Does Code-Graph-RAG need a graph database server?

No. By default it stores the graph in an embedded SQLite file. Memgraph and Neo4j are opt-in backends.

Which languages does Code-Graph-RAG support?

It fully supports Python, TypeScript, TSX, JavaScript, Rust, Go, Java, C, C++, C#, PHP, Lua, Dart and Julia. Several more have structural support.

Can Claude Code use Code-Graph-RAG?

Yes. It runs as an MCP server, so Claude Code and other MCP clients can query and edit a codebase through it.