wiki-query
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseQuery — Ask about the wiki
查询——询问维基相关内容
Follow for format conventions, links, and language.
wiki/CONVENTIONS.md请遵循中的格式规范、链接和语言要求。
wiki/CONVENTIONS.mdLanguage
语言
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 ( or ), then from wiki frontmatter/index if guardrails are absent. Keep exact product names and code identifiers unchanged.
.wiki-guardrails.ymlquery_languagelanguage- Write ,
intent:, andvec:in the wiki language.hyde: - Use for exact terms from both languages when useful.
lex: - 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.ymlquery_languagelanguage- 用维基语言编写、
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 in this skills repo.
docs/wiki/qmd-setup.mdDetect availability before each query:
- MCP available (and
mcp__qmd__statustools registered) → use the MCP tools.mcp__qmd__query - CLI available (succeeds) → use
which qmd.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 , , or automatically — those are owner-run setup commands. The skill only queries an already-built index.
qmd embedqmd updateqmd collection add推荐的检索引擎是**QMD**(本地混合搜索:BM25 + 向量 + LLM重排序)。每个仓库只需一次性设置——请参阅本技能仓库中的。
docs/wiki/qmd-setup.md每次查询前检测可用性:
- MCP可用(已注册和
mcp__qmd__status工具)→ 使用MCP工具。mcp__qmd__query - CLI可用(执行成功)→ 使用
which qmd命令。qmd query --json --files --min-score 0.4 - 两者都不可用→ 回退到下文描述的grep/索引路径。告知用户一次QMD未配置,并引导他们查看。
docs/wiki/qmd-setup.md
切勿自动运行、或命令——这些是管理员执行的设置命令。本技能仅查询已构建好的索引。
qmd embedqmd updateqmd collection addSteps
步骤
-
Plan the search — turn the user's question into a structured query document. Always provide anline so reranking and snippet extraction stay anchored to the actual goal:
intent: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; a "how does X work" is mostlylex/vec).hyde -
Retrieve via QMD
- MCP: call with the structured
mcp__qmd__queryarray (or the multi-linesearchesstring) and theqfield. Restrict byintentwhen the question is scoped to a single collection vs cross-repo.collections - 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(ormcp__qmd__multi_get/qmd geton the CLI). Fetch the full body when the snippet is borderline; honor theqmd multi-getfield returned by QMD — it carries collection-level guidance the owner curated.context
- MCP: call
-
Fallback path (no QMD)
- Read and use the "By topic" table to locate likely pages.
wiki/index.md - Use /
grepwith the keywords distilled in step 1.Glob - Read the identified pages in full.
- Read
-
Synthesize the answer:
- Direct answer to the question.
- Cite the wiki pages used with links: (use the path returned by QMD, not the docid).
[page](wiki/path.md) - 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.
-
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 (cross-cutting summary) or as a new section in an existing page.
wiki/sources/ - If it is a simple one-off answer → no need to save.
- If the answer synthesizes multiple pages in a new and useful way → offer to save it as a page in
-
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)
-
规划搜索——将用户的问题转换为结构化查询文档。始终提供行,以便重排序和片段提取始终紧扣实际目标:
intent:intent: <用户实际需求的一句话描述> lex: <精确术语/短语/否定词> vec: <问题的自然语言改写> hyde: <一段类似理想答案的简短段落>如果子查询没有增加有效信息,可以省略(比如词汇表查询只需要;“X如何工作”类问题主要用lex/vec)。hyde -
通过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(或CLI中的mcp__qmd__multi_get/qmd get)读取前3-5条结果。如果片段内容不够明确,则获取完整正文;遵循QMD返回的qmd multi-get字段——它包含管理员整理的集合级指导信息。context
- MCP:调用
-
回退路径(无QMD)
- 读取,使用“按主题分类”表格定位可能的页面。
wiki/index.md - 使用/
grep工具结合步骤1中提炼的关键词进行搜索。Glob - 完整读取找到的页面。
- 读取
-
合成答案:
- 直接回答用户的问题。
- 使用链接引用所使用的维基页面:(使用QMD返回的路径,而非docid)。
[页面名称](wiki/path.md) - 如果来源之间存在矛盾,呈现不同观点并标记冲突。
- 如果维基中不存在相关信息,请明确说明,并建议可纳入的来源。
-
评估答案是否具有持久价值
- 如果答案以新的有用方式整合了多个页面的内容→ 提议将其保存为中的页面(跨领域摘要)或现有页面的新章节。
wiki/sources/ - 如果只是简单的一次性答案→ 无需保存。
- 如果答案以新的有用方式整合了多个页面的内容→ 提议将其保存为
-
记录(仅当查询导致维基更新时):
## [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 line to QMD — it is the strongest single lever for relevance.
intent: - Trust QMD's field — it reflects curated metadata (e.g.
contextis not the source of truth). Do not "correct" it from training intuition.raw/ - 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/ - 如果找不到信息,建议可纳入哪些来源来填补空白。
- 始终引用所使用的维基页面。
- 如果问题暴露出内容缺口,建议可创建哪些页面(但不要自动创建——留待纳入流程处理)。