kb-query
KB Query
Search, answer, and generate outputs from the compiled wiki.
The key principle is that substantive research answers become persistent knowledge artifacts. Do not treat valuable Q&A as disposable chat.
Read before querying
Read these files first:
- local
AGENTS.md - local
CLAUDE.mdif present ../obsidian-notes-karpathy/references/file-model.md../obsidian-notes-karpathy/references/lifecycle-matrix.md../obsidian-notes-karpathy/references/qa-template.md../obsidian-notes-karpathy/references/content-output-template.md../obsidian-notes-karpathy/references/search-upgrades.md../obsidian-notes-karpathy/references/activity-log-template.md../obsidian-notes-karpathy/references/obsidian-safe-markdown.md
If one or more shared references are missing, continue with the minimum compatible contract:
- ground answers in the compiled wiki instead of improvising from chat context
- archive substantive answers by default
- obey Obsidian-safe markdown rules whenever you emit tables
Report missing shared references in the final summary.
Then start with:
wiki/index.mdwiki/indices/INDEX.mdwiki/indices/CONCEPTS.mdwiki/indices/SOURCES.mdwiki/indices/ENTITIES.mdwhen it exists
Mode selection
Choose one of three modes:
- search mode for finding relevant notes and evidence quickly
- research mode for answering a substantive question
- publish mode for generating outward-facing artifacts grounded in the wiki
Search mode
For search-like requests:
- inspect
wiki/index.md - inspect concept, source, and optional entity indices
- use ordinary file search or
obsidian-cli - use backlinks, unlinked mentions, or property search when they can surface related evidence faster than plain text search
- return a structured result list with short relevance notes and a few excerpts
Prefer markdown-first navigation before suggesting any search infrastructure upgrade.
Research mode
For complex questions, follow this order:
Step 1: understand the question
Identify:
- key concepts
- key entities when relevant
- expected answer shape
- whether the question is factual, comparative, analytical, or exploratory
Step 2: check existing Q&A
Search outputs/qa/ first.
If you find a strong prior answer:
- use it as a starting point
- update or extend it when needed
- avoid re-deriving the same answer from scratch
Step 3: navigate the wiki
Read the most relevant concept pages, entity pages, and summaries, following wikilinks where they add evidence or contrast.
Step 4: synthesize with provenance
Answer using wiki citations and explicit uncertainty when sources disagree or evidence is thin.
Step 5: archive by default
If the answer is substantive, save it to outputs/qa/{date}-{slug}.md using ../obsidian-notes-karpathy/references/qa-template.md.
Only skip archival when:
- the user explicitly says not to save it, or
- the interaction is trivial and purely operational
Step 6: append the query log
When the answer is archived or materially updated, append a query entry to wiki/log.md using ../obsidian-notes-karpathy/references/activity-log-template.md.
Step 7: feed useful insights back into the wiki
After archiving, check whether the answer revealed:
- a new concept page that should exist
- a new entity page that should exist
- new evidence for an existing concept or entity
- a missing connection between pages
Update the wiki when the improvement is mechanical and well-supported.
Publish mode
Use this when the user wants content for an audience rather than only an internal answer.
Supported artifacts:
outputs/content/articles/for article draftsoutputs/content/threads/for X or social threadsoutputs/content/talks/for talk outlinesoutputs/reports/for markdown reportsoutputs/slides/for Marp decksoutputs/charts/for Mermaid or Canvas outputs
For every generated artifact:
- look for an existing supporting Q&A note first
- if no strong supporting Q&A exists, create one before or immediately after the publish artifact
- use
../obsidian-notes-karpathy/references/content-output-template.mdwhen the output is audience-facing - cite the wiki pages and prior Q&A consulted
- keep filenames date-prefixed and slugged
- append a
publishentry towiki/log.mdwhen the artifact is substantive - if the artifact uses tables, keep them Obsidian-safe; never place alias-style wikilinks inside table cells
Output requirements
In your user-facing summary, report:
- which wiki pages or prior Q&A you relied on
- which mode you used
- where the new artifact was saved
- whether you updated any concept or entity pages as a result
- whether you appended a
queryorpublishentry towiki/log.md - whether any shared references or optional local files were missing
Tooling notes
- Use
obsidian-markdownfor all markdown outputs and wikilinks. - Use
obsidian-cliwhen available for vault-aware search. - Use
obsidian-canvas-creatoronly when the user explicitly wants a canvas-style artifact.