query

A command for asking questions of a personal wiki, a collection of organized pages that stores researched knowledge.

In plain words
What is it for?
Use it for factual lookups, comparisons, analyses, and summaries based on wiki content, with routing, search, and citations.
Why use it?
It finds the relevant wiki pages, compares or combines their information, and can save useful answers back into the wiki instead of leaving them only in chat.

Command for Claude Code

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/fivetaku/llm-wiki/query
Clone the repo
git clone --depth 1 https://github.com/fivetaku/llm-wiki

Made for: Claude Code.

Per session 97 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,419 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.00097 $0.01419
Opus 5 $0.00048 $0.00709
Sonnet 5 $0.00019 $0.00284
Haiku 4.5 $0.00010 $0.00142

Measured 2d ago against content hash 4e828252adb7, 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/commands/query.md · 58 lines

How it starts

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

위키에 질문하고 관련 페이지를 회수해 인용과 함께 합성합니다. 좋은 답은 채팅에 흘리지 않고 50-queries/에 파일백해 누적합니다.

Phase A(Route)는 "어디를 열지"만 작은 파일(라우터+aliases, ~2K 토큰)로 정하고, Phase B(Search)에서만 샤드·페이지를 읽습니다 — 라우팅은 샤드를 절대 읽지 않아 샤딩의 토큰 절감을 지킵니다. 정본은 conventions.md §9.

사용법

/query [질문]
/query 나폴레옹의 전술이 어떻게 진화했나?
/query A와 B를 비교 표로

Phase A — ROUTE (페이지 안 읽음)

  • A1. 파싱 — 질문에서 엔티티 N개 + 타입 의도(entity/concept/source) + 연산(단순조회 / 비교 / 종합·탐색)을 뽑는다. 모호하면 한 줄 되묻고 진행.
  • A2. 정본화(normalize)30-wiki/{topic}/aliases.md를 읽어 각 표기를 정본명으로 바꾼다 (예: "Parasite"→기생충).
  • A3. 분기:
    • .rag/가 있고 임베딩 키가 유효하면 → 경로 1(하이브리드 검색, 1순위): collections.json routing으로 의도→컬렉션 선택 → search.py "{질문}" --type {컬렉션} --k 8 --json → 반환 page 경로 Read(라우터·샤드 불필요) → 점수로 우선순위. 실패(키 부재·429·오류) 시 조용히 경로 2로 폴백.
    • 그 외 → 경로 2(라우터→샤드 tiered-read, 기본/폴백): 30-wiki/index.md(루트)에서 주제를 고르고 → {topic}/index.md(주제 라우터)만 보고 각 정본 엔티티의 **(타입, 샤드)**를 정한다. 샤드는 정본명 첫 글자로(한글=둘째 샤드). 동명은 라우터 충돌 노트로 양쪽 샤드 포함. 타입 모호면 후보 샤드 모두, **다중 엔티티(비교·종합)**면 각 샤드 union. 산출 = 열 샤드의 최소 집합.
  • B1. 샤드 회수 — Route가 지정한 샤드만 연다(다른 샤드 로드 금지). 각 줄 description·키워드로 후보 페이지 선별. 거시·탐색 질문은 overview.md를 먼저 읽고 내려간다.
  • B2. tiered read — 후보 frontmatter summary로 추리고 관련 페이지 본문만 펼친다. 본문 [[링크]]1홉만 따라가 보강(무한 확장 금지).
  • B3. 넓히기 사다리(미스 시) — 기대 샤드에서 못 찾으면: (a) 같은 타입 형제 샤드(정본화 실패로 글자 오판 대비) → (b) 30-wiki/{topic}/ 전체 grep → (c) lazy 생성 또는 "없음".
  • B4. lazy 생성 — grep에도 없을 때: 20-raw/·sources/씨앗이 있으면 raw+웹으로 즉석 생성(tier: auto, provenance: web-enriched) → auto-generated.md 대장 + 첫 글자 샤드 등재(라우터는 개수만 갱신). 씨앗 없으면 지어내지 말고 "위키에 없음 — /ingest 필요".
  • B5. 근거로만 답 — 회수 페이지 내용으로만, 각 주장에 [[페이지]] 인용 + provenance. 근거 없으면 지어내지 않는다.
  • B6. 복리 환원 — 탐색·종합 가치가 있으면 50-queries/{slug}.mdtype: query 저장 + 관련 페이지에 [[링크]] 연결 + 주제 라우터 「저장된 쿼리」절 + log.md(## [날짜] query | {요약}) 갱신. 단순 단답은 저장 안 함.

Read the full file on GitHub · 58 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 · 58 lines · 97 tokens per session scan A 4e828252adb7

Subscribe to this mod's changes

query is a command published in the GitHub repository fivetaku/llm-wiki (82 stars, last pushed 2mo ago), licensed MIT. It adds 97 tokens to every session and 1,419 once invoked, about $0.0005 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.