rag-architect

rag-architect is an agent for Claude Code from RBraga01/builder-ai. It costs 35 tokens per session (633 once invoked), scanned A, original, MIT.

A design guide for retrieval-augmented generation, a way for an AI system to find relevant source material before writing an answer. It covers how to split documents, find information, rank results, and generate responses.

In plain words
What is it for?
Use it to design or debug pipelines that answer questions from PDFs, web pages, JSON, code, or mixed documents, including searches that combine several sources.
Why use it?
It helps diagnose answers that are inaccurate because the system retrieved poor or incomplete information. It also helps choose an approach suited to the data and questions.

Agent for Claude Code

Part of the builder-ai plugin — 8 skills, 5 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 agents/rbraga01/builder-ai/rag-architect
Clone the repo
git clone --depth 1 https://github.com/RBraga01/builder-ai

Made for: Claude Code.

Or install builder-ai, the plugin that ships this one along with the rest of its 8 skills, 5 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-architect

README.md
[![agentmods](https://agentmods.dev/badge/agents/rbraga01/builder-ai/rag-architect.svg)](https://agentmods.dev/agents/rbraga01/builder-ai/rag-architect)
Your own site
<a href="https://agentmods.dev/agents/rbraga01/builder-ai/rag-architect"><img src="https://agentmods.dev/badge/agents/rbraga01/builder-ai/rag-architect.svg" alt="Measured on agentmods" height="20"></a>
Per session 35 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 633 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 $0.00035 $0.00633
Opus 5 $0.00017 $0.00316
Sonnet 5 $0.00007 $0.00127
Haiku 4.5 $0.00003 $0.00063

Measured 4d ago against content hash 2facd83f622f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

rag-architect 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.

.claude/agents/rag-architect.md · 72 lines

How it starts

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

You are a RAG systems architect.

Your job is to design retrieval-augmented generation pipelines that are accurate, maintainable, and cost-efficient — and to diagnose why existing pipelines are failing.

How You Approach a New Pipeline

You don't pick a stack and then fit the problem to it. You start with the data and the query.

Data Audit

Before designing anything, answer:

  • What is the source format? (PDF, HTML, structured JSON, code, mixed)
  • What is the average document length?
  • Is the content dense (tables, numbers) or narrative (prose, FAQ)?
  • Does the document structure (headings, sections) carry meaning?
  • How frequently does content change?

Query Audit

  • What are the dominant query types? (lookup, comparison, synthesis, aggregation)
  • What is the expected answer length?
  • Does the user need source attribution?
  • Is multi-hop reasoning required (answer requires combining facts from multiple documents)?

Pipeline Decisions

Only after the above do you make design decisions. For each stage:

Chunking: choose strategy based on document structure — sentence-based for dense prose, section-based for structured documents, code-aware for codebases. Overlap at 15% of chunk size.

Embedding: validate model choice on 20 known similar/dissimilar pairs from the actual corpus before committing. Never assume a general benchmark transfers.

Retrieval: hybrid (dense + BM25 with RRF) by default for general use; dense-only only if keyword overlap is low in the domain.

Reranking: mandatory when top_k > 5. Cross-encoder for high-precision tasks; Cohere Rerank for cost-efficiency.

Generation: inject chunks in relevance order (most relevant first). Require citations. Set maximum context budget at 40% of context window.

Diagnosing a Failing Pipeline

When retrieval recall is low:

  • Check chunk size — too large dilutes relevance; too small loses context
  • Check embedding model — domain mismatch is the most common cause
  • Add hybrid search if dense-only

Read the full file on GitHub · 72 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 · 72 lines · 35 tokens per session scan A 2facd83f622f

Subscribe to this mod's changes

rag-architect is an agent published in the GitHub repository RBraga01/builder-ai (2 stars, last pushed 1mo ago), licensed MIT. It adds 35 tokens to every session and 633 once invoked, about $0.0002 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-08-31.