131 lines
3.5 KiB
Markdown
131 lines
3.5 KiB
Markdown
---
|
|
name: wiki-query
|
|
description: >
|
|
Answer questions using the Obsidian wiki vault. Reads hot cache first, then index,
|
|
then relevant pages. Synthesizes answers with citations. Files good answers back
|
|
as wiki pages. Triggers on: "what do you know about", "query:", "what is", "explain",
|
|
"summarize", "find in wiki", "search the wiki", "based on the wiki".
|
|
allowed-tools: ["Read", "Write", "Bash", "Glob", "Grep"]
|
|
---
|
|
|
|
# wiki-query — Query the Wiki
|
|
|
|
The wiki has already done the synthesis work. Read strategically, answer precisely, and file good answers back so the knowledge compounds.
|
|
|
|
---
|
|
|
|
## Query Workflow
|
|
|
|
1. **Read** `wiki/hot.md` first. It may already have the answer or directly relevant context.
|
|
2. **Read** `wiki/index.md` to find the most relevant pages (scan for titles and descriptions).
|
|
3. **Read** those pages. Follow wikilinks to depth-2 for key entities — no deeper.
|
|
4. **Synthesize** the answer in chat. Cite sources with wikilinks: `(Source: [[Page Name]])`.
|
|
5. **Offer to file** the answer: "This analysis seems worth keeping. Should I save it as `wiki/questions/answer-name.md`?"
|
|
6. If the question reveals a **gap**: say "I don't have enough on X. Want to find a source?"
|
|
|
|
---
|
|
|
|
## Token Discipline
|
|
|
|
Read the minimum needed:
|
|
|
|
| Start with | Cost (approx) | When to stop |
|
|
|------------|---------------|--------------|
|
|
| hot.md | ~500 tokens | If it has the answer |
|
|
| index.md | ~1000 tokens | If you can identify 3-5 relevant pages |
|
|
| 3-5 wiki pages | ~300 tokens each | Usually sufficient |
|
|
| 10+ wiki pages | expensive | Only for synthesis across the entire wiki |
|
|
|
|
If hot.md has the answer, respond without reading further.
|
|
|
|
---
|
|
|
|
## Index Format Reference
|
|
|
|
The master index (`wiki/index.md`) looks like:
|
|
|
|
```markdown
|
|
## Domains
|
|
- [[Domain Name]] — description (N sources)
|
|
|
|
## Entities
|
|
- [[Entity Name]] — role (first: [[Source]])
|
|
|
|
## Concepts
|
|
- [[Concept Name]] — definition (status: developing)
|
|
|
|
## Sources
|
|
- [[Source Title]] — author, date, type
|
|
|
|
## Questions
|
|
- [[Question Title]] — answer summary
|
|
```
|
|
|
|
Scan the section headers first to determine which sections to read.
|
|
|
|
---
|
|
|
|
## Domain Sub-Index Format
|
|
|
|
Each domain folder has a `_index.md` for focused lookups:
|
|
|
|
```markdown
|
|
---
|
|
type: meta
|
|
title: "Entities Index"
|
|
updated: YYYY-MM-DD
|
|
---
|
|
# Entities
|
|
|
|
## People
|
|
- [[Person Name]] — role, org
|
|
|
|
## Organizations
|
|
- [[Org Name]] — what they do
|
|
|
|
## Products
|
|
- [[Product Name]] — category
|
|
```
|
|
|
|
Use sub-indexes when the question is scoped to one domain. Avoid reading the full master index for narrow queries.
|
|
|
|
---
|
|
|
|
## Filing Answers Back
|
|
|
|
Good answers compound into the wiki. Don't let insights disappear into chat history.
|
|
|
|
When filing an answer:
|
|
|
|
```yaml
|
|
---
|
|
type: question
|
|
title: "Short descriptive title"
|
|
question: "The exact query as asked."
|
|
answer_quality: solid
|
|
created: YYYY-MM-DD
|
|
updated: YYYY-MM-DD
|
|
tags: [question, <domain>]
|
|
related:
|
|
- "[[Page referenced in answer]]"
|
|
sources:
|
|
- "[[wiki/sources/relevant-source.md]]"
|
|
status: developing
|
|
---
|
|
```
|
|
|
|
Then write the answer as the page body. Include citations. Link every mentioned concept or entity.
|
|
|
|
After filing, add an entry to `wiki/index.md` under Questions and append to `wiki/log.md`.
|
|
|
|
---
|
|
|
|
## Gap Handling
|
|
|
|
If the question cannot be answered from the wiki:
|
|
|
|
1. Say clearly: "I don't have enough in the wiki to answer this well."
|
|
2. Identify the specific gap: "I have nothing on [subtopic]."
|
|
3. Suggest: "Want to find a source on this? I can help you search or process one."
|
|
4. Do not fabricate. Do not answer from training data if the question is about the specific domain in this wiki.
|