@zosmaai/pi-llm-wiki 0.10.7 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.de.md +35 -4
  3. package/README.es.md +260 -170
  4. package/README.fr.md +35 -4
  5. package/README.hi.md +35 -4
  6. package/README.ja.md +35 -4
  7. package/README.ko.md +35 -4
  8. package/README.md +38 -3
  9. package/README.pt.md +35 -4
  10. package/README.ru.md +35 -4
  11. package/README.zh.md +260 -170
  12. package/assets/demo.gif +0 -0
  13. package/dist/extensions/llm-wiki/lib/bootstrap.js +71 -0
  14. package/dist/extensions/llm-wiki/lib/embeddings.js +401 -0
  15. package/dist/extensions/llm-wiki/lib/guardrails.js +232 -0
  16. package/dist/extensions/llm-wiki/lib/indexing.js +78 -0
  17. package/dist/extensions/llm-wiki/lib/ingest-worker.js +310 -0
  18. package/dist/extensions/llm-wiki/lib/inject.js +65 -0
  19. package/dist/extensions/llm-wiki/lib/knowledge-document.js +442 -0
  20. package/dist/extensions/llm-wiki/lib/knowledge-links.js +206 -0
  21. package/dist/extensions/llm-wiki/lib/legacy-repair.js +443 -0
  22. package/dist/extensions/llm-wiki/lib/metadata.js +499 -0
  23. package/dist/extensions/llm-wiki/lib/model-command.js +86 -0
  24. package/dist/extensions/llm-wiki/lib/observation.js +283 -0
  25. package/dist/extensions/llm-wiki/lib/recall.js +875 -0
  26. package/dist/extensions/llm-wiki/lib/retro.js +158 -0
  27. package/dist/extensions/llm-wiki/lib/runtime.js +191 -0
  28. package/dist/extensions/llm-wiki/lib/source-extractors.js +426 -0
  29. package/dist/extensions/llm-wiki/lib/source-packet.js +229 -0
  30. package/dist/extensions/llm-wiki/lib/subagent.js +41 -0
  31. package/dist/extensions/llm-wiki/lib/task-config.js +172 -0
  32. package/dist/extensions/llm-wiki/lib/tools.js +1192 -0
  33. package/dist/extensions/llm-wiki/lib/trajectories-command.js +51 -0
  34. package/dist/extensions/llm-wiki/lib/trajectory.js +467 -0
  35. package/dist/extensions/llm-wiki/lib/utils.js +347 -0
  36. package/dist/extensions/llm-wiki/lib/vault-format.js +247 -0
  37. package/dist/extensions/llm-wiki/lib/visible-status.js +31 -0
  38. package/dist/extensions/llm-wiki/lib/wiki-service.js +128 -0
  39. package/dist/mcp/exec.js +121 -0
  40. package/dist/mcp/index.js +229 -0
  41. package/dist/mcp/operations.js +130 -0
  42. package/dist/package.json +1 -0
  43. package/docs/superpowers/plans/2026-08-02-okf-foundation.md +1579 -0
  44. package/docs/superpowers/plans/2026-08-03-okf-foundation-remediation.md +3005 -0
  45. package/docs/superpowers/plans/2026-08-06-okf-foundation-release-remediation.md +1174 -0
  46. package/docs/superpowers/specs/2026-08-02-okf-foundation-design.md +578 -0
  47. package/docs/superpowers/specs/2026-08-02-okf-v0.2-interoperability-design.md +538 -0
  48. package/extensions/llm-wiki/index.ts +22 -36
  49. package/extensions/llm-wiki/lib/bootstrap.ts +84 -0
  50. package/extensions/llm-wiki/lib/embeddings.ts +9 -3
  51. package/extensions/llm-wiki/lib/guardrails.ts +174 -29
  52. package/extensions/llm-wiki/lib/indexing.ts +2 -1
  53. package/extensions/llm-wiki/lib/ingest-worker.ts +170 -29
  54. package/extensions/llm-wiki/lib/knowledge-document.ts +661 -0
  55. package/extensions/llm-wiki/lib/knowledge-links.ts +282 -0
  56. package/extensions/llm-wiki/lib/legacy-repair.ts +572 -0
  57. package/extensions/llm-wiki/lib/metadata.ts +531 -116
  58. package/extensions/llm-wiki/lib/observation.ts +37 -43
  59. package/extensions/llm-wiki/lib/recall.ts +61 -33
  60. package/extensions/llm-wiki/lib/retro.ts +65 -41
  61. package/extensions/llm-wiki/lib/source-extractors.ts +12 -17
  62. package/extensions/llm-wiki/lib/source-packet.ts +44 -31
  63. package/extensions/llm-wiki/lib/tools.ts +406 -348
  64. package/extensions/llm-wiki/lib/trajectory.ts +15 -1
  65. package/extensions/llm-wiki/lib/utils.ts +121 -130
  66. package/extensions/llm-wiki/lib/vault-format.ts +363 -0
  67. package/extensions/llm-wiki/lib/wiki-service.ts +183 -0
  68. package/mcp/exec.ts +122 -0
  69. package/mcp/index.ts +60 -250
  70. package/mcp/operations.ts +176 -0
  71. package/package.json +8 -2
  72. package/scripts/migrate-llm-wiki.js +801 -0
  73. package/skills/llm-wiki/SKILL.md +8 -6
package/README.zh.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![CI](https://github.com/zosmaai/pi-llm-wiki/actions/workflows/ci.yml/badge.svg)](https://github.com/zosmaai/pi-llm-wiki/actions/workflows/ci.yml)
8
8
  [![npm](https://img.shields.io/npm/v/@zosmaai/pi-llm-wiki)](https://www.npmjs.com/package/@zosmaai/pi-llm-wiki)
9
9
  [![npm downloads](https://img.shields.io/npm/dm/@zosmaai/pi-llm-wiki)](https://www.npmjs.com/package/@zosmaai/pi-llm-wiki)
10
- [![Coverage](https://codecov.io/gh/zosmaai/pi-llm-wiki/branch/main/graph/badge.svg)](https://codecov.io/gh/zosmaai/pi-llm-wiki)
10
+ [![Coverage](https://img.shields.io/badge/coverage-85.09%25-brightgreen.svg)](https://codecov.io/gh/zosmaai/pi-llm-wiki)
11
11
  [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
12
12
  [![CodeQL](https://github.com/zosmaai/pi-llm-wiki/actions/workflows/codeql.yml/badge.svg)](https://github.com/zosmaai/pi-llm-wiki/actions/workflows/codeql.yml)
13
13
  [![GitHub Repo Stars](https://img.shields.io/github/stars/zosmaai/pi-llm-wiki?style=social)](https://github.com/zosmaai/pi-llm-wiki/stargazers)
@@ -16,24 +16,30 @@
16
16
 
17
17
  <br/>
18
18
 
19
- <div align="center">
20
- <a href="https://github.com/zosmaai/pi-llm-wiki/stargazers">
21
- <img src="./assets/thank-you-for-the-star.png" alt="Thank you for starring pi-llm-wiki!" width="100%" />
22
- </a>
23
- <br/>
24
- <sub>
25
- If you find pi-llm-wiki useful,
26
- <a href="https://github.com/zosmaai/pi-llm-wiki">⭐ star the repo</a> —
27
- it lets us know we're building something that matters.
28
- </sub>
29
- </div>
19
+ **基于 [pi](https://pi.dev) 的自维护、兼容 Obsidian 的知识库。**
20
+ 遵循 Andrej Karpathy 的 [LLM Wiki 模式](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f)。
30
21
 
31
- <br/>
22
+ 将原始来源(网址、PDF、Markdown、JSON、XML)转化为持久、互联、由 LLM 维护的 Wiki,并随时间不断积累。
32
23
 
33
- **基于 [pi](https://pi.dev) 的自维护、兼容 Obsidian 的知识库。遵循 Andrej Karpathy 的 LLM Wiki 模式。**
34
- Follows Andrej Karpathy's [LLM Wiki pattern](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f).
24
+ ### 原生 Open Knowledge Format (OKF) v0.2 支持
35
25
 
36
- 将原始来源(网址、PDF、Markdown、JSON、XML)转化为持久、互联、由 LLM 维护的 Wiki,并随时间不断积累。
26
+ 构建可随身携带的知识库——不再是另一个封闭的应用专属导出:
27
+
28
+ - **创建可移植的 OKF v0.2 文档**,具有标准 frontmatter、标准 Markdown 链接和稳定的来源引用。
29
+ - **同时读取旧版和 OKF 页面**,现有 vault 无需自动迁移或重写即可继续工作。
30
+ - **从权威页面生成确定性索引和日志**,保持导航和元数据可重现。
31
+ - **从 Pi 或 MCP 使用相同的知识模型**,支持 Claude Code、Cursor、Windsurf 和其他 MCP 客户端。
32
+ - **保持 Obsidian 兼容性**,同时让知识准备好供支持 Open Knowledge Format 的工具使用。
33
+
34
+ 从新的 OKF vault 开始,或将 pi-llm-wiki 指向现有 vault,按您的节奏采用该格式。查看 [OKF Foundation 规范](docs/superpowers/specs/2026-08-02-okf-foundation-design.md) 了解实现细节。
35
+
36
+ ---
37
+
38
+ ## 演示
39
+
40
+ <div align="center">
41
+ <img src="./assets/demo.gif" alt="pi-llm-wiki demo" width="1920" />
42
+ </div>
37
43
 
38
44
  ---
39
45
 
@@ -43,7 +49,7 @@ Follows Andrej Karpathy's [LLM Wiki pattern](https://gist.github.com/karpathy/44
43
49
  pi install npm:@zosmaai/pi-llm-wiki
44
50
  ```
45
51
 
46
- The extension will proactively suggest creating a wiki on your first session. Alternatively:
52
+ 扩展将在首次会话时主动建议创建 wiki。或者:
47
53
 
48
54
  ```
49
55
  /wiki-init "AI Engineering"
@@ -59,95 +65,106 @@ The extension will proactively suggest creating a wiki on your first session. Al
59
65
 
60
66
  **pi-llm-wiki** 创建了一个中间层:
61
67
 
62
- - **原始来源包保留源头真实输入**
63
- - **来源页面总结每个来源的内容**
64
- - **规范 Wiki 页面追踪 Wiki 当前的知识状态**
65
- - **生成的元数据使所有内容可搜索和可导航**
68
+ - **原始来源包** 保留真实来源输入
69
+ - **来源页面** 总结每个来源的内容
70
+ - **规范 wiki 页面** 追踪 wiki 当前认定的内容
71
+ - **生成的元数据** 保持所有内容可搜索和可导航
66
72
 
67
- 结果是一个不断累积的 Wiki——当你捕获来源、提问并归档持久分析时,知识会不断增长。
73
+ 结果是:随着您捕获来源、提出问题并归档持久分析,wiki 会不断 **积累**。
68
74
 
69
75
  ---
70
76
 
71
- ## 功能特性
72
-
73
- | Capability | Description |
74
- |------------|-------------|
75
- | 🏠 **Personal fallback** | Always-on `~/.llm-wiki/` vault — knowledge compounds across projects even when no project wiki exists |
76
- | 🔗 **Immutable source capture** | URLs, local files (PDF/md/txt/html/XML/JSON), or pasted text structured source packets |
77
- | 🧠 **Automated ingestion** | `wiki_ingest` batch-processes sources into concept, entity, synthesis & analysis pages |
78
- | 🔍 **Full-text search** | Generated registry with keyword lookup across all pages and sources |
79
- | 🩺 **Mechanical linting** | Orphans, broken links, duplicate aliases, coverage gaps, stale captures |
80
- | 📊 **Dashboard** | `wiki_status` — counts, source states, recent activity |
81
- | 🤖 **Auto-update watch** | `wiki_watch` — print a `crontab` line that runs the full cycle on a schedule |
82
- | 🧠 **Layered recall** | Searches both personal (`~/.llm-wiki/`) and project (`.llm-wiki/`) vaults — personal knowledge follows you everywhere |
83
- | 📝 **Auto-bootstrap** | Extension suggests creating a wiki when none exists in the current directory |
84
- | 💾 **Lightweight capture** | `wiki_retro` save atomic insights as a single markdown file; full 4-layer pipeline also available via `wiki_capture_source` |
85
- | 🌐 **MCP Server** | Use with Claude Code, Cursor, Windsurf via stdio MCP transport |
86
- | 📝 **Obsidian-friendly** | Folder-qualified wikilinks, stable source-ID citations, compatible vault |
87
- | 🛡️ **Guardrails** | Blocks direct edits to raw sources and generated metadata |
88
- | 🔧 **Configurable PDF extraction** | MarkItDown timeout via `WIKI_MARKITDOWN_TIMEOUT_MS` env var |
89
- | 🧪 **38+ tests, CI, CodeQL** | TypeScript, Vitest, Biome, Codecov |
77
+ ## 特性
78
+
79
+ | 功能 | 描述 |
80
+ |------|------|
81
+ | 🏠 **个人回退** | 始终开启的 `~/.llm-wiki/` vault——即使没有项目 wiki,知识也能跨项目积累 |
82
+ | 🔗 **不可变的来源捕获** | URL、本地文件(PDF/md/txt/html/XML/JSON)或粘贴文本结构化来源包 |
83
+ | 🧠 **自动化摄取** | `wiki_ingest` 批量处理来源到概念、实体、综合和分析页面 |
84
+ | 🔍 **全文搜索** | 生成的注册表,跨所有页面和来源的关键字查找 |
85
+ | 🩺 **机械式 linting** | 孤儿页面、断链、重复别名、覆盖缺口、过时捕获 |
86
+ | 📊 **仪表板** | `wiki_status`——计数、来源状态、最近活动 |
87
+ | 🤖 **自动更新监控** | `wiki_watch`——打印按计划运行完整周期的 `crontab` |
88
+ | 🧠 **分层召回** | 同时搜索个人(`~/.llm-wiki/`)和项目(`.llm-wiki/`)vault——个人知识随您到处 |
89
+ | 📝 **自动引导** | 当前目录不存在 wiki 时扩展建议创建 |
90
+ | 💾 **轻量级捕获** | `wiki_retro`——将原子洞察保存为单个 markdown 文件;通过 `wiki_capture_source` 也可用完整 4 层管道 |
91
+ | 🧭 **代理工作记忆** _(可选)_ | `wiki_capture_trajectory` 记录任务如何解决的(工具调用轨迹)→ 提炼为可重用的 `skill`/`case` 页面 `wiki_recall_skill` 下次展示。默认关闭;用 `/wiki-trajectories on` 启用 |
92
+ | 🌐 **OKF v0.2 原生** | 可移植 Open Knowledge Format 文档、双读旧版兼容、确定性投影 |
93
+ | 🌐 **MCP 服务器** | 通过 stdio MCP 传输从 Claude Code、Cursor、Windsurf 使用相同的 OKF 感知 wiki |
94
+ | 📝 **Obsidian 友好** | 文件夹限定 wikilinks、稳定来源 ID 引用、兼容 vault |
95
+ | 🛡️ **护栏** | 阻止直接编辑原始来源和生成的元数据 |
96
+ | 🔧 **可配置的 PDF 提取** | 通过 `WIKI_MARKITDOWN_TIMEOUT_MS` 环境变量设置 MarkItDown 超时 |
97
+ | 🧪 **562 测试、85.09% 覆盖率** | TypeScript、Vitest、Biome、Codecov、CodeQL |
90
98
 
91
99
  ---
92
100
 
93
101
  ## 工具
94
102
 
95
- | Tool | Description |
96
- |------|-------------|
97
- | `wiki_bootstrap` | Initialize a new wiki vault with config, templates, schema, and metadata |
98
- | `wiki_capture_source` | Capture a URL, local file, or pasted text into an immutable source packet |
99
- | `wiki_recall` | Search wiki for task-relevant pages — searches both personal (`~/.llm-wiki/`) and project (`.llm-wiki/`) vaults, deduplicated |
100
- | `wiki_retro` | Save atomic insights from completed tasks into the wiki |
101
- | `wiki_ingest` | Process uningested source packets into wiki pages (batch) |
102
- | `wiki_ensure_page` | Resolve or safely create entity / concept / synthesis / analysis pages |
103
- | `wiki_search` | Search the generated wiki registry |
104
- | `wiki_lint` | Deterministic health checks (orphans, gaps, contradictions, auto-fix) |
105
- | `wiki_status` | Show counts, source states, and recent activity |
106
- | `wiki_rebuild_meta` | Force a full metadata rebuild (registry, backlinks, index, log) |
107
- | `wiki_log_event` | Append a structured event to the wiki activity log |
108
- | `wiki_watch` | Print a `crontab` line for automatic wiki updates (daily / weekly / hourly) — does not install it |
103
+ | 工具 | 描述 |
104
+ |------|------|
105
+ | `wiki_bootstrap` | 用配置、模板、模式和元数据初始化新的 wiki vault |
106
+ | `wiki_capture_source` | URL、本地文件或粘贴文本捕获到不可变的来源包中 |
107
+ | `wiki_recall` | 搜索 wiki 中与任务相关的页面——搜索个人和项目 vault,去重 |
108
+ | `wiki_retro` | 将已完成任务的原子洞察保存到 wiki |
109
+ | `wiki_ingest` | 处理未摄取的来源包到 wiki 页面(批量) |
110
+ | `wiki_ensure_page` | 解析或安全创建实体/概念/综合/分析页面 |
111
+ | `wiki_search` | 搜索生成的 wiki 注册表 |
112
+ | `wiki_lint` | 确定性健康检查(孤儿、缺口、矛盾、自动修复) |
113
+ | `wiki_status` | 显示计数、来源状态和最近活动 |
114
+ | `wiki_rebuild_meta` | 强制完整元数据重建(注册表、反向链接、索引、日志) |
115
+ | `wiki_log_event` | 将结构化事件追加到 wiki 活动日志 |
116
+ | `wiki_watch` | 打印自动 wiki 更新的 `crontab` 行(每日/每周/每小时)——不安装它 |
117
+ | `wiki_capture_trajectory` _(可选)_ | 捕获已完成任务的工具调用轨迹(代理工作记忆) |
118
+ | `wiki_distill_skills` _(可选)_ | 批量未提炼的轨迹以合成为可重用的技能页面 |
119
+ | `wiki_recall_skill` _(可选)_ | 召回提炼的技能+类似过去案例——"我以前做过这个吗?" |
120
+
121
+ > 三个代理轨迹工具 **默认关闭**(issue #80)。用 `/wiki-trajectories on` 启用(设置 `llm-wiki.trajectories`);关闭时完全不注册。
109
122
 
110
123
  ### 斜杠命令
111
124
 
112
- | Command | Description |
113
- |---------|-------------|
114
- | `/wiki-init <topic>` | Initialize a new LLM Wiki vault |
115
- | `/wiki-ingest [path]` | Process new source files and update the wiki |
116
- | `/wiki-query <question>` | Ask questions against the wiki with citations |
117
- | `/wiki-discover [--topic <topic>]` | Auto-discover new sources from the web |
118
- | `/wiki-run [--schedule daily\|weekly]` | Full cycle: discover ingest → lint |
119
- | `/wiki-lint [--fix]` | Health check (orphans, contradictions, gaps) |
120
- | `/wiki-status` | Show a concise operational summary |
121
- | `/wiki-digest [--period daily\|weekly]` | Generate a digest of recent activity |
122
- | `/wiki-retro` | Save atomic insights from completed tasks |
125
+ | 命令 | 描述 |
126
+ |------|------|
127
+ | `/wiki-init <topic>` | 初始化新的 LLM Wiki vault |
128
+ | `/wiki-ingest [path]` | 处理新来源文件并更新 wiki |
129
+ | `/wiki-query <question>` | 带引用向 wiki 提问 |
130
+ | `/wiki-discover [--topic <topic>]` | 从网络自动发现新来源 |
131
+ | `/wiki-run [--schedule daily\|weekly]` | 完整周期:发现摄取 → lint |
132
+ | `/wiki-lint [--fix]` | 健康检查(孤儿、矛盾、缺口) |
133
+ | `/wiki-status` | 显示简洁的操作摘要 |
134
+ | `/wiki-digest [--period daily\|weekly]` | 生成最近活动的摘要 |
135
+ | `/wiki-retro` | 保存已完成任务的原子洞察 |
136
+ | `/wiki-req <concept>` | 将概念分解为原子、可追踪的需求页面 |
137
+ | `/wiki-trajectories <on\|off>` | 启用/禁用代理工作记忆(可选,默认关闭) |
138
+ | `/wiki-record <title>` | 捕获已完成任务的轨迹(需要启用轨迹) |
139
+ | `/wiki-skills [query]` | 搜索提炼的技能+过去案例(需要启用轨迹) |
123
140
 
124
141
  ---
125
142
 
126
143
  ## 分层 Vault 架构
127
144
 
128
- Knowledge follows you everywhere. pi-llm-wiki uses a layered vault system:
145
+ 知识随您到处。pi-llm-wiki 使用分层 vault 系统:
129
146
 
130
- | Layer | Location | Purpose |
131
- |-------|----------|---------|
132
- | 🏠 **Personal** | `~/.llm-wiki/` | Always active. Zero setup. Knowledge compounds across all your sessions — regardless of which project you're in. |
133
- | 📁 **Project** | `{project}/.llm-wiki/` | Explicit opt-in. Dedicated wiki per project, sharing personal knowledge when relevant. |
134
- | 🏢 **Company** (future) | git-tracked | Shared wiki across a team. `wiki_publish` promotes personal/project pages to the company wiki. |
147
+ | | 位置 | 用途 |
148
+ |----|------|------|
149
+ | 🏠 **个人** | `~/.llm-wiki/` | 始终激活。零设置。知识跨所有会话积累——无论您在哪个项目中。 |
150
+ | 📁 **项目** | `{project}/.llm-wiki/` | 明确选择加入。每个项目专用 wiki,相关时共享个人知识。 |
151
+ | 🏢 **公司**(未来) | git 跟踪 | 团队共享 wiki。`wiki_publish` 将个人/项目页面提升到公司 wiki |
135
152
 
136
153
  **工作原理:**
137
154
 
138
- 1. `resolveVaultRoot()` checks: cwd → walk up for `.llm-wiki/` → `~/.llm-wiki/`
139
- 2. `wiki_recall` (layered) searches **both** personal and project vaults, merging results with vault labels
140
- 3. Personal results are shown first in recall output, tagged as "📓 personal"
141
- 4. `wiki_retro` writes to whichever vault is active (project takes priority)
142
- 5. Set `WIKI_HOME` env var to override the personal wiki location
155
+ 1. `resolveVaultRoot()` 检查:cwd → 向上查找 `.llm-wiki/` → `~/.llm-wiki/`
156
+ 2. `wiki_recall`(分层)搜索 **两个** 个人和项目 vault,合并结果带 vault 标签
157
+ 3. 个人结果在召回输出中首先显示,标记为 "📓 personal"
158
+ 4. `wiki_retro` 写入当前激活的 vault(项目优先)
159
+ 5. 设置 `WIKI_HOME` 环境变量覆盖个人 wiki 位置
143
160
 
144
- This means: you can have a project wiki for team documentation **and** a personal wiki for your own notes, and recall searches both simultaneously.
161
+ 这意味着:您可以有用于团队文档的项目 wiki **和** 用于个人笔记的个人 wikirecall 同时搜索两者。
145
162
 
146
163
  ---
147
164
 
148
165
  ## 快速开始(详细)
149
166
 
150
- ### 1) 创建新 Wiki
167
+ ### 1) 创建新的 wiki
151
168
 
152
169
  ```bash
153
170
  mkdir my-wiki
@@ -155,13 +172,13 @@ cd my-wiki
155
172
  pi
156
173
  ```
157
174
 
158
- pi 提问:
175
+ 询问 pi
159
176
 
160
177
  ```
161
178
  Initialize an llm wiki here for AI research.
162
179
  ```
163
180
 
164
- This calls `wiki_bootstrap` and creates:
181
+ 这将调用 `wiki_bootstrap` 并创建:
165
182
 
166
183
  ```
167
184
  .llm-wiki/
@@ -187,23 +204,23 @@ Capture this PDF into the wiki: ./papers/context-windows.pdf
187
204
  Capture these notes into the wiki: ...pasted text...
188
205
  ```
189
206
 
190
- ### 3) 整合来源
207
+ ### 3) 集成来源
191
208
 
192
- 1. Capture the source
193
- 2. Read `.llm-wiki/wiki/sources/SRC-*.md`
194
- 3. Update that source page
195
- 4. Search for impacted canonical pages with `wiki_search`
196
- 5. Create missing pages with `wiki_ensure_page`
197
- 6. Update concept / entity / synthesis pages with citations
198
- 7. Mark the integration with `wiki_log_event kind=integrate`
209
+ 1. 捕获来源
210
+ 2. 读取 `.llm-wiki/wiki/sources/SRC-*.md`
211
+ 3. 更新该来源页面
212
+ 4. `wiki_search` 搜索受影响的规范页面
213
+ 5. `wiki_ensure_page` 创建缺失页面
214
+ 6. 更新概念/实体/综合页面带引用
215
+ 7. `wiki_log_event kind=integrate` 标记集成
199
216
 
200
- ### 4) 查询 Wiki
217
+ ### 4) 查询 wiki
201
218
 
202
219
  ```
203
220
  Based on the wiki, what are the main tradeoffs between long-context models and RAG?
204
221
  ```
205
222
 
206
- By default, query mode is **read-only**. To file a durable answer:
223
+ 默认情况下,查询模式是 **只读**。要归档持久答案:
207
224
 
208
225
  ```
209
226
  Answer the question and file the result as an analysis page.
@@ -216,50 +233,48 @@ Answer the question and file the result as an analysis page.
216
233
  ```
217
234
  my-wiki/
218
235
  └─ .llm-wiki/
219
- ├─ config.json # Vault config
220
- ├─ templates/ # Page templates
236
+ ├─ config.json # Vault 配置
237
+ ├─ templates/ # 页面模板
221
238
  ├─ raw/
222
239
  │ └─ sources/
223
240
  │ └─ SRC-2026-05-11-001/
224
241
  │ ├─ manifest.json
225
- │ ├─ original/ # Original artifact
226
- │ ├─ extracted.md # Normalized text
242
+ │ ├─ original/ # 原始工件
243
+ │ ├─ extracted.md # 规范化文本
227
244
  │ └─ attachments/
228
245
  ├─ wiki/
229
- │ ├─ sources/ # Source pages (what each source says)
230
- │ ├─ concepts/ # Concepts and recurring ideas
231
- │ ├─ entities/ # People, orgs, products, papers, systems
232
- │ ├─ syntheses/ # Cross-source theses and tensions
233
- │ └─ analyses/ # Durable filed answers from queries
246
+ │ ├─ sources/ # 来源页面(每个来源说什么)
247
+ │ ├─ concepts/ # 概念和重复出现的想法
248
+ │ ├─ entities/ # 人物、组织、产品、论文、系统
249
+ │ ├─ syntheses/ # 跨来源论点和张力
250
+ │ └─ analyses/ # 来自查询的持久归档答案
234
251
  ├─ meta/
235
- │ ├─ registry.json # Auto-generated search index
252
+ │ ├─ registry.json # 自动生成搜索索引
236
253
  │ ├─ backlinks.json
237
254
  │ ├─ index.md
238
- │ ├─ events.jsonl # Append-only event log
255
+ │ ├─ events.jsonl # 仅追加事件日志
239
256
  │ ├─ log.md
240
257
  │ └─ lint-report.md
241
- └─ WIKI_SCHEMA.md # Operating manual
258
+ └─ WIKI_SCHEMA.md # 操作手册
242
259
  ```
243
260
 
244
261
  ### 所有权模型
245
262
 
246
- | Path | Owner | Rule |
247
- |------|-------|------|
248
- | Path | Owner | Rule |
249
- |------|-------|------|
250
- | `.llm-wiki/raw/**` | Extension tools | Immutable after capture |
251
- | `.llm-wiki/wiki/**` | Model + user | Editable knowledge pages |
252
- | `.llm-wiki/meta/registry.json` | Extension | Generated |
253
- | `.llm-wiki/meta/backlinks.json` | Extension | Generated |
254
- | `.llm-wiki/meta/index.md` | Extension | Generated |
255
- | `.llm-wiki/meta/events.jsonl` | Extension / tool | Append-only |
256
- | `.llm-wiki/meta/log.md` | Extension | Generated from events |
257
- | `.llm-wiki/meta/lint-report.md` | Extension | Generated |
258
- | `.llm-wiki/WIKI_SCHEMA.md` | Human + explicit request | Operating manual |
263
+ | 路径 | 所有者 | 规则 |
264
+ |------|--------|------|
265
+ | `.llm-wiki/raw/**` | 扩展工具 | 捕获后不可变 |
266
+ | `.llm-wiki/wiki/**` | 模型 + 用户 | 可编辑知识页面 |
267
+ | `.llm-wiki/meta/registry.json` | 扩展 | 生成 |
268
+ | `.llm-wiki/meta/backlinks.json` | 扩展 | 生成 |
269
+ | `.llm-wiki/meta/index.md` | 扩展 | 生成 |
270
+ | `.llm-wiki/meta/events.jsonl` | 扩展/工具 | 仅追加 |
271
+ | `.llm-wiki/meta/log.md` | 扩展 | 从事件生成 |
272
+ | `.llm-wiki/meta/lint-report.md` | 扩展 | 生成 |
273
+ | `.llm-wiki/WIKI_SCHEMA.md` | 人工 + 明确请求 | 操作手册 |
259
274
 
260
275
  ---
261
276
 
262
- ## 链接与引用风格
277
+ ## 链接和引用风格
263
278
 
264
279
  ### 内部导航
265
280
 
@@ -275,15 +290,15 @@ my-wiki/
275
290
  [[sources/SRC-2026-04-04-001|SRC-2026-04-04-001]]
276
291
  ```
277
292
 
278
- Stable source-page IDs keep provenance stable even if titles change.
293
+ 稳定的来源页面 ID 即使标题更改也保持溯源稳定。
279
294
 
280
295
  ---
281
296
 
282
- ## 防护措施
297
+ ## 护栏
283
298
 
284
- The extension **blocks** direct tool-call edits to:
299
+ 扩展 **阻止** 直接工具调用编辑:
285
300
 
286
- - `.llm-wiki/raw/**` — immutable source artifacts
301
+ - `.llm-wiki/raw/**`——不可变的来源工件
287
302
  - `.llm-wiki/meta/registry.json`
288
303
  - `.llm-wiki/meta/backlinks.json`
289
304
  - `.llm-wiki/meta/events.jsonl`
@@ -291,65 +306,65 @@ The extension **blocks** direct tool-call edits to:
291
306
  - `.llm-wiki/meta/log.md`
292
307
  - `.llm-wiki/meta/lint-report.md`
293
308
 
294
- If the model directly edits `.llm-wiki/wiki/**` using Pi's built-in `write` or `edit` tools, the extension **automatically rebuilds** generated metadata at the end of the agent turn.
309
+ 如果模型直接使用 Pi 内置的 `write` `edit` 工具编辑 `.llm-wiki/wiki/**`,扩展 **自动重建** 生成的元数据在代理回合结束时。
295
310
 
296
311
  ---
297
312
 
298
313
  ## 来源包格式
299
314
 
300
- Each captured source is stored as a structured packet:
315
+ 每个捕获的来源存储为结构化包:
301
316
 
302
317
  ```
303
318
  .llm-wiki/raw/sources/SRC-YYYY-MM-DD-NNN/
304
- ├─ manifest.json # Capture metadata (title, URL, format, timestamp)
305
- ├─ original/ # Original artifact (preserved as-is)
306
- ├─ extracted.md # Normalized text (PDF→md, XML→md, JSON→md, etc.)
307
- └─ attachments/ # Future attachment downloads
319
+ ├─ manifest.json # 捕获元数据(标题、URL、格式、时间戳)
320
+ ├─ original/ # 原始工件(原样保留)
321
+ ├─ extracted.md # 规范化文本(PDF→mdXML→mdJSON→md 等)
322
+ └─ attachments/ # 未来附件下载
308
323
  ```
309
324
 
310
- This preserves both the **original artifact** and a **normalized extracted view** for reading.
325
+ 这同时保留 **原始工件** **规范化提取视图** 供阅读。
311
326
 
312
327
  ---
313
328
 
314
329
  ## MCP 服务器
315
330
 
316
- Use the wiki from **any MCP-compatible tool** Claude Code, Cursor, Windsurf, and others.
331
+ **任何 MCP 兼容工具** 使用 wiki——Claude CodeCursorWindsurf 等。
317
332
 
318
- The package ships a standalone MCP server exposing 5 wiki tools over stdio:
333
+ 包附带独立 MCP 服务器,通过 stdio 暴露 5 wiki 工具:
319
334
 
320
- | Tool | Description |
321
- |------|-------------|
322
- | `wiki_recall` | Search wiki for task-relevant pages |
323
- | `wiki_search` | Full registry search |
324
- | `wiki_status` | Wiki stats (page counts, type breakdown) |
325
- | `wiki_retro` | Save atomic insights |
326
- | `wiki_capture_source` | Capture text as a source packet |
335
+ | 工具 | 描述 |
336
+ |------|------|
337
+ | `wiki_recall` | 搜索 wiki 中与任务相关的页面 |
338
+ | `wiki_search` | 完整注册表搜索 |
339
+ | `wiki_status` | Wiki 统计(页面计数、类型分解) |
340
+ | `wiki_retro` | 保存原子洞察 |
341
+ | `wiki_capture_source` | 捕获文本为来源包 |
327
342
 
328
- ### 使用方法
343
+ ### 用法
329
344
 
330
345
  ```bash
331
- # Auto-discovered by pi:
346
+ # pi 自动发现:
332
347
  pi install npm:@zosmaai/pi-llm-wiki
333
348
 
334
- # Standalone with any MCP client:
349
+ # 独立使用任何 MCP 客户端:
335
350
  WIKI_ROOT=~/my-wiki node node_modules/@zosmaai/pi-llm-wiki/mcp/index.js
336
351
  ```
337
352
 
338
- Set `WIKI_ROOT` to your wiki vault directory. If unset, the server auto-detects from the current working directory.
353
+ 设置 `WIKI_ROOT` 为您的 wiki vault 目录。如果未设置,服务器从当前工作目录自动检测。
339
354
 
340
355
  ---
341
356
 
342
357
  ## 技能行为
343
358
 
344
- The bundled `llm-wiki` skill teaches the model to:
359
+ 捆绑的 `llm-wiki` 技能教导模型:
345
360
 
346
- - ❌ Never edit raw sources directly
347
- - ❌ Never edit generated metadata files
348
- - ✅ Capture first, integrate second
349
- - ✅ Search before creating new canonical pages
350
- - ✅ Cite facts using source-page IDs
351
- - ✅ Keep query mode read-only by default
352
- - ✅ Use "Tensions / caveats" and "Open questions" when evidence is mixed
361
+ - ❌ 从不直接编辑原始来源
362
+ - ❌ 从不编辑生成的元数据文件
363
+ - ✅ 先捕获,后集成
364
+ - ✅ 创建新规范页面前先搜索
365
+ - ✅ 使用来源页面 ID 引用事实
366
+ - ✅ 默认保持查询模式只读
367
+ - ✅ 证据混合时使用 "张力/注意事项" "开放问题"
353
368
 
354
369
  ---
355
370
 
@@ -357,50 +372,125 @@ The bundled `llm-wiki` skill teaches the model to:
357
372
 
358
373
  ### Vault 层
359
374
 
360
- See the [Layered Vault Architecture](#layered-vault-architecture) section above for the personal/project/company layering.
375
+ 参见上方 [分层 Vault 架构](#分层-vault-架构) 部分了解个人/项目/公司分层。
361
376
 
362
377
  ### 四层页面模型
363
378
 
364
- Each wiki vault has four layers with clear ownership:
379
+ 每个 wiki vault 有四个层,所有权清晰:
365
380
 
366
381
  ```
367
- .llm-wiki/raw/sources/SRC-*/ # Immutable source packets (extension-owned)
368
- .llm-wiki/wiki/ # Editable knowledge pages (you + LLM)
369
- .llm-wiki/meta/ # Auto-generated registry, backlinks, index, log
370
- .llm-wiki/ # Config and templates
382
+ .llm-wiki/raw/sources/SRC-*/ # 不可变来源包(扩展所有)
383
+ .llm-wiki/wiki/ # 可编辑知识页面(您 + LLM
384
+ .llm-wiki/meta/ # 自动生成注册表、反向链接、索引、日志
385
+ .llm-wiki/ # 配置和模板
371
386
  ```
372
387
 
373
- Read [docs/architecture.md](docs/architecture.md) for the full design document.
388
+ 阅读 [docs/architecture.md](docs/architecture.md) 获取完整设计文档。
374
389
 
375
390
  ---
376
391
 
377
392
  ## 文档
378
393
 
379
- | Document | What it covers |
380
- |----------|---------------|
381
- | [Architecture](docs/architecture.md) | How the four layers work, ownership model |
382
- | [Commands](docs/commands.md) | All slash commands and tool reference |
383
- | [Obsidian Integration](docs/obsidian.md) | Vault setup and recommended plugins |
384
- | [Configuration](docs/configuration.md) | Wiki modes, topics, environment variables |
385
- | [API](docs/api.md) | Extension tool parameter reference |
394
+ | 文档 | 涵盖内容 |
395
+ |------|----------|
396
+ | [架构](docs/architecture.md) | 四层如何工作、所有权模型 |
397
+ | [命令](docs/commands.md) | 所有斜杠命令和工具参考 |
398
+ | [Obsidian 集成](docs/obsidian.md) | Vault 设置和推荐插件 |
399
+ | [配置](docs/configuration.md) | Wiki 模式、主题、环境变量 |
400
+ | [API](docs/api.md) | 扩展工具参数参考 |
386
401
 
387
402
  ---
388
403
 
389
404
  ## 贡献
390
405
 
391
- See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, test patterns, and PR workflow.
406
+ 查看 [CONTRIBUTING.md](CONTRIBUTING.md) 了解开发设置、测试模式和 PR 工作流。
392
407
 
393
408
  ---
394
409
 
395
- ## Star 历史
410
+ <div align="center">
411
+ <a href="https://github.com/zosmaai/pi-llm-wiki/stargazers">
412
+ <img src="./assets/thank-you-for-the-star.png" alt="Thank you for starring pi-llm-wiki!" width="100%" />
413
+ </a>
414
+ <br/>
415
+ <sub>
416
+ If you find pi-llm-wiki useful,
417
+ <a href="https://github.com/zosmaai/pi-llm-wiki">⭐ star the repo</a> —
418
+ it lets us know we're building something that matters.
419
+ </sub>
420
+ </div>
396
421
 
397
- [![Star History Chart](https://api.star-history.com/svg?repos=zosmaai/pi-llm-wiki&type=Date)](https://star-history.com/#zosmaai/pi-llm-wiki&Date)
422
+ <br/>
398
423
 
399
424
  ## 贡献者
400
425
 
401
- <a href="https://github.com/zosmaai/pi-llm-wiki/graphs/contributors">
402
- <img src="https://contrib.rocks/image?repo=zosmaai/pi-llm-wiki" alt="Contributors" />
403
- </a>
426
+ 感谢所有贡献者!此列表由 [`.github/workflows/contributors.yml`](.github/workflows/contributors.yml) 自动生成——查看 [#60](https://github.com/zosmaai/pi-llm-wiki/issues/60) 了解原因。
427
+
428
+ <!-- readme: contributors -start -->
429
+ <table>
430
+ <tbody>
431
+ <tr>
432
+ <td align="center">
433
+ <a href="https://github.com/arjun-zosma">
434
+ <img src="https://avatars.githubusercontent.com/u/25246034?v=4" width="64;" alt="arjun-zosma"/>
435
+ <br />
436
+ <sub><b>Arjun Nayak</b></sub>
437
+ </a>
438
+ </td>
439
+ <td align="center">
440
+ <a href="https://github.com/Shanvit7">
441
+ <img src="https://avatars.githubusercontent.com/u/64424817?v=4" width="64;" alt="Shanvit7"/>
442
+ <br />
443
+ <sub><b>Shanvit S Shetty</b></sub>
444
+ </a>
445
+ </td>
446
+ <td align="center">
447
+ <a href="https://github.com/jfraser">
448
+ <img src="https://avatars.githubusercontent.com/u/165964?v=4" width="64;" alt="jfraser"/>
449
+ <br />
450
+ <sub><b>James Fraser</b></sub>
451
+ </a>
452
+ </td>
453
+ <td align="center">
454
+ <a href="https://github.com/CelestialCreator">
455
+ <img src="https://avatars.githubusercontent.com/u/177931942?v=4" width="64;" alt="CelestialCreator"/>
456
+ <br />
457
+ <sub><b>Akshay</b></sub>
458
+ </a>
459
+ </td>
460
+ <td align="center">
461
+ <a href="https://github.com/xcsf">
462
+ <img src="https://avatars.githubusercontent.com/u/43439835?v=4" width="64;" alt="xcsf"/>
463
+ <br />
464
+ <sub><b>xcsf</b></sub>
465
+ </a>
466
+ </td>
467
+ <td align="center">
468
+ <a href="https://github.com/danielnaab">
469
+ <img src="https://avatars.githubusercontent.com/u/136512?v=4" width="64;" alt="danielnaab"/>
470
+ <br />
471
+ <sub><b>Daniel Naab</b></sub>
472
+ </a>
473
+ </td>
474
+ <td align="center">
475
+ <a href="https://github.com/deestax">
476
+ <img src="https://avatars.githubusercontent.com/u/152369481?v=4" width="64;" alt="deestax"/>
477
+ <br />
478
+ <sub><b>Superdao</b></sub>
479
+ </a>
480
+ </td>
481
+ <td align="center">
482
+ <a href="https://github.com/mystery4f">
483
+ <img src="https://avatars.githubusercontent.com/u/40482524?v=4" width="64;" alt="mystery4f"/>
484
+ <br />
485
+ <sub><b>标准萌新</b></sub>
486
+ </a>
487
+ </td>
488
+ </tr>
489
+ <tbody>
490
+ </table>
491
+ <!-- readme: contributors -end -->
492
+
493
+ <sub>Full history: [contributors graph](https://github.com/zosmaai/pi-llm-wiki/graphs/contributors).</sub>
404
494
 
405
495
  ---
406
496
 
@@ -409,6 +499,6 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, test patterns, and
409
499
  <a href="https://pi.dev">pi.dev</a> · <a href="https://github.com/zosmaai/pi-llm-wiki/issues">Issues</a>
410
500
  </div>
411
501
 
412
- ## 许可证
502
+ ## License
413
503
 
414
504
  MIT
Binary file