@itradingai/aiwiki 0.2.21 → 0.2.23
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 +211 -179
- package/README.zh-CN.md +312 -0
- package/docs/AGENT_HANDOFF.md +115 -185
- package/docs/AGENT_HANDOFF.zh-CN.md +150 -0
- package/docs/FAQ.md +73 -49
- 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 +174 -362
- package/docs/USAGE.zh-CN.md +247 -0
- package/docs/development-log.md +145 -0
- package/package.json +12 -3
- package/skill/SKILL.md +6 -2
package/docs/AGENT_HANDOFF.md
CHANGED
|
@@ -1,41 +1,45 @@
|
|
|
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
|
-
|
|
21
|
-
|
|
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
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
User:
|
|
26
|
+
provides links, files, or notes, then reviews or reuses the result
|
|
27
|
+
```
|
|
24
28
|
|
|
25
|
-
|
|
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.
|
|
26
30
|
|
|
27
|
-
##
|
|
31
|
+
## Required Command-First Contract
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
When working inside an AIWiki workspace, call AIWiki commands before generic file search or ad hoc note edits.
|
|
30
34
|
|
|
31
|
-
|
|
35
|
+
First sync workspace guidance:
|
|
32
36
|
|
|
33
37
|
```bash
|
|
34
38
|
aiwiki agent sync --path <workspace> --yes
|
|
35
39
|
aiwiki agent check --path <workspace> --json
|
|
36
40
|
```
|
|
37
41
|
|
|
38
|
-
|
|
42
|
+
Use this command-first loop:
|
|
39
43
|
|
|
40
44
|
```bash
|
|
41
45
|
aiwiki setup --path <workspace> --yes
|
|
@@ -48,38 +52,31 @@ aiwiki query <topic> --path <workspace>
|
|
|
48
52
|
aiwiki context <topic> --path <workspace>
|
|
49
53
|
```
|
|
50
54
|
|
|
51
|
-
|
|
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.
|
|
56
|
+
|
|
57
|
+
## Ingest Flow
|
|
52
58
|
|
|
53
|
-
|
|
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.
|
|
54
60
|
|
|
55
|
-
1.
|
|
56
|
-
2.
|
|
57
|
-
3.
|
|
58
|
-
4.
|
|
59
|
-
5.
|
|
60
|
-
6.
|
|
61
|
-
7.
|
|
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:
|
|
62
68
|
|
|
63
69
|
```bash
|
|
64
70
|
aiwiki ingest-agent --stdin
|
|
65
71
|
```
|
|
66
72
|
|
|
67
|
-
|
|
73
|
+
If the current shell or assistant bridge cannot guarantee UTF-8 stdin, write a UTF-8 JSON file and call:
|
|
68
74
|
|
|
69
75
|
```bash
|
|
70
76
|
aiwiki ingest-agent --payload <utf8-json-file>
|
|
71
77
|
```
|
|
72
78
|
|
|
73
|
-
|
|
74
|
-
10. 汇报产物时先说核心产物:Raw、Source Card、Wiki Entry、Run Summary、Processing Summary。Claim、Asset、Topic、Outline 只在本次 CLI 输出或文件中真实存在时再提。
|
|
75
|
-
|
|
76
|
-
## 编码要求
|
|
77
|
-
|
|
78
|
-
payload 必须是 UTF-8 JSON。Windows PowerShell、批处理、第三方 Agent shell bridge 可能会把中文 JSON 管道按非 UTF-8 编码传递;遇到中文乱码、`payload must be valid JSON` 或无法确认管道编码时,使用 `--payload <utf8-json-file>`。
|
|
79
|
-
|
|
80
|
-
AIWiki 会修复常见 UTF-8 mojibake,但这只是兜底;宿主 Agent 仍应尽量传入干净 UTF-8。
|
|
81
|
-
|
|
82
|
-
## 成功 payload
|
|
79
|
+
## Minimal Payload
|
|
83
80
|
|
|
84
81
|
```json
|
|
85
82
|
{
|
|
@@ -87,9 +84,9 @@ AIWiki 会修复常见 UTF-8 mojibake,但这只是兜底;宿主 Agent 仍应
|
|
|
87
84
|
"source": {
|
|
88
85
|
"kind": "url",
|
|
89
86
|
"url": "https://example.com/article",
|
|
90
|
-
"title": "
|
|
87
|
+
"title": "Article title",
|
|
91
88
|
"content_format": "markdown",
|
|
92
|
-
"content": "
|
|
89
|
+
"content": "Article body read by the host assistant.",
|
|
93
90
|
"fetcher": "host-agent",
|
|
94
91
|
"fetch_status": "ok",
|
|
95
92
|
"captured_at": "2026-05-07T10:00:00+08:00",
|
|
@@ -97,47 +94,35 @@ AIWiki 会修复常见 UTF-8 mojibake,但这只是兜底;宿主 Agent 仍应
|
|
|
97
94
|
"represents_user_view": false
|
|
98
95
|
},
|
|
99
96
|
"analysis": {
|
|
100
|
-
"summary": "
|
|
101
|
-
"key_points": [
|
|
102
|
-
|
|
103
|
-
"核心观点 2"
|
|
104
|
-
],
|
|
105
|
-
"related_concepts": [
|
|
106
|
-
"概念 A"
|
|
107
|
-
],
|
|
108
|
-
"claims": [
|
|
109
|
-
{
|
|
110
|
-
"claim": "强主张应绑定原文证据",
|
|
111
|
-
"confidence": "high",
|
|
112
|
-
"source_quote": "这里是宿主 Agent 读取到的正文内容。"
|
|
113
|
-
}
|
|
114
|
-
]
|
|
97
|
+
"summary": "One-sentence summary.",
|
|
98
|
+
"key_points": ["Key point 1", "Key point 2"],
|
|
99
|
+
"related_concepts": ["Concept A"]
|
|
115
100
|
},
|
|
116
101
|
"request": {
|
|
117
102
|
"mode": "ingest",
|
|
118
|
-
"outputs": [
|
|
119
|
-
"source_card",
|
|
120
|
-
"wiki_entry",
|
|
121
|
-
"processing_summary"
|
|
122
|
-
],
|
|
103
|
+
"outputs": ["source_card", "wiki_entry", "processing_summary"],
|
|
123
104
|
"language": "zh-CN"
|
|
124
105
|
}
|
|
125
106
|
}
|
|
126
107
|
```
|
|
127
108
|
|
|
128
|
-
## Analysis
|
|
109
|
+
## Optional Analysis Fields
|
|
129
110
|
|
|
130
|
-
|
|
111
|
+
When useful, provide:
|
|
131
112
|
|
|
132
|
-
- `entities
|
|
133
|
-
- `concepts
|
|
134
|
-
- `tensions
|
|
135
|
-
- `reusable_judgments
|
|
136
|
-
- `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`
|
|
137
122
|
|
|
138
|
-
|
|
123
|
+
Do not invent unsupported facts. Treat AIWiki grounding warnings as review signals, not as confirmed proof that something is wrong.
|
|
139
124
|
|
|
140
|
-
##
|
|
125
|
+
## Failed Fetch Payload
|
|
141
126
|
|
|
142
127
|
```json
|
|
143
128
|
{
|
|
@@ -145,161 +130,102 @@ AIWiki 会修复常见 UTF-8 mojibake,但这只是兜底;宿主 Agent 仍应
|
|
|
145
130
|
"source": {
|
|
146
131
|
"kind": "url",
|
|
147
132
|
"url": "https://example.com/article",
|
|
148
|
-
"title": "
|
|
133
|
+
"title": "Unreadable article",
|
|
149
134
|
"fetcher": "host-agent",
|
|
150
135
|
"fetch_status": "failed",
|
|
151
|
-
"fetch_notes": "
|
|
136
|
+
"fetch_notes": "The page requires login or the assistant could not access the body.",
|
|
152
137
|
"captured_at": "2026-05-07T10:00:00+08:00"
|
|
153
138
|
},
|
|
154
139
|
"request": {
|
|
155
140
|
"mode": "record_fetch_failure",
|
|
156
|
-
"outputs": [
|
|
157
|
-
|
|
158
|
-
],
|
|
159
|
-
"language": "zh-CN"
|
|
141
|
+
"outputs": ["processing_summary"],
|
|
142
|
+
"language": "en"
|
|
160
143
|
}
|
|
161
144
|
}
|
|
162
145
|
```
|
|
163
146
|
|
|
164
|
-
##
|
|
165
|
-
|
|
166
|
-
- 不要在 payload 中包含输出路径。
|
|
167
|
-
- 不要让用户手动保存 payload。
|
|
168
|
-
- 不要让用户每次输入 `--path`。
|
|
169
|
-
- 不要声称网页抓取是 AIWiki CLI 的能力。
|
|
170
|
-
- 不要声称 AIWiki CLI 会在没有 Agent 分析字段时自动高质量总结。
|
|
171
|
-
- 不要在 `fetch_status: "failed"` 时塞入正文内容。
|
|
172
|
-
- 不要替用户安装 Dataview。
|
|
173
|
-
- 不要修改 `.obsidian`、`community-plugins.json` 或 Obsidian 插件配置。
|
|
174
|
-
|
|
175
|
-
## Obsidian + Dataview 边界
|
|
147
|
+
## User Reply
|
|
176
148
|
|
|
177
|
-
|
|
149
|
+
After the CLI runs, read the command output and report:
|
|
178
150
|
|
|
179
|
-
|
|
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
|
|
180
159
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
成功时:
|
|
160
|
+
Recommended success reply:
|
|
184
161
|
|
|
185
162
|
```text
|
|
186
|
-
AIWiki
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
Wiki
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
资料卡:<source_card>
|
|
193
|
-
处理记录:<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>
|
|
194
169
|
```
|
|
195
170
|
|
|
196
|
-
|
|
171
|
+
If `wiki_entry_quality` is `scaffold`, say clearly that the entry is a traceable fallback and still needs assistant enrichment.
|
|
197
172
|
|
|
198
|
-
|
|
199
|
-
未成功入库正文,但已记录失败原因。
|
|
200
|
-
原因:<summary>
|
|
201
|
-
记录目录:<run_dir>
|
|
202
|
-
处理摘要:<processing_summary>
|
|
203
|
-
Obsidian 入口:<dashboard>
|
|
204
|
-
```
|
|
173
|
+
If `fetch_status` is `failed`, say that AIWiki recorded the failure reason but did not ingest readable content.
|
|
205
174
|
|
|
206
|
-
## Query
|
|
175
|
+
## Query Protocol
|
|
207
176
|
|
|
208
|
-
|
|
177
|
+
When the user asks what AIWiki knows about a topic, call:
|
|
209
178
|
|
|
210
179
|
```bash
|
|
211
|
-
aiwiki context "
|
|
180
|
+
aiwiki context "<topic>"
|
|
212
181
|
```
|
|
213
182
|
|
|
214
|
-
|
|
183
|
+
Use filters when intent is narrow:
|
|
215
184
|
|
|
216
185
|
```bash
|
|
217
|
-
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
|
|
218
189
|
```
|
|
219
190
|
|
|
220
|
-
|
|
191
|
+
Read these fields before responding:
|
|
221
192
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
193
|
+
- `query_scope`
|
|
194
|
+
- `result_quality`
|
|
195
|
+
- `recommended_next_action`
|
|
196
|
+
- `match_reasons`
|
|
197
|
+
- `quality_signals`
|
|
198
|
+
- `related_refs`
|
|
225
199
|
|
|
226
|
-
|
|
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.
|
|
227
201
|
|
|
228
|
-
|
|
229
|
-
aiwiki lint --fix-empty-dirs --json
|
|
230
|
-
aiwiki lint --json
|
|
231
|
-
```
|
|
202
|
+
## Lint Protocol
|
|
232
203
|
|
|
233
|
-
|
|
204
|
+
When the user asks to check, organize, or lint the knowledge base, first call:
|
|
234
205
|
|
|
235
206
|
```bash
|
|
236
|
-
aiwiki lint --
|
|
237
|
-
aiwiki lint --severity warning
|
|
238
|
-
aiwiki lint --severity info
|
|
207
|
+
aiwiki lint --json
|
|
239
208
|
```
|
|
240
209
|
|
|
241
|
-
|
|
210
|
+
If `safe_fixes.only_safe_fixes` is true and the user allows cleanup:
|
|
242
211
|
|
|
243
212
|
```bash
|
|
244
|
-
aiwiki lint --
|
|
213
|
+
aiwiki lint --fix-empty-dirs --json
|
|
214
|
+
aiwiki lint --json
|
|
245
215
|
```
|
|
246
216
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
`context` 返回 JSON,注意其中的 `generation_mode`、`quality` 和 `warnings`。如果结果是 `deterministic_fallback` / `scaffold`,回复时要说明它只是可追溯脚手架,不是高质量知识提炼。
|
|
250
|
-
|
|
251
|
-
`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.
|
|
252
218
|
|
|
253
219
|
## Source Role
|
|
254
220
|
|
|
255
|
-
|
|
221
|
+
Use the default role for external material:
|
|
256
222
|
|
|
257
223
|
```json
|
|
258
224
|
"source_role": "input",
|
|
259
225
|
"represents_user_view": false
|
|
260
226
|
```
|
|
261
227
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
```json
|
|
265
|
-
"source_role": "output",
|
|
266
|
-
"represents_user_view": true
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
不要把外部资料标成代表用户观点。
|
|
270
|
-
# Knowledge Base Purpose
|
|
271
|
-
|
|
272
|
-
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.
|
|
273
|
-
|
|
274
|
-
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.
|
|
275
|
-
|
|
276
|
-
## Context JSON for Retrieval
|
|
277
|
-
|
|
278
|
-
When answering from AIWiki, prefer:
|
|
279
|
-
|
|
280
|
-
```bash
|
|
281
|
-
aiwiki context "<topic>" --limit 10
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
Use filters when the user intent is narrow:
|
|
285
|
-
|
|
286
|
-
```bash
|
|
287
|
-
aiwiki context "<topic>" --type wiki_entries --source-role input --wiki-type source_knowledge --status active
|
|
288
|
-
aiwiki context "<topic>" --type source_cards --status to-review
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
`context` is local Markdown/frontmatter retrieval only. Do not describe it as vector search, RAG, a database query, or external web search.
|
|
292
|
-
|
|
293
|
-
Read these fields before responding:
|
|
294
|
-
|
|
295
|
-
- `query_scope`: what was searched and which filters were applied.
|
|
296
|
-
- `result_quality.total_matches` and `result_quality.has_wiki_entry`: whether the answer is grounded in a Wiki Entry or only in supporting artifacts.
|
|
297
|
-
- `recommended_next_action`: whether to answer, enrich, review grounding, or broaden the query.
|
|
298
|
-
- `match_reasons`: why each result matched, such as title, body, tags, topics, relationships, or source URL.
|
|
299
|
-
- `quality_signals`: scaffold, enriched, status, grounding, and relationship hints.
|
|
300
|
-
- `related_refs`: local wikilinks and frontmatter relationships such as `source_card`, `raw_file`, and run artifacts.
|
|
301
|
-
|
|
302
|
-
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.
|
|
303
229
|
|
|
304
230
|
## Agent Skill Upgrade Flow
|
|
305
231
|
|
|
@@ -307,22 +233,26 @@ When the user asks you to install, update, upgrade, or repair AIWiki integration
|
|
|
307
233
|
|
|
308
234
|
```bash
|
|
309
235
|
aiwiki agent sync --yes
|
|
310
|
-
aiwiki agent
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
Use JSON when you need exact state:
|
|
314
|
-
|
|
315
|
-
```bash
|
|
316
|
-
aiwiki agent sync --json --yes
|
|
236
|
+
aiwiki agent sync --path <workspace> --yes
|
|
317
237
|
aiwiki agent check --json
|
|
238
|
+
aiwiki agent check --path <workspace> --json
|
|
318
239
|
```
|
|
319
240
|
|
|
320
241
|
Interpret sync results:
|
|
321
242
|
|
|
322
|
-
- `installed`: target did not exist and now has the packaged skill.
|
|
323
|
-
- `current`:
|
|
324
|
-
- `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.
|
|
325
246
|
- `would_install` / `would_update`: dry-run preview only.
|
|
326
247
|
- `unsupported`: no safe automatic target is known; use `aiwiki prompt agent`.
|
|
327
248
|
|
|
328
|
-
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 插件配置。
|