Repolode
vitali87

vitali87/code-graph-rag

Indexes multi-language codebases into a knowledge graph so you can query, search, and edit code in plain English via an AI agent or MCP server.

Stars
5,267
Forks
702
Open issues
589
Last commit
1 hour ago

What is it?

Code-Graph-RAG parses a repository with Tree-sitter, extracting functions, classes, methods, modules, and the relationships between them into a graph. The graph is stored in an embedded SQLite file by default, so no database server is needed; Memgraph and Neo4j are available as opt-in backends.

Once indexed, you can ask questions in natural language, which the tool turns into Cypher queries against the graph, and retrieve the actual source of any function or class. The agent can also make AST-based edits with a diff preview, optimise code, find dead code from entry points, and search or rewrite code by AST pattern with ast-grep.

The project also runs as an MCP server so Claude Code and other MCP clients can query and edit the codebase directly. Python 3.12+ and ripgrep are required for installation, and the package is published on PyPI.

Key features

  • 01Parses multiple languages, including Python, TypeScript, Rust, Go, Java, C/C++ and C#, into one graph schema.
  • 02Answers natural-language questions by generating Cypher queries against the code graph.
  • 03Retrieves source code for functions, classes, and methods by name or intent.
  • 04Applies AST-based code edits with a diff preview before changes are written.
  • 05Detects dead code by walking call and reference edges from entry points.
  • 06Runs as an MCP server for Claude Code and other MCP clients.

Use cases

  • Onboarding onto a large monorepo and asking how modules and functions connect.
  • Letting an AI coding assistant in Claude Code work with grounded structural context.
  • Auditing a mixed-language codebase for unused functions before cleanup.
  • Running AST-pattern searches and rewrites across several languages.

Topics

FAQ

What is code-graph-rag?
Indexes multi-language codebases into a knowledge graph so you can query, search, and edit code in plain English via an AI agent or MCP server. Code-Graph-RAG parses a repository with Tree-sitter, extracting functions, classes, methods, modules, and the relationships between them into a graph. The graph is stored in an embedded SQLite file by default, so no database server is needed; Memgraph and Neo4j are available as opt-in backends.
Is code-graph-rag free to use? What license does it have?
code-graph-rag is open source under the MIT license. Check the license terms before using it in commercial products.
Is code-graph-rag still maintained?
Actively maintained. The last commit to code-graph-rag was on Oct 19, 2026.
What can I use code-graph-rag for?
Onboarding onto a large monorepo and asking how modules and functions connect. Letting an AI coding assistant in Claude Code work with grounded structural context. Auditing a mixed-language codebase for unused functions before cleanup. Running AST-pattern searches and rewrites across several languages.
Where can I get code-graph-rag?
The source code and installation instructions are on GitHub: https://github.com/vitali87/code-graph-rag

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects