
rag-rat
by cq27-dev
rag-rat
What a repository knows about itself. rag-rat is a local repo-intelligence index and MCP server
for coding agents. It keeps source files read-only, writes only its own SQLite database, and answers
with provenance on every result — current source, the code graph, git/GitHub history, and durable,
source-anchored repo memories that persist across sessions and agents.
Every coding harness already has grep and file reads. rag-rat adds the layer they do not provide:
source-anchored rationale. It connects the code an agent is about to touch to its callers, callees,
tests, git/GitHub history, prior decisions, invariants, risks, and duplicate-code signals — and
labels every result with confidence and coverage, so an agent can judge it instead of trusting it.
sequenceDiagram
participant Repo as Repository
participant Engine as rag-rat engine
participant Agent as Coding agent
Repo->>Engine: Source · git/GitHub · repo memories
Engine->>Engine: Index → graph → (opt) SCIP oracle → reconcile
Agent->>Engine: where / why / who-calls / impact?
Engine-->>Agent: source + call paths + papertrail + memories (with provenance)
Agent->>Engine: record a finding
Engine->>Repo: persist a source-anchored repo memory
Why
- Provenance, not guesses. Every result carries a confidence label, coverage warnings, and the raw evidence — so a partial index or an ambiguous edge reads as exactly that.
- Repo memories. Typed, source-anchored notes (
Invariant,Decision,Risk, …) that survive refactors and surface automatically during future queries — the signal grep can't give you. They are not assistant memory: they are versioned, local, source-anchored facts about this repository that any future agent retrieves with evidence. - A real code graph. tree-sitter callers/callees/imports across Rust, TypeScript/TSX, Kotlin,
C/C++, Python, Swift, and Go — with an optional compiler-grade SCIP oracle for
configured toolchains that upgrades edges to
Compilerconfidence and ranks the load-bearing symbols. - History as evidence. Git history, lazy chunk blame, and cached GitHub issue/PR/review rationale, all queryable.
- Issue distillation. Every closed issue and merged PR plus its fixing diff distilled into a typed decision record — root cause, the approach that landed (and the rejected alternatives), and the outcome — validated against the thread and surfaced as drive-by context on the anchored symbols.
- Rides your existing grep. A grep-augmentation hook injects the memories and symbols behind whatever you just searched for.
- Flags clones as you write them. A PreToolUse hook on Write/Edit/MultiEdit fingerprints the functions you're writing and warns when they're exact or near-duplicates of code already in the repo — so an agent reuses instead of re-implementing. Read-only, and a silent no-op when the index isn't ready, so it never blocks a write.
Quickstart
For Claude Code, Codex, and opencode, install the plugin. It registers the MCP server, adds the
hooks, and installs a version-matched rag-rat binary on first run (the Claude Code and Codex
bundles also add the skills; on opencode add them with npx @rag-rat/skills):
# Claude Code
claude plugin marketplace add cq27-dev/rag-rat
cl
Related servers

n8n
Updated todayby n8n-io
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

mcp-server-fetch
OfficialUpdated todayA Model Context Protocol server providing tools to fetch and convert web content for usage by LLMs

@modelcontextprotocol/server-filesystem
OfficialUpdated todayMCP server for filesystem access