@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.
@@ -1,59 +1,82 @@
1
- # AIWiki Agent 对接说明
1
+ # AIWiki Agent Handoff
2
2
 
3
- 这份文档写给任何可以读取网页、生成结构化内容并调用本机命令的宿主 Agent。
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
- 入库 https://example.com/article
10
+ Ingest this into AIWiki:
11
+ https://example.com/article
11
12
  ```
12
13
 
13
- Agent 应自动读取网页,生成 payload,通过 AIWiki CLI 写入本地知识库,并把结果摘要回复给用户。
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
- Agent 负责:读取网页、理解正文、尽量生成 analysis/wiki_entry、调用 CLI、回复用户
19
- AIWiki CLI 负责:校验 payload、写本地文件、生成 Wiki Entry、输出入库结果
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 不做通用网页抓取,也不调用 LLM。网页读取失败时,Agent 仍然要调用 CLI 记录失败原因;高质量 Wiki 内容由宿主 Agent 提供。
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
- 证据和疑似风险要分开:`source_quote` 等能回到原文的字段是宿主提供的 evidence/provenance;`coverage_suspected_incomplete`、`unsupported_claims`、`needs_review` 是 AIWiki 的复核提示,不代表已经证明遗漏或错误。
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
- 1. 读取用户给的 URL、正文、附件或消息。
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 ingest-agent --stdin
38
+ aiwiki agent sync --path <workspace> --yes
39
+ aiwiki agent check --path <workspace> --json
39
40
  ```
40
41
 
41
- 8. 如果当前 shell、终端或宿主环境无法保证 stdin 是 UTF-8,先把 payload 写成 UTF-8 JSON 文件,再调用:
42
+ Use this command-first loop:
42
43
 
43
44
  ```bash
44
- aiwiki ingest-agent --payload <utf8-json-file>
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
- 9. 读取 CLI 输出,向用户回复入库状态、摘要、Wiki 条目、质量模式、资料卡和处理记录。
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
- payload 必须是 UTF-8 JSON。Windows PowerShell、批处理、第三方 Agent shell bridge 可能会把中文 JSON 管道按非 UTF-8 编码传递;遇到中文乱码、`payload must be valid JSON` 或无法确认管道编码时,使用 `--payload <utf8-json-file>`。
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
- AIWiki 会修复常见 UTF-8 mojibake,但这只是兜底;宿主 Agent 仍应尽量传入干净 UTF-8。
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
- ## 成功 payload
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": "这里是宿主 Agent 读取到的正文内容。",
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
- "核心观点 1",
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
- `analysis` 仍然向后兼容;旧 payload 不需要修改。宿主 Agent 能提供时,可以额外写入这些可选字段:
111
+ When useful, provide:
105
112
 
106
- - `entities`:文章中可复查的人、产品、组织、地点等实体。
107
- - `concepts`:可沉淀为知识条目的概念、方法或框架。
108
- - `tensions`:原文中的冲突、取舍、不确定性或反常识点。
109
- - `reusable_judgments`:可复用判断,建议同时提供 `rationale` 和 `source_quote`。
110
- - `suggested_links`:建议关联到已有 Wiki 条目的线索和原因。
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
- 不能确认的内容不要编造。AIWiki 会为成功入库的正文写入 `content_fingerprint`;重复入库同一来源同一正文时会保留新 run、输出 warning,并避免覆盖已有长期文件。
123
+ Do not invent unsupported facts. Treat AIWiki grounding warnings as review signals, not as confirmed proof that something is wrong.
113
124
 
114
- ## 失败 payload
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": "网页需要登录或宿主 Agent 无法访问正文。",
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
- "processing_summary"
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
- ## Obsidian + Dataview 边界
149
+ After the CLI runs, read the command output and report:
150
150
 
151
- AIWiki 生成的知识库不依赖 Dataview。用户不安装 Dataview 时,也可以用 Obsidian 原生 Properties、Backlinks、Search、Graph View 和普通 wikilink 审阅。
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
- Dataview 只是可选增强。用户自行在 Obsidian Community plugins 中安装并启用 Dataview 后,`dashboards/AIWiki Home.md`、`dashboards/Review Queue.md`、`dashboards/Recent Runs.md` 和 `dashboards/Topic Pipeline.md` 会渲染成表格。
154
-
155
- ## Agent 回复模板
156
-
157
- 成功时:
160
+ Recommended success reply:
158
161
 
159
162
  ```text
160
- AIWiki 已完成入库,并生成 Wiki 条目。
161
- 契合度:<fit_score> / <fit_level>
162
- 摘要:<summary>
163
- Wiki 条目:<wiki_entry>
164
- 质量模式:<wiki_entry_quality> / <wiki_entry_generation_mode>
165
- Grounding:<grounding_evidence_channel> / review=<grounding_needs_review> / markers=<grounding_markers>
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
- ```text
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 / Lint
175
+ ## Query Protocol
181
176
 
182
- 当用户说“从 AIWiki 里了解某个主题”时,调用:
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
- `context` 是给宿主 Agent 使用的 JSON。如果用户是在终端里直接想看结果,可以运行:
183
+ Use filters when intent is narrow:
189
184
 
190
185
  ```bash
191
- aiwiki query "<主题>"
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
- 当用户说“整理 / 检查知识库”时,先调用 JSON 检查:
191
+ Read these fields before responding:
195
192
 
196
- ```bash
197
- aiwiki lint --json
198
- ```
193
+ - `query_scope`
194
+ - `result_quality`
195
+ - `recommended_next_action`
196
+ - `match_reasons`
197
+ - `quality_signals`
198
+ - `related_refs`
199
199
 
200
- 如果 `safe_fixes.only_safe_fixes` `true`,且用户允许整理,可以应用内置安全修复并再次检查:
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
- ```bash
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 --severity error
211
- aiwiki lint --severity warning
212
- aiwiki lint --severity info
207
+ aiwiki lint --json
213
208
  ```
214
209
 
215
- 只做临时检查、不改 dashboard 时用:
210
+ If `safe_fixes.only_safe_fixes` is true and the user allows cleanup:
216
211
 
217
212
  ```bash
218
- aiwiki lint --no-write
213
+ aiwiki lint --fix-empty-dirs --json
214
+ aiwiki lint --json
219
215
  ```
220
216
 
221
- Lint 输出会包含摘要、`safe_fixes`、最高优先级问题、分级报告,以及建议动作。把 `error` 当作必须先修的结构问题,把 `warning` 当作需要处理或复核的维护问题,把 `info` 当作富集、归档或后续整理 backlog。当前唯一可自动应用的 safe fix `remove_empty_optional_dir`,只会删除已知且为空的可选增强目录;不要删除核心目录、未知目录、非空目录或文件。
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 check
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`: installed skill already matches the packaged skill.
298
- - `updated`: installed skill differed; the old file was backed up and replaced.
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 that the user may need to restart or reload the Agent. Do not claim the new skill is active until the Agent has reloaded it.
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 插件配置。