wiki-query

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Wiki Query

Wiki 查询

FTS5 BM25 retrieval over wiki pages indexed by
wiki-builder
.
对由
wiki-builder
索引的 wiki 页面执行 FTS5 BM25 检索。

When to use

使用时机

  • Before writing any new wiki page → check coverage first
  • User asks a domain question that may already live in a wiki
  • "Ask the <slug> wiki: <question>"
  • Verifying citations before quoting a claim
  • SessionStart
    auto-load when prompt matches a known wiki topic
  • 编写任何新 wiki 页面之前 → 先检查覆盖范围
  • 用户提出可能已存在于某个 wiki 中的领域问题
  • “询问 <slug> wiki:<question>”
  • 引用某项声明之前验证来源
  • 当提示词与已知 wiki 主题匹配时,通过
    SessionStart
    自动加载

Commands

命令

node $SKILL_ROOT/scripts/query.js search "<query>" [--wiki <slug>] [--limit 10] [--json]
node $SKILL_ROOT/scripts/query.js related <slug> <rel-path> [--limit 5]
node $SKILL_ROOT/scripts/query.js show <slug> <rel-path>
search
with no
--wiki
ranks across all wikis.
related
finds adjacent pages by reusing the page's title + summary as the query.
node $SKILL_ROOT/scripts/query.js search "<query>" [--wiki <slug>] [--limit 10] [--json]
node $SKILL_ROOT/scripts/query.js related <slug> <rel-path> [--limit 5]
node $SKILL_ROOT/scripts/query.js show <slug> <rel-path>
未指定
--wiki
的
search
会对所有 wiki 进行排名。
related
通过复用页面的标题和摘要作为查询来查找相邻页面。

Output

输出

JSON-friendly. Each hit:
{
  "page_id": 12,
  "wiki_slug": "agent-memory",
  "rel_path": "wiki/concepts/episodic-memory.md",
  "title": "Episodic Memory",
  "snippet": "... [time-stamped] traces, distinct from semantic ...",
  "rank": -3.21
}
Lower (more negative) rank = better BM25 match.
输出易于接入 JSON。每个命中项如下:
{
  "page_id": 12,
  "wiki_slug": "agent-memory",
  "rel_path": "wiki/concepts/episodic-memory.md",
  "title": "Episodic Memory",
  "snippet": "... [time-stamped] traces, distinct from semantic ...",
  "rank": -3.21
}
rank 越低(越负),BM25 匹配效果越好。

Citing back

引用方式

Every wiki hit must be cited as:
[wiki:<slug>] <title> — `<rel_path>`
Do not paraphrase a hit without showing the source.
每个 wiki 命中项都必须按以下格式引用:
[wiki:<slug>] <title> — `<rel_path>`
不得在不展示来源的情况下转述命中内容。

SessionStart integration

SessionStart 集成

When
pro-workflow
's SessionStart hook detects wiki-relevant terms in the user prompt, it runs
query.js search "<prompt>" --limit 3
and injects top hits into the session as a hint:
[wiki-query] 3 relevant pages:
- agent-memory · wiki/concepts/episodic-memory.md
- agent-memory · wiki/papers/park-2023-generative-agents.md
- ...
Helps Claude recall existing knowledge instead of redoing research.
当
pro-workflow
的 SessionStart hook 检测到用户提示词中与 wiki 相关的词项时,会运行
query.js search "<prompt>" --limit 3
,并将排名最高的命中项作为提示注入会话:
[wiki-query] 3 relevant pages:
- agent-memory · wiki/concepts/episodic-memory.md
- agent-memory · wiki/papers/park-2023-generative-agents.md
- ...
这有助于 Claude 回忆已有知识,而不是重复开展研究。

Limits (Phase 3.3.0)

限制(Phase 3.3.0)

  • BM25 only. Vector search arrives 3.3.2 with sqlite-vec.
  • No re-ranking. MMR diversity arrives with the research loop in 3.3.1.
  • Snippet window is 16 tokens around match — tune via
    --snippet-len
    .
  • 仅支持 BM25。Vector search 将在 3.3.2 版本中通过 sqlite-vec 推出。
  • 不支持 re-ranking。MMR diversity 将随 3.3.1 版本中的 research loop 一同引入。
  • snippet 窗口为匹配内容周围的 16 个 token——可通过
    --snippet-len
    调整。