sillyspec 3.26.10 → 3.26.13

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 (101) hide show
  1. package/.claude/skills/sillyspec-archive/SKILL.md +85 -85
  2. package/.claude/skills/sillyspec-brainstorm/SKILL.md +114 -114
  3. package/.claude/skills/sillyspec-commit/SKILL.md +109 -109
  4. package/.claude/skills/sillyspec-continue/SKILL.md +45 -45
  5. package/.claude/skills/sillyspec-doctor/SKILL.md +76 -76
  6. package/.claude/skills/sillyspec-execute/SKILL.md +200 -200
  7. package/.claude/skills/sillyspec-explore/SKILL.md +95 -95
  8. package/.claude/skills/sillyspec-knowledge/SKILL.md +269 -269
  9. package/.claude/skills/sillyspec-plan/SKILL.md +148 -148
  10. package/.claude/skills/sillyspec-quick/SKILL.md +115 -111
  11. package/.claude/skills/sillyspec-resume/SKILL.md +68 -68
  12. package/.claude/skills/sillyspec-scan/SKILL.md +79 -79
  13. package/.claude/skills/sillyspec-state/SKILL.md +64 -64
  14. package/.claude/skills/sillyspec-status/SKILL.md +54 -54
  15. package/.claude/skills/sillyspec-verify/SKILL.md +83 -83
  16. package/.claude/skills/sillyspec-workspace/SKILL.md +169 -169
  17. package/.gitattributes +2 -0
  18. package/.husky/pre-push +20 -20
  19. package/README.md +203 -201
  20. package/SKILL.md +91 -90
  21. package/package.json +39 -39
  22. package/packages/dashboard/dist/assets/index-Bq_Z2hne.js +7446 -7446
  23. package/packages/dashboard/dist/assets/index-O2W5RV4z.css +1 -1
  24. package/packages/dashboard/dist/index.html +16 -16
  25. package/packages/dashboard/package.json +25 -25
  26. package/packages/dashboard/server/executor.js +95 -86
  27. package/packages/dashboard/server/index.js +663 -601
  28. package/packages/dashboard/server/parser.js +526 -526
  29. package/src/change-risk-profile.js +254 -254
  30. package/src/classify-change.js +109 -109
  31. package/src/config-schema.js +313 -310
  32. package/src/contract-matrix.js +388 -379
  33. package/src/db.js +370 -350
  34. package/src/dispatch/backends/local-agent.js +155 -155
  35. package/src/dispatch/backends/sillyhub-mcp.js +245 -245
  36. package/src/dispatch/probe.js +246 -210
  37. package/src/dispatch/strategy.js +121 -121
  38. package/src/docs-check.js +188 -16
  39. package/src/docs-debt.js +6 -2
  40. package/src/docs-gate.js +1 -0
  41. package/src/doctor-diagnostics.js +898 -711
  42. package/src/endpoint-extractor.js +401 -401
  43. package/src/fs-atomic.js +71 -69
  44. package/src/git-helper.js +82 -79
  45. package/src/hooks/claude-pre-tool-use.cjs +125 -125
  46. package/src/hooks/worktree-guard.js +854 -848
  47. package/src/index.js +251 -20
  48. package/src/init.js +624 -623
  49. package/src/knowledge-match.js +130 -130
  50. package/src/local-detect.js +128 -120
  51. package/src/machine-interface.js +543 -543
  52. package/src/migrate.js +127 -127
  53. package/src/modules.js +7 -5
  54. package/src/progress/change-registry.js +297 -260
  55. package/src/progress/consistency-doctor.js +355 -355
  56. package/src/progress/shared.js +36 -36
  57. package/src/progress/stage-machine.js +589 -550
  58. package/src/progress/step-store.js +261 -261
  59. package/src/progress.js +1285 -1127
  60. package/src/quicklog.js +724 -693
  61. package/src/review-tier.js +77 -77
  62. package/src/run/command.js +1408 -1364
  63. package/src/run/complete-handlers.js +1450 -1399
  64. package/src/run/complete.js +1181 -920
  65. package/src/run/gates.js +878 -755
  66. package/src/run/prompt.js +765 -761
  67. package/src/run/quick-audit.js +155 -146
  68. package/src/run/shared.js +1348 -1215
  69. package/src/run/stage.js +527 -479
  70. package/src/scan-postcheck.js +371 -371
  71. package/src/setup.js +414 -416
  72. package/src/sillyhub-mcp/client.js +597 -529
  73. package/src/spec-dir-typo.js +3 -24
  74. package/src/spec-sync.js +358 -319
  75. package/src/stage-contract.js +871 -897
  76. package/src/stage-review.js +549 -549
  77. package/src/stages/archive.js +156 -155
  78. package/src/stages/brainstorm-auto.js +236 -236
  79. package/src/stages/brainstorm.js +597 -597
  80. package/src/stages/cmd-existence.js +145 -145
  81. package/src/stages/doctor.js +386 -371
  82. package/src/stages/execute.js +1014 -1003
  83. package/src/stages/explore.js +34 -34
  84. package/src/stages/index.js +29 -29
  85. package/src/stages/knowledge.js +498 -498
  86. package/src/stages/plan-postcheck.js +1323 -1302
  87. package/src/stages/plan.js +642 -623
  88. package/src/stages/quick.js +153 -151
  89. package/src/stages/scan.js +607 -607
  90. package/src/stages/status.js +64 -64
  91. package/src/stages/verify.js +264 -264
  92. package/src/sync.js +1325 -1135
  93. package/src/task-review.js +1204 -1019
  94. package/src/taskcard.js +178 -0
  95. package/src/verify-postcheck.js +1199 -1186
  96. package/src/workflow.js +600 -600
  97. package/src/worktree-apply.js +1237 -1136
  98. package/src/worktree-deps.js +453 -353
  99. package/src/worktree.js +1527 -1481
  100. package/templates/workflows/archive-impact.yaml +79 -79
  101. package/templates/workflows/scan-docs.yaml +132 -132
@@ -1,270 +1,270 @@
1
- ---
2
- name: sillyspec:knowledge
3
- description: Agent-safe knowledge base commands for SillySpec repositories. Search, inspect, validate, refresh, and propose knowledge entries.
4
- argument-hint: "search --query \"<text>\" --limit N | inspect --id \"<id>\" | validate | refresh | propose --title \"<title>\" --category <name>"
5
- version: "3.19.2"
6
- ---
7
-
8
- ## 交互规范
9
- 当需要用户从多个选项中做出选择时,必须使用 Claude Code 内置的 AskUserQuestion 工具,将选项以参数传入。
10
-
11
- ## 何时使用此技能
12
- Use this skill when working on a SillySpec repository and the task may depend on prior project knowledge, known issues, implementation patterns, scan-derived learnings, execute-stage knowledge hits, or `.sillyspec/knowledge`.
13
-
14
- Before implementing changes, **first search the knowledge base** to avoid repeating known work or running into known issues.
15
-
16
- ## 命令列表
17
-
18
- ### 1. knowledge search — 搜索知识库
19
- 在执行任务前搜索相关知识。
20
-
21
- ```bash
22
- sillyspec knowledge search --query "<task summary>" --limit 5
23
- ```
24
-
25
- **示例:**
26
- ```bash
27
- sillyspec knowledge search --query "worktree baseline apply conflict" --limit 5
28
- sillyspec knowledge search --query "postcheck validation error"
29
- sillyspec knowledge search --query "GLM usage metadata"
30
- ```
31
-
32
- **输出(JSON):**
33
- ```json
34
- {
35
- "ok": true,
36
- "query": "worktree baseline",
37
- "matches": [
38
- {
39
- "id": "patterns",
40
- "path": "knowledge/patterns.md",
41
- "title": "Patterns",
42
- "summary": "每个阶段对应 `src/stages/` 下的独立模块...",
43
- "score": 3,
44
- "tags": ["worktree", "git-worktree", "WorktreeManager"],
45
- "category": "Patterns"
46
- }
47
- ]
48
- }
49
- ```
50
-
51
- **使用场景:**
52
- - 实现新功能前,检查是否有现有模式可复用
53
- - 遇到报错前,搜索是否是已知问题
54
- - 修改特定模块前,了解约定和坑点
55
-
56
- ---
57
-
58
- ### 2. knowledge inspect — 读取知识条目详情
59
- 搜索命中后,读取完整条目内容。
60
-
61
- ```bash
62
- sillyspec knowledge inspect --id "<knowledge-id>"
63
- ```
64
-
65
- **示例:**
66
- ```bash
67
- sillyspec knowledge inspect --id "patterns"
68
- sillyspec knowledge inspect --id "known-issues/sqljs-wasm-only"
69
- sillyspec knowledge inspect --id "generated/worktree-baseline-conflict"
70
- ```
71
-
72
- **输出(JSON):**
73
- ```json
74
- {
75
- "ok": true,
76
- "entry": {
77
- "id": "patterns",
78
- "title": "Patterns",
79
- "summary": "每个阶段对应 `src/stages/` 下的独立模块...",
80
- "zone": "manual",
81
- "path": "knowledge/patterns.md",
82
- "meta": {
83
- "author": "<git-user>",
84
- "created_at": "2026-06-19T12:40:00+08:00",
85
- "updated_at": "2026-06-24T10:00:00+08:00"
86
- },
87
- "body": "完整 markdown 内容..."
88
- }
89
- }
90
- ```
91
-
92
- **zone 说明:**
93
- - `manual` — 人工维护的知识(可直接信任)
94
- - `generated` — 自动提取的知识(scan 生成,需人工审核)
95
- - `proposed` — 提议待审核的知识(未合并)
96
-
97
- ---
98
-
99
- ### 3. knowledge validate — 校验知识库健康度
100
- 在 commit/archive 前检查知识库是否可用。
101
-
102
- ```bash
103
- sillyspec knowledge validate
104
- ```
105
-
106
- **输出(JSON):**
107
- ```json
108
- {
109
- "ok": false,
110
- "errors": [
111
- {
112
- "code": "broken_reference",
113
- "path": "knowledge/generated/foo.md",
114
- "referenced_in": "INDEX.md",
115
- "display": "Foo Pattern"
116
- },
117
- {
118
- "code": "empty_file",
119
- "path": "knowledge/bar.md"
120
- }
121
- ],
122
- "warnings": [
123
- {
124
- "code": "too_many_uncategorized",
125
- "count": 12,
126
- "path": "knowledge/uncategorized.md"
127
- },
128
- {
129
- "code": "unregistered_file",
130
- "path": "knowledge/new-file.md"
131
- }
132
- ]
133
- }
134
- ```
135
-
136
- **错误码说明:**
137
- | code | 说明 |
138
- |---|---|
139
- | `knowledge_dir_missing` | `.sillyspec/knowledge/` 目录不存在 |
140
- | `missing_index` | `INDEX.md` 不存在 |
141
- | `broken_reference` | INDEX.md 引用的文件不存在 |
142
- | `empty_file` | 知识文件为空 |
143
- | `too_many_uncategorized` | uncategorized.md 条目 ≥10,需清理 |
144
- | `unregistered_file` | 手动知识文件未在 INDEX.md 注册 |
145
-
146
- ---
147
-
148
- ### 4. knowledge refresh — 从 scan 文档刷新自动知识
149
- **仅写 generated/ 区,不覆盖 manual/。**
150
-
151
- ```bash
152
- sillyspec knowledge refresh
153
- ```
154
-
155
- **使用场景:**
156
- - scan 阶段完成后,自动提取可复用知识
157
- - archive 阶段完成后,沉淀长期有效的模式
158
-
159
- **行为:**
160
- 1. 扫描 `.sillyspec/docs/<project>/scan/*.md`
161
- 2. 提取每个 `## 章节`(至少 3 行)作为知识条目
162
- 3. 写入 `.sillyspec/knowledge/generated/<slug>.md`
163
- 4. 生成 `generated/INDEX.md`
164
-
165
- **输出(JSON):**
166
- ```json
167
- {
168
- "ok": true,
169
- "generated_count": 8,
170
- "new_count": 5,
171
- "overwritten_count": 3,
172
- "files": [
173
- { "file": "generated/worktree-isolation.md", "title": "...", "new": true },
174
- { "file": "generated/progress-management.md", "title": "...", "new": false }
175
- ]
176
- }
177
- ```
178
-
179
- **注意事项:**
180
- - generated/ 区知识是自动生成,不保证准确,需人工审核后合并到 manual/
181
- - 已有文件会被覆盖( overwrite_count)
182
-
183
- ---
184
-
185
- ### 5. knowledge propose — 提议新知识
186
- 不直接编辑 manual/,而是写入 proposed/ 供审核。
187
-
188
- ```bash
189
- sillyspec knowledge propose --title "<title>" --category <category> --body "<content>" --from "<source>"
190
- ```
191
-
192
- **参数说明:**
193
- | 参数 | 必填 | 说明 |
194
- |---|---|---|
195
- | `--title` | ✅ | 知识标题 |
196
- | `--category` | ❌ | 分类(默认 uncategorized),如 known-issues, patterns, conventions |
197
- | `--body` | ❌ | 知识正文 |
198
- | `--from` | ❌ | 来源标注(如 execute/quick/scan) |
199
-
200
- **示例:**
201
- ```bash
202
- sillyspec knowledge propose --title "GLM API 超时处理" --category known-issues --body "GLM 模型默认超时 30 秒..." --from "execute"
203
- ```
204
-
205
- **输出(JSON):**
206
- ```json
207
- {
208
- "ok": true,
209
- "id": "proposed/glm-api-timeout",
210
- "path": "knowledge/proposed/glm-api-timeout.md",
211
- "title": "GLM API 超时处理",
212
- "category": "known-issues",
213
- "new": true,
214
- "action": "created"
215
- }
216
- ```
217
-
218
- **后续流程:**
219
- - archive/commit 阶段审核 proposed/ 条目
220
- - 合格的合并到 manual/,不合格的删除
221
-
222
- ---
223
-
224
- ## Agent 使用指南
225
-
226
- ### 任务前必查
227
- 在开始实现新功能、修改现有代码、或遇到报错前:
228
- 1. `knowledge search --query "<任务关键词>"`
229
- 2. 命中则 `knowledge inspect --id "<id>"`
230
- 3. 遵循知识中的约定和避坑建议
231
-
232
- ### 发现新知识
233
- 执行任务中发现可复用模式或新坑:
234
- 1. `knowledge propose --title "<标题>" --category <分类> --body "<内容>"`
235
- 2. 不要直接编辑 `.sillyspec/knowledge/manual/*.md`
236
-
237
- ### 提交前校验
238
- commit/archive 前检查知识库状态:
239
- 1. `knowledge validate`
240
- 2. 如有 errors,先修复再提交
241
-
242
- ### 扫描后刷新
243
- scan 阶段完成后:
244
- 1. `knowledge refresh`
245
- 2. 审核生成的 `generated/*.md`,有用的合并到 manual/
246
-
247
- ---
248
-
249
- ## 禁止事项
250
-
251
- ❌ **不要直接编辑** `manual/` 或 `generated/` 中的知识文件
252
- - 使用 `knowledge propose` 提议新知识
253
- - 使用 `knowledge refresh` 刷新自动知识
254
-
255
- ❌ **不要使用 `grep` 或 `cat` 直接读取知识文件**
256
- - 使用 `knowledge search` 和 `knowledge inspect`
257
- - 它们使用与 execute 阶段相同的匹配引擎
258
-
259
- ❌ **不要让 agent 去审核 proposed/ 条目**
260
- - 提议供人工审核,不要自动合并
261
- - 只有用户明确要求才合并
262
-
263
- ---
264
-
265
- ## 设计原则
266
-
267
- - **Agent-safe:** 所有输出为 JSON,失败有明确错误码
268
- - **写保护:** refresh 仅写 generated/,propose 仅写 proposed/,不碰 manual/
269
- - **匹配引擎:** 使用 `knowledge-match.js`(与 execute 阶段一致)
1
+ ---
2
+ name: sillyspec:knowledge
3
+ description: Agent-safe knowledge base commands for SillySpec repositories. Search, inspect, validate, refresh, and propose knowledge entries.
4
+ argument-hint: "search --query \"<text>\" --limit N | inspect --id \"<id>\" | validate | refresh | propose --title \"<title>\" --category <name>"
5
+ version: "3.19.2"
6
+ ---
7
+
8
+ ## 交互规范
9
+ 当需要用户从多个选项中做出选择时,必须使用 Claude Code 内置的 AskUserQuestion 工具,将选项以参数传入。
10
+
11
+ ## 何时使用此技能
12
+ Use this skill when working on a SillySpec repository and the task may depend on prior project knowledge, known issues, implementation patterns, scan-derived learnings, execute-stage knowledge hits, or `.sillyspec/knowledge`.
13
+
14
+ Before implementing changes, **first search the knowledge base** to avoid repeating known work or running into known issues.
15
+
16
+ ## 命令列表
17
+
18
+ ### 1. knowledge search — 搜索知识库
19
+ 在执行任务前搜索相关知识。
20
+
21
+ ```bash
22
+ sillyspec knowledge search --query "<task summary>" --limit 5
23
+ ```
24
+
25
+ **示例:**
26
+ ```bash
27
+ sillyspec knowledge search --query "worktree baseline apply conflict" --limit 5
28
+ sillyspec knowledge search --query "postcheck validation error"
29
+ sillyspec knowledge search --query "GLM usage metadata"
30
+ ```
31
+
32
+ **输出(JSON):**
33
+ ```json
34
+ {
35
+ "ok": true,
36
+ "query": "worktree baseline",
37
+ "matches": [
38
+ {
39
+ "id": "patterns",
40
+ "path": "knowledge/patterns.md",
41
+ "title": "Patterns",
42
+ "summary": "每个阶段一个独立模块定义(含步骤与提示词)...",
43
+ "score": 3,
44
+ "tags": ["worktree", "git-worktree", "WorktreeManager"],
45
+ "category": "Patterns"
46
+ }
47
+ ]
48
+ }
49
+ ```
50
+
51
+ **使用场景:**
52
+ - 实现新功能前,检查是否有现有模式可复用
53
+ - 遇到报错前,搜索是否是已知问题
54
+ - 修改特定模块前,了解约定和坑点
55
+
56
+ ---
57
+
58
+ ### 2. knowledge inspect — 读取知识条目详情
59
+ 搜索命中后,读取完整条目内容。
60
+
61
+ ```bash
62
+ sillyspec knowledge inspect --id "<knowledge-id>"
63
+ ```
64
+
65
+ **示例:**
66
+ ```bash
67
+ sillyspec knowledge inspect --id "patterns"
68
+ sillyspec knowledge inspect --id "known-issues/sqljs-wasm-only"
69
+ sillyspec knowledge inspect --id "generated/worktree-baseline-conflict"
70
+ ```
71
+
72
+ **输出(JSON):**
73
+ ```json
74
+ {
75
+ "ok": true,
76
+ "entry": {
77
+ "id": "patterns",
78
+ "title": "Patterns",
79
+ "summary": "每个阶段对应 `src/stages/` 下的独立模块...",
80
+ "zone": "manual",
81
+ "path": "knowledge/patterns.md",
82
+ "meta": {
83
+ "author": "<git-user>",
84
+ "created_at": "2026-06-19T12:40:00+08:00",
85
+ "updated_at": "2026-06-24T10:00:00+08:00"
86
+ },
87
+ "body": "完整 markdown 内容..."
88
+ }
89
+ }
90
+ ```
91
+
92
+ **zone 说明:**
93
+ - `manual` — 人工维护的知识(可直接信任)
94
+ - `generated` — 自动提取的知识(scan 生成,需人工审核)
95
+ - `proposed` — 提议待审核的知识(未合并)
96
+
97
+ ---
98
+
99
+ ### 3. knowledge validate — 校验知识库健康度
100
+ 在 commit/archive 前检查知识库是否可用。
101
+
102
+ ```bash
103
+ sillyspec knowledge validate
104
+ ```
105
+
106
+ **输出(JSON):**
107
+ ```json
108
+ {
109
+ "ok": false,
110
+ "errors": [
111
+ {
112
+ "code": "broken_reference",
113
+ "path": "knowledge/generated/foo.md",
114
+ "referenced_in": "INDEX.md",
115
+ "display": "Foo Pattern"
116
+ },
117
+ {
118
+ "code": "empty_file",
119
+ "path": "knowledge/bar.md"
120
+ }
121
+ ],
122
+ "warnings": [
123
+ {
124
+ "code": "too_many_uncategorized",
125
+ "count": 12,
126
+ "path": "knowledge/uncategorized.md"
127
+ },
128
+ {
129
+ "code": "unregistered_file",
130
+ "path": "knowledge/new-file.md"
131
+ }
132
+ ]
133
+ }
134
+ ```
135
+
136
+ **错误码说明:**
137
+ | code | 说明 |
138
+ |---|---|
139
+ | `knowledge_dir_missing` | `.sillyspec/knowledge/` 目录不存在 |
140
+ | `missing_index` | `INDEX.md` 不存在 |
141
+ | `broken_reference` | INDEX.md 引用的文件不存在 |
142
+ | `empty_file` | 知识文件为空 |
143
+ | `too_many_uncategorized` | uncategorized.md 条目 ≥10,需清理 |
144
+ | `unregistered_file` | 手动知识文件未在 INDEX.md 注册 |
145
+
146
+ ---
147
+
148
+ ### 4. knowledge refresh — 从 scan 文档刷新自动知识
149
+ **仅写 generated/ 区,不覆盖 manual/。**
150
+
151
+ ```bash
152
+ sillyspec knowledge refresh
153
+ ```
154
+
155
+ **使用场景:**
156
+ - scan 阶段完成后,自动提取可复用知识
157
+ - archive 阶段完成后,沉淀长期有效的模式
158
+
159
+ **行为:**
160
+ 1. 扫描 `.sillyspec/docs/<project>/scan/*.md`
161
+ 2. 提取每个 `## 章节`(至少 3 行)作为知识条目
162
+ 3. 写入 `.sillyspec/knowledge/generated/<slug>.md`
163
+ 4. 生成 `generated/INDEX.md`
164
+
165
+ **输出(JSON):**
166
+ ```json
167
+ {
168
+ "ok": true,
169
+ "generated_count": 8,
170
+ "new_count": 5,
171
+ "overwritten_count": 3,
172
+ "files": [
173
+ { "file": "generated/worktree-isolation.md", "title": "...", "new": true },
174
+ { "file": "generated/progress-management.md", "title": "...", "new": false }
175
+ ]
176
+ }
177
+ ```
178
+
179
+ **注意事项:**
180
+ - generated/ 区知识是自动生成,不保证准确,需人工审核后合并到 manual/
181
+ - 已有文件会被覆盖( overwrite_count)
182
+
183
+ ---
184
+
185
+ ### 5. knowledge propose — 提议新知识
186
+ 不直接编辑 manual/,而是写入 proposed/ 供审核。
187
+
188
+ ```bash
189
+ sillyspec knowledge propose --title "<title>" --category <category> --body "<content>" --from "<source>"
190
+ ```
191
+
192
+ **参数说明:**
193
+ | 参数 | 必填 | 说明 |
194
+ |---|---|---|
195
+ | `--title` | ✅ | 知识标题 |
196
+ | `--category` | ❌ | 分类(默认 uncategorized),如 known-issues, patterns, conventions |
197
+ | `--body` | ❌ | 知识正文 |
198
+ | `--from` | ❌ | 来源标注(如 execute/quick/scan) |
199
+
200
+ **示例:**
201
+ ```bash
202
+ sillyspec knowledge propose --title "GLM API 超时处理" --category known-issues --body "GLM 模型默认超时 30 秒..." --from "execute"
203
+ ```
204
+
205
+ **输出(JSON):**
206
+ ```json
207
+ {
208
+ "ok": true,
209
+ "id": "proposed/glm-api-timeout",
210
+ "path": "knowledge/proposed/glm-api-timeout.md",
211
+ "title": "GLM API 超时处理",
212
+ "category": "known-issues",
213
+ "new": true,
214
+ "action": "created"
215
+ }
216
+ ```
217
+
218
+ **后续流程:**
219
+ - archive/commit 阶段审核 proposed/ 条目
220
+ - 合格的合并到 manual/,不合格的删除
221
+
222
+ ---
223
+
224
+ ## Agent 使用指南
225
+
226
+ ### 任务前必查
227
+ 在开始实现新功能、修改现有代码、或遇到报错前:
228
+ 1. `knowledge search --query "<任务关键词>"`
229
+ 2. 命中则 `knowledge inspect --id "<id>"`
230
+ 3. 遵循知识中的约定和避坑建议
231
+
232
+ ### 发现新知识
233
+ 执行任务中发现可复用模式或新坑:
234
+ 1. `knowledge propose --title "<标题>" --category <分类> --body "<内容>"`
235
+ 2. 不要直接编辑 `.sillyspec/knowledge/manual/*.md`
236
+
237
+ ### 提交前校验
238
+ commit/archive 前检查知识库状态:
239
+ 1. `knowledge validate`
240
+ 2. 如有 errors,先修复再提交
241
+
242
+ ### 扫描后刷新
243
+ scan 阶段完成后:
244
+ 1. `knowledge refresh`
245
+ 2. 审核生成的 `generated/*.md`,有用的合并到 manual/
246
+
247
+ ---
248
+
249
+ ## 禁止事项
250
+
251
+ ❌ **不要直接编辑** `manual/` 或 `generated/` 中的知识文件
252
+ - 使用 `knowledge propose` 提议新知识
253
+ - 使用 `knowledge refresh` 刷新自动知识
254
+
255
+ ❌ **不要使用 `grep` 或 `cat` 直接读取知识文件**
256
+ - 使用 `knowledge search` 和 `knowledge inspect`
257
+ - 它们使用与 execute 阶段相同的匹配引擎
258
+
259
+ ❌ **不要让 agent 去审核 proposed/ 条目**
260
+ - 提议供人工审核,不要自动合并
261
+ - 只有用户明确要求才合并
262
+
263
+ ---
264
+
265
+ ## 设计原则
266
+
267
+ - **Agent-safe:** 所有输出为 JSON,失败有明确错误码
268
+ - **写保护:** refresh 仅写 generated/,propose 仅写 proposed/,不碰 manual/
269
+ - **匹配引擎:** 使用 `knowledge-match.js`(与 execute 阶段一致)
270
270
  - **审计友好:** 每个条目记录来源、创建/更新时间