wiki-query

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Query — Ask about the wiki

查询——询问维基相关内容

Follow
wiki/CONVENTIONS.md
for format conventions, links, and language.
请遵循
wiki/CONVENTIONS.md
中的格式规范、链接和语言要求。

Language

语言

Write the artifact in the user's language. Apply correct grammar and any required diacritics or script-specific characters. If the user's language is unclear, ask before generating output.
使用用户的语言撰写输出内容。确保语法正确,并使用所需的变音符号或特定脚本字符。如果用户的语言不明确,请先询问再生成输出。

Query language alignment

查询语言对齐

When the user's language differs from the wiki language, translate the retrieval query into the wiki language before searching. Determine the wiki language from
.wiki-guardrails.yml
(
query_language
or
language
), then from wiki frontmatter/index if guardrails are absent. Keep exact product names and code identifiers unchanged.
  • Write
    intent:
    ,
    vec:
    , and
    hyde:
    in the wiki language.
  • Use
    lex:
    for exact terms from both languages when useful.
  • Answer the user in the user's language unless they ask otherwise.
  • If translation is uncertain, say which terms were translated and keep the original terms in
    lex:
    .
当用户使用的语言与维基语言不同时,先将检索查询翻译成维基语言再进行搜索。从
.wiki-guardrails.yml
文件(
query_language
language
字段)确定维基语言;如果没有该配置文件,则从维基的前置元数据/索引中确定。产品名称和代码标识符保持不变。
  • 用维基语言编写
    intent:
    vec:
    hyde:
    字段。
  • 当有用时,使用
    lex:
    来包含两种语言中的精确术语。
  • 除非用户另有要求,否则用用户的语言回答问题。
  • 如果对翻译不确定,请说明哪些术语已翻译,并将原始术语保留在
    lex:
    中。

Retrieval — prefer QMD when available

检索——优先使用QMD(如果可用)

The recommended retrieval engine is QMD (local hybrid search: BM25 + vector + LLM reranking). Setup is one-time per repo — see
docs/wiki/qmd-setup.md
in this skills repo.
Detect availability before each query:
  • MCP available (
    mcp__qmd__status
    and
    mcp__qmd__query
    tools registered) → use the MCP tools.
  • CLI available (
    which qmd
    succeeds) → use
    qmd query --json --files --min-score 0.4
    .
  • Neither available → fall back to the grep/index path described below. Tell the user once that QMD is not configured and point them to
    docs/wiki/qmd-setup.md
    .
Never run
qmd embed
,
qmd update
, or
qmd collection add
automatically — those are owner-run setup commands. The skill only queries an already-built index.
推荐的检索引擎是**QMD**(本地混合搜索:BM25 + 向量 + LLM重排序)。每个仓库只需一次性设置——请参阅本技能仓库中的
docs/wiki/qmd-setup.md
每次查询前检测可用性:
  • MCP可用(已注册
    mcp__qmd__status
    mcp__qmd__query
    工具)→ 使用MCP工具。
  • CLI可用
    which qmd
    执行成功)→ 使用
    qmd query --json --files --min-score 0.4
    命令。
  • 两者都不可用→ 回退到下文描述的grep/索引路径。告知用户一次QMD未配置,并引导他们查看
    docs/wiki/qmd-setup.md
切勿自动运行
qmd embed
qmd update
qmd collection add
命令——这些是管理员执行的设置命令。本技能仅查询已构建好的索引。

Steps

步骤

  1. Plan the search — turn the user's question into a structured query document. Always provide an
    intent:
    line so reranking and snippet extraction stay anchored to the actual goal:
    intent: <one-sentence framing of what the user actually wants>
    lex: <exact terms / phrases / -negations>
    vec: <natural-language paraphrase of the question>
    hyde: <one short paragraph that looks like the ideal answer>
    Drop a sub-query if it does not add signal (a glossary lookup needs only
    lex
    ; a "how does X work" is mostly
    vec
    /
    hyde
    ).
  2. Retrieve via QMD
    • MCP: call
      mcp__qmd__query
      with the structured
      searches
      array (or the multi-line
      q
      string) and the
      intent
      field. Restrict by
      collections
      when the question is scoped to a single collection vs cross-repo.
    • CLI:
      qmd query "$(cat <<EOF intent: ... lex: ... vec: ... hyde: ... EOF )" --json --files -n 8 --min-score 0.3
    • Read the top 3-5 hits with
      mcp__qmd__get
      /
      mcp__qmd__multi_get
      (or
      qmd get
      /
      qmd multi-get
      on the CLI). Fetch the full body when the snippet is borderline; honor the
      context
      field returned by QMD — it carries collection-level guidance the owner curated.
  3. Fallback path (no QMD)
    • Read
      wiki/index.md
      and use the "By topic" table to locate likely pages.
    • Use
      grep
      /
      Glob
      with the keywords distilled in step 1.
    • Read the identified pages in full.
  4. Synthesize the answer:
    • Direct answer to the question.
    • Cite the wiki pages used with links:
      [page](wiki/path.md)
      (use the path returned by QMD, not the docid).
    • If sources contradict each other, present the different viewpoints and flag the conflict.
    • If the information does not exist in the wiki, say so explicitly and suggest sources that could be ingested.
  5. Assess whether the answer has lasting value
    • If the answer synthesizes multiple pages in a new and useful way → offer to save it as a page in
      wiki/sources/
      (cross-cutting summary) or as a new section in an existing page.
    • If it is a simple one-off answer → no need to save.
  6. Log (only if the query resulted in a wiki update):
    ## [YYYY-MM-DD] query | <question summary>
    - Retrieval: qmd | grep-fallback
    - Pages consulted: ...
    - Result saved: yes/no (which page, if yes)
  1. 规划搜索——将用户的问题转换为结构化查询文档。始终提供
    intent:
    行,以便重排序和片段提取始终紧扣实际目标:
    intent: <用户实际需求的一句话描述>
    lex: <精确术语/短语/否定词>
    vec: <问题的自然语言改写>
    hyde: <一段类似理想答案的简短段落>
    如果子查询没有增加有效信息,可以省略(比如词汇表查询只需要
    lex
    ;“X如何工作”类问题主要用
    vec
    /
    hyde
    )。
  2. 通过QMD检索
    • MCP:调用
      mcp__qmd__query
      ,传入结构化的
      searches
      数组(或多行
      q
      字符串)以及
      intent
      字段。如果问题限定在单个集合而非跨仓库,则通过
      collections
      参数进行限制。
    • CLI
      qmd query "$(cat <<EOF intent: ... lex: ... vec: ... hyde: ... EOF )" --json --files -n 8 --min-score 0.3
    • 使用
      mcp__qmd__get
      /
      mcp__qmd__multi_get
      (或CLI中的
      qmd get
      /
      qmd multi-get
      )读取前3-5条结果。如果片段内容不够明确,则获取完整正文;遵循QMD返回的
      context
      字段——它包含管理员整理的集合级指导信息。
  3. 回退路径(无QMD)
    • 读取
      wiki/index.md
      ,使用“按主题分类”表格定位可能的页面。
    • 使用
      grep
      /
      Glob
      工具结合步骤1中提炼的关键词进行搜索。
    • 完整读取找到的页面。
  4. 合成答案
    • 直接回答用户的问题。
    • 使用链接引用所使用的维基页面:
      [页面名称](wiki/path.md)
      (使用QMD返回的路径,而非docid)。
    • 如果来源之间存在矛盾,呈现不同观点并标记冲突。
    • 如果维基中不存在相关信息,请明确说明,并建议可纳入的来源。
  5. 评估答案是否具有持久价值
    • 如果答案以新的有用方式整合了多个页面的内容→ 提议将其保存为
      wiki/sources/
      中的页面(跨领域摘要)或现有页面的新章节。
    • 如果只是简单的一次性答案→ 无需保存。
  6. 记录(仅当查询导致维基更新时):
    ## [YYYY-MM-DD] query | <问题摘要>
    - 检索方式: qmd | grep回退
    - 查阅页面: ...
    - 结果已保存: 是/否(如果是,说明保存到哪个页面)

Rules

规则

  • Answer first based on the wiki — do not re-synthesize from scratch using code or external sources when the answer already exists.
  • Always supply an
    intent:
    line to QMD — it is the strongest single lever for relevance.
  • Trust QMD's
    context
    field — it reflects curated metadata (e.g.
    raw/
    is not the source of truth). Do not "correct" it from training intuition.
  • If you cannot find the information, suggest which sources could be ingested to cover the gap.
  • Always cite the wiki pages used.
  • If the question reveals a gap, suggest pages that could be created (but do not create them automatically — leave that for ingest).
  • 首先基于维基内容回答——当答案已存在时,不要使用代码或外部资源重新生成。
  • 始终向QMD提供
    intent:
    行——这是提升相关性最有效的手段。
  • 信任QMD的
    context
    字段——它反映了经过整理的元数据(例如
    raw/
    不是权威来源)。不要凭经验“修正”它。
  • 如果找不到信息,建议可纳入哪些来源来填补空白。
  • 始终引用所使用的维基页面。
  • 如果问题暴露出内容缺口,建议可创建哪些页面(但不要自动创建——留待纳入流程处理)。