OpenSource-Hub
C

code-graph-rag

SHA-256
3.1k stars·Developer Tools·SHA-256 checksum verified

Code-Graph-RAG is an AI-powered RAG tool that parses multi-language codebases into a knowledge graph, enabling semantic code search, dead-code detection, and AI-assisted editing via CLI or MCP.

Turn a multi-language codebase into a knowledge graph, query and edit it using natural language with AI assistance.

Core Features

  • Multi-language parsing with Tree-sitter (Python, TS/JS, Rust, Go, Java, C/C++, etc.)
  • Knowledge graph storage in Memgraph with a unified language-agnostic schema
  • Natural language queries that generate Cypher automatically
  • AST-based structural search and replace across the whole codebase
  • Dead code detection by walking call/reference edges from entry points

What It Can't Do

  • Requires Docker to run Memgraph. Parsing very large monorepos can be slow and memory-intensive. The --clean flag wipes the entire shared graph across all projects—use with caution. Language support varies (e.g., Ruby only has structural support via ast-grep); check the language matrix before relying on specific features.

Use Cases

  • Understanding and querying large monorepos with mixed languages
  • Safe refactoring, dead code cleanup, and AI-assisted code modernization

Detailed Introduction

Code-Graph-RAG is an open-source RAG (Retrieval-Augmented Generation) system designed specifically for large monorepos with mixed programming languages. Using Tree-sitter, it parses source code into an AST, extracts functions, classes, methods, modules, and their relationships, and stores the result as a knowledge graph in Memgraph. Users interact with the codebase through a CLI or an MCP server, asking questions in plain English. The AI model converts the query into Cypher, retrieves the relevant graph nodes, and returns grounded answers. Beyond Q&A, the tool offers AST-based structural search and replace (via ast-grep), dead code detection by traversing call/reference edges, and AI-driven code optimisation against best practices. Unlike tools like GitHub Code Search or Sourcegraph, Code-Graph-RAG provides a language-agnostic graph schema that unifies all languages, making cross-language refactoring and semantic understanding significantly easier. It also integrates with MCP, so Claude Code and other agents can directly edit code with previewed diffs.

Tags

RAG知识图谱代码搜索AI 编程助手MCP

Getting Started

1

Download installer

Click the button above to download the installer for your system

2

Install the software

Double-click the downloaded installer and follow the prompts

3

Step 1: Install the CLI via uv (Docker is required for Memgraph)

4

Step 2: Run cgr start on a repository to parse and index it

5

Step 3: Launch the interactive CLI to query the codebase, or configure the MCP server for AI clients

Install Guide
  1. Step 1: Install the CLI via uv (Docker is required for Memgraph)
  2. Step 2: Run cgr start on a repository to parse and index it
  3. Step 3: Launch the interactive CLI to query the codebase, or configure the MCP server for AI clients
File Integrity

SHA-256 checksum verified

Checksum extracted from GitHub official Release page

SHA256 Checksum

b07e6bb03ccf02d4bc69efd482366a340da8606a2ba2a23c53ac3545e0dbf7b3

This checksum is extracted from the GitHub Release page. Verify file integrity after download.

All SHA-256 checksums on this platform are extracted from the project's official GitHub Release page, without any modification. You can independently verify them on the GitHub Releases page.

Open Source Transparency

View GitHub Source
Environment Guide

Uninstall Info

Uninstall: remove the Python package (pipx uninstall or uv tool uninstall), then stop the Docker daemon with 'cgr daemon down' if you started containers with the built-in stack.

No Extra Dependencies

Ready to use after download. No additional runtime required.

Project Info
LicenseMIT
Last Updated2026-08-10T04:27:21Z
GitHub RepositoryOfficial Website

Similar Projects