Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add commands/kumaran-is/claude-code-onboarding/rag-debuggit clone --depth 1 https://github.com/kumaran-is/claude-code-onboardingWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/kumaran-is/claude-code-onboarding/rag-debug)<a href="https://agentmods.dev/commands/kumaran-is/claude-code-onboarding/rag-debug"><img src="https://agentmods.dev/badge/commands/kumaran-is/claude-code-onboarding/rag-debug.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00015 | $0.01552 |
| Opus 5 | $0.00008 | $0.00776 |
| Sonnet 5 | $0.00003 | $0.00310 |
| Haiku 4.5 | $0.00002 | $0.00155 |
Grade A, and why
rag-debug scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 160 lines — stays where its author put it; the contents beside it link to each section on GitHub.
/rag-debug — Diagnose RAG Failure
Diagnose a specific RAG failure by walking the 9-layer diagnostic chain (playbook §40).
Symptom or failing query: $ARGUMENTS
Phase 1: Get the trace
Ask the user for the full trace of the failing query. You need:
- The exact query as the user typed it
- Filters applied (tenant, ACL, version, date range)
- All retriever outputs with scores (dense top-N, sparse top-N)
- RRF fused result
- Reranker output (pre and post)
- Final context packed into the LLM prompt
- The LLM's response
- What the correct answer should have been, and which document(s) should have produced it
If the user can't produce this — that's already a finding: they don't have audit logs (§39.2). Recommend that first. Then ask what they CAN reproduce manually.
Phase 2: Walk the chain
Walk these layers IN ORDER. The first layer where the right chunk goes missing is the root cause. Do not skip ahead.
Layer 1: Parsing / Ingestion
Question: Does the answer text exist in ANY chunk in the index?
Action: search the index directly (BM25 or substring) for distinctive phrases from the expected answer. If you can't find it, the problem is parsing or ingestion.
- ❌ Not in any chunk → stop here. Root cause is Layer 1. Recommend parser audit (§6.1), OCR check, chunk quality scoring (§9.11).
- ✅ Found in a chunk → continue to Layer 2.
Layer 2: Chunking
Question: Is the full answer in a SINGLE chunk, or split across chunks?
- ❌ Split across chunks (e.g., the condition is in one chunk, the rule in another) → stop here. Root cause is chunking. Recommend document-aware + parent-child (§9.4), overlap, or recursive retrieval (§9.12).
- ✅ Single chunk → continue to Layer 3.
Layer 3: Filtering
Question: Did filters wrongly exclude the right chunk?
Action: replay the query WITHOUT filters. Does the right chunk appear?
- ❌ Right chunk only appears without filters → stop here. Root cause is filtering. Check tenant filter (should not exclude), version filter (
effective_to), access_level mismatch. - Special case: post-filter on top-k → critical fix (§20.2)
- ✅ Right chunk found with filters → continue to Layer 4.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 160 lines · 15 tokens per session scan A 109af75badb3
rag-debug is a command published in the GitHub repository kumaran-is/claude-code-onboarding (35 stars, last pushed 2mo ago), licensed MIT. It adds 15 tokens to every session and 1,552 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other commands, from other repositories
rag-audit
Report quality and best-practice gaps in an existing implementation. TRIGGER WHEN: the user asks to review, audit, or validate a RAG pipeline: chunking, embeddings, retrieval, reranking, or production readiness. DO NOT TRIGGER WHEN: building from scratch (use rag-architect), or auditing a pure vector database (use…
rag-debug
Debug RAG pipeline issues with systematic retrieval and generation analysis.
querying
Query documents from a search index using type-safe filters with support for pagination, sorting, field selection, scoring, and highlighting. Count matching documents efficiently without returning results.
agent
Add an AI agent / RAG backend (@convex-dev/agent) to the Convex app.
ingest
Manually add knowledge to the Weaviate store.
vector.batch_exists
Check existence for multiple vector keys.