Skip to content
Back to search

code-graph-rag

The ultimate RAG for your monorepo. Query, understand, and edit multi-language codebases with the power of AI and knowledge graphs

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/vitali87/code-graph-rag with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/vitali87/code-graph-rag'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/vitali87--code-graph-rag/badge.svg)](/listings/vitali87--code-graph-rag)

HTML

<a href="/listings/vitali87--code-graph-rag"><img src="/api/listings/vitali87--code-graph-rag/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

`cgr` is published to PyPI. Install it system-wide with the `treesitter-full` (all languages) and `semantic` (vector search) extras:

# with uv (recommended)
uv tool install "code-graph-rag[treesitter-full,semantic]"

# or with pipx
pipx install "code-graph-rag[treesitter-full,semantic]"

Which version am I getting?

Three version lines exist and they intentionally differ:

| where | what it tracks | |---|---| | git tags | every version, one per merge | | GitHub Releases (binaries, signatures) | every 50th version, plus any security fix | | PyPI | every 50th version, plus any security fix |

So the newest tag on `main` usually runs ahead of the newest release, often by tens of patch versions; they coincide only just after a release. Nothing is stuck, the cadences differ by design. A security fix does NOT wait for the cadence: it ships a release and a PyPI upload immediately.

`uv tool install` and `pipx install` give you the newest PyPI version, which is the newest RELEASE, not the newest tag. Interim tags exist so every merge is addressable; binaries and PyPI uploads follow the cadence above.

To run code newer than the latest release, install from git:

uv tool install "code-graph-rag[treesitter-full,semantic] @ git+https://github.com/vitali87/code-graph-rag@main"

To upgrade an existing install, run `uv tool upgrade code-graph-rag` (with pipx, `pipx upgrade code-graph-rag`, or `pipx reinstall code-graph-rag` for a git install). [Upgrade](docs/getting-started/installation.md#upgrade) covers the other install methods.

You also need Python 3.12+, Docker (for Memgraph), `cmake`, and `ripgrep`. Full prerequisites, source installs, and environment setup are in the [Installation](docs/getting-started/installation.md) guide.

> [!NOTE] > The wheel is pure Python (`py3-none-any`), so it installs on any platform with Python 3.12 or newer. Older system interpreters (Debian Bookworm ships 3.11) need the interpreter pinned explicitly; see [Installation](docs/getting-started/installation.md#older-system-interpreters) for the commands.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 242 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. <div align="center">
  2. <picture>
  3. <source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark-any.png">
  4. <source media="(prefers-color-scheme: light)" srcset="assets/logo-light-any.png">
  5. <img src="assets/logo-light-any.png" alt="Code-Graph-RAG Logo" width="480">
  6. </picture>
  7. <p>
  8. <a href="https://trendshift.io/repositories/99619" target="_blank" rel="noopener noreferrer"><img src="https://trendshift.io/api/badge/repositories/99619" alt="vitali87/code-graph-rag | Trendshift" width="250" height="55"/></a>
  9. </p>
  10. <p>
  11. <a href="https://github.com/vitali87/code-graph-rag/actions/workflows/ci.yml">
  12. <img src="https://img.shields.io/github/actions/workflow/status/vitali87/code-graph-rag/ci.yml?branch=main" alt="CI" />
  13. </a>
  14. <a href="https://codecov.io/gh/vitali87/code-graph-rag">
  15. <img src="https://codecov.io/gh/vitali87/code-graph-rag/graph/badge.svg" alt="Codecov" />
  16. </a>
  17. <a href="https://sonarcloud.io/summary/overall?id=vitali87_code-graph-rag">
  18. <img src="https://sonarcloud.io/api/project_badges/measure?project=vitali87_code-graph-rag&metric=alert_status" alt="Quality Gate Status" />
  19. </a>
  20. <a href="https://code-graph-rag.com">
  21. <img src="https://img.shields.io/badge/Enterprise-Support%20%26%20Services-6366f1" alt="Enterprise Support" />
  22. </a>
  23. <a href="https://pypi.org/project/code-graph-rag/">
  24. <img src="https://img.shields.io/pypi/v/code-graph-rag" alt="PyPI Version" />
  25. </a>
  26. <a href="https://pepy.tech/projects/code-graph-rag">
  27. <img src="https://static.pepy.tech/personalized-badge/code-graph-rag?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads" alt="PyPI Downloads" />
  28. </a>
  29. <a href="https://skillsllm.com/security-check/DHsMGRb1Ysys">
  30. <img src="https://skillsllm.com/security-check/badge.svg?owner=vitali87&repo=code-graph-rag" alt="SkillsLLM Security Check" />
  31. </a>
  32. <a href="https://scorecard.dev/viewer/?uri=github.com/vitali87/code-graph-rag">
  33. <img src="https://api.scorecard.dev/projects/github.com/vitali87/code-graph-rag/badge" alt="OpenSSF Scorecard" />
  34. </a>
  35. <a href="https://www.bestpractices.dev/projects/13757">
  36. <img src="https://www.bestpractices.dev/projects/13757/badge" alt="OpenSSF Best Practices" />
  37. </a>
  38. </p>
  39. </div>
  40. # Code-Graph-RAG
  41. Code-Graph-RAG parses a multi-language codebase with Tree-sitter, sharpened by compiler-grade frontends and runtime traces where available, builds a knowledge graph of its structure in an embedded graph database that needs no server, and lets you query, edit, and optimise that code in plain English. It works across a monorepo of mixed languages under one unified graph schema.
  42. <p align="center">
  43. <b>1. Index:</b> <code>cgr start --update-graph</code> parses a repository into a knowledge graph (sped up)
  44. </p>
  45. <p align="center">
  46. <img src="./assets/demo-indexing.gif" alt="cgr parsing the code-graph-rag repository into a knowledge graph, then printing node and relationship counts">
  47. </p>
  48. <p align="center">
  49. <b>2. Ask:</b> <code>cgr start</code> answers questions and edits code, grounded in that graph
  50. </p>
  51. <p align="center">
  52. <img src="./assets/demo.gif" alt="cgr agent answering questions about the indexed repository">
  53. </p>
  54. ## Latest News 🔥
  55. <!-- SECTION:latest_news -->
  56. - **Security Fix**: Addressed a potential issue with parameter defaults.
  57. - **Stack Handling**: Improved stack management for Qdrant and Memgraph.
  58. <!-- /SECTION:latest_news -->
  59. See [NEWS.md](NEWS.md) for the full history.
  60. ## What It Does
  61. Point Code-Graph-RAG at a repository and it reads every source file, extracts functions, classes, methods, modules, and the relationships between them, and stores the result as an interconnected graph. Once the graph exists you can:
  62. - Ask questions about the codebase in natural language and get answers grounded in the real structure.
  63. - Retrieve the actual source of any function, class, or method by name or by intent.
  64. - Edit code through the agent with AST-based surgical patching and a diff preview before anything changes.
  65. - Optimise code against language best practices or your own coding standards.
  66. - Find dead code by walking call and reference edges from entry points.
  67. - Search and rewrite structurally by AST pattern with ast-grep.
  68. - Overlay runtime behaviour: trace a test run (or pull production eBPF profiles) with `cgr trace` and merge the calls that actually happened into the graph, exposing dispatch that static analysis cannot see.
  69. ## How It Works
  70. The system has two components:
  71. 1. **Multi-language parser.** A Tree-sitter based parser reads the codebase and ingests functions, classes, methods, modules, and their relationships into the graph under a single language-agnostic schema. Where a toolchain is available, compiler-grade frontends layer exact facts on top (libclang for C/C++, `go/types` for Go, and opt-in Roslyn, `javac` and Jedi for C#, Java and Python), and [dynamic tracing](docs/guide/dynamic-tracing.md) merges calls observed at runtime. Tree-sitter stays the backbone: a trace only sees code that ran, and a compiler frontend only covers what its toolchain can build.
  72. 2. **RAG system** (`codebase_rag/`). An interactive CLI that turns natural language into Cypher queries, retrieves matching code, and drives AI-powered editing and optimisation.
  73. ```
  74. Source Code -> Tree-sitter Parser -> AST Analysis -> Knowledge Graph
  75. |
  76. User Query -> AI Model (Cypher Gen) -> Cypher Query -> Graph Results -> Response
  77. ```
  78. The graph is stored in an embedded SQLite file by default. Memgraph and Neo4j are opt-in backends that run the same Cypher; [Graph Backends](docs/architecture/embedded-graph.md) compares them.
  79. See the [Architecture Overview](docs/architecture/overview.md) and [Graph Schema](docs/architecture/graph-schema.md) for the full picture.
  80. ## Supported Languages
  81. Python, TypeScript, TSX, JavaScript, Rust, Go, Java, C, C++, C#, PHP, Lua, Dart, and Julia are fully supported. Scala is in development, and Ruby, Kotlin, Swift, Elixir, Haskell, Solidity, Bash, and Nix have structural support (modules, functions, classes where the language has them, and imports) through the pluggable ast-grep tier. See the [Language Support](docs/architecture/language-support.md) matrix for per-language capabilities.
  82. ## Installation
  83. `cgr` is published to PyPI. Install it system-wide with the `treesitter-full` (tree-sitter grammars), `ast-grep` (Ruby, Kotlin, Swift, Elixir, Haskell, Solidity, Bash, Nix) and `semantic` (vector search) extras:
  84. ```bash
  85. # with uv (recommended)
  86. uv tool install "code-graph-rag[treesitter-full,ast-grep,semantic]"
  87. # or with pipx
  88. pipx install "code-graph-rag[treesitter-full,ast-grep,semantic]"
  89. ```
  90. ### Which version am I getting?
  91. Three version lines exist and they intentionally differ:
  92. | where | what it tracks |
  93. |---|---|
  94. | git tags | every version, one per merge |
  95. | GitHub Releases (binaries, signatures) | every 50th version, plus any security fix, breaking change or merge labelled `release now` |
  96. | PyPI | every 50th version, plus any security fix, breaking change or merge labelled `release now` |
  97. So the newest tag on `main` usually runs ahead of the newest release, often by
  98. tens of patch versions; they coincide only just after a release. Nothing is
  99. stuck, the cadences differ by design. A security fix, a breaking change or a
  100. merge a maintainer labels `release now` does NOT wait for the cadence: each ships
  101. a release and a PyPI upload immediately.
  102. `uv tool install` and `pipx install` give you the newest PyPI version, which is the
  103. newest RELEASE, not the newest tag. Interim tags exist so every merge is
  104. addressable; binaries and PyPI uploads follow the cadence above.
  105. To run code newer than the latest release, install from git:
  106. ```bash
  107. uv tool install "code-graph-rag[treesitter-full,ast-grep,semantic] @ git+https://github.com/vitali87/code-graph-rag@main"
  108. ```
  109. To upgrade an existing install, run `uv tool upgrade code-graph-rag` (with pipx, `pipx upgrade code-graph-rag`, or `pipx reinstall code-graph-rag` for a git install). [Upgrade](docs/getting-started/installation.md#upgrade) covers the other install methods.
  110. You also need Python 3.12+ and `ripgrep`. The graph lives in an embedded SQLite file by default, so there is no database server to run: no Docker and no `cmake`. Memgraph and Neo4j remain available as opt-in backends ([Graph Backends](docs/architecture/embedded-graph.md)). Full prerequisites, source installs, and environment setup are in the [Installation](docs/getting-started/installation.md) guide.
  111. > [!NOTE]
  112. > cgr requires its native extension, `cgr-graph-rs`, which ships for CPython 3.12 or newer on Linux (x86_64, aarch64), macOS and Windows x64, so it installs on those platforms only. Older system interpreters (Debian Bookworm ships 3.11) need the interpreter pinned explicitly; see [Installation](docs/getting-started/installation.md#older-system-interpreters) for the commands.
  113. ## Quick Start
  114. ```bash
  115. # Parse a repository into the graph, then query it
  116. cgr start --repo-path /path/to/repo --update-graph
  117. cgr start --repo-path /path/to/repo
  118. ```
  119. The graph is written to `~/.cgr/graph.sqlite` (set `SQLITE_GRAPH_PATH` to move it).
  120. To use Memgraph instead, install the driver with the `memgraph` extra, set
  121. `GRAPH_BACKEND=memgraph`, and start the packaged Memgraph + Qdrant stack with
  122. `cgr daemon up`.
  123. Repeat the first command for each repository you want indexed; the graph is
  124. shared, and syncing one project leaves the others alone. To start over from an
  125. empty graph, add `--clean` — it deletes **every** project in the shared graph,
  126. not just this one, and asks for confirmation first when other
  127. projects would be destroyed.
  128. A default index leaves out the opt-in [capture groups](docs/architecture/graph-schema.md#capture-groups); add them with `--capture` or `CGR_CAPTURE`.
  129. The [Quick Start](docs/getting-started/quickstart.md) guide walks through parsing, querying, and exporting in five minutes.
  130. ## MCP Server
  131. Code-Graph-RAG runs as an [MCP](https://modelcontextprotocol.io) server so Claude Code and other MCP clients can query and edit your codebase directly. See the [MCP Server](docs/guide/mcp-server.md) guide for setup.
  132. ## Documentation
  133. **Getting Started**
  134. - [Installation](docs/getting-started/installation.md)
  135. - [Quick Start](docs/getting-started/quickstart.md)
  136. - [Configuration](docs/getting-started/configuration.md)
  137. **User Guide**
  138. - [CLI Reference](docs/guide/cli-reference.md)
  139. - [Interactive Querying](docs/guide/interactive-querying.md)
  140. - [Code Optimisation](docs/guide/code-optimization.md)
  141. - [Dead Code Detection](docs/guide/dead-code.md)
  142. - [Dynamic Call Tracing](docs/guide/dynamic-tracing.md)
  143. - [Graph Export](docs/guide/graph-export.md)
  144. - [Real-Time Updates](docs/guide/realtime-updates.md)
  145. - [C/C++ Semantic Mode](docs/guide/cpp-semantic-mode.md)
  146. - [MCP Server](docs/guide/mcp-server.md)
  147. - [Porting Between Languages](docs/guide/porting.md)
  148. **Architecture**
  149. - [Overview](docs/architecture/overview.md)
  150. - [Graph Schema](docs/architecture/graph-schema.md)
  151. - [Graph Backends](docs/architecture/embedded-graph.md)
  152. - [Language Support](docs/architecture/language-support.md)
  153. - [Data-Flow Edges](docs/architecture/data-flow-edges.md)
  154. **Python SDK**
  155. - [Overview](docs/sdk/overview.md)
  156. - [Graph Loader](docs/sdk/graph-loader.md)
  157. - [Cypher Generator](docs/sdk/cypher-generator.md)
  158. - [Semantic Search](docs/sdk/semantic-search.md)
  159. **Advanced**
  160. - [Adding Languages](docs/advanced/adding-languages.md)
  161. - [Ignore Patterns](docs/advanced/ignore-patterns.md)
  162. - [Building Binaries](docs/advanced/building-binaries.md)
  163. - [Troubleshooting](docs/advanced/troubleshooting.md)
  164. ## Enterprise Services
  165. Code-Graph-RAG is open source and free to use. For organisations that need more, we offer **fully managed cloud-hosted solutions** and **on-premise deployments**:
  166. - **Cloud-Hosted Deployment**: Managed cloud infrastructure for both the graph database and the AI agent connection. Zero infrastructure overhead, so we handle scaling, updates, and availability while your team focuses on building.
  167. - **On-Premise & Air-Gapped Deployment**: Deploy Code-Graph-RAG entirely within your own environment, including air-gapped networks. Full data sovereignty for regulated industries and security-sensitive organisations.
  168. We also offer custom development, integration consulting, technical support contracts, and team training.
  169. **[View plans & pricing at code-graph-rag.com](https://code-graph-rag.com/enterprise)**
  170. ## Contributing
  171. Please see [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines. Good first PRs come from the TODO issues.
  172. ## Support
  173. For issues or questions, check the [Troubleshooting](docs/advanced/troubleshooting.md) guide first, then open an issue.
  174. If cgr is useful to you, please consider pledging support on [GitHub Sponsors](https://github.com/sponsors/vitali87). cgr links the page under `cgr --version` and, in a terminal, after most commands finish; set `CGR_SPONSOR_PLEDGE=false` to hide that line.
  175. ## Accessibility
  176. [ACCESSIBILITY.md](ACCESSIBILITY.md) describes what cgr and its documentation support for people using assistive technology or alternative settings, the known limitations and their workarounds, and how to report a barrier.
  177. ## License
  178. MIT. See [LICENSE](LICENSE).
  179. Third-party components and their licences are credited on the [Credits page](https://docs.code-graph-rag.com/credits/).

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.