Query Analyst

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.

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/takagoto/rag-learning-academy/query-analyst
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.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.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 2,008 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.1 $0.00035 $0.02008
Opus 5 $0.00017 $0.01004
Sonnet 5 $0.00007 $0.00402
Haiku 4.5 $0.00003 $0.00201

Measured 6d ago against content hash 60f72498bc83, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, 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 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.

.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. 6d 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 (18 stars, last pushed 5mo ago), licensed MIT. It adds 35 tokens to every session and 2,008 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-30.

Related

Other agents, from other repositories

AGENTS

In-depth tutorials on LLMs, RAGs and real-world AI agent applications.

patchy631/ai-engineering-hub · 0 tokens

query_optimizer_agent_plan

Query Optimizer Agent 是一个专门用于在 RAG (Retrieval-Augmented Generation) 流程中优化用户查询的智能体。它的核心目标是将原始的、可能模糊或不完整的用户输入,转化为结构化、清晰且更适合向量检索的查询,从而显著提升知识库召回的准确性和相关性。.

DemonDamon/AgenticX · 0 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

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

ai-platform-architect

Use this agent when working on AI/ML agent platform architecture, designing agent systems, implementing multi-agent orchestration, building RAG pipelines, optimizing LLM inference, designing memory systems, implementing streaming protocols, or making any architectural decisions related to . This includes agent…

asiflow/claude-nexus-hyper-agent-team · 778 tokens