ai-rag-setup

ai-rag-setup is a command for Claude Code from Matt-Dionis/claude-code-configs. It costs 12 tokens per session (1,648 once invoked), scanned A, original, MIT.

A setup guide for retrieval-augmented generation, or RAG. RAG lets an AI system search a collection of documents or data and use the relevant results when generating an answer.

In plain words
What is it for?
Use it to create embeddings, split source content into searchable pieces, store vectors, retrieve matching content, and pass that content into AI prompts for basic, conversational, advanced, or agent-driven RAG.
Why use it?
It helps AI responses use information from a project’s own data instead of relying only on the model’s built-in knowledge. It also covers the storage, searching, ranking, and evaluation needed for this process.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it to create embeddings, split source content into searchable pieces, store vectors, retrieve matching content, and pass that content into AI prompts for basic, conversational, advanced, or agent-driven RAG.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/matt-dionis/claude-code-configs/ai-rag-setup
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.

Clone the repo
git clone --depth 1 https://github.com/Matt-Dionis/claude-code-configs

Made for: Claude Code.

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 ai-rag-setup

README.md
[![agentmods](https://agentmods.dev/badge/commands/matt-dionis/claude-code-configs/ai-rag-setup.svg)](https://agentmods.dev/commands/matt-dionis/claude-code-configs/ai-rag-setup)
Your own site
<a href="https://agentmods.dev/commands/matt-dionis/claude-code-configs/ai-rag-setup"><img src="https://agentmods.dev/badge/commands/matt-dionis/claude-code-configs/ai-rag-setup.svg" alt="Measured on agentmods" height="20"></a>
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,648 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00012 $0.01648
Opus 5 $0.00006 $0.00824
Sonnet 5 $0.00002 $0.00330
Haiku 4.5 $0.00001 $0.00165

Measured 4d ago against content hash 7d555a3876b9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

ai-rag-setup 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 4d 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.

configurations/tooling/vercel-ai-sdk/.claude/commands/ai-rag-setup.md · 253 lines

How it starts

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

Set up RAG (Retrieval-Augmented Generation) System

Create a comprehensive RAG implementation with embeddings, vector storage, and retrieval: $ARGUMENTS

Current Project Analysis

Existing database setup: !find . -name "*schema*" -o -name "*migration*" -o -name "drizzle.config.*" | head -5

Vector database configuration: !grep -r "vector\|embedding" . --include="*.ts" --include="*.sql" | head -5

AI SDK integration: !grep -r "embed\|embedMany" . --include="*.ts" | head -5

RAG Implementation Types

Basic RAG: Simple query → retrieve → generate pipeline Advanced RAG: Multi-query, re-ranking, hybrid search, filtering Conversational RAG: Context-aware retrieval with chat history Agentic RAG: Tool-based retrieval with dynamic knowledge access

Your Task

  1. Analyze current data infrastructure and vector storage capabilities
  2. Design embedding and chunking strategy for optimal retrieval
  3. Set up vector database with proper indexing and search
  4. Implement embedding pipeline with batch processing
  5. Create retrieval system with similarity search and ranking
  6. Build RAG generation pipeline with context injection
  7. Add evaluation metrics for retrieval and generation quality
  8. Implement comprehensive testing for all RAG components

Implementation Requirements

Data Processing Pipeline
  • Document ingestion and preprocessing
  • Intelligent chunking strategies (sentence, semantic, sliding window)
  • Metadata extraction and enrichment
  • Batch embedding generation with rate limiting
  • Deduplication and quality filtering
Vector Storage and Search
  • Database setup (PostgreSQL + pgvector, Pinecone, Supabase, etc.)
  • Proper indexing (HNSW, IVFFlat) for performance
  • Similarity search with filtering and ranking
  • Hybrid search combining vector and text search
  • Metadata filtering and faceted search
RAG Generation
  • Context selection and ranking
  • Prompt engineering for RAG scenarios
  • Context window management
  • Response grounding and source attribution
  • Quality control and relevance scoring

Read the full file on GitHub · 253 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. 4d ago First seen · 253 lines · 12 tokens per session scan A 7d555a3876b9

Subscribe to this mod's changes

ai-rag-setup is a command published in the GitHub repository Matt-Dionis/claude-code-configs (624 stars, last pushed 1y ago), licensed MIT. It adds 12 tokens to every session and 1,648 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.