Code-Graph-RAG is a multi-language codebase analysis tool that constructs a unified knowledge graph to enable natural language querying, editing, and optimization. The system utilizes Tree-sitter as its primary parsing backbone to extract functions, classes, and modules into a Memgraph database under a language-agnostic schema. To increase precision, it layers compiler-grade frontends—such as libclang for C/C++, go/types for Go, and Roslyn for C#—on top of the static analysis. It also supports dynamic analysis by merging runtime traces, such as eBPF profiles, into the graph to resolve dispatch behaviors invisible to static tools. The architecture supports a wide array of languages, including Python, TypeScript, Rust, and Go, with structural support for others via ast-grep. Users can interact with the codebase through a CLI that converts natural language into Cypher queries or via an MCP server for integration with agents like Claude Code. Advanced features include AST-based surgical patching for code editing, dead-code detection by walking call edges, and a pluggable backend support for Neo4j. The tool requires Python 3.12+ and can be deployed via PyPI or Docker.

Read original