@itradingai/aiwiki 0.2.10 → 0.2.11
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.
- package/README.md +150 -116
- package/dist/src/app.js +36 -3
- package/dist/src/context.js +123 -0
- package/dist/src/frontmatter.js +55 -0
- package/dist/src/ingest.js +17 -1
- package/dist/src/lint.js +188 -0
- package/dist/src/payload.js +143 -2
- package/dist/src/wiki-entry.js +151 -0
- package/dist/src/workspace.js +1 -0
- package/docs/AGENT_HANDOFF.md +41 -13
- package/docs/FAQ.md +38 -5
- package/docs/SHOWCASE.md +8 -3
- package/docs/USAGE.md +40 -10
- package/package.json +1 -1
- package/skill/LINT_PROTOCOL.md +42 -0
- package/skill/QUERY_PROTOCOL.md +38 -0
- package/skill/SKILL.md +100 -37
package/docs/AGENT_HANDOFF.md
CHANGED
|
@@ -15,33 +15,34 @@ Agent 应自动读取网页,生成 payload,通过 AIWiki CLI 写入本地知
|
|
|
15
15
|
## 职责边界
|
|
16
16
|
|
|
17
17
|
```text
|
|
18
|
-
Agent
|
|
19
|
-
AIWiki CLI 负责:校验 payload
|
|
18
|
+
Agent 负责:读取网页、理解正文、尽量生成 analysis/wiki_entry、调用 CLI、回复用户
|
|
19
|
+
AIWiki CLI 负责:校验 payload、写本地文件、生成 Wiki Entry、输出入库结果
|
|
20
20
|
用户负责:提供链接或正文,最后审阅结果
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
AIWiki CLI
|
|
23
|
+
AIWiki CLI 不做通用网页抓取,也不调用 LLM。网页读取失败时,Agent 仍然要调用 CLI 记录失败原因;高质量 Wiki 内容由宿主 Agent 提供。
|
|
24
24
|
|
|
25
25
|
## 标准流程
|
|
26
26
|
|
|
27
27
|
1. 读取用户给的 URL、正文、附件或消息。
|
|
28
28
|
2. 如果读取成功,生成 `fetch_status: "ok"` 的 payload。
|
|
29
|
-
3.
|
|
30
|
-
4.
|
|
31
|
-
5.
|
|
32
|
-
6.
|
|
29
|
+
3. 尽量基于正文生成 `analysis` 或 `wiki_entry`。
|
|
30
|
+
4. 如果读取失败,生成 `fetch_status: "failed"` 的 payload,并写清 `fetch_notes`。
|
|
31
|
+
5. 不要让用户保存 payload。
|
|
32
|
+
6. 不要让用户手动运行命令。
|
|
33
|
+
7. 优先通过 stdin 调用:
|
|
33
34
|
|
|
34
35
|
```bash
|
|
35
36
|
aiwiki ingest-agent --stdin
|
|
36
37
|
```
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
8. 如果当前 shell、终端或宿主环境无法保证 stdin 是 UTF-8,先把 payload 写成 UTF-8 JSON 文件,再调用:
|
|
39
40
|
|
|
40
41
|
```bash
|
|
41
42
|
aiwiki ingest-agent --payload <utf8-json-file>
|
|
42
43
|
```
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
9. 读取 CLI 输出,向用户回复入库状态、摘要、Wiki 条目、质量模式、资料卡和处理记录。
|
|
45
46
|
|
|
46
47
|
## 编码要求
|
|
47
48
|
|
|
@@ -64,10 +65,21 @@ AIWiki 会修复常见 UTF-8 mojibake,但这只是兜底;宿主 Agent 仍应
|
|
|
64
65
|
"fetch_status": "ok",
|
|
65
66
|
"captured_at": "2026-05-07T10:00:00+08:00"
|
|
66
67
|
},
|
|
68
|
+
"analysis": {
|
|
69
|
+
"summary": "一句话总结。",
|
|
70
|
+
"key_points": [
|
|
71
|
+
"核心观点 1",
|
|
72
|
+
"核心观点 2"
|
|
73
|
+
],
|
|
74
|
+
"related_concepts": [
|
|
75
|
+
"概念 A"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
67
78
|
"request": {
|
|
68
79
|
"mode": "ingest",
|
|
69
80
|
"outputs": [
|
|
70
81
|
"source_card",
|
|
82
|
+
"wiki_entry",
|
|
71
83
|
"creative_assets",
|
|
72
84
|
"topics",
|
|
73
85
|
"draft_outline",
|
|
@@ -108,6 +120,7 @@ AIWiki 会修复常见 UTF-8 mojibake,但这只是兜底;宿主 Agent 仍应
|
|
|
108
120
|
- 不要让用户手动保存 payload。
|
|
109
121
|
- 不要让用户每次输入 `--path`。
|
|
110
122
|
- 不要声称网页抓取是 AIWiki CLI 的能力。
|
|
123
|
+
- 不要声称 AIWiki CLI 会在没有 Agent 分析字段时自动高质量总结。
|
|
111
124
|
- 不要在 `fetch_status: "failed"` 时塞入正文内容。
|
|
112
125
|
- 不要替用户安装 Dataview。
|
|
113
126
|
- 不要修改 `.obsidian`、`community-plugins.json` 或 Obsidian 插件配置。
|
|
@@ -123,13 +136,13 @@ Dataview 只是可选增强。用户自行在 Obsidian Community plugins 中安
|
|
|
123
136
|
成功时:
|
|
124
137
|
|
|
125
138
|
```text
|
|
126
|
-
|
|
139
|
+
AIWiki 已完成入库,并生成 Wiki 条目。
|
|
127
140
|
契合度:<fit_score> / <fit_level>
|
|
128
141
|
摘要:<summary>
|
|
142
|
+
Wiki 条目:<wiki_entry>
|
|
143
|
+
质量模式:<wiki_entry_quality> / <wiki_entry_generation_mode>
|
|
129
144
|
资料卡:<source_card>
|
|
130
145
|
处理记录:<processing_summary>
|
|
131
|
-
Obsidian 入口:<dashboard>
|
|
132
|
-
待审队列:<review_queue>
|
|
133
146
|
```
|
|
134
147
|
|
|
135
148
|
失败但已记录时:
|
|
@@ -140,5 +153,20 @@ Obsidian 入口:<dashboard>
|
|
|
140
153
|
记录目录:<run_dir>
|
|
141
154
|
处理摘要:<processing_summary>
|
|
142
155
|
Obsidian 入口:<dashboard>
|
|
143
|
-
待审队列:<review_queue>
|
|
144
156
|
```
|
|
157
|
+
|
|
158
|
+
## Query / Lint
|
|
159
|
+
|
|
160
|
+
当用户说“从 AIWiki 里了解某个主题”时,调用:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
aiwiki context "<主题>"
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
当用户说“整理 / 检查知识库”时,调用:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
aiwiki lint
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
`context` 返回 JSON,注意其中的 `generation_mode`、`quality` 和 `warnings`。如果结果是 `deterministic_fallback` / `scaffold`,回复时要说明它只是可追溯脚手架,不是高质量知识提炼。
|
package/docs/FAQ.md
CHANGED
|
@@ -2,11 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
## AIWiki 是什么?
|
|
4
4
|
|
|
5
|
-
AIWiki 是一个开源的 Agent-first
|
|
5
|
+
AIWiki 是一个开源的 Agent-first 本地 LLM-wiki CLI。宿主 Agent 负责读取和理解内容,AIWiki 负责把结果稳定写成本地 Markdown 知识库。
|
|
6
6
|
|
|
7
7
|
## AIWiki 是网页爬虫吗?
|
|
8
8
|
|
|
9
|
-
不是。网页读取主要交给宿主 Agent,AIWiki
|
|
9
|
+
不是。网页读取主要交给宿主 Agent,AIWiki 专注于校验结构化输入、写本地文件、生成 Wiki Entry、提供 context 和 lint。
|
|
10
|
+
|
|
11
|
+
## AIWiki 会自动高质量总结吗?
|
|
12
|
+
|
|
13
|
+
不会。AIWiki CLI 本身不调用 LLM。高质量 Wiki Entry 来自宿主 Agent 在 payload 中提供的 `analysis` 或 `wiki_entry`。
|
|
14
|
+
|
|
15
|
+
## 为什么会生成 05-wiki?
|
|
16
|
+
|
|
17
|
+
因为 AIWiki 的目标不是只保存资料,而是让资料进入可查询、可维护的 Wiki 知识层。成功入库会生成 `05-wiki/source-knowledge/<slug>.md`。
|
|
18
|
+
|
|
19
|
+
## Wiki Entry 的两种质量模式是什么?
|
|
20
|
+
|
|
21
|
+
- `agent_enriched` / `enriched`:宿主 Agent 提供了总结、核心观点、知识点等分析结果。
|
|
22
|
+
- `deterministic_fallback` / `scaffold`:AIWiki 只生成标题、来源、正文预览、反链和待补全区。
|
|
23
|
+
|
|
24
|
+
## 05-wiki 是否代表我的观点?
|
|
25
|
+
|
|
26
|
+
不一定。外部资料生成的 Wiki Entry 默认代表外部资料的结构化整理,不代表用户个人观点。
|
|
10
27
|
|
|
11
28
|
## 一定要用 Obsidian 吗?
|
|
12
29
|
|
|
@@ -18,9 +35,9 @@ AIWiki 是一个开源的 Agent-first AI 知识库 CLI。它把文章链接、
|
|
|
18
35
|
|
|
19
36
|
## 宿主 Agent 和 AIWiki 各负责什么?
|
|
20
37
|
|
|
21
|
-
- 宿主 Agent
|
|
22
|
-
- AIWiki 负责校验 payload
|
|
23
|
-
-
|
|
38
|
+
- 宿主 Agent 负责读取网页、正文或附件,并尽量生成 `analysis` / `wiki_entry`
|
|
39
|
+
- AIWiki 负责校验 payload、写本地知识库、生成 Wiki Entry、输出处理记录
|
|
40
|
+
- 用户负责提供链接或正文,并在需要时让 Agent 继续查询或补全
|
|
24
41
|
|
|
25
42
|
## 为什么要先让 Agent 学会 AIWiki?
|
|
26
43
|
|
|
@@ -45,3 +62,19 @@ aiwiki agent install
|
|
|
45
62
|
- [USAGE.md](USAGE.md)
|
|
46
63
|
- [SHOWCASE.md](SHOWCASE.md)
|
|
47
64
|
- [AGENT_HANDOFF.md](AGENT_HANDOFF.md)
|
|
65
|
+
|
|
66
|
+
## 怎么从知识库里查询?
|
|
67
|
+
|
|
68
|
+
让宿主 Agent 调用:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
aiwiki context "主题"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## 怎么检查知识库结构?
|
|
75
|
+
|
|
76
|
+
运行:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
aiwiki lint
|
|
80
|
+
```
|
package/docs/SHOWCASE.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
### 宿主 Agent 做的事
|
|
14
14
|
|
|
15
15
|
1. 读取网页正文或可访问内容。
|
|
16
|
-
2. 组装 `aiwiki.agent_payload.v1`。
|
|
16
|
+
2. 组装 `aiwiki.agent_payload.v1`,并尽量提供 `analysis` 或 `wiki_entry`。
|
|
17
17
|
3. 调用 `aiwiki ingest-agent --stdin`。
|
|
18
18
|
4. 把 AIWiki 的处理结果回复给用户。
|
|
19
19
|
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
09-runs/<run-id>/payload.json
|
|
24
24
|
09-runs/<run-id>/raw.md
|
|
25
25
|
09-runs/<run-id>/source-card.md
|
|
26
|
+
09-runs/<run-id>/wiki-entry.md
|
|
26
27
|
09-runs/<run-id>/creative-assets.md
|
|
27
28
|
09-runs/<run-id>/topics.md
|
|
28
29
|
09-runs/<run-id>/draft-outline.md
|
|
@@ -35,6 +36,7 @@
|
|
|
35
36
|
02-raw/articles/
|
|
36
37
|
03-sources/article-cards/
|
|
37
38
|
04-claims/_suggestions/
|
|
39
|
+
05-wiki/source-knowledge/
|
|
38
40
|
06-assets/_suggestions/
|
|
39
41
|
07-topics/ready/
|
|
40
42
|
08-outputs/outlines/
|
|
@@ -44,8 +46,9 @@ dashboards/
|
|
|
44
46
|
### 用户在 Obsidian 里怎么看
|
|
45
47
|
|
|
46
48
|
- 打开 `dashboards/AIWiki Home.md`
|
|
47
|
-
- 查看 `
|
|
48
|
-
-
|
|
49
|
+
- 查看 `05-wiki/source-knowledge/<slug>.md`
|
|
50
|
+
- 从 Wiki 条目回到资料卡、原文、选题、大纲和处理记录
|
|
51
|
+
- 需要结构检查时运行 `aiwiki lint`
|
|
49
52
|
|
|
50
53
|
## 示例 2:网页没读到正文
|
|
51
54
|
|
|
@@ -74,5 +77,7 @@ dashboards/
|
|
|
74
77
|
|
|
75
78
|
- AIWiki 不是网页爬虫本体
|
|
76
79
|
- 宿主 Agent 负责读取内容
|
|
80
|
+
- 宿主 Agent 负责高质量总结和知识提炼
|
|
77
81
|
- AIWiki 负责稳定写入本地知识库
|
|
82
|
+
- AIWiki 会创建 Wiki Entry;没有 Agent 分析字段时只生成可追溯脚手架
|
|
78
83
|
- 结果始终可追踪、可复盘、可继续写作
|
package/docs/USAGE.md
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
AIWiki CLI 不负责网页抓取。Qclaw、Codex、Claude Code、Cursor、Gemini CLI 等都只是宿主 Agent 的例子;这份文档面向的是通用宿主 Agent 协作。
|
|
10
10
|
|
|
11
|
+
AIWiki CLI 也不调用 LLM。高质量 Wiki Entry 来自宿主 Agent 提供的 `analysis` 或 `wiki_entry`;如果没有这些字段,AIWiki 会生成可追溯的 deterministic fallback 条目,只包含来源、反链、正文预览和待补全区。
|
|
12
|
+
|
|
11
13
|
## 1. 一次性设置
|
|
12
14
|
|
|
13
15
|
发布后直接运行交互式 setup:
|
|
@@ -118,8 +120,11 @@ source_url: https://example.com/article
|
|
|
118
120
|
summary: 这里是文章前段摘要,方便 Agent 快速告诉用户文章大意。
|
|
119
121
|
run_id: 20260507-153012-abc123
|
|
120
122
|
run_dir: F:\knowledge_data\aiwiki\09-runs\20260507-153012-abc123
|
|
121
|
-
files:
|
|
123
|
+
files: 15
|
|
122
124
|
processing_summary: 09-runs/20260507-153012-abc123/processing-summary.md
|
|
125
|
+
wiki_entry: 05-wiki/source-knowledge/article-slug.md
|
|
126
|
+
wiki_entry_generation_mode: agent_enriched
|
|
127
|
+
wiki_entry_quality: enriched
|
|
123
128
|
source_card: 03-sources/article-cards/article-slug.md
|
|
124
129
|
draft_outline: 09-runs/20260507-153012-abc123/draft-outline.md
|
|
125
130
|
dashboard: dashboards/AIWiki Home.md
|
|
@@ -130,13 +135,13 @@ warnings: 0
|
|
|
130
135
|
宿主 Agent 回复用户时建议展示:
|
|
131
136
|
|
|
132
137
|
```text
|
|
133
|
-
|
|
138
|
+
AIWiki 已完成入库,并生成 Wiki 条目。
|
|
134
139
|
契合度:90 / high
|
|
135
140
|
摘要:……
|
|
141
|
+
Wiki 条目:……
|
|
142
|
+
质量模式:enriched / agent_enriched
|
|
136
143
|
资料卡:……
|
|
137
144
|
处理记录:……
|
|
138
|
-
Obsidian 入口:dashboards/AIWiki Home.md
|
|
139
|
-
待审队列:dashboards/Review Queue.md
|
|
140
145
|
```
|
|
141
146
|
|
|
142
147
|
网页读取失败但已记录原因时类似:
|
|
@@ -187,12 +192,18 @@ Obsidian 入口:dashboards/AIWiki Home.md
|
|
|
187
192
|
02-raw/articles/
|
|
188
193
|
03-sources/article-cards/
|
|
189
194
|
04-claims/_suggestions/
|
|
195
|
+
05-wiki/source-knowledge/
|
|
190
196
|
06-assets/_suggestions/
|
|
191
197
|
07-topics/ready/
|
|
192
198
|
08-outputs/outlines/
|
|
193
199
|
```
|
|
194
200
|
|
|
195
|
-
|
|
201
|
+
`05-wiki/source-knowledge` 是默认知识层;`09-runs` 用于追溯每次处理。
|
|
202
|
+
|
|
203
|
+
Wiki Entry 有两种质量模式:
|
|
204
|
+
|
|
205
|
+
- `agent_enriched` / `enriched`:宿主 Agent 提供了 `analysis` 或 `wiki_entry`。
|
|
206
|
+
- `deterministic_fallback` / `scaffold`:AIWiki 只生成来源、反链、正文预览和待补全区。
|
|
196
207
|
|
|
197
208
|
### Obsidian 链接规则
|
|
198
209
|
|
|
@@ -200,13 +211,14 @@ AIWiki 生成的 Markdown 按 Obsidian vault 内路径组织,文件正文会
|
|
|
200
211
|
|
|
201
212
|
```text
|
|
202
213
|
[[03-sources/article-cards/article-slug|资料卡]]
|
|
214
|
+
[[05-wiki/source-knowledge/article-slug|Wiki 条目]]
|
|
203
215
|
[[02-raw/articles/article-slug|原文]]
|
|
204
216
|
[[09-runs/20260507-153012-abc123/processing-summary|处理记录]]
|
|
205
217
|
```
|
|
206
218
|
|
|
207
219
|
链接规则:
|
|
208
220
|
- wikilink 使用 vault 相对路径,统一为 `/`,并去掉 `.md` 后缀。
|
|
209
|
-
- `03-sources/article-cards`
|
|
221
|
+
- `05-wiki/source-knowledge` 是默认知识入口;`03-sources/article-cards` 会链接到 Wiki 条目、原文、Claim 建议、素材建议、选题、大纲和本次处理记录。
|
|
210
222
|
- `02-raw/articles`、`04-claims/_suggestions`、`06-assets/_suggestions`、`07-topics/ready`、`08-outputs/outlines` 会回链到资料卡,Obsidian 的 Backlinks/Graph View 可以串起同一篇资料。
|
|
211
223
|
- `09-runs/<run-id>/processing-summary.md` 会把本次生成的 Markdown 文件列成可点击 wikilink;`payload.json` 不是 Markdown,保留普通路径。
|
|
212
224
|
- frontmatter 会写入 `aiwiki_id`、`type`、`status`、`slug`、`source_url`、`created_at`、`captured_at`、`run_id`、`source_card`、`raw_note`、`claims_note`、`assets_note`、`topics_note`、`outline_note`、`run_summary`、`tags` 等字段,便于后续用 Obsidian Search / Properties / Dataview 做筛选。
|
|
@@ -247,12 +259,29 @@ docs/AGENT_HANDOFF.md
|
|
|
247
259
|
核心要求:
|
|
248
260
|
|
|
249
261
|
- Agent 负责读取网页正文。
|
|
262
|
+
- Agent 应尽量提供 `analysis` 或 `wiki_entry`,让 Wiki Entry 进入 enriched 模式。
|
|
250
263
|
- Agent 不要让用户保存 payload。
|
|
251
264
|
- Agent 不要让用户手动运行 `ingest-agent`。
|
|
252
265
|
- Agent 生成 payload 后优先通过 stdin 调用 `aiwiki ingest-agent --stdin`。
|
|
253
|
-
- Agent
|
|
266
|
+
- Agent 最后向用户汇报入库状态、摘要、Wiki 条目、质量模式、资料卡和处理记录。
|
|
267
|
+
|
|
268
|
+
## 7. 查询和整理
|
|
269
|
+
|
|
270
|
+
从知识库调度内容:
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
aiwiki context "AI Agent"
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
检查知识库结构:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
aiwiki lint
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
`context` 返回 JSON 给宿主 Agent 使用。`lint` 输出报告并写入 `dashboards/Lint Report.md`。
|
|
254
283
|
|
|
255
|
-
##
|
|
284
|
+
## 8. 高级调试
|
|
256
285
|
|
|
257
286
|
如果 Agent 只能输出 JSON,才需要手动保存 payload:
|
|
258
287
|
|
|
@@ -285,7 +314,7 @@ aiwiki ingest-url "https://example.com/article" --content-file "F:\knowledge_dat
|
|
|
285
314
|
|
|
286
315
|
注意:`ingest-url` 不会抓网页,只会读取 `--content-file`。
|
|
287
316
|
|
|
288
|
-
##
|
|
317
|
+
## 9. 常见问题
|
|
289
318
|
|
|
290
319
|
### 找不到 `aiwiki` 命令
|
|
291
320
|
|
|
@@ -317,7 +346,7 @@ aiwiki setup --path "F:\knowledge_data\aiwiki" --yes
|
|
|
317
346
|
aiwiki setup --path "新的知识库路径" --yes
|
|
318
347
|
```
|
|
319
348
|
|
|
320
|
-
##
|
|
349
|
+
## 10. 最小验收清单
|
|
321
350
|
|
|
322
351
|
完成一次 Agent 入库测试后,检查:
|
|
323
352
|
|
|
@@ -331,4 +360,5 @@ aiwiki status
|
|
|
331
360
|
- `09-runs` 下出现新目录。
|
|
332
361
|
- `processing-summary.md` 存在。
|
|
333
362
|
- 成功读取时,`03-sources/article-cards` 下出现资料卡。
|
|
363
|
+
- 成功读取时,`05-wiki/source-knowledge` 下出现 Wiki Entry。
|
|
334
364
|
- 抓取失败时,`09-runs/<run-id>-fetch-failed` 下出现失败记录。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itradingai/aiwiki",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Agent-first AI knowledge base CLI for turning articles, links and notes into Obsidian-ready source cards, topics, outlines and reusable knowledge assets.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# AIWiki Lint Protocol
|
|
2
|
+
|
|
3
|
+
Use this protocol when the user asks:
|
|
4
|
+
|
|
5
|
+
- 整理一下 AIWiki
|
|
6
|
+
- 检查知识库有没有问题
|
|
7
|
+
- 看看 AIWiki 结构是否健康
|
|
8
|
+
- lint AIWiki
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
1. Call:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
aiwiki lint
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
2. Read the terminal report.
|
|
19
|
+
3. Mention the report path, usually:
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
dashboards/Lint Report.md
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
4. Explain warnings and errors as structure-health feedback.
|
|
26
|
+
5. Do not frame lint as "the user must manually audit every note".
|
|
27
|
+
|
|
28
|
+
## Issue Meaning
|
|
29
|
+
|
|
30
|
+
- `error`: broken structure such as a missing internal link.
|
|
31
|
+
- `warning`: likely fix needed, such as missing source fields or stale fallback entries.
|
|
32
|
+
- `info`: useful inventory, such as deterministic fallback count or duplicate titles.
|
|
33
|
+
|
|
34
|
+
## Repair Guidance
|
|
35
|
+
|
|
36
|
+
Prefer small, traceable fixes:
|
|
37
|
+
|
|
38
|
+
- Regenerate or enrich missing Wiki Entries.
|
|
39
|
+
- Fix broken wikilinks.
|
|
40
|
+
- Add missing `source_card` or `raw_file` paths.
|
|
41
|
+
- Ask the host Agent to provide `analysis` for scaffold entries.
|
|
42
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# AIWiki Query Protocol
|
|
2
|
+
|
|
3
|
+
Use this protocol when the user asks:
|
|
4
|
+
|
|
5
|
+
- 从 AIWiki 里了解某个主题
|
|
6
|
+
- 基于 AIWiki 里的资料总结某个问题
|
|
7
|
+
- AIWiki 里有没有关于某个主题的内容
|
|
8
|
+
- 帮我用 AIWiki 写一篇文章大纲
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
1. Identify the topic and expected output shape.
|
|
13
|
+
2. Call:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
aiwiki context "<topic>"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
3. Read the JSON result.
|
|
20
|
+
4. Prefer `matches.wiki_entries` before source cards, claims, topics, outlines, or raw refs.
|
|
21
|
+
5. Pay attention to `generation_mode`, `quality`, and `warnings`.
|
|
22
|
+
6. If the best Wiki Entry has `quality: "scaffold"`, tell the user that the entry is a traceable fallback and may need Agent enrichment.
|
|
23
|
+
7. Do not scan `02-raw` by default unless:
|
|
24
|
+
- Wiki Entries are insufficient.
|
|
25
|
+
- The user asks to verify the original source.
|
|
26
|
+
- There is a source conflict.
|
|
27
|
+
- A precise quote or source check is needed.
|
|
28
|
+
|
|
29
|
+
## Reply Shape
|
|
30
|
+
|
|
31
|
+
Include:
|
|
32
|
+
|
|
33
|
+
- Which Wiki Entries were found.
|
|
34
|
+
- Main conclusions.
|
|
35
|
+
- Source basis.
|
|
36
|
+
- Known gaps or scaffold warnings.
|
|
37
|
+
- Suggested next step.
|
|
38
|
+
|
package/skill/SKILL.md
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: aiwiki
|
|
3
|
-
description: Agent-first AIWiki workflow for turning one URL/body into local knowledge
|
|
3
|
+
description: Agent-first AIWiki workflow for turning one URL/body into local Wiki knowledge files.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# AIWiki Skill
|
|
7
7
|
|
|
8
|
-
Use this skill when the user asks an Agent to process one URL, article body, or local text file with the `aiwiki` keyword
|
|
8
|
+
Use this skill when the user asks an Agent to process one URL, article body, or local text file with the `aiwiki` keyword, or says phrases like `入库 <url>` / `收录 <url>` / `从 AIWiki 里了解 <topic>`.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
AIWiki CLI does not fetch webpages and does not call an LLM. The host Agent reads and understands the source; AIWiki validates, writes, links, tracks, queries, and lints local Markdown knowledge files.
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Ingest Flow
|
|
13
13
|
|
|
14
14
|
1. Read the URL, message, attachment, or user-provided body.
|
|
15
15
|
2. Build an `aiwiki.agent_payload.v1` payload with `source` and `request`.
|
|
16
|
-
3.
|
|
17
|
-
4.
|
|
18
|
-
5.
|
|
16
|
+
3. If you understand the source, also provide `analysis` and/or `wiki_entry`.
|
|
17
|
+
4. Do not include output paths in the payload. The CLI decides where files are written.
|
|
18
|
+
5. If webpage reading fails, still build a payload with `source.fetch_status` set to `failed` and include `source.fetch_notes`.
|
|
19
|
+
6. Prefer stdin so the user does not need to save a payload file:
|
|
19
20
|
|
|
20
21
|
```bash
|
|
21
22
|
aiwiki ingest-agent --stdin
|
|
@@ -33,43 +34,34 @@ For local files, call:
|
|
|
33
34
|
aiwiki ingest-file --file <file>
|
|
34
35
|
```
|
|
35
36
|
|
|
36
|
-
##
|
|
37
|
+
## Wiki Entry Generation Rules
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
- `ingested`: whether readable content was written into the knowledge base.
|
|
41
|
-
- `recorded`: whether AIWiki wrote a run record.
|
|
42
|
-
- `fetch_status`: whether the host Agent supplied readable content.
|
|
43
|
-
- `fit_score` and `fit_level`: lightweight fit feedback for review priority.
|
|
44
|
-
- `summary`: short content summary or fetch-failure note.
|
|
45
|
-
- `run_dir` and `processing_summary`: local result entry points.
|
|
46
|
-
- `source_card`: Obsidian source-card entry when ingestion succeeded.
|
|
47
|
-
- `dashboard` and `review_queue`: Obsidian review database entry points.
|
|
48
|
-
|
|
49
|
-
Recommended reply shape:
|
|
39
|
+
AIWiki always creates a Wiki Entry for successful ingestion:
|
|
50
40
|
|
|
51
41
|
```text
|
|
52
|
-
|
|
53
|
-
契合度:<fit_score> / <fit_level>
|
|
54
|
-
摘要:<summary>
|
|
55
|
-
资料卡:<source_card>
|
|
56
|
-
处理记录:<processing_summary>
|
|
57
|
-
Obsidian 入口:<dashboard>
|
|
58
|
-
待审队列:<review_queue>
|
|
42
|
+
05-wiki/source-knowledge/<slug>.md
|
|
59
43
|
```
|
|
60
44
|
|
|
61
|
-
|
|
45
|
+
There are two modes:
|
|
46
|
+
|
|
47
|
+
- `agent_enriched` / `enriched`: you provided `analysis` or `wiki_entry`; AIWiki writes those results into the Wiki Entry.
|
|
48
|
+
- `deterministic_fallback` / `scaffold`: you only provided source content; AIWiki writes title, source links, body preview, backlinks, and a "to be completed by Agent" section.
|
|
62
49
|
|
|
63
|
-
|
|
50
|
+
Because AIWiki CLI does not call an LLM, high-quality summary and knowledge extraction are the host Agent's responsibility. When possible, provide:
|
|
64
51
|
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
52
|
+
- `analysis.summary`
|
|
53
|
+
- `analysis.key_points`
|
|
54
|
+
- `analysis.reusable_knowledge`
|
|
55
|
+
- `analysis.related_concepts`
|
|
56
|
+
- `analysis.use_cases`
|
|
57
|
+
- `analysis.topic_candidates`
|
|
58
|
+
- `analysis.claims`
|
|
59
|
+
- `analysis.outline`
|
|
60
|
+
- `wiki_entry.title`
|
|
61
|
+
- `wiki_entry.sections`
|
|
62
|
+
- `wiki_entry.markdown`
|
|
71
63
|
|
|
72
|
-
##
|
|
64
|
+
## Minimal Payload
|
|
73
65
|
|
|
74
66
|
```json
|
|
75
67
|
{
|
|
@@ -84,10 +76,81 @@ If `fetch_status` is `failed`, say that AIWiki recorded the failure reason but d
|
|
|
84
76
|
"fetch_status": "ok",
|
|
85
77
|
"captured_at": "2026-05-07T10:00:00+08:00"
|
|
86
78
|
},
|
|
79
|
+
"analysis": {
|
|
80
|
+
"summary": "One-sentence summary.",
|
|
81
|
+
"key_points": ["Key point 1", "Key point 2"],
|
|
82
|
+
"related_concepts": ["Concept A"]
|
|
83
|
+
},
|
|
87
84
|
"request": {
|
|
88
85
|
"mode": "ingest",
|
|
89
|
-
"outputs": ["source_card", "creative_assets", "topics", "draft_outline", "processing_summary"],
|
|
86
|
+
"outputs": ["source_card", "wiki_entry", "creative_assets", "topics", "draft_outline", "processing_summary"],
|
|
90
87
|
"language": "zh-CN"
|
|
91
88
|
}
|
|
92
89
|
}
|
|
93
90
|
```
|
|
91
|
+
|
|
92
|
+
## User Reply
|
|
93
|
+
|
|
94
|
+
After the CLI runs, read the command output and report these fields:
|
|
95
|
+
|
|
96
|
+
- `ingested`
|
|
97
|
+
- `recorded`
|
|
98
|
+
- `fetch_status`
|
|
99
|
+
- `fit_score` and `fit_level`
|
|
100
|
+
- `summary`
|
|
101
|
+
- `wiki_entry`
|
|
102
|
+
- `wiki_entry_generation_mode`
|
|
103
|
+
- `wiki_entry_quality`
|
|
104
|
+
- `source_card`
|
|
105
|
+
- `processing_summary`
|
|
106
|
+
- `run_dir`
|
|
107
|
+
|
|
108
|
+
Recommended success reply:
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
AIWiki 已完成入库,并生成 Wiki 条目。
|
|
112
|
+
质量模式:<wiki_entry_quality> / <wiki_entry_generation_mode>
|
|
113
|
+
摘要:<summary>
|
|
114
|
+
Wiki 条目:<wiki_entry>
|
|
115
|
+
资料卡:<source_card>
|
|
116
|
+
处理记录:<processing_summary>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
If `wiki_entry_quality` is `scaffold`, say clearly that this Wiki Entry is a traceable fallback and still needs Agent enrichment for high-quality knowledge extraction.
|
|
120
|
+
|
|
121
|
+
If `fetch_status` is `failed`, say that AIWiki recorded the failure reason but did not ingest readable content.
|
|
122
|
+
|
|
123
|
+
## Query Protocol
|
|
124
|
+
|
|
125
|
+
When the user asks to understand a topic from AIWiki, call:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
aiwiki context "<topic>"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Use the returned JSON to answer. Prefer Wiki Entries first. Do not scan `02-raw` by default unless the Wiki result is insufficient, the user asks to verify the original text, or sources conflict.
|
|
132
|
+
|
|
133
|
+
## Lint Protocol
|
|
134
|
+
|
|
135
|
+
When the user asks to整理 / 检查 / lint the knowledge base, call:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
aiwiki lint
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Explain warnings and errors as structure-health feedback. Do not frame lint as a requirement that the user manually review every item.
|
|
142
|
+
|
|
143
|
+
## Obsidian + Dataview Boundary
|
|
144
|
+
|
|
145
|
+
- AIWiki can be used with plain Markdown.
|
|
146
|
+
- Obsidian is a useful viewing surface, not a hard dependency.
|
|
147
|
+
- Dataview is optional and only enhances generated dashboards.
|
|
148
|
+
- Do not install Dataview for the user.
|
|
149
|
+
- Do not edit `.obsidian`, `community-plugins.json`, or Obsidian plugin configuration.
|
|
150
|
+
|
|
151
|
+
## Prohibited
|
|
152
|
+
|
|
153
|
+
- Do not ask the user to save payload files.
|
|
154
|
+
- Do not ask the user to type `--path` every time.
|
|
155
|
+
- Do not claim AIWiki CLI fetches webpages.
|
|
156
|
+
- Do not claim AIWiki CLI automatically creates high-quality summaries without Agent-provided analysis.
|