kb-query

kb-query is a command for Claude Code from eddiebelaval/squire. It costs 0 tokens per session (1,362 once invoked), scanned A, original, MIT.

A question-and-answer command for searching one or more knowledge bases and citing the notes it uses. It can also save answers or format them as Marp slides, a Markdown-based presentation format.

In plain words
What is it for?
Use it to query a relevant knowledge base, search across all of them, save the result, or create a slide deck.
Why use it?
It helps you answer questions from your own reference material while keeping track of where the information came from.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution. Also seen: reads .claude/ paths.

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/eddiebelaval/squire/kb-query
Clone the repo
git clone --depth 1 https://github.com/eddiebelaval/squire

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

README.md
[![agentmods](https://agentmods.dev/badge/commands/eddiebelaval/squire/kb-query.svg)](https://agentmods.dev/commands/eddiebelaval/squire/kb-query)
Your own site
<a href="https://agentmods.dev/commands/eddiebelaval/squire/kb-query"><img src="https://agentmods.dev/badge/commands/eddiebelaval/squire/kb-query.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 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,362 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.00000 $0.01362
Opus 5 $0.00000 $0.00681
Sonnet 5 $0.00000 $0.00272
Haiku 4.5 $0.00000 $0.00136

Measured 2d ago against content hash b2ae7aa66173, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, 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 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/kb-query.md · 197 lines

How it starts

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

/kb-query -- Knowledge Base Query

You answer questions against id8Labs knowledge bases, citing sources with Obsidian wikilinks.

Arguments: $ARGUMENTS


Route by Arguments

Parse $ARGUMENTS:

Input Action
<question> Query the most relevant KB (auto-detect from question content)
<question> --kb <name> Query a specific KB
<question> --all Query across all KBs (federated)
<question> --save Save the answer to the KB's output/ directory
<question> --kb <name> --save Query specific KB and save
<question> --slides Output answer as Marp slide deck
<question> --slides --save Generate slides and save to output/
list List all registered KBs with descriptions and tags
(empty) List all registered KBs

Flags can be combined: --all --save, --kb research --save, --all --slides --save


Setup

  1. Read ~/Development/id8/knowledge/manifest.json
  2. Read the skill reference: ~/.claude/skills/knowledge/SKILL.md

Query Process

Step 1: Select Target KBs

  • If --kb <name>: use only that KB
  • If --all: use all KBs in manifest
  • If no flag: read question, match against KB tags in manifest, select the most relevant 1-2 KBs

Step 2: Load Indexes

For each target KB:

  1. Read {kb}/wiki/_index.md to understand what articles exist
  2. Scan section headers and article descriptions to identify relevant articles

Step 3: Read Relevant Articles

Based on the question:

  1. Identify which concept, source, and connection articles are relevant
  2. Read those articles (use Glob to find files if needed)
  3. For extended KBs (research): also check registries (findings, contradictions, open-questions)
  4. For mirror KBs (memory): read the linked topic files

Be selective. Don't read the entire KB. Read the index, identify 3-8 relevant articles, read those.

Step 4: Synthesize Answer

Answer the question using information from the articles:

  • Cite sources using [[wikilinks]] (e.g., "According to [[concepts/dark-mode-native]], ...")
  • If cross-KB query: clearly attribute which KB each insight comes from
  • If information is insufficient: say so and suggest what raw sources might help
  • Be concise but thorough

Read the full file on GitHub · 197 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 · 197 lines · 0 tokens per session scan A b2ae7aa66173

Subscribe to this mod's changes

kb-query is a command published in the GitHub repository eddiebelaval/squire (21 stars, last pushed 20d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,362 tokens. 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-09-03.