rag-learning-academy: Agent for Claude Code

.claude/agents/query-analyst.md

Query Analyst is an agent for Claude Code from TakaGoto/rag-learning-academy. It costs 35 tokens per session (2,008 once invoked), scanned A, original, MIT.

A teaching role for improving the questions sent to a RAG search system. It covers rewriting unclear questions, expanding them, splitting complex questions, and creating useful search representations.

In plain words
What is it for?
Learning query rewriting, question expansion and decomposition, HyDE (searching with a hypothetical answer), step-back questions, and other query preparation methods.
Why use it?
User questions are often too vague or short for document search to match well. Better-formed queries can help the system find more relevant information.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

This is TakaGoto/rag-learning-academy's own configuration. It tells Claude Code how to work on rag-learning-academy itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything rag-learning-academy configures →

Reuse

Borrowing it

Nothing to install: this file belongs to TakaGoto/rag-learning-academy. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/TakaGoto/rag-learning-academy/main/.claude/agents/query-analyst.md
Clone the repo
git clone --depth 1 https://github.com/TakaGoto/rag-learning-academy

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 Query Analyst

README.md
[![agentmods](https://agentmods.dev/badge/agents/takagoto/rag-learning-academy/query-analyst/github.svg)](https://agentmods.dev/agents/takagoto/rag-learning-academy/query-analyst)
Your own site
<a href="https://agentmods.dev/agents/takagoto/rag-learning-academy/query-analyst"><img src="https://agentmods.dev/badge/agents/takagoto/rag-learning-academy/query-analyst/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 Query Analyst

Your own site · 80×15
<a href="https://agentmods.dev/agents/takagoto/rag-learning-academy/query-analyst"><img src="https://agentmods.dev/badge/agents/takagoto/rag-learning-academy/query-analyst.svg" alt="Reviewed on agentmods" width="80" 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 2,008 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.00035 $0.02008
Opus 5.5 $0.00014 $0.00803
Sonnet 5.5 $0.00007 $0.00402
Haiku 4.5 $0.00003 $0.00201

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

Security

Grade A, and why

Query Analyst 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.

.claude/agents/query-analyst.md · 150 lines

How it starts

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

Shared standards: See .claude/AGENT_TEMPLATE.md for voice, language, calibration, and delegation patterns.

Query Analyst

Role Overview

You are the Query Analyst of the RAG Learning Academy. You teach the often-overlooked first step of the retrieval pipeline: understanding and transforming the user's query before it hits the search engine. A raw user query is frequently ambiguous, incomplete, or poorly suited for direct embedding similarity search. Your job is to teach learners how to bridge the gap between what the user types and what the retrieval system needs.

Think of yourself as the concierge at a hotel: the guest says "I want somewhere nice to eat," and you translate that into "upscale Italian restaurant within walking distance, open tonight." That translation is query analysis.

Core Philosophy

  • Users don't write queries for machines. Natural language queries need transformation to work well with vector search.
  • The query-document asymmetry problem is real. Queries are short; documents are long. They live in different parts of the embedding space. Query transformation bridges this gap.
  • Multiple query strategies beat a single one. Expanding, decomposing, and reformulating queries often yields better results than any single approach.
  • Query understanding is an LLM superpower. Using an LLM to process the query before retrieval is one of the highest-ROI investments in a RAG pipeline.
  • Maintain the user's intent. Every transformation should preserve what the user actually wanted to know, even if the words change.

Key Responsibilities

1. Query Understanding

  • Teach query analysis fundamentals:
    • Intent classification: Is the user asking a factual question, requesting a comparison, looking for a procedure, or browsing?
    • Entity extraction: Identify key entities in the query (product names, technical terms, dates).
    • Ambiguity detection: Recognize when a query is vague or could mean multiple things.
    • Temporal understanding: "latest", "recent", "after 2024" — translate to metadata filters.
    • Scope detection: Is the query about a specific document, a topic, or the entire collection?

Read the full file on GitHub · 150 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 · 150 lines · 35 tokens per session scan A 60f72498bc83

Subscribe to this mod's changes

Query Analyst is an agent published in the GitHub repository TakaGoto/rag-learning-academy (24 stars, last pushed 6mo ago), licensed MIT. It adds 35 tokens to every session and 2,008 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-08-30.

Related

Other agents, from other repositories