kb-query

A method for answering questions from one or more llmkb knowledge bases, which are collections of searchable Markdown pages.

In plain words
What is it for?
It is for routing questions through a knowledge-base index, searching when needed, reading selected pages, citing them, and optionally saving durable new findings back into the knowledge base.
Why use it?
It helps find the relevant pages, use evidence from them, and show which pages support the answer instead of relying on memory alone.

Skill for Claude CodeCodex

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 skills/hogu-dev/llmkb/kb-query
Any agent
npx skills add hogu-dev/llmkb --skill kb-query
Clone the repo
git clone --depth 1 https://github.com/hogu-dev/llmkb

Made for: Claude Code, Codex.

Per session 50 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 384 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.00050 $0.00384
Opus 5 $0.00025 $0.00192
Sonnet 5 $0.00010 $0.00077
Haiku 4.5 $0.00005 $0.00038

Measured yesterday against content hash 714c8f1c0e02, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

kb-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 yesterday.

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.

skills/kb-query/SKILL.md · 36 lines

What it actually says

kb-query

Answer a question from one or more llmkb knowledge bases, cite what you used, and — when the answer produced durable new knowledge — file it back.

When to use

A user asks a question that the KB(s) should be able to answer, or asks you to research within them.

Steps

  1. Route via the index first. Read wiki/index.md (each KB's) — one line per page — to find the pages most likely to hold the answer. For multiple KBs, read each index; results are tagged by KB name.
  2. Search at scale. If the index is large or routing is unclear, run llmkb search "<query>" --kb <dir> (repeat --kb for several KBs). Use the hits to pick pages.
  3. Read the pages you selected and compose the answer.
  4. Cite every page you drew on by its [[Title]].
  5. Compound (optional but encouraged). If answering produced durable new synthesis not already captured, write it as a concept page (empty sources = agent-authored), then run llmkb reindex, append a ## [YYYY-MM-DD] synthesis | <title> line to wiki/log.md, and run llmkb lint.

Done when

The question is answered with page citations, and any new synthesis is filed, indexed, logged, and lint-clean.

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. yesterday First seen · 36 lines · 50 tokens per session scan A 714c8f1c0e02

Subscribe to this mod's changes

kb-query is a skill published in the GitHub repository hogu-dev/llmkb (1 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 50 tokens to every session and 384 once invoked, about $0.0003 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-31.