W

wiki-query

by @ar9avv
4.4(21)

コンパイルされたObsidian wikiに対して知識検索を実行し、事前に統合された相互参照知識を返します。

knowledge-retrievalobsidiansearchwikiGitHub
インストール方法
npx skills add https://github.com/ar9av/obsidian-wiki --skill wiki-query
compare_arrows

Before / After 効果比較

1 组
使用前

大量のドキュメントからキーワードを手動で検索し、関連するセクションを読み、文脈を理解しようとし、答えを見つけるのに 10-15 分かかります。

使用後

事前に統合された wiki を直接照会すると、システムは抽出された知識の回答を返し、30 秒以内に正確な情報を得られます。

SKILL.md

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.

This skill is READ-ONLY

wiki-query answers questions. It MUST NOT create or modify any wiki content. The ONLY write it may perform is the single Step 6 append to log.md.

Never, even when a change seems obviously helpful:

  • create or edit pages under concepts/, entities/, skills/, references/, synthesis/, journal/, or projects/
  • modify index.md, hot.md, _insights.md, or .manifest.json

If the user's message contains a new finding, an action request ("save this", "ban X", "record that"), or anything implying a change, do not perform it. Answer the question, PROPOSE the change, and route the user to the right skill:

  • quick note / gotcha → wiki-capture --quick
  • a full new page → wiki-capture
  • a project-knowledge sync → wiki-update

Before You Start

  1. Resolve config — follow the Config Resolution Protocol in llm-wiki/SKILL.md (inline @name override → walk up CWD for .env → global config → prompt setup). For cross-project queries without @name, prefer the global config when present, even if it is a symlink to the vault .env. This gives OBSIDIAN_VAULT_PATH and any QMD variables. Works from any project directory.
  2. Load QMD settings from the resolved config before deciding retrieval strategy. If QMD_WIKI_COLLECTION is set, treat QMD as available subject only to transport/tool checks below. If it is empty or unset, say briefly why QMD is being skipped before using grep/page reads.
  3. If $OBSIDIAN_VAULT_PATH/hot.md exists, read it first — it gives you instant context on recent activity. If the user's question is about something ingested recently, hot.md may answer it before you even open index.md.
  4. 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 0: GraphRAG Pre-pass (fast index query — no page reads)

Before opening any pages, query the compiled graph index:

obsidian-wiki graph-query "$OBSIDIAN_VAULT_PATH" "<question>" --pretty

Output fields:

  • answer_type: direct | path | list | gap | impact | bridges | hubs | clusters | surprising — shapes what to do next. The last five are structural intents: the question is about the shape of the vault, and the answer comes back fully computed in graph (see below) with no page reads at all.
  • graph: present only for structural intents — the computed answer. null otherwise.
  • candidates: top-ranked pages by title/tag/summary match + degree, with scores and summaries
  • should_read: the pages most worth opening — start here instead of speculatively reading many files
  • path: for multi-hop queries, the shortest wikilink path between the two concepts
  • god_nodes_relevant: hub pages related to your query terms — always useful context
  • index_only: if true, the top candidate's summary already answers the question — skip page reads
  • temporal: as_of, retrievable, excluded_historical — how many pages the event-time filter held back (see below)

Structural intents — these are answered entirely from the graph. The user's phrasing routes automatically:

The user asksanswer_typegraph contains
"what breaks if I delete X" / "what depends on X" / "what links to X"impactdirect_dependents, transitive_dependents, total
"which pages bridge my clusters" / "what would fragment my vault"bridgespages by betweenness, with label and connects_labels
"what's central" / "top hubs" / "my main topics"hubspages by degree, with in/out split
"what clusters do I have" / "how is my wiki organised"clusterseach cluster's label, size, cohesion, fragmented
"surprising connections" / "unexpected links"surprisingcross-cluster links, rarest first

Report the graph payload directly — do not re-derive it by reading pages. If a structural question names a page that can't be resolved, the CLI falls back to direct and graph is null.

Decision tree:

  1. If graph is non-null → the structural answer is complete. Report it and stop; no page reads.
  2. If index_only: true → answer directly from candidates[0].summary. Skip Steps 1–4, go to Step 5.
  3. If answer_type == "path" and path is non-empty → the connection is in path. Read only those pages.
  4. Otherwise → open only should_read pages (not all candidates). This replaces the speculative 5–10 page reads the old flow required.

The graph used here excludes vault bookkeeping files (index.md, log.md, hot.md, _insights.md). They link to nearly every page, so including them made any two pages look ~2 hops apart and produced meaningless A → index → B paths.

Event time. Pages may carry valid_from / valid_until / superseded_by frontmatter. A page whose valid_until has passed is historical: it stays in the vault and in the graph, but drops out of candidates by default, so "which X do we use?" answers with what is true now rather than whatever was written first.

  • When temporal.excluded_historical is non-zero, say so if it is material to the answer — the user may be asking about the superseded state.
  • If the question is about the past ("what did we use in 2025", "before the migration"), re-run with --as-of YYYY-MM-DD to retrieve what held then.
  • Use --include-historical when the user explicitly wants the whole history, or when you are tracing how a decision changed.
  • A returned candidate carrying superseded_by names its replacement — follow it rather than reporting the stale claim as current.
obsidian-wiki graph-query "$OBSIDIAN_VAULT_PATH" "<question>" --as-of 2025-06-01 --pretty
obsidian-wiki graph-query "$OBSIDIAN_VAULT_PATH" "<question>" --include-historical --pretty

The structural intents ignore this filter on purpose: deleting a page still breaks the historical pages that link to it, so a blast radius must not shrink just because a dependent is no longer current.

Fallback (if obsidian-wiki is not installed): proceed with Step 1 as normal using grep and index.md.

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?" / "What contradicts X?" → Find both pages, their cross-references, and their relationships: frontmatter blocks for typed edges
  • Path / multi-hop query — "How is X connected to Y?" / "What links X to Y?" / "Trace the chain from X to Z" / "What does X depend on transitively?" → X and Y don't link directly; the connection runs through intermediate pages. Use the multi-hop graph traversal in Step 4b.
  • 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
  • Challenge query — "challenge this" / "argue against X" / "poke holes in my plan" / "what did I decide about X?" → The user is about to commit to something. Look for the vault's own evidence against it. See "Challenge queries" under Step 5.

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:
    1. Exact title or alias match
    2. Tag match
    3. Summary field contains the query term
    4. index.md entry contains the query term
  • Apply tier ordering within each rank bucket: when two candidates score equally, prefer tier: core over tier: supporting over tier: peripheral. Read the tier: frontmatter field with the same cheap grep as other fields. Pages without a tier: field are treated as supporting.

Track retrieval counts as you go (for the transparency report in Step 5/6):

  • candidates_seen — total distinct pages that matched any rank criterion above, before trimming to the top 5–10.
  • candidates_used — how many of those you actually carried forward into Steps 3/4.
  • dropped — candidates_seen − candidates_used, i.e. matches that existed but were never read. If this is non-zero, name the dropped pages (or the count if there are many) so the user knows retrieval wasn't exhaustive — this is not an error, just an honest accounting of what was left out.

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 resolved config)

GUARD: If $QMD_WIKI_COLLECTION is empty or unset after config resolution, skip this entire step and proceed to Step 3. Mention the missing variable in your working update.

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, run QMD before reaching for Grep unless the question is already fully answered by hot.md or index.md metadata. QMD is especially preferred when the question is semantic, project-specific, asks for related context, or uses terms that may not appear verbatim in titles/frontmatter.

Choose the QMD transport from $QMD_TRANSPORT:

  • mcp (default): use the QMD MCP tool configured in the agent.
  • cli: run the local qmd CLI. Use $QMD_CLI if set; otherwise use qmd.

For detailed CLI command selection, maintenance, and VM caveats, use the local $qmd-cli skill when it is installed.

If the selected transport is unavailable (no MCP tool, qmd not on PATH, or the command errors), skip QMD and continue with Step 3.

For MCP transport:

mcp__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>

For CLI transport, pick the command from $QMD_CLI_SEARCH_MODE:

Keep operator-like or punctuation-heavy tokens such as no-sudo, ansible_become=false, and ~/.local/bin in the lex: line. Rewrite the vec: line as plain natural language without hyphenated -term words; QMD treats -term as negation, and negation is not supported in vec/hyde queries.

  • quality (default): best relevance; slower on CPU.
    ${QMD_CLI:-qmd} query $'lex: <key terms>\nvec: <question rephrased as a description>' -c "$QMD_WIKI_COLLECTION" -n 8 --files
    
  • balanced: hybrid search without LLM reranking; use when quality is too slow.
    ${QMD_CLI:-qmd} query $'lex: <key terms>\nvec: <question rephrased as a description>' -c "$QMD_WIKI_COLLECTION" -n 8 --no-rerank --files
    
  • fast: semantic-only recall, or search instead when exact names, file paths, or error messages matter.
    ${QMD_CLI:-qmd} vsearch "<question rephrased as a description>" -c "$QMD_WIKI_COLLECTION" -n 8 --files
    

Use ${QMD_CLI:-qmd} get "#docid" to retrieve a ranked document by docid when CLI output provides one.

The returned snippets or ranked files 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.

Fold QMD hits into the same candidates_seen count from Step 2 (dedupe by path — a page found by both frontmatter grep and QMD counts once).

Defensive filter: drop any _raw/ path from wiki-collection results. The wiki collection is supposed to index only compiled pages, but a misconfigured collection (see .env.example) can end up indexing _raw/ — including stale drafts sitting in _raw/_archived/ that were already superseded by a promoted page. Before using a QMD hit from $QMD_WIKI_COLLECTION, check its path: if it contains _raw/, discard it from the wiki-collection result set (it may still surface legitimately via $QMD_PAPERS_COLLECTION, cited as a raw source). This keeps a misconfigured collection degrading to "missing recall" rather than "silently citing a superseded draft as compiled knowledge." If you see _raw/ paths coming back from the wiki collection, mention it in your working update so the user knows their collection scope needs fixing (see .env.example QMD section).

Also search papers when the question may have source material in _raw/:

If QMD_PAPERS_COLLECTION 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.

Step 3: Section Pass (medium cost — only if Steps 2/2b are inconclusive)

For each of the top candidates, pull the relevant sectio

...

ユーザーレビュー (0)

レビューを書く

効果
使いやすさ
ドキュメント
互換性

レビューなし

統計データ

インストール数3.6K
評価4.4 / 5.0
バージョン
更新日2026年11月15日
比較事例1 件

ユーザー評価

4.4(21)
5
57%
4
29%
3
10%
2
5%
1
0%

この Skill を評価

0.0

対応プラットフォーム

🔧Claude Code

タイムライン

作成2026年4月26日
最終更新2026年11月15日
🎁 Agent 知識カード
アンケート