Primary question: Does graph-based code understanding give meaningfully better answers than file-based RAG for your specific monorepo complexity?
RepoDaily adoption score
RepoDaily rates this as 91/100 (strong) for adoption: evidence, installation path, production risk, differentiation, license clarity, and AI/agent fit are scored from the article sources and adoption notes.
5 source(s) across 4 source category/categories, plus a RepoDaily-specific evidence module when available.
5 workflow step(s), 5 next-action step(s), and 5 command/install signal(s) were detected.
Trending momentum is +682 stars, with maintenance/release/issue signals counted when present.
Risk is marked medium, with 5 security note(s) and 4 explicit skip condition(s).
3 opportunity lens item(s), 4 alternative(s), and 4 type-specific section(s) support differentiation.
License source or license wording is present.
7 AI/agent-related signal(s) were detected in the article text and metadata.
Project overview
Code-Graph-RAG is an open-source retrieval-augmented generation system that treats a codebase as a queryable knowledge graph rather than a pile of text files. It uses Tree-sitter to produce language-agnostic ASTs for Python, TypeScript, JavaScript, Rust, Java, C++, Go, Lua, and now Ruby, then stores the resulting entities—modules, functions, classes, and their relationships—in Memgraph. From there, an LLM generates Cypher queries in response to natural-language questions, retrieves actual source snippets, and can even apply AST-targeted edits with visual diff previews.
The project differentiates itself from conventional file-chunking RAG by modelling inter-code relationships directly. Dead code detection identifies functions unreachable from any entry point; dependency analysis reads pyproject.toml to map imports; semantic search uses UniXcoder embeddings to find functions by intent rather than by keyword. These capabilities make it closer to a static-analysis platform than a documentation chatbot.
Version 0.0.603 is distributed on PyPI under the MIT licence and requires Python 3.12 or higher. It ships with an MCP server for integration with Claude Code, CLI entry points (`cgr` and `code-graph-rag`), and a daemon-based architecture that keeps the graph updated in real time via a file watcher. The maintainer also offers managed cloud and on-premise enterprise deployments through code-graph-rag.com.
Why it is trending now
- 682 stars in the trend period, ranking 8th overall on 2026-08-11, signalling strong developer appetite for graph-based code intelligence tools.
- Ruby support was recently added through a pluggable ast-grep tier that can introduce a new language from a single YAML pattern file, emitting Module, Function, and Class nodes.
- MCP server integration targets Claude Code users directly, placing the tool in the fast-growing model-context-protocol ecosystem alongside other developer productivity agents.
- Multi-language monorepo support covering nine or more languages under one unified graph schema addresses a real gap: most code-search tools handle one ecosystem well but struggle with polyglot repositories.
Problem it solves
- Conventional file-chunking RAG loses structural context—call graphs, inheritance chains, and cross-file dependencies are invisible when code is split into arbitrary text windows.
- Static analysis tools are typically language-specific; a monorepo with Python services, TypeScript frontends, and Rust binaries requires separate tooling per language.
- Dead code accumulates silently in large repositories, increasing maintenance burden and attack surface without clear visibility.
- Natural-language code queries usually return approximate matches rather than precise structural answers about which functions call what, where a class is defined, or which paths are reachable.
- Semantic search by keyword misses functions that implement the same intent using different vocabulary, making cross-team code reuse difficult.
How it works
- Install the package from PyPI: `pip install code-graph-rag`. The CLI registers two entry points (`cgr` and `code-graph-rag`), both pointing to `codebase_rag.cli:app`.
- Start the Memgraph backend: `cgr daemon up`. This brings up the graph database that stores the codebase structure.
- Index a repository: `cgr start --repo-path ./my-project --update-graph`. Tree-sitter parsers produce ASTs for each supported language; the resulting modules, functions, classes, and relationships are written to Memgraph.
- Query or edit through natural language. The LLM (Google Gemini, OpenAI, or Ollama) generates Cypher queries against the graph, retrieves matching source code snippets, and can apply AST-based edits with visual diff previews.
- For MCP integration, connect Claude Code (or another MCP client) to the running server, enabling in-editor codebase questions, optimisation suggestions, and shell command execution.
Product demo and interface preview


Architecture: From Source Text to Queryable Graph
Code-Graph-RAG's pipeline has three distinct layers. The parsing layer uses Tree-sitter (pinned at 0.25.2) to produce ASTs for each supported language. The project maintains forked versions of tree-sitter-c and tree-sitter-cpp because upstream tree-sitter-c drops declarations after a `#define` whose value embeds a block comment (documented as issue #555). The forks carry a `repeat(preproc_arg)` fix and are pinned to specific commits in pyproject.toml.
The storage layer is Memgraph, accessed through pymgclient 1.5.1+. The graph schema is unified across languages: a Python function and a Rust function both become Function nodes with consistent relationship types. This design choice means cross-language queries—for example, 'which entry points eventually call this shared utility'—work without per-language adapters.
The intelligence layer handles Cypher generation via pydantic-ai 2.0.0+, supporting Google Gemini, OpenAI, and Ollama as backing models. Tokenisation uses tiktoken 0.12.0+. Semantic search is an optional layer powered by UniXcoder embeddings with qdrant-client, torch, and transformers available through the `[semantic]` extra. The `watchdog` library provides real-time file watching to keep the graph updated during active development.
Command Surface and Package Configuration
- `cgr daemon up` — starts the Memgraph backend via the bundled docker-compose.yaml.
- `cgr start --repo-path ./my-project --update-graph` — indexes a repository and populates or refreshes the knowledge graph.
- Two CLI aliases registered in pyproject.toml: `code-graph-rag` and `cgr`, both calling `codebase_rag.cli:app`.
- Optional extras: `pip install code-graph-rag[treesitter-full]` for all language grammars; `[semantic]` for torch + transformers + qdrant; `[milvus]` for pymilvus with milvus-lite; `[ast-grep]` for the pluggable YAML-based language tier.
- Pre-commit hooks are mandatory for contributors: `make dev` runs `pre-commit install` and `pre-commit autoupdate`. Commits must pass checks; `--no-verify` is explicitly prohibited.
Integration Surface: MCP, Claude Code, and LLM Backends
The MCP server integration is the primary delivery mechanism for AI-assisted code work. Claude Code connects to the running Code-Graph-RAG server and gains the ability to answer structural questions about the codebase, retrieve source snippets, execute shell commands, and propose AST-targeted edits. The MCP dependency is pinned at version 1.28.1+.
Cypher generation supports three LLM providers out of the box: Google Gemini, OpenAI, and Ollama. The Ollama path is significant for security-conscious organisations because it allows fully local inference without sending source code to external APIs. The pydantic-ai framework (2.0.0+) acts as the abstraction layer between these providers and the graph query logic.
Maintenance and Security Posture
- Version 0.0.603 is classified as 'Development Status :: 4 - Beta' in pyproject.toml classifiers, indicating the API and feature set are not yet stable.
- CI runs through GitHub Actions (ci.yml workflow), with Codecov coverage tracking and SonarCloud quality gate checks.
- OpenSSF Scorecard and OpenSSF Best Practices badges are present, indicating participation in supply-chain security programmes (project ID 13757 on bestpractices.dev).
- A SkillsLLM Security Check badge is linked, pointing to skillsllm.com/security-check for the repository.
- The README contains a comment noting the GitHub account was previously suspended, causing shields.io badges to return 'repo not found' during that period. This is a recoverability and continuity risk for downstream dependents.
- Forked tree-sitter-c and tree-sitter-cpp grammars are pinned to specific commits; the pyproject.toml notes these overrides should be dropped once upstream releases the fix for issue #555.
Who should pay attention?
Good fit if
- Your monorepo spans three or more programming languages and conventional search tools return shallow results.
- You use Claude Code or another MCP-compatible agent and want it to understand your codebase structurally rather than as flat text.
- Dead code detection and dependency analysis are ongoing concerns in your repository's maintenance cycle.
- Your team needs on-premise or local LLM inference (via Ollama) for code analysis due to data residency requirements.
Skip for now if
- Your codebase is a single language and under 50,000 lines—language-specific linters and IDE search will be faster and more mature.
- You cannot run Memgraph or Docker in your environment, as the daemon-based architecture depends on it.
- Your team lacks access to any supported LLM provider (Gemini, OpenAI, or Ollama), which is required for Cypher generation.
- You need production-grade stability—the beta classification and 0.0.x versioning signal that breaking changes are expected.
Risks and cautions
The project is functionally capable but remains in beta with a 0.0.x version, depends on forked grammar packages, and requires Memgraph plus an LLM provider to deliver value.
- Version 0.0.603 with 'Development Status :: 4 - Beta' classifier means APIs and graph schema may change without deprecation cycles.
- Forked tree-sitter-c and tree-sitter-cpp are pinned to specific commits, creating a maintenance dependency on the maintainer's GitHub forks until upstream issue #555 is resolved.
- The README documents a past GitHub account suspension that broke badge rendering and potentially package availability, raising continuity concerns.
- Core functionality requires a running Memgraph instance and network access to an LLM provider, adding operational complexity beyond a typical pip install.
- Semantic search features require the optional `[semantic]` extra, which pulls in torch and transformers—significant dependencies that may conflict with existing environments.
- The project uses defusedxml 0.7.1+ for XML parsing, which mitigates common XML external entity (XXE) attacks.
- Shell command execution is a documented feature ('Shell Command Execution for running tests and CLI tools'), which means the MCP server can execute arbitrary commands—access control and sandboxing are the operator's responsibility.
- Ollama support enables fully local inference, eliminating the need to transmit source code to external LLM APIs.
- OpenSSF Scorecard and OpenSSF Best Practices participation (project 13757) indicate awareness of supply-chain security practices.
- Pre-commit hooks are mandatory for all contributors, and inline comments are explicitly prohibited by contribution policy, reducing the risk of misleading or stale documentation in code.
Alternatives to compare
| Approach | When to use | Trade-off |
|---|---|---|
Sourcegraph Cody | You want a mature, enterprise-grade code search and AI assistant with broader language coverage and hosted infrastructure. | Freemium with paid tiers; cloud-hosted or self-hosted enterprise. |
aider | You primarily need AI-assisted code editing in a terminal workflow rather than structural codebase queries. | Free and open source; requires your own LLM API key. |
Continue | You want an IDE-integrated (VS Code, JetBrains) AI coding assistant with codebase context rather than a standalone graph-based tool. | Free and open source with paid enterprise features. |
Tree-sitter symbol indexers (e.g., ast-grep) | You need structural code search and linting rules without the knowledge-graph or LLM query layer. | Free and open source. |
What this trend reveals
Polyglot monorepo onboarding
Teams inheriting a monorepo with Python services, TypeScript frontends, and Rust or C++ core modules can use the unified graph schema to ask cross-language questions like 'which functions in the Python layer eventually call into the C++ shared library'—a query that file-based RAG cannot answer.
Index a representative subdirectory, run a cross-language call-path query, and compare the result against manual grep or IDE search for the same question.
Dead-code audit before major refactors
The dead code detection feature identifies functions unreachable from any entry point, which directly reduces maintenance burden and potential attack surface before a refactor or security review.
Run `cgr start` on a repository that has undergone multiple feature additions and removals, then manually verify a sample of the flagged functions against actual usage.
Local-only code analysis with Ollama
Organisations with strict data residency requirements can use the Ollama backend for Cypher generation, keeping all source code and queries on local infrastructure without external API calls.
Configure Ollama as the LLM provider, index a non-trivial project, and confirm that no outbound network traffic occurs during query and edit operations.
RepoDaily verdict
Code-Graph-RAG delivers a genuinely different approach to codebase intelligence by modelling structural relationships in a graph rather than chunking files for embedding search. Its multi-language Tree-sitter parsing, MCP integration with Claude Code, and features like dead-code detection and semantic search fill a real gap for polyglot monorepo teams. The beta version, forked grammar dependencies, and Memgraph operational requirement mean it is best suited for evaluation in development environments today, with production use depending on continued stability and the resolution of upstream tree-sitter issues.