rag-tune

rag-tune is a command for Claude Code from sigistry/marketplace. It costs 16 tokens per session (752 once invoked), scanned A, original, MIT.

A code review command for retrieval-augmented generation (RAG), where an AI finds relevant documents before generating an answer. It examines how documents are split, searched, ranked, and passed to the model.

In plain words
What is it for?
Use it to inspect a RAG pipeline's retrieval quality and cost, then receive a ranked list of concrete fixes without rebuilding the search index.
Why use it?
It finds cases where the right information is not retrieved, irrelevant information crowds the context, or the pipeline costs more than necessary.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: model in frontmatter.

Part of the llm-app-hardener plugin — 4 skills, 4 commands, 2 agents shipped together

Good fit Use it to inspect a RAG pipeline's retrieval quality and cost, then receive a ranked list of concrete fixes without rebuilding the search index.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/sigistry/marketplace/rag-tune
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/sigistry/marketplace

Made for: Claude Code.

Or install llm-app-hardener, the plugin that ships this one along with the rest of its 4 skills, 4 commands, 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-tune

README.md
[![agentmods](https://agentmods.dev/badge/commands/sigistry/marketplace/rag-tune/github.svg)](https://agentmods.dev/commands/sigistry/marketplace/rag-tune)
Your own site
<a href="https://agentmods.dev/commands/sigistry/marketplace/rag-tune"><img src="https://agentmods.dev/badge/commands/sigistry/marketplace/rag-tune/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-tune

Your own site · 80×15
<a href="https://agentmods.dev/commands/sigistry/marketplace/rag-tune"><img src="https://agentmods.dev/badge/commands/sigistry/marketplace/rag-tune.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 752 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.00016 $0.00752
Opus 5 $0.00008 $0.00376
Sonnet 5 $0.00003 $0.00150
Haiku 4.5 $0.00002 $0.00075

Measured 6d ago against content hash 84cb32036ee9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

rag-tune 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 6d 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/llm-app-hardener/commands/rag-tune.md · 43 lines

How it starts

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

Audit the RAG (retrieval-augmented generation) pipeline at $ARGUMENTS (default: directories that look like a pipeline, rag/, ingest/, retrieval/, embeddings/, or files importing a vector store) for both answer quality and cost, and output prioritized, concrete fixes. Most RAG quality problems are retrieval problems, not model problems: the right chunk never reaches the context, or the wrong chunks crowd it out. This is a static read of the pipeline code and config, no index rebuild or query run required.

Process

Step 1: Detect the stack

Identify the framework and vector store from imports and config:

Layer Signal
Framework langchain, llama-index, haystack, or hand-rolled retrieval
Vector store pinecone, weaviate, qdrant, chroma, pgvector, faiss, milvus
Embeddings embedding model name/dimension in config or client calls
Reranker cohere.rerank, rerank, cross-encoder, bge-reranker, or none

Step 2: Audit each stage

Walk the pipeline stage by stage and flag issues with the file:line where each is configured:

Stage What to check
Chunking Strategy (fixed vs. recursive vs. semantic), size, and overlap; whether chunks split mid-sentence/mid-table and whether structure (headings, code, tables) is preserved
Embedding model Fit for domain and language; dimension vs. store config; query/document asymmetry; staleness vs. current models
Retrieval top_k, similarity metric, metadata/namespace filtering, hybrid (dense + keyword/BM25) vs. pure vector
Reranking Presence of a reranker; over-fetch-then-rerank (retrieve N, rerank to k); model choice
Context assembly Ordering (lost-in-the-middle: strongest evidence at the ends), dedup, token budget, and whether low-score chunks are padding the prompt
Grounding / citations Whether the prompt demands source-grounded answers and returns citations; guard against answering from unretrieved knowledge

Read the full file on GitHub · 43 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. 6d ago First seen · 43 lines · 16 tokens per session scan A 84cb32036ee9

Subscribe to this mod's changes

rag-tune is a command published in the GitHub repository sigistry/marketplace (3 stars, last pushed 5d ago), licensed MIT. It adds 16 tokens to every session and 752 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.