query

A command for searching a documentation wiki and combining relevant pages into an answer. It can also trace concept paths or save a search answer as a permanent wiki page.

In plain words
What is it for?
Use it to answer questions from the wiki, find links between two concepts, or promote a saved query result into a wiki page.
Why use it?
It reduces the need to search pages manually and helps gather connected information while preserving citations and possible contradictions.

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/narailabs/doc-wiki/query
Clone the repo
git clone --depth 1 https://github.com/narailabs/doc-wiki
Per session 18 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 542 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.00018 $0.00542
Opus 5 $0.00009 $0.00271
Sonnet 5 $0.00004 $0.00108
Haiku 4.5 $0.00002 $0.00054

Measured 2d ago against content hash 1a4b001e1851, 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.

commands/query.md · 17 lines

What it actually says

Invoke the doc-wiki skill to run the /doc-wiki:query workflow with the user's arguments: $ARGUMENTS

Call Skill(doc-wiki, "query $ARGUMENTS"). The skill orchestrator reads skills/doc-wiki/SKILL.md, locates the ### /doc-wiki:query — Summary-first search + synthesis section, and dispatches one of four modes:

  • Synthesis mode (default): runs the summary-first flow — read summaries.md, score relevance, load top-N pages, follow links up to 5 levels, synthesize with citations, surface contradictions, archive to outputs/queries/, log token efficiency. After the answer, prompts "Save this answer as a permanent wiki page?" (gated by autonomy mode).
  • Path mode (when --from and --to are present): shells out to graph_ops.js path against <wiki-root>/graph/edges.jsonl and returns the typed-edge chain connecting the two concepts. Skips summary-first scoring, link-following, synthesis, and the promote prompt.
  • Promote mode (when --promote <file|last|N> is present): converts an archived answer in outputs/queries/ into a wiki page (frontmatter, citation→link rewriting, topic placement). Argument forms: last/latest → most recent; integer N → Nth most recent; path → as-is; single token → filename substring match; empty → list-and-pick.
  • Review mode (when --review is present): bulk archive triage with per-item P/S/D/A approval, honoring autonomy mode. Supports --since <duration>, --limit <N>, and --topic <dir> for filtering.

If $ARGUMENTS is empty, ask the user what they want: a question to answer (synthesis mode), two concepts to connect (path mode), an archive to promote, or a batch review of archives.

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 · 17 lines · 18 tokens per session scan A 1a4b001e1851

Subscribe to this mod's changes

query is a command published in the GitHub repository narailabs/doc-wiki (13 stars, last pushed 2d ago), licensed Apache-2.0. It adds 18 tokens to every session and 542 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.