rag-audit

rag-audit is a command for Claude Code from acaprino/daodan. It costs 74 tokens per session (572 once invoked), scanned A, original, MIT.

A command that audits an existing RAG system. RAG, or retrieval-augmented generation, finds relevant source content—often with embeddings and a vector database—before an AI model writes an answer.

In plain words
What is it for?
Use it to inspect a RAG pipeline and produce an actionable review of ingestion, chunking, embedding models, vector storage, retrieval, reranking, access controls, and evaluation.
Why use it?
It identifies gaps in document splitting, embeddings, search, reranking, filtering, prompting, evaluation, and production readiness. This helps distinguish weaknesses in an existing implementation from work needed to build one.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Part of the rag-development plugin — 1 skill, 1 command, 2 agents shipped together

Install

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.

agentmods
npx agentmods add commands/acaprino/daodan/rag-audit
Clone the repo
git clone --depth 1 https://github.com/acaprino/daodan

Made for: Claude Code.

Or install rag-development, the plugin that ships this one along with the rest of its 1 skill, 1 command, 2 agents.

Wrote 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.

agentmods badge for rag-audit

README.md
[![agentmods](https://agentmods.dev/badge/commands/acaprino/daodan/rag-audit.svg)](https://agentmods.dev/commands/acaprino/daodan/rag-audit)
Your own site
<a href="https://agentmods.dev/commands/acaprino/daodan/rag-audit"><img src="https://agentmods.dev/badge/commands/acaprino/daodan/rag-audit.svg" alt="Measured on agentmods" height="20"></a>
Per session 74 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 572 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00074 $0.00572
Opus 5 $0.00037 $0.00286
Sonnet 5 $0.00015 $0.00114
Haiku 4.5 $0.00007 $0.00057

Measured yesterday against content hash 6536910f6a7b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

rag-audit 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 yesterday.

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.

exports/claude/plugins/rag-development/commands/rag-audit.md · 74 lines

How it starts

The opening of the file, as written. The whole thing — 74 lines — stays where its author put it; the contents beside it link to each section on GitHub.

RAG Audit

Analyze an existing RAG implementation and produce an actionable audit report.

Instructions

  1. Identify RAG components in the codebase:

    • Document ingestion/chunking code
    • Embedding model usage
    • Vector database configuration
    • Retrieval/search logic
    • Re-ranking (if any)
    • Prompt construction for LLM generation
    • Evaluation setup (if any)
  2. Audit each component against best practices:

Chunking

  • Chunk size appropriate for use case (400-512 tokens default)
  • Overlap configured (10-20%)
  • Document preprocessing handles tables, images, headers
  • Chunking strategy matches document structure

Embeddings

  • Model is current (not deprecated)
  • Dimensions appropriate (not over-provisioned)
  • Embeddings cached at ingestion (not re-computed)

Vector Database

  • Payload indexes created on filtered fields
  • Quantization enabled (INT8 minimum for production)
  • HNSW parameters tuned (m >= 16, ef_construct >= 100)
  • On-disk storage configured for large collections

Retrieval

  • Hybrid search implemented (dense + sparse)
  • Re-ranking applied (cross-encoder or Cohere Rerank)
  • Metadata filtering for multi-tenancy/access control
  • MMR or diversity mechanism to avoid duplicate results

Generation

  • Context window usage efficient (not stuffing irrelevant chunks)
  • Source attribution in responses
  • Streaming enabled for user experience

Production

  • Evaluation metrics in place (RAGAS or equivalent)
  • Observability/tracing configured
  • Semantic caching for repeat queries
  • Error handling for embedding API failures
  • Rate limiting and cost controls

Security

  • Tenant isolation enforced via mandatory filters
  • PII filtering at ingestion
  • Input sanitization for prompt injection
  • Output validation
  1. Generate report with:
    • Current state assessment (what's implemented)
    • Risk areas (what's missing or misconfigured)
    • Priority improvements (ordered by impact)
    • Code examples for each recommendation

Read the full file on GitHub · 74 lines

Changes

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.

  1. yesterday First seen · 74 lines · 74 tokens per session scan A 6536910f6a7b

Subscribe to this mod's changes

rag-audit is a command published in the GitHub repository acaprino/daodan (8 stars, last pushed yesterday), licensed MIT. It adds 74 tokens to every session and 572 once invoked, about $0.0004 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-05.