wiki-query
Original:🇺🇸 English
Translated
Answer questions by searching the compiled Obsidian wiki. Use this skill when the user asks a question about their knowledge base, wants to find information across their wiki, asks "what do I know about X", "find everything related to Y", or wants synthesized answers with citations from their wiki pages. Also use when the user wants to explore connections between topics in their wiki. Works from any project. Includes an index-only fast mode triggered by "quick answer", "just scan", "don't read the pages", "fast lookup" — returns answers from page summaries and frontmatter without reading page bodies.
2installs
Sourcear9av/obsidian-wiki
Added on
NPX Install
npx skill4agent add ar9av/obsidian-wiki wiki-queryTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Wiki Query — Knowledge Retrieval
You are answering questions against a compiled Obsidian wiki, not raw source documents. The wiki contains pre-synthesized, cross-referenced knowledge.
Before You Start
- Read to get
~/.obsidian-wiki/config(works from any project). Fall back toOBSIDIAN_VAULT_PATHif you're inside the obsidian-wiki repo..env - Read to understand the wiki's scope and structure
$OBSIDIAN_VAULT_PATH/index.md
Retrieval Protocol
Follow the Retrieval Primitives table in . Reading is the dominant cost of this skill — use the cheapest primitive that answers the question and escalate only when it can't. Never jump straight to full-page reads.
llm-wiki/SKILL.mdStep 1: Understand the Question
Classify the query type:
- Factual lookup — "What is X?" → Find the relevant page(s)
- Relationship query — "How does X relate to Y?" → Find both pages and their cross-references
- Synthesis query — "What's the current thinking on X?" → Find all pages that touch X, synthesize
- Gap query — "What don't I know about X?" → Find what's missing, check open questions sections
Also decide the mode:
- Index-only mode — triggered by "quick answer", "just scan", "don't read the pages", "fast lookup". Stops at Step 3. Answers from frontmatter + only.
index.md - Normal mode — the full tiered pipeline below.
Step 2: Index Pass (cheap)
Build a candidate set without opening any page bodies:
- You've already read above — use it as the first filter. It lists every page with a one-line description and tags.
index.md - Use to scan page frontmatter only for title, tag, alias, and summary matches. A pattern like
Grepscoped to vault^(title|tags|aliases|summary):files is far cheaper than content grep..md - Collect the top 5–10 candidate page paths ranked by:
- Exact title or alias match
- Tag match
- Summary field contains the query term
- entry contains the query term
index.md
If you're in index-only mode, stop here. Answer from fields, titles, and descriptions only. Label the answer clearly: "(index-only answer — page bodies not read; facts below are from page summaries and may miss nuance)". Then skip to Step 5.
summary:index.mdStep 2b: QMD Semantic Pass (optional — requires QMD_WIKI_COLLECTION
in .env
)
QMD_WIKI_COLLECTION.envGUARD: If is empty or unset, skip this entire step and proceed to Step 3.
$QMD_WIKI_COLLECTIONNo QMD? Skip to Step 3 and usedirectly on the vault. QMD is faster and concept-aware but the grep path is fully functional. SeeGrepfor setup..env.example
If is set and the index pass didn't produce clear candidates — or the question requires semantic matching rather than exact terms — use QMD before reaching for :
QMD_WIKI_COLLECTIONGrepmcp__qmd__query:
collection: <QMD_WIKI_COLLECTION> # e.g. "knowledge-base-wiki"
intent: <the user's question>
searches:
- type: lex # keyword match — good for exact names, file paths, error messages
query: <key terms>
- type: vec # semantic match — good for concepts, patterns, "what is X like"
query: <question rephrased as a description>The returned snippets act as pre-read section summaries. If they answer the question fully, skip Step 3 and go straight to Step 4 (reading only the pages QMD ranked highest). If not, use the ranked file list to guide which files to grep or read in Step 3.
Also search when the question may have source material in :
papers_raw/If is set and the user is asking about a topic likely covered by ingested papers (research, theory, background), run a parallel search against the papers collection. Cite raw sources separately from compiled wiki pages in your answer.
QMD_PAPERS_COLLECTIONStep 3: Section Pass (medium cost — only if Steps 2/2b are inconclusive)
For each of the top candidates, pull the relevant section without reading the whole page:
- Use to get just the lines around the match.
Grep -A 10 -B 2 "<query-term>" <candidate-file> - This usually returns 15–30 lines per hit instead of 100–500.
- If the section grep gives a clear answer, go straight to Step 5.
Step 4: Full Read (expensive — last resort)
Only when Steps 2 and 3 don't answer the question:
- the top 3 candidates in full.
Read - Follow at most one hop of from those pages if the answer requires cross-references.
[[wikilinks]] - Check "Open Questions" sections for known gaps.
- If you're still short, then fall back to a broad content grep across the vault. Tell the user you escalated — this is the expensive path and they should know.
Step 5: Synthesize an Answer
Compose your answer from wiki content:
- Cite specific wiki pages using notation
[[page-name]] - Note which step the answer came from ("found in summary" vs "grepped section" vs "full page read") — helps the user understand confidence
- If the wiki has contradictions, present both sides
- If the wiki doesn't cover something, say so explicitly
- Suggest which sources might fill the gap
Step 6: Log the Query
Append to :
log.md- [TIMESTAMP] QUERY query="the user's question" result_pages=N mode=normal|index_only escalated=true|falseAnswer Format
Structure answers like this:
Based on the wiki:[Your synthesized answer with [[wikilinks]] to source pages]Pages consulted: [[page-a]], [[page-b]], [[page-c]]Gaps: [What the wiki doesn't cover that might be relevant]