@itradingai/aiwiki 0.2.20 → 0.2.22
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 +245 -172
- package/README.zh-CN.md +323 -0
- package/dist/src/app.js +120 -10
- package/docs/AGENT_HANDOFF.md +133 -177
- package/docs/AGENT_HANDOFF.zh-CN.md +150 -0
- package/docs/FAQ.md +80 -42
- package/docs/FAQ.zh-CN.md +103 -0
- package/docs/README.md +34 -23
- package/docs/README.zh-CN.md +34 -0
- package/docs/RELEASE.md +46 -16
- package/docs/RELEASE.zh-CN.md +84 -0
- package/docs/ROADMAP.md +51 -29
- package/docs/ROADMAP.zh-CN.md +65 -0
- package/docs/SHOWCASE.md +59 -45
- package/docs/SHOWCASE.zh-CN.md +81 -0
- package/docs/TRIAL_FEEDBACK_TEMPLATE.md +49 -0
- package/docs/USAGE.md +172 -358
- package/docs/USAGE.zh-CN.md +243 -0
- package/docs/development-log.md +80 -0
- package/package.json +11 -2
- package/skill/SKILL.md +33 -2
package/docs/AGENT_HANDOFF.md
CHANGED
|
@@ -1,59 +1,82 @@
|
|
|
1
|
-
# AIWiki Agent
|
|
1
|
+
# AIWiki Agent Handoff
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This document is for any host assistant that can read sources, produce structured content, and run local commands.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Goal
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
When the user says:
|
|
8
8
|
|
|
9
9
|
```text
|
|
10
|
-
|
|
10
|
+
Ingest this into AIWiki:
|
|
11
|
+
https://example.com/article
|
|
11
12
|
```
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
The assistant should read the source, build an AIWiki payload, call the AIWiki CLI, and report the result to the user.
|
|
14
15
|
|
|
15
|
-
##
|
|
16
|
+
## Responsibility Boundary
|
|
16
17
|
|
|
17
18
|
```text
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
Assistant:
|
|
20
|
+
reads sources, understands content, creates analysis/wiki_entry, calls CLI, replies to user
|
|
21
|
+
|
|
22
|
+
AIWiki CLI:
|
|
23
|
+
validates payloads, writes local Markdown files, creates Wiki Entries, outputs run status
|
|
24
|
+
|
|
25
|
+
User:
|
|
26
|
+
provides links, files, or notes, then reviews or reuses the result
|
|
21
27
|
```
|
|
22
28
|
|
|
23
|
-
AIWiki CLI
|
|
29
|
+
AIWiki CLI does not fetch webpages and does not call an LLM. If source reading fails, the assistant should still call AIWiki with a failed-fetch payload so the attempt is traceable.
|
|
24
30
|
|
|
25
|
-
|
|
31
|
+
## Required Command-First Contract
|
|
26
32
|
|
|
27
|
-
|
|
33
|
+
When working inside an AIWiki workspace, call AIWiki commands before generic file search or ad hoc note edits.
|
|
28
34
|
|
|
29
|
-
|
|
30
|
-
2. 如果读取成功,生成 `fetch_status: "ok"` 的 payload。
|
|
31
|
-
3. 尽量基于正文生成 `analysis` 或 `wiki_entry`。
|
|
32
|
-
4. 如果读取失败,生成 `fetch_status: "failed"` 的 payload,并写清 `fetch_notes`。
|
|
33
|
-
5. 不要让用户保存 payload。
|
|
34
|
-
6. 不要让用户手动运行命令。
|
|
35
|
-
7. 优先通过 stdin 调用:
|
|
35
|
+
First sync workspace guidance:
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
|
-
aiwiki
|
|
38
|
+
aiwiki agent sync --path <workspace> --yes
|
|
39
|
+
aiwiki agent check --path <workspace> --json
|
|
39
40
|
```
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
Use this command-first loop:
|
|
42
43
|
|
|
43
44
|
```bash
|
|
44
|
-
aiwiki
|
|
45
|
+
aiwiki setup --path <workspace> --yes
|
|
46
|
+
aiwiki lint --json --path <workspace>
|
|
47
|
+
aiwiki lint --fix-empty-dirs --json --path <workspace>
|
|
48
|
+
aiwiki ingest-file --file <file> --path <workspace>
|
|
49
|
+
aiwiki ingest-agent --stdin --path <workspace>
|
|
50
|
+
aiwiki status --path <workspace>
|
|
51
|
+
aiwiki query <topic> --path <workspace>
|
|
52
|
+
aiwiki context <topic> --path <workspace>
|
|
45
53
|
```
|
|
46
54
|
|
|
47
|
-
|
|
48
|
-
10. 汇报产物时先说核心产物:Raw、Source Card、Wiki Entry、Run Summary、Processing Summary。Claim、Asset、Topic、Outline 只在本次 CLI 输出或文件中真实存在时再提。
|
|
55
|
+
Use `rg`, `find`, direct file reading, or temporary scripts only after the relevant AIWiki command has been tried or when the command is unavailable. If you fall back, explain which AIWiki command was insufficient and why.
|
|
49
56
|
|
|
50
|
-
##
|
|
57
|
+
## Ingest Flow
|
|
51
58
|
|
|
52
|
-
|
|
59
|
+
For a first-time public trial, guide the user through one small loop: setup, one source ingest, generated-file inspection, query/context reuse, lint/doctor check, then feedback with `docs/TRIAL_FEEDBACK_TEMPLATE.md`. Do not introduce Pro-only flows, crawlers, vector search, or a new feedback command.
|
|
53
60
|
|
|
54
|
-
|
|
61
|
+
1. Read the URL, file, note, attachment, or user-provided body.
|
|
62
|
+
2. Read `_system/purpose.md` when it exists and decide whether the material fits the workspace.
|
|
63
|
+
3. Build an `aiwiki.agent_payload.v1` payload with `source` and `request`.
|
|
64
|
+
4. If you understand the source, also provide `analysis` and/or `wiki_entry`.
|
|
65
|
+
5. Do not include output paths in the payload. The CLI decides where files are written.
|
|
66
|
+
6. If source reading fails, set `source.fetch_status` to `failed` and include `source.fetch_notes`.
|
|
67
|
+
7. Prefer stdin:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
aiwiki ingest-agent --stdin
|
|
71
|
+
```
|
|
55
72
|
|
|
56
|
-
|
|
73
|
+
If the current shell or assistant bridge cannot guarantee UTF-8 stdin, write a UTF-8 JSON file and call:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
aiwiki ingest-agent --payload <utf8-json-file>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Minimal Payload
|
|
57
80
|
|
|
58
81
|
```json
|
|
59
82
|
{
|
|
@@ -61,9 +84,9 @@ AIWiki 会修复常见 UTF-8 mojibake,但这只是兜底;宿主 Agent 仍应
|
|
|
61
84
|
"source": {
|
|
62
85
|
"kind": "url",
|
|
63
86
|
"url": "https://example.com/article",
|
|
64
|
-
"title": "
|
|
87
|
+
"title": "Article title",
|
|
65
88
|
"content_format": "markdown",
|
|
66
|
-
"content": "
|
|
89
|
+
"content": "Article body read by the host assistant.",
|
|
67
90
|
"fetcher": "host-agent",
|
|
68
91
|
"fetch_status": "ok",
|
|
69
92
|
"captured_at": "2026-05-07T10:00:00+08:00",
|
|
@@ -71,47 +94,35 @@ AIWiki 会修复常见 UTF-8 mojibake,但这只是兜底;宿主 Agent 仍应
|
|
|
71
94
|
"represents_user_view": false
|
|
72
95
|
},
|
|
73
96
|
"analysis": {
|
|
74
|
-
"summary": "
|
|
75
|
-
"key_points": [
|
|
76
|
-
|
|
77
|
-
"核心观点 2"
|
|
78
|
-
],
|
|
79
|
-
"related_concepts": [
|
|
80
|
-
"概念 A"
|
|
81
|
-
],
|
|
82
|
-
"claims": [
|
|
83
|
-
{
|
|
84
|
-
"claim": "强主张应绑定原文证据",
|
|
85
|
-
"confidence": "high",
|
|
86
|
-
"source_quote": "这里是宿主 Agent 读取到的正文内容。"
|
|
87
|
-
}
|
|
88
|
-
]
|
|
97
|
+
"summary": "One-sentence summary.",
|
|
98
|
+
"key_points": ["Key point 1", "Key point 2"],
|
|
99
|
+
"related_concepts": ["Concept A"]
|
|
89
100
|
},
|
|
90
101
|
"request": {
|
|
91
102
|
"mode": "ingest",
|
|
92
|
-
"outputs": [
|
|
93
|
-
"source_card",
|
|
94
|
-
"wiki_entry",
|
|
95
|
-
"processing_summary"
|
|
96
|
-
],
|
|
103
|
+
"outputs": ["source_card", "wiki_entry", "processing_summary"],
|
|
97
104
|
"language": "zh-CN"
|
|
98
105
|
}
|
|
99
106
|
}
|
|
100
107
|
```
|
|
101
108
|
|
|
102
|
-
## Analysis
|
|
109
|
+
## Optional Analysis Fields
|
|
103
110
|
|
|
104
|
-
|
|
111
|
+
When useful, provide:
|
|
105
112
|
|
|
106
|
-
- `entities
|
|
107
|
-
- `concepts
|
|
108
|
-
- `tensions
|
|
109
|
-
- `reusable_judgments
|
|
110
|
-
- `suggested_links
|
|
113
|
+
- `entities`
|
|
114
|
+
- `concepts`
|
|
115
|
+
- `tensions`
|
|
116
|
+
- `reusable_judgments`
|
|
117
|
+
- `suggested_links`
|
|
118
|
+
- `claims` with `source_quote` when claims need evidence
|
|
119
|
+
- `wiki_entry.title`
|
|
120
|
+
- `wiki_entry.sections`
|
|
121
|
+
- `wiki_entry.markdown`
|
|
111
122
|
|
|
112
|
-
|
|
123
|
+
Do not invent unsupported facts. Treat AIWiki grounding warnings as review signals, not as confirmed proof that something is wrong.
|
|
113
124
|
|
|
114
|
-
##
|
|
125
|
+
## Failed Fetch Payload
|
|
115
126
|
|
|
116
127
|
```json
|
|
117
128
|
{
|
|
@@ -119,161 +130,102 @@ AIWiki 会修复常见 UTF-8 mojibake,但这只是兜底;宿主 Agent 仍应
|
|
|
119
130
|
"source": {
|
|
120
131
|
"kind": "url",
|
|
121
132
|
"url": "https://example.com/article",
|
|
122
|
-
"title": "
|
|
133
|
+
"title": "Unreadable article",
|
|
123
134
|
"fetcher": "host-agent",
|
|
124
135
|
"fetch_status": "failed",
|
|
125
|
-
"fetch_notes": "
|
|
136
|
+
"fetch_notes": "The page requires login or the assistant could not access the body.",
|
|
126
137
|
"captured_at": "2026-05-07T10:00:00+08:00"
|
|
127
138
|
},
|
|
128
139
|
"request": {
|
|
129
140
|
"mode": "record_fetch_failure",
|
|
130
|
-
"outputs": [
|
|
131
|
-
|
|
132
|
-
],
|
|
133
|
-
"language": "zh-CN"
|
|
141
|
+
"outputs": ["processing_summary"],
|
|
142
|
+
"language": "en"
|
|
134
143
|
}
|
|
135
144
|
}
|
|
136
145
|
```
|
|
137
146
|
|
|
138
|
-
##
|
|
139
|
-
|
|
140
|
-
- 不要在 payload 中包含输出路径。
|
|
141
|
-
- 不要让用户手动保存 payload。
|
|
142
|
-
- 不要让用户每次输入 `--path`。
|
|
143
|
-
- 不要声称网页抓取是 AIWiki CLI 的能力。
|
|
144
|
-
- 不要声称 AIWiki CLI 会在没有 Agent 分析字段时自动高质量总结。
|
|
145
|
-
- 不要在 `fetch_status: "failed"` 时塞入正文内容。
|
|
146
|
-
- 不要替用户安装 Dataview。
|
|
147
|
-
- 不要修改 `.obsidian`、`community-plugins.json` 或 Obsidian 插件配置。
|
|
147
|
+
## User Reply
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
After the CLI runs, read the command output and report:
|
|
150
150
|
|
|
151
|
-
|
|
151
|
+
- ingest status
|
|
152
|
+
- source title or URL
|
|
153
|
+
- summary
|
|
154
|
+
- Wiki Entry path
|
|
155
|
+
- Wiki Entry quality mode
|
|
156
|
+
- Source Card path
|
|
157
|
+
- Processing Summary path
|
|
158
|
+
- warnings, if any
|
|
152
159
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
## Agent 回复模板
|
|
156
|
-
|
|
157
|
-
成功时:
|
|
160
|
+
Recommended success reply:
|
|
158
161
|
|
|
159
162
|
```text
|
|
160
|
-
AIWiki
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
Wiki
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
资料卡:<source_card>
|
|
167
|
-
处理记录:<processing_summary>
|
|
163
|
+
AIWiki completed the ingest and created a Wiki Entry.
|
|
164
|
+
Quality: <wiki_entry_quality> / <wiki_entry_generation_mode>
|
|
165
|
+
Summary: <summary>
|
|
166
|
+
Wiki Entry: <wiki_entry>
|
|
167
|
+
Source Card: <source_card>
|
|
168
|
+
Processing Summary: <processing_summary>
|
|
168
169
|
```
|
|
169
170
|
|
|
170
|
-
|
|
171
|
+
If `wiki_entry_quality` is `scaffold`, say clearly that the entry is a traceable fallback and still needs assistant enrichment.
|
|
171
172
|
|
|
172
|
-
|
|
173
|
-
未成功入库正文,但已记录失败原因。
|
|
174
|
-
原因:<summary>
|
|
175
|
-
记录目录:<run_dir>
|
|
176
|
-
处理摘要:<processing_summary>
|
|
177
|
-
Obsidian 入口:<dashboard>
|
|
178
|
-
```
|
|
173
|
+
If `fetch_status` is `failed`, say that AIWiki recorded the failure reason but did not ingest readable content.
|
|
179
174
|
|
|
180
|
-
## Query
|
|
175
|
+
## Query Protocol
|
|
181
176
|
|
|
182
|
-
|
|
177
|
+
When the user asks what AIWiki knows about a topic, call:
|
|
183
178
|
|
|
184
179
|
```bash
|
|
185
|
-
aiwiki context "
|
|
180
|
+
aiwiki context "<topic>"
|
|
186
181
|
```
|
|
187
182
|
|
|
188
|
-
|
|
183
|
+
Use filters when intent is narrow:
|
|
189
184
|
|
|
190
185
|
```bash
|
|
191
|
-
aiwiki
|
|
186
|
+
aiwiki context "<topic>" --type wiki_entries --status active --limit 5
|
|
187
|
+
aiwiki context "<topic>" --source-role output --limit 5
|
|
188
|
+
aiwiki context "<topic>" --type source_cards --status to-review --limit 5
|
|
192
189
|
```
|
|
193
190
|
|
|
194
|
-
|
|
191
|
+
Read these fields before responding:
|
|
195
192
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
193
|
+
- `query_scope`
|
|
194
|
+
- `result_quality`
|
|
195
|
+
- `recommended_next_action`
|
|
196
|
+
- `match_reasons`
|
|
197
|
+
- `quality_signals`
|
|
198
|
+
- `related_refs`
|
|
199
199
|
|
|
200
|
-
|
|
200
|
+
Do not scan `02-raw` by default unless the Wiki result is insufficient, the user asks to verify the original text, or sources conflict.
|
|
201
201
|
|
|
202
|
-
|
|
203
|
-
aiwiki lint --fix-empty-dirs --json
|
|
204
|
-
aiwiki lint --json
|
|
205
|
-
```
|
|
202
|
+
## Lint Protocol
|
|
206
203
|
|
|
207
|
-
|
|
204
|
+
When the user asks to check, organize, or lint the knowledge base, first call:
|
|
208
205
|
|
|
209
206
|
```bash
|
|
210
|
-
aiwiki lint --
|
|
211
|
-
aiwiki lint --severity warning
|
|
212
|
-
aiwiki lint --severity info
|
|
207
|
+
aiwiki lint --json
|
|
213
208
|
```
|
|
214
209
|
|
|
215
|
-
|
|
210
|
+
If `safe_fixes.only_safe_fixes` is true and the user allows cleanup:
|
|
216
211
|
|
|
217
212
|
```bash
|
|
218
|
-
aiwiki lint --
|
|
213
|
+
aiwiki lint --fix-empty-dirs --json
|
|
214
|
+
aiwiki lint --json
|
|
219
215
|
```
|
|
220
216
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
`context` 返回 JSON,注意其中的 `generation_mode`、`quality` 和 `warnings`。如果结果是 `deterministic_fallback` / `scaffold`,回复时要说明它只是可追溯脚手架,不是高质量知识提炼。
|
|
224
|
-
|
|
225
|
-
`context` 也可能返回 grounding 字段。回复用户时可以把 `grounding_needs_review: true` 解释为“这条资料需要复核证据或覆盖度”,不要说成“AIWiki 已确认漏掉重点”。
|
|
217
|
+
Only `remove_empty_optional_dir` is auto-safe today. It removes known empty optional enhancement directories and must not delete core directories, unknown directories, non-empty directories, or files.
|
|
226
218
|
|
|
227
219
|
## Source Role
|
|
228
220
|
|
|
229
|
-
|
|
221
|
+
Use the default role for external material:
|
|
230
222
|
|
|
231
223
|
```json
|
|
232
224
|
"source_role": "input",
|
|
233
225
|
"represents_user_view": false
|
|
234
226
|
```
|
|
235
227
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
```json
|
|
239
|
-
"source_role": "output",
|
|
240
|
-
"represents_user_view": true
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
不要把外部资料标成代表用户观点。
|
|
244
|
-
# Knowledge Base Purpose
|
|
245
|
-
|
|
246
|
-
Before ingesting, querying, or reorganizing material, read `_system/purpose.md` in the target AIWiki workspace. Treat it as the local contract for what belongs in this knowledge base, what should stay out, and how future multi-knowledge-base routing should be handled.
|
|
247
|
-
|
|
248
|
-
If the material does not fit the purpose file, do not force it into the knowledge base as confirmed knowledge. Record the mismatch, ask for review when needed, or keep it as a traceable source rather than a claim.
|
|
249
|
-
|
|
250
|
-
## Context JSON for Retrieval
|
|
251
|
-
|
|
252
|
-
When answering from AIWiki, prefer:
|
|
253
|
-
|
|
254
|
-
```bash
|
|
255
|
-
aiwiki context "<topic>" --limit 10
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
Use filters when the user intent is narrow:
|
|
259
|
-
|
|
260
|
-
```bash
|
|
261
|
-
aiwiki context "<topic>" --type wiki_entries --source-role input --wiki-type source_knowledge --status active
|
|
262
|
-
aiwiki context "<topic>" --type source_cards --status to-review
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
`context` is local Markdown/frontmatter retrieval only. Do not describe it as vector search, RAG, a database query, or external web search.
|
|
266
|
-
|
|
267
|
-
Read these fields before responding:
|
|
268
|
-
|
|
269
|
-
- `query_scope`: what was searched and which filters were applied.
|
|
270
|
-
- `result_quality.total_matches` and `result_quality.has_wiki_entry`: whether the answer is grounded in a Wiki Entry or only in supporting artifacts.
|
|
271
|
-
- `recommended_next_action`: whether to answer, enrich, review grounding, or broaden the query.
|
|
272
|
-
- `match_reasons`: why each result matched, such as title, body, tags, topics, relationships, or source URL.
|
|
273
|
-
- `quality_signals`: scaffold, enriched, status, grounding, and relationship hints.
|
|
274
|
-
- `related_refs`: local wikilinks and frontmatter relationships such as `source_card`, `raw_file`, and run artifacts.
|
|
275
|
-
|
|
276
|
-
If `quality_signals` contains `quality:scaffold` or `grounding:needs_review`, tell the user the result is a traceable lead that needs enrichment or review. Do not present it as confirmed final knowledge.
|
|
228
|
+
Use `source_role: "output"` with `represents_user_view: true` only when the user is importing their own published writing, talk transcript, newsletter, or similar authored output.
|
|
277
229
|
|
|
278
230
|
## Agent Skill Upgrade Flow
|
|
279
231
|
|
|
@@ -281,22 +233,26 @@ When the user asks you to install, update, upgrade, or repair AIWiki integration
|
|
|
281
233
|
|
|
282
234
|
```bash
|
|
283
235
|
aiwiki agent sync --yes
|
|
284
|
-
aiwiki agent
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
Use JSON when you need exact state:
|
|
288
|
-
|
|
289
|
-
```bash
|
|
290
|
-
aiwiki agent sync --json --yes
|
|
236
|
+
aiwiki agent sync --path <workspace> --yes
|
|
291
237
|
aiwiki agent check --json
|
|
238
|
+
aiwiki agent check --path <workspace> --json
|
|
292
239
|
```
|
|
293
240
|
|
|
294
241
|
Interpret sync results:
|
|
295
242
|
|
|
296
|
-
- `installed`: target did not exist and now has the packaged skill.
|
|
297
|
-
- `current`:
|
|
298
|
-
- `updated`:
|
|
243
|
+
- `installed`: target did not exist and now has the packaged skill or guidance.
|
|
244
|
+
- `current`: target already matches the packaged version.
|
|
245
|
+
- `updated`: target differed; the old file was backed up and replaced.
|
|
299
246
|
- `would_install` / `would_update`: dry-run preview only.
|
|
300
247
|
- `unsupported`: no safe automatic target is known; use `aiwiki prompt agent`.
|
|
301
248
|
|
|
302
|
-
After sync, report the target path, backup path when present, and
|
|
249
|
+
After sync, report the target path, backup path when present, and whether the assistant needs restart or reload. Do not claim the new skill is active until the assistant has reloaded it.
|
|
250
|
+
|
|
251
|
+
## Prohibited
|
|
252
|
+
|
|
253
|
+
- Do not ask the user to save payload files.
|
|
254
|
+
- Do not ask the user to type `--path` every time.
|
|
255
|
+
- Do not claim AIWiki fetches webpages.
|
|
256
|
+
- Do not claim AIWiki automatically creates high-quality summaries without assistant-provided analysis.
|
|
257
|
+
- Do not install Dataview for the user.
|
|
258
|
+
- Do not edit `.obsidian`, `community-plugins.json`, or Obsidian plugin configuration.
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# AIWiki Agent 接入说明
|
|
2
|
+
|
|
3
|
+
这份文档写给可以读取资料、生成结构化内容并调用本机命令的宿主 AI 助手。
|
|
4
|
+
|
|
5
|
+
## 目标
|
|
6
|
+
|
|
7
|
+
当用户说:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
把这个资料入库到 AIWiki:
|
|
11
|
+
https://example.com/article
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
助手应该读取资料,生成 AIWiki payload,调用 AIWiki CLI,然后把结果回复给用户。
|
|
15
|
+
|
|
16
|
+
## 职责边界
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
助手:
|
|
20
|
+
读取资料、理解内容、生成 analysis/wiki_entry、调用 CLI、回复用户
|
|
21
|
+
|
|
22
|
+
AIWiki CLI:
|
|
23
|
+
校验 payload、写入本地 Markdown、创建 Wiki Entry、输出 run 状态
|
|
24
|
+
|
|
25
|
+
用户:
|
|
26
|
+
提供链接、文件或笔记,最后审阅或复用结果
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
AIWiki CLI 不抓网页,也不调用 LLM。读取失败时,助手也应该调用 AIWiki 记录失败原因。
|
|
30
|
+
|
|
31
|
+
## 命令优先契约
|
|
32
|
+
|
|
33
|
+
在 AIWiki 知识库里工作时,先调用 AIWiki 命令,再考虑通用文件搜索或临时脚本。
|
|
34
|
+
|
|
35
|
+
先同步知识库根指导:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
aiwiki agent sync --path <workspace> --yes
|
|
39
|
+
aiwiki agent check --path <workspace> --json
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
日常闭环按这个顺序使用:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
aiwiki setup --path <workspace> --yes
|
|
46
|
+
aiwiki lint --json --path <workspace>
|
|
47
|
+
aiwiki lint --fix-empty-dirs --json --path <workspace>
|
|
48
|
+
aiwiki ingest-file --file <file> --path <workspace>
|
|
49
|
+
aiwiki ingest-agent --stdin --path <workspace>
|
|
50
|
+
aiwiki status --path <workspace>
|
|
51
|
+
aiwiki query <topic> --path <workspace>
|
|
52
|
+
aiwiki context <topic> --path <workspace>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
只有当对应 AIWiki 命令无法回答问题时,才退回 `rg`、`find`、直接读文件或临时脚本;退回时说明哪个 AIWiki 命令不够用以及原因。
|
|
56
|
+
|
|
57
|
+
## 入库流程
|
|
58
|
+
|
|
59
|
+
1. 读取 URL、文件、笔记、附件或用户粘贴的正文。
|
|
60
|
+
2. 如果存在 `_system/purpose.md`,先阅读并判断资料是否适合该知识库。
|
|
61
|
+
3. 生成 `aiwiki.agent_payload.v1`,包含 `source` 和 `request`。
|
|
62
|
+
4. 能理解来源时,尽量提供 `analysis` 或 `wiki_entry`。
|
|
63
|
+
5. 不要在 payload 中包含输出路径。
|
|
64
|
+
6. 如果读取失败,设置 `source.fetch_status` 为 `failed`,并写明 `source.fetch_notes`。
|
|
65
|
+
7. 优先通过 stdin 调用:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
aiwiki ingest-agent --stdin
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
如果当前 shell 或助手桥接不能保证 UTF-8 stdin,写入 UTF-8 JSON 文件后调用:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
aiwiki ingest-agent --payload <utf8-json-file>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 用户回复
|
|
78
|
+
|
|
79
|
+
CLI 运行后,读取输出并汇报:
|
|
80
|
+
|
|
81
|
+
- 入库状态
|
|
82
|
+
- 来源标题或 URL
|
|
83
|
+
- 摘要
|
|
84
|
+
- Wiki Entry 路径
|
|
85
|
+
- Wiki Entry 质量模式
|
|
86
|
+
- Source Card 路径
|
|
87
|
+
- Processing Summary 路径
|
|
88
|
+
- warning
|
|
89
|
+
|
|
90
|
+
推荐成功回复:
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
AIWiki 已完成入库,并创建 Wiki 条目。
|
|
94
|
+
质量:<wiki_entry_quality> / <wiki_entry_generation_mode>
|
|
95
|
+
摘要:<summary>
|
|
96
|
+
Wiki 条目:<wiki_entry>
|
|
97
|
+
资料卡:<source_card>
|
|
98
|
+
处理记录:<processing_summary>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
如果 `wiki_entry_quality` 是 `scaffold`,要说明它只是可追踪脚手架,仍需要助手继续补全高质量知识提炼。
|
|
102
|
+
|
|
103
|
+
## 查询协议
|
|
104
|
+
|
|
105
|
+
用户问 AIWiki 里某个主题时,调用:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
aiwiki context "<topic>"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
不要默认扫描 `02-raw`,除非 Wiki 结果不足、用户要求核对原文,或来源之间有冲突。
|
|
112
|
+
|
|
113
|
+
## Lint 协议
|
|
114
|
+
|
|
115
|
+
用户要求检查、整理或 lint 知识库时,先调用:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
aiwiki lint --json
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
如果 `safe_fixes.only_safe_fixes` 为 true 且用户允许整理:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
aiwiki lint --fix-empty-dirs --json
|
|
125
|
+
aiwiki lint --json
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
当前唯一自动安全修复是 `remove_empty_optional_dir`,只能删除已知且为空的可选增强目录。
|
|
129
|
+
|
|
130
|
+
## 升级和修复接入
|
|
131
|
+
|
|
132
|
+
用户要求安装、更新、升级或修复 AIWiki 接入时,运行:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
aiwiki agent sync --yes
|
|
136
|
+
aiwiki agent sync --path <workspace> --yes
|
|
137
|
+
aiwiki agent check --json
|
|
138
|
+
aiwiki agent check --path <workspace> --json
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
同步后汇报目标路径、备份路径和是否需要重启或重新加载助手。
|
|
142
|
+
|
|
143
|
+
## 禁止事项
|
|
144
|
+
|
|
145
|
+
- 不要让用户手动保存 payload。
|
|
146
|
+
- 不要让用户每次输入 `--path`。
|
|
147
|
+
- 不要声称 AIWiki 会抓网页。
|
|
148
|
+
- 不要声称 AIWiki 在没有助手分析字段时会自动生成高质量总结。
|
|
149
|
+
- 不要替用户安装 Dataview。
|
|
150
|
+
- 不要修改 `.obsidian`、`community-plugins.json` 或 Obsidian 插件配置。
|