TopGit
GitHub Repo Review

Code-Graph-RAG: Query Your Codebase Like a Graph

vitali87/code-graph-rag
CTopGit review image for vitali87/code-graph-rag
Review by Topgit.dev for vitali87/code-graph-rag, with GitHub repository stats and README context.
Quick verdict

Code-Graph-RAG is worth the setup if you're working in a mixed-language monorepo and tired of AI tools that only see one file at a time — the Memgraph-backed graph keeps call and reference edges intact, so queries return the actual structure instead of a guess from nearby text. Skip it if you just want a single-file autocomplete assistant; the Docker/cmake/ripgrep setup is real overhead for that use case.

Stars
★ 5.2k
Forks
⑂ 682
Language
Python
License
MIT
Topic
Updated
Sep 2026
Homepage
GitHub

Understanding Code-Graph-RAG

Code-Graph-RAG is a CLI tool and Python library that turns a codebase into a queryable knowledge graph: a Tree-sitter AST parser reads every function, class, and module across a mixed-language repo into Memgraph, with an optional Qdrant semantic-search layer alongside it. From there you ask questions in plain English, and an interactive RAG layer translates them into Cypher queries against that graph.

Core Capabilities

  • Tree-sitter parsing across Python, TypeScript, TSX, JavaScript, Rust, Go, Java, C, C++, C#, PHP, Lua, and Dart, stored in one Memgraph knowledge graph.
  • Natural-language querying: the RAG layer turns a plain-English question into a Cypher query against the graph and returns grounded answers.
  • AST-based code editing with a diff preview before anything is written to disk.
  • Dead code detection by walking call and reference edges outward from entry points.
  • Structural search and replace via ast-grep, exposed as agent tools for whole-codebase AST-pattern rewrites.
  • Data-flow taint tracing (FLOWS_TO edges) tracks values through assignments, function calls, and I/O sinks, offering coverage for C#, Java, C, and Go.
  • The graph can be directly queried and edited by Claude Code and other MCP clients via an MCP server.
How this repository's GitHub stars have grown over time. Source: star-history.com.View the star history

Practical Applications

  • Getting oriented in a large, unfamiliar monorepo that mixes several languages under one codebase.
  • Answering structural questions in plain English instead of grepping — e.g. what calls a given function across language boundaries.
  • AI-assisted refactoring and dead-code cleanup with a diff preview instead of blind find-and-replace.
  • Wiring Claude Code or another MCP client directly into the codebase graph for agentic edits.
  • Tracing how a value flows from input to an I/O sink for a security-focused data-flow review.

Installation Steps

Code-Graph-RAG (the cgr CLI) is published to PyPI. Install it with the treesitter-full and semantic extras — uv tool install "code-graph-rag[treesitter-full,semantic]" (recommended) or pipx install "code-graph-rag[treesitter-full,semantic]". You also need Docker (Memgraph runs in a container), cmake, and ripgrep installed separately; the README points to a full installation guide for source installs and environment setup.

Getting Started with a Repository

Start the packaged Memgraph and Qdrant stack with cgr daemon up — no compose file needed. Then parse a repository into the graph with cgr start --repo-path /path/to/repo --update-graph, and query it afterward with cgr start --repo-path /path/to/repo. Repeat the parse step for each additional repository; the graph is shared across all of them, and syncing one leaves the others untouched. Adding --clean wipes every project in the shared graph, not just the one you're pointed at, and asks for confirmation first when other projects would be destroyed.

Strengths

  • Parses 12 languages (Python, TypeScript, TSX, JavaScript, Rust, Go, Java, C, C++, C#, PHP, Lua, Dart) into one shared graph schema — most single-language tools don't even attempt that breadth.
  • Queries return the actual call/reference structure from the graph, not just the nearest-sounding text chunk.
  • AST-based edits come with a diff preview before anything touches disk, instead of a blind patch.
  • Ships an MCP server out of the box, so Claude Code and other MCP clients connect without custom glue code.
  • MIT-licensed and free to run yourself; the paid tiers are optional, not a gate on the open-source core.

Considerations and Setup Complexity

  • Setup pulls in Docker, cmake, and ripgrep on top of the Python package itself — more moving parts than a pip-install-and-go tool.
  • Scala support is still in development, and Ruby only has structural support through the ast-grep tier rather than the full parser treatment the other 12 languages get, per the README's own language matrix.
  • The knowledge graph is shared across every repo you index, so --clean resets everything at once unless you catch the confirmation prompt.
  • The open-source core is self-hosted only — cloud-hosted and on-premise deployment options are sold separately as enterprise services.

Alternative Approaches

Frequently Asked Questions

What programming languages does Code-Graph-RAG support?

Code-Graph-RAG fully supports Python, TypeScript, TSX, JavaScript, Rust, Go, Java, C, C++, C#, PHP, Lua, and Dart. Scala is still in development, and Ruby currently has structural support only, through a separate ast-grep-based tier rather than the full parser treatment the other languages get.

What database does Code-Graph-RAG use for its knowledge graph?

Code-Graph-RAG stores its knowledge graph in Memgraph, run locally via Docker as part of the packaged daemon stack alongside Qdrant for semantic/vector search.

Can Code-Graph-RAG analyze a monorepo?

Code-Graph-RAG is built specifically for monorepos: each repository you parse with cgr start --update-graph joins one shared graph, so relationships across mixed-language projects stay queryable together.

Does Code-Graph-RAG offer commercial support or managed services?

Code-Graph-RAG's core is open source and free to self-host. Beyond that, the maintainers sell cloud-hosted deployment, on-premise/air-gapped deployment, and custom integration or training as separate enterprise services, per the README.

What is the license for Code-Graph-RAG?

Code-Graph-RAG is released under the MIT license, per the LICENSE file in the repository.

How does Code-Graph-RAG enable code editing?

Code-Graph-RAG's agent edits code through AST-based surgical patching rather than freeform text replacement, and shows a diff preview before any change is written to disk.

The problem it solves

Most AI coding assistants read a repository as a pile of text chunks ranked by embedding similarity, which works for a single file but breaks down across a mixed-language monorepo where a Python service calls a Go microservice that shares a schema with a TypeScript frontend — the actual call and import edges get lost. Code-Graph-RAG keeps that structure by parsing everything into one graph, so a query about what calls a given function returns the real answer instead of the nearest-sounding text.

Who should try it — and who should skip

Reach for Code-Graph-RAG if you maintain a real multi-language monorepo and want an AI agent that understands cross-file structure, not just embeddings — especially if you're already using Claude Code or another MCP client. Skip it if you work in a single small repo where a normal code-search or single-file assistant already does the job; standing up Memgraph via Docker is not worth it at that scale.

Related repositories

Source & attribution

Facts and quotes sourced from the vitali87/code-graph-rag GitHub repository and its README.

GitHub data · last synced Aug 11, 2026Reviewed by Henry
Back to TopGit

Curious whether code-graph-rag is right for you?

Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about code-graph-rag.

GitHub