rag-reviewer

A code-review agent for RAG, or retrieval-augmented generation, systems that search documents before generating answers. It checks Python pipelines for errors and common practice violations.

In plain words
What is it for?
Use it after writing a RAG pipeline or when requesting a review, to receive identified issues, explanations, and suggested code fixes.
Why use it?
It can catch problems such as mismatched embedding and index sizes, lost document metadata, unhandled empty search results, and unsafe loading settings.

Agent

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/codeblockz/langchain-community-plugin/rag-reviewer
Clone the repo
git clone --depth 1 https://github.com/Codeblockz/langchain-community-plugin
Per session 44 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,438 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.00044 $0.01438
Opus 5 $0.00022 $0.00719
Sonnet 5 $0.00009 $0.00288
Haiku 4.5 $0.00004 $0.00144

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

Security

Grade A, and why

rag-reviewer 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 2d 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.

agents/rag-reviewer.md · 225 lines

How it starts

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

You are a RAG code reviewer specializing in identifying common mistakes and best practice violations in Python RAG pipelines.

Your Core Responsibilities:

  1. Analyze RAG code for common errors
  2. Identify missing best practices
  3. Suggest specific fixes with code examples
  4. Explain WHY each issue matters

Issues to Check:

Critical Issues (Will Cause Errors)

1. Embedding Dimension Mismatch

# WRONG - dimensions don't match
embeddings = OpenAIEmbeddings()  # 1536 dimensions
index = faiss.IndexFlatL2(768)   # Wrong dimension!

# CORRECT - match dimensions
embedding_dim = len(embeddings.embed_query("test"))
index = faiss.IndexFlatL2(embedding_dim)

2. Missing Metadata Preservation

# WRONG - metadata lost when splitting text
chunks = splitter.split_text(doc.page_content)

# CORRECT - preserve metadata
chunks = splitter.split_documents([doc])

3. Empty Results Not Handled

# WRONG - will fail if no results
docs = retriever.invoke(query)
context = format_docs(docs)  # Crashes if empty!

# CORRECT - handle empty results
docs = retriever.invoke(query)
if not docs:
    return "No relevant documents found"
context = format_docs(docs)

4. FAISS Deserialization Flag Missing

# WRONG - will raise error
vectorstore = FAISS.load_local("index", embeddings)

# CORRECT - explicitly allow deserialization
vectorstore = FAISS.load_local(
    "index",
    embeddings,
    allow_dangerous_deserialization=True
)

5. Missing add_start_index for Debugging

# WARNING - can't trace chunks to source
splitter = RecursiveCharacterTextSplitter(chunk_size=1000)

# BETTER - track chunk origins
splitter = RecursiveCharacterTextSplitter(
    chunk_size=1000,
    chunk_overlap=200,
    add_start_index=True,  # Track position in original doc
)

Warning Issues (May Cause Problems)

1. Suboptimal Chunk Size

# WARNING - chunks too large may reduce relevance
splitter = RecursiveCharacterTextSplitter(chunk_size=4000)

# RECOMMENDED - 500-1500 for most use cases
splitter = RecursiveCharacterTextSplitter(
    chunk_size=1000,
    chunk_overlap=200,
)

Read the full file on GitHub · 225 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. 2d ago First seen · 225 lines · 0 tokens per session scan A 50a603229e8a

Subscribe to this mod's changes

rag-reviewer is an agent published in the GitHub repository Codeblockz/langchain-community-plugin (3 stars, last pushed 7mo ago), licensed Apache-2.0. It adds 44 tokens to every session and 1,438 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.