query

A repository question-and-answer command that searches and reads source files before answering in plain language. It includes citations to the files it used.

In plain words
What is it for?
Use it to explain authentication, trace an API request through to a database response, inspect selected starting files, or ask more thorough questions with the hard-LLM option.
Why use it?
It helps you understand an unfamiliar codebase without manually locating every file involved in a system or data flow.

Command

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 commands/trafficguard/typedai/query
Clone the repo
git clone --depth 1 https://github.com/TrafficGuard/typedai
Per session 14 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 416 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.00014 $0.00416
Opus 5 $0.00007 $0.00208
Sonnet 5 $0.00003 $0.00083
Haiku 4.5 $0.00001 $0.00042

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

Security

Grade A, and why

query 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.

claude-plugins/code-analysis/commands/query.md · 61 lines

What it actually says

Query

Ask natural language questions about a codebase and receive detailed answers with citations to specific files. The agent iteratively searches and reads files to gather context before generating a comprehensive answer.

How It Works

The query agent:

  1. Analyzes the repository structure to understand the codebase
  2. Searches for relevant files using regex and/or vector search
  3. Reads and inspects files that might contain answers
  4. Synthesizes information and generates a detailed answer
  5. Includes citations to files where information was found
  6. Returns the list of files that were analyzed

Usage

query "How does the authentication system work?"

# Complex query with hard LLM (more thorough)
query -h "Explain the complete data flow from API request to database response"

# With initial files to include in context
query --initial-files=src/auth.ts,src/middleware.ts "How does this authentication flow work?"

Flags:

  • -h: Use hard LLM for complex queries (slower but more thorough)
  • --initial-files=file1,file2: Comma-separated list of initial files to include in context
  • -r: Resume from previous agent run

Output Format

Returns a detailed text answer with:

  • Comprehensive explanation answering the query
  • Citations to specific files where information was found
  • List of all files that were analyzed
  • Confidence level indicator

Example Queries

Architecture & Design:

  • "What is the overall architecture of this application?"
  • "What design patterns are used in the codebase?"

Implementation Details:

  • "How does the caching mechanism work?"
  • "Where is error handling implemented?"

Debugging:

  • "Where would authentication failures be logged?"
  • "What happens when a database connection fails?"

Notes

  • Uses multiple search strategies (file system tree with per-file summaries, regex and vector search if available)
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 · 61 lines · 14 tokens per session scan A 14a9f35983cf

Subscribe to this mod's changes

query is a command published in the GitHub repository TrafficGuard/typedai (1,192 stars, last pushed 8mo ago), licensed MIT. It adds 14 tokens to every session and 416 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-08-30.