rag-cag-expert

rag-cag-expert is an agent for Claude Code from jpoutrin/product-forge. It costs 28 tokens per session (2,741 once invoked), scanned A, original, MIT.

An expert assistant for retrieval-augmented generation (RAG), which retrieves relevant documents for an AI model, and cache-augmented generation (CAG), which reuses prepared context. It covers system designs, vector databases, document processing, and cache strategies.

In plain words
What is it for?
Use it to plan retrieval, caching, vector database, document-processing, and multi-tenant AI architectures.
Why use it?
It helps you compare implementation approaches when building AI systems that answer from private or structured information.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter; names the TodoWrite tool.

Part of the rag-cag plugin — 2 skills, 1 agent shipped together

Good fit Use it to plan retrieval, caching, vector database, document-processing, and multi-tenant AI architectures.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/jpoutrin/product-forge/rag-cag-expert
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/jpoutrin/product-forge

Made for: Claude Code.

Or install rag-cag, the plugin that ships this one along with the rest of its 2 skills, 1 agent.

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-cag-expert

README.md
[![agentmods](https://agentmods.dev/badge/agents/jpoutrin/product-forge/rag-cag-expert/github.svg)](https://agentmods.dev/agents/jpoutrin/product-forge/rag-cag-expert)
Your own site
<a href="https://agentmods.dev/agents/jpoutrin/product-forge/rag-cag-expert"><img src="https://agentmods.dev/badge/agents/jpoutrin/product-forge/rag-cag-expert/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for rag-cag-expert

Your own site · 80×15
<a href="https://agentmods.dev/agents/jpoutrin/product-forge/rag-cag-expert"><img src="https://agentmods.dev/badge/agents/jpoutrin/product-forge/rag-cag-expert.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,741 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.00028 $0.02741
Opus 5.5 $0.00011 $0.01096
Sonnet 5.5 $0.00006 $0.00548
Haiku 4.5 $0.00003 $0.00274

Measured 1mo ago against content hash 52b395d7b515, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

rag-cag-expert 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 1mo 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.

plugins/rag-cag/agents/rag-cag-expert.md · 398 lines

How it starts

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

RAG & CAG Expert Agent

You are an expert in Retrieval-Augmented Generation (RAG) and Cache-Augmented Generation (CAG) systems, specializing in enterprise-scale architectures with security-first multi-tenant design.

Core Competencies

RAG Architectures

  • Simple RAG: Single-index retrieval for small corpora
  • Hybrid RAG: Dense + sparse search with RRF fusion
  • HybridRAG: Vector + Knowledge Graph integration
  • Agentic RAG: Query routing and multi-step reasoning
  • GraphRAG: Cross-document reasoning and thematic analysis
  • RAPTOR: Hierarchical summarization trees

CAG (Cache-Augmented Generation)

  • KV-cache preloading for small corpora
  • Semantic caching strategies
  • Cache invalidation patterns
  • Tenant-isolated cache layers

Vector Databases

  • Qdrant: Hybrid search, named vectors, filtering
  • Milvus: Large-scale sharding, multi-region
  • Chroma: Simple deployment, local development
  • Weaviate: GraphQL interface, multi-modal
  • pgvector: PostgreSQL integration

Document Processing

  • PDF parsing (LlamaParse, Docling, PyMuPDF)
  • Multimodal processing (Vision LLM grounding)
  • Code parsing (Tree-sitter AST)
  • Audio/Video transcription (Whisper)

Architecture Selection Guide

VOLUME-BASED ARCHITECTURE DECISION
════════════════════════════════════════════════════════════════

< 10K docs, < 1M chunks
├── Pattern: Simple RAG or CAG
├── Vector DB: Chroma / pgvector
├── Caching: Basic LRU
└── Consider CAG if corpus < 100K tokens

10K-500K docs, 1M-50M chunks
├── Pattern: Hybrid RAG + Reranking
├── Vector DB: Qdrant / Weaviate
├── Caching: Semantic cache (Redis)
└── Federated indexes by source type

500K-5M docs, 50M-500M chunks
├── Pattern: Agentic RAG + Routing
├── Vector DB: Milvus / Pinecone
├── Caching: Distributed semantic
└── Sharded + tiered storage

5M+ docs, 500M+ chunks
├── Pattern: Multi-cluster + GraphRAG
├── Vector DB: Milvus cluster / Vespa
├── Caching: Multi-layer
└── Hierarchical retrieval (RAPTOR)

Read the full file on GitHub · 398 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. 1mo ago First seen · 398 lines · 28 tokens per session scan A 52b395d7b515

Subscribe to this mod's changes

rag-cag-expert is an agent published in the GitHub repository jpoutrin/product-forge (16 stars, last pushed 7mo ago), licensed MIT. It adds 28 tokens to every session and 2,741 once invoked, about $0.0001 per session on Opus 5.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.

Related

Other agents, from other repositories

langchain4j-ai-development-expert

Provides expert LangChain4j development capability for building AI applications, RAG systems, ChatBots, and MCP servers. Handles AI services, vector stores, embeddings, and model integration patterns. Use proactively when working on AI development tasks, RAG implementation, or intelligent agent creation.

giuseppe-trisciuoglio/developer-kit · 65 tokens

wiki-qa-probe

A single retrieval probe — explores ONE facet of a question deep through the knowledge graph, embeddings, and source files, and returns grounded findings with exact citations for the hypervisor to fuse.

bearlike/Assistant · 43 tokens

token

Token and context management — context window optimization, token counting, truncation strategy, chunking design.

tonone-ai/tonone · 21 tokens

qdrant-expert

Configure and operate the vector store in production. TRIGGER WHEN: creating Qdrant collections, tuning HNSW, quantization, dense plus sparse hybrid search, payload indexing, multi-tenancy, or Qdrant performance troubleshooting. DO NOT TRIGGER WHEN: end-to-end RAG design, or another vector database such as Pinecone…

acaprino/daodan · 91 tokens

FAI LangChain Expert

LangChain framework specialist — LCEL expression language, chains, agents with tool use, retrievers, memory, callbacks, LangSmith tracing, and production RAG pipeline patterns.

frootai/frootai · 41 tokens

rag-evaluator

Run retrieval regression gates (hitgate) against the current repo state. Compares Hit@5, MRR, and per-intent metrics to detect whether a change helped, regressed, or held steady. Use for shipping retrieval code changes, validating retuning before merge, or measuring refactor impact on search quality.

LucasSantana-Dev/sharekit · 68 tokens