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
~/.obsidian-wiki/config
to get
OBSIDIAN_VAULT_PATH
(works from any project). Fall back to
.env
if you're inside the obsidian-wiki repo.
Read
$OBSIDIAN_VAULT_PATH/index.md
to understand the wiki's scope and structure
Visibility Filter (optional)
By default,
all pages are returned
regardless of visibility tags. This preserves existing behavior — nothing changes unless the user asks for it.
If the user's query includes phrases like
"public only"
,
"user-facing"
,
"no internal content"
,
"as a user would see it"
, or
"exclude internal"
, activate
filtered mode
:
Build a
blocked tag set
:
{visibility/internal, visibility/pii}
In the Index Pass (Step 2), skip any candidate whose frontmatter tags contain a blocked tag
In Section/Full Read passes (Steps 3–4), do not read or cite any blocked page
Synthesize the answer
only from allowed pages
— do not mention that excluded pages exist
Pages with no
visibility/
tag, or tagged
visibility/public
, are always included.
In filtered mode, note the filter in the Step 6 log entry:
mode=filtered
.
Retrieval Protocol
Follow the Retrieval Primitives table in
llm-wiki/SKILL.md
.
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.
Step 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 +
index.md
only.
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
index.md
above — use it as the first filter. It lists every page with a one-line description and tags.
Use
Grep
to scan page
frontmatter only
for title, tag, alias, and summary matches. A pattern like
^(title|tags|aliases|summary):
scoped to vault
.md
files is far cheaper than content grep.
Collect the top 5–10 candidate page paths ranked by:
Exact title or alias match
Tag match
Summary field contains the query term
index.md
entry contains the query term
If you're in
index-only mode
, stop here. Answer from
summary:
fields, titles, and
index.md
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.
Step 2b: QMD Semantic Pass (optional — requires
QMD_WIKI_COLLECTION
in
.env
)
GUARD: If
$QMD_WIKI_COLLECTION
is empty or unset, skip this entire step and proceed to Step 3.
No QMD?
Skip to Step 3 and use
Grep
directly on the vault. QMD is faster and concept-aware but the grep path is fully functional. See
.env.example
for setup.
If
QMD_WIKI_COLLECTION
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
Grep
:
mcp__qmd__query:
collection:
wiki-query
安装
npx skills add https://github.com/ar9av/obsidian-wiki --skill wiki-query