Repo intelligence for AI coding agents

A local, read-only index and MCP server that gives your coding agent a repository’s callers, call paths, history, and memory, with a confidence label on every answer.

Claude Code ·Codex ·OpenCode ·Cursor ·Gemini CLI ·Goose ·VS Code ·Zed ·+ 70 more via npx @rag-rat/skills

How it works

Index once, then query with provenance. No change to how you already work.

01

Index

Point rag-rat at a repo. It parses every file with tree-sitter and embeds it locally; source stays read-only, and everything lands in one SQLite database.

02

Build the graph

Callers, callees, imports, and type references become a real graph. Run the optional SCIP oracle to upgrade edges to compiler-grade truth.

03

Serve over MCP

Your agent asks where, why, who-calls, and what-breaks, and gets answers with provenance through 47 tools, with no change to how you work.

04

Remember

Findings become typed, source-anchored memories that survive refactors and resurface for the next agent and the next session.

What a repository knows about itself

Every coding harness already has grep and file reads. rag-rat adds the layer they don't: source-anchored rationale, with the receipts.

A code graph you can trust

Callers, callees, and imports across six languages, with a label on every edge for how it was resolved, so a guess reads as a guess.

  • Rust, TypeScript/TSX, Kotlin, C/C++, Python, and Swift
  • Every edge labeled Exact, Syntactic, Name-only, or Ambiguous
  • Opt-in compiler-grade SCIP oracle (rust-analyzer, scip-typescript, scip-clang)
  • important_symbols ranks what is load-bearing, by PageRank over the graph

Impact before you touch it

See the blast radius of a change before an agent makes it: callers, tests, and the notes that apply.

  • impact_surface gathers callers, callees, tests, and memories around a symbol
  • Rank importance relative to your current git diff
  • Near-miss clone detection warns before an agent re-implements existing code

History as evidence

The why behind the code, not just the what, and kept strictly apart from current source.

  • Git history and lazy, cached chunk blame
  • Issue, PR, and review rationale mirrored locally (the papertrail)
  • rationale_search across GitHub and GitLab trackers
  • Old decisions are typed and dated, never mistaken for today’s code

Memory that survives refactors

Typed, source-anchored notes that outlive the exact lines they describe and resurface for the next session.

  • Invariants, decisions, and risks, anchored to symbols, not line numbers
  • Auto-surface inside impact_surface and symbol_lookup results
  • Self-maintaining via the dream loop, which flags coverage gaps, drift, and stale references
  • One durable per-machine store, so memories survive a git clean -fdx

Rides the tools you already use

Drops into your agent over MCP with no workflow change: local-first, offline, and read-only on your source.

  • 47 MCP tools for search, graph, history, and memory
  • A grep hook injects relevant memories and symbols behind your searches
  • Install as a Claude Code, Codex, or OpenCode plugin, or run npx @rag-rat/bin
  • Reads source read-only; writes only its own local SQLite database

Built for parallel, worktree-based agents

Run a fleet of agents at once, each in its own git worktree of the same repo. They share one index and one memory graph instead of each rebuilding its own.

  • One index, every worktree

    Every worktree of a repo resolves to the same consolidated store, keyed off the main worktree, so nothing is re-indexed per branch.

  • Per-worktree dirty overlay

    Each worktree sees its own uncommitted edits in query results, and a branch switch reuses rows instead of triggering a reindex.

  • Safe under concurrency

    One watcher and one writer per worktree, enforced with file locks, plus a worktree-safe gc that prunes rows no live commit still holds.

  • Target a specific tree

    Point an MCP query at a linked worktree by path; memories anchored on an in-flight branch re-anchor themselves when it merges.

Dream: memory that maintains itself

Memories rot: the code moves under them, an invariant gets superseded, a load-bearing function ships with no note at all. dream is the maintenance loop that keeps the layer honest, and keeps a human in the loop.

Always-on worklist

  • Coverage gaps

    Load-bearing symbols (by the same PageRank as important_symbols) that carry no memory, so the next agent to touch them gets nothing.

  • Stale references

    A memory citing a path or anchor that no longer resolves. Every finding gets a stable id you can review, deterministically, at no cost.

Optional AI passes

  • Verify

    Checks each memory against current source reality: has the code drifted from what it claims? It labels the memory current or diverged, and only proposes; it never changes a memory itself.

  • Compact

    Rewrites a verbose note into a tight three-to-four-sentence summary. Both passes run a small model on a GPU you control, only when there is pending work.

Fully deterministic until you opt in, and off by default. Nothing is deleted automatically: you, or an agent over MCP, accept or dismiss each finding, and settled verdicts don’t come back. Run it on demand or on a nightly schedule. Configure dream

On every result

rag-rat labels what it returns so an agent can judge it instead of trusting it, the thing grep and a raw vector search can't give you.

Confidence

Every edge and answer is labeled by how it was resolved, from a compiler-verified fact down to a best-guess name match.

Coverage

A partial or stale index says so, out loud, instead of quietly returning less than the whole picture.

Evidence

The raw source, call paths, and history come attached, so an agent can judge the answer instead of trusting it.

What's coming

Grounded in the open milestones on GitHub. Building means in active development; planned means designed and queued. Every item links to its tracking issue.

Building

  • Multi-tracker papertrail

    GitHub and GitLab ship today; Bitbucket, Jira, and OAuth device-flow login are next: one provider-neutral mirror of every issue and PR. #597

  • Peer-to-peer memory sync

    Signed per-device logs and end-to-end-encrypted streams so repo memories move between your own machines, with no server and no cloud. #406

  • One-command setup

    npx @rag-rat/setup to install the binary and register rag-rat across ~9 agents in a single step. #545

  • Always-on type-aware resolution

    A cheap, always-on tier that resolves Rust calls by receiver type, closer to compiler accuracy without running the full oracle. #567

Planned

  • Issue distillation

    Turn closed issues and their fixing diffs into typed decision records (root cause, decision, outcome) anchored to the symbols they touched. #113

  • Swift semantic resolution

    A SourceKit-LSP oracle backend for compiler-grade Swift edges, on top of the existing tree-sitter baseline. #637

  • Edit-driven reindex

    Reindex exactly the paths your edits touch, the moment they change, for freshness that never leans only on the file watcher. #661

  • Shareable knowledge streams

    Public, read-only memory streams so a repo can publish what it knows about itself for any agent to subscribe to. #407

Built to scale

Measured on real repositories, not toys.

319 s
to index the Linux kernel, end to end (v7.0)
1.06M
symbols mapped
9.14M
graph edges
47
MCP tools

62,903 files · 3.49 GiB peak RSS · SCIP-oracle precision 92.8% (C) / 81.7% (Rust). See the benchmarks

How it's different

rag-rat is structure and provenance, not another text search.

Capability Grep + file readsVector / semantic searchrag-rat
Finds code by meaning
Callers, callees, and impact surface
Confidence + coverage on every result
Git and issue/PR rationale
Memory that survives refactors
Fully local, source never leaves your machine varies

Questions

Is rag-rat a RAG framework?

It’s the retrieval half. RAG is retrieve, then augment, then generate; rag-rat does the retrieve and augment (structured, provenance-labeled context from the code graph, git and issue history, and memory) and hands it to your coding agent, which does the generating. So it’s the backend you build a code-RAG workflow on, not an embed-and-chat pipeline of its own. The name is a wink.

Does my code leave my machine?

No. rag-rat reads your source read-only and writes only its own local SQLite database. Embeddings run locally by default; you can optionally offload bulk embedding to a GPU you control.

How does it stop an agent re-implementing code that already exists?

A write-time clone check fingerprints functions as they are written and warns when they are exact or near-duplicates of code already in the repo, so the agent reuses instead of rewriting. It is read-only and a silent no-op until the index is ready.

Can an agent see who calls a function before a refactor?

Yes. find_callers, trace_callees, and impact_surface return the call paths, tests, and memories around a symbol (the blast radius) before anything changes.

Does it remember decisions between sessions?

Yes. Typed, source-anchored memories (invariants, decisions, risks) persist across sessions and agents, survive refactors, and resurface automatically in later queries.

Which coding agents does it work with?

A one-step plugin for Claude Code, Codex, and OpenCode, plus npx @rag-rat/skills to install it into 70+ agents including Cursor, VS Code, Zed, and Goose.

Get started

Install the plugin, then open your repo and say “Set up rag-rat in this repo.” The setup skill scans the project, previews the config, and indexes only after you confirm.

Claude Code

claude plugin marketplace add cq27-dev/rag-rat
claude plugin install rag-rat@rag-rat

Codex

codex plugin marketplace add cq27-dev/rag-rat
codex plugin add rag-rat@rag-rat

OpenCode

# MCP + hooks (add -g for a global install)
opencode plugin @rag-rat/plugin-opencode
# the skills ship separately
npx @rag-rat/skills

Any agent, or the standalone CLI

# no Rust toolchain needed
npx @rag-rat/bin --help