flow-comet 1.6.4 → 1.6.5

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 (64) hide show
  1. package/.flow-comet/skills/flow-comet/INSTALLED_VERSION +1 -1
  2. package/.flow-comet/skills/flow-comet/SKILL.md +21 -3
  3. package/.flow-comet/skills/flow-comet/reference/artifact-template-overlay.md +154 -0
  4. package/.flow-comet/skills/flow-comet/reference/artifact-templates.json +387 -0
  5. package/.flow-comet/skills/flow-comet/reference/entry-detail.md +8 -2
  6. package/.flow-comet/skills/flow-comet/reference/workflow-protocol.json +22 -0
  7. package/.flow-comet/skills/flow-comet/scripts/evolve.mjs +174 -0
  8. package/.flow-comet/skills/flow-comet/scripts/guard-self-test.mjs +3 -1
  9. package/.flow-comet/skills/flow-comet/scripts/health.mjs +28 -4
  10. package/.flow-comet/skills/flow-comet/scripts/items/a.mjs +41 -18
  11. package/.flow-comet/skills/flow-comet/scripts/items/b.mjs +16 -16
  12. package/.flow-comet/skills/flow-comet/scripts/items/c.mjs +6 -6
  13. package/.flow-comet/skills/flow-comet/scripts/items/h.mjs +9 -7
  14. package/.flow-comet/skills/flow-comet/scripts/items/l.mjs +2 -2
  15. package/.flow-comet/skills/flow-comet/scripts/items/m.mjs +17 -13
  16. package/.flow-comet/skills/flow-comet/scripts/items/n.mjs +154 -0
  17. package/.flow-comet/skills/flow-comet/scripts/lib/guard-artifact-skeleton.mjs +406 -0
  18. package/.flow-comet/skills/flow-comet/scripts/lib/guard-evidence-gates.mjs +206 -3
  19. package/.flow-comet/skills/flow-comet/scripts/lib/guard-gates.mjs +458 -60
  20. package/.flow-comet/skills/flow-comet/scripts/lib/guard-routing.mjs +38 -58
  21. package/.flow-comet/skills/flow-comet/scripts/lib/guard-template-fidelity.mjs +642 -230
  22. package/.flow-comet/skills/flow-comet/scripts/lib/guard-uidesign.mjs +85 -14
  23. package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-admin.mjs +43 -5
  24. package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-flow.mjs +15 -1
  25. package/.flow-comet/skills/flow-comet/scripts/lib/state-explain.mjs +18 -1
  26. package/.flow-comet/skills/flow-comet/scripts/lib/state-skillmarkers.mjs +60 -0
  27. package/.flow-comet/skills/flow-comet/scripts/lib/system-fixtures.mjs +73 -9
  28. package/.flow-comet/skills/flow-comet/scripts/lib/test-fixtures.mjs +21 -1
  29. package/.flow-comet/skills/flow-comet/scripts/lib/text-anchor-checks.mjs +9 -0
  30. package/.flow-comet/skills/flow-comet/scripts/protocol-utils.mjs +212 -0
  31. package/.flow-comet/skills/flow-comet/scripts/scenarios/a.mjs +15 -5
  32. package/.flow-comet/skills/flow-comet/scripts/scenarios/c.mjs +4 -4
  33. package/.flow-comet/skills/flow-comet/scripts/scenarios/e.mjs +20 -10
  34. package/.flow-comet/skills/flow-comet/scripts/scenarios/g.mjs +4 -1
  35. package/.flow-comet/skills/flow-comet/scripts/scenarios/j.mjs +6 -6
  36. package/.flow-comet/skills/flow-comet/scripts/scenarios/l.mjs +13 -5
  37. package/.flow-comet/skills/flow-comet/scripts/scenarios/n.mjs +2125 -0
  38. package/.flow-comet/skills/flow-comet/scripts/system-test.mjs +6 -5
  39. package/.flow-comet/skills/flow-comet/scripts/workflow-guard.mjs +74 -2
  40. package/.flow-comet/skills/flow-comet-archive/SKILL.md +6 -2
  41. package/.flow-comet/skills/flow-comet-change/SKILL.md +6 -2
  42. package/.flow-comet/skills/flow-comet-design/GUIDANCE.md +13 -3
  43. package/.flow-comet/skills/flow-comet-design/SKILL.md +15 -8
  44. package/.flow-comet/skills/flow-comet-dev/SKILL.md +1 -1
  45. package/.flow-comet/skills/flow-comet-evolve/SKILL.md +1 -0
  46. package/.flow-comet/skills/flow-comet-execute/SKILL.md +13 -10
  47. package/.flow-comet/skills/flow-comet-health/SKILL.md +1 -1
  48. package/.flow-comet/skills/flow-comet-integration/SKILL.md +1 -1
  49. package/.flow-comet/skills/flow-comet-open/GUIDANCE.md +14 -4
  50. package/.flow-comet/skills/flow-comet-open/SKILL.md +11 -9
  51. package/.flow-comet/skills/flow-comet-plan/GUIDANCE.md +13 -3
  52. package/.flow-comet/skills/flow-comet-plan/SKILL.md +11 -7
  53. package/.flow-comet/skills/flow-comet-requirement/SKILL.md +1 -1
  54. package/.flow-comet/skills/flow-comet-review/SKILL.md +15 -9
  55. package/.flow-comet/skills/flow-comet-subagent-execute/GUIDANCE.md +13 -3
  56. package/.flow-comet/skills/flow-comet-subagent-execute/SKILL.md +11 -8
  57. package/.flow-comet/skills/flow-comet-task/SKILL.md +1 -1
  58. package/.flow-comet/skills/flow-comet-test/SKILL.md +6 -2
  59. package/.flow-comet/skills/flow-comet-ui-design/SKILL.md +2 -2
  60. package/.flow-comet/skills/flow-comet-verify/SKILL.md +12 -8
  61. package/README.md +3 -3
  62. package/package.json +1 -1
  63. package/scripts/dsh-bridge.mjs +2 -2
  64. package/scripts/lib/installer-flowkit.mjs +43 -3
@@ -110,9 +110,13 @@ flow-kit 9 阶段工作流的 workflow-kernel 实现。保留 flow-kit 的全部
110
110
  2. 随后按该节点 SKILL 的 Required Skill Calls,用 Skill 工具加载协议技能(与 Implementation 同名的条目已随路由加载,无需重复加载),加载完成后**立即**逐条运行声明命令(open/review 等涉及多个协议文件的节点,每个协议文件对应一条声明命令):
111
111
 
112
112
  ```bash
113
- node .claude/skills/flow-comet/scripts/workflow-state.mjs skill-load <node> <skill> --prompt flow-kit/prompts/<阶段>.md
113
+ node .claude/skills/flow-comet/scripts/workflow-state.mjs skill-load <node> <skill> --prompt flow-kit/prompts/<阶段>.md --templates <模板基名,...>
114
114
  ```
115
115
 
116
+ > **`--templates` 是内置节点的必填声明**(每个标记各写全清单):open → `CHANGE.md,REQUIREMENT.md` · design → `DESIGN.md`(前端可加 `UI-DESIGN.md`)· plan → `TASK.md` · execute / subagent-execute → `SUMMARY.md` · review → `REVIEW.md,TEST.md` · verify / archive 为零模板节点,**省略该参数**。逐节点示例命令见各节点册的「加载声明」小节。
117
+
118
+ > **加载链的两条指针**:节点入口**先**打印 `READ PROMPT:`(指向 `flow-kit/prompts/<阶段>.md`——这一步怎么做),**再**打印 `READ TEMPLATE:`(指向 `flow-kit/templates/<DOC>.md`——产出长什么样),**有模板的节点两行都要读**;零模板节点(verify / archive)只有 `READ PROMPT:`。design 的**前端** change 还会多打印一行 `READ PROMPT(条件提示词): …2a-ui-design.md…`(按 `frontendCriterion` 判定;非前端不打印)。`--prompt` 必须是该节点的协议文件(以入口打印的 `READ PROMPT:` 行为准);落在节点协议面外的路径会在下一次入口被拦下(BLOCKED)并给出重声明命令——重跑声明即可,不要手改标记。
119
+
116
120
  > **跑声明命令 ≠ 加载**:声明只把“哪次会话加载了哪个 skill、按哪份协议工作”写进状态供 exit/record 核对;真正加载只有第 1 步的 Skill 工具能做到。协议的引用示例:execute / subagent-execute 节点加载 flow-comet-dev 时用 `--prompt flow-kit/prompts/4-dev.md`(DEV 阶段协议),交付物按 `flow-kit/templates/SUMMARY.md` 模板填写并补写 `## 自检方法` 段。
117
121
 
118
122
  节点退出(exit)与证据记录(record)会核对声明标记。声明如实记录执行者动作——加载了哪个 skill、按哪份协议工作——**不等于产出证明**;产出是否正确由产物结构校验与门禁把关。**技能加载前置门**:新 change 的 required 条目不再自动补写——handoff request / record 前必须已有本节点声明标记(先加载、再声明、后干活);声明标记自动补写仅对旧 change 兜底(按协议 requiredSkillCalls 代记,标记带 `auto: true`),手动声明仍推荐(如实记录加载动作与协议文件)。`flow-comet-ui-design` 与协议同等级(`guarded`)且**仅前端适用**:前端 change 须先加载并 `skill-load` 声明、record 载荷带 `required-skill:design.flow-comet-ui-design`(出口不再自动补写);非前端不加载不声明(出口输出可见的 `UI-DESIGN: skipped(非前端)`);旧 change 渐进,缺件仅 WARN。前端判据是**结构级**的:`CHANGE.md` 的「视觉调性」段在场,且段内的「不适用」标记成**结构形态**——**独立行**、居**行首**(可带列表符号 / 引用 / 加粗),或写在适用性类标签的**字段值位**;标记之后须成**词形边界**(紧跟空白、标点或行尾),命中即回显**命中片段**。段内其它位置顺带提到「不适用」不算标注,仍判前端。
@@ -168,9 +172,11 @@ node .claude/skills/flow-comet/scripts/workflow-state.mjs record <node-id> '{"su
168
172
 
169
173
  All artifacts in `.specs/<change-id>/`. Cross-change files in `.specs/` (CONTEXT.md, LESSONS.md, CHANGELOG.md).
170
174
 
171
- > **模板权威**:工件段形以 `flow-kit/templates/**` 为唯一权威。
175
+ > **模板权威**:工件段形 = **上游模板 + 本仓登记的增量段**——`flow-kit/templates/**` 是唯一权威,增量段与条件段登记见 `reference/artifact-templates.json`。
172
176
  > **archive 定位与读法**:见主 `SKILL.md` 的「Artifact Paths」小节(单一来源——「何时可读 / 读什么 / 不读什么」的三段判据只在那一处表达,本文不复述)。
173
177
 
178
+ > **要核对某工件的条件段 / 结构子段 / 增量段登记时,先读 `reference/artifact-template-overlay.md`**(逐工件的人类可读登记册;快照与指纹以登记表 JSON 为准)。
179
+
174
180
  ### Scripts
175
181
 
176
182
  > **命令路径的平台化**:本文件命令统一为**权威源设计形态** `node .claude/skills/flow-comet/scripts/...`。安装时由 prepare-env 按平台处理——Claude Code 平台零替换(即此形态);Codex 平台自动替换为 `node .agents/skills/flow-comet/scripts/...`(技能安装于 `.agents/skills/`,Codex 自动发现)。相对引用(`reference/`、`flow-kit/`)不替换——随技能目录整体复制,相对位置不变。手动复制(方案 C)仅面向 Claude Code;Codex 请用安装器。
@@ -38,6 +38,10 @@
38
38
  "outputSchemas": [
39
39
  "flowkit.intake.v1"
40
40
  ],
41
+ "templates": [
42
+ "CHANGE",
43
+ "REQUIREMENT"
44
+ ],
41
45
  "guardrails": [
42
46
  {
43
47
  "id": "intake-artifacts",
@@ -84,6 +88,9 @@
84
88
  "outputSchemas": [
85
89
  "flowkit.design.v1"
86
90
  ],
91
+ "templates": [
92
+ "DESIGN"
93
+ ],
87
94
  "guardrails": [
88
95
  {
89
96
  "id": "design-artifacts",
@@ -123,6 +130,9 @@
123
130
  "outputSchemas": [
124
131
  "flowkit.plan.v1"
125
132
  ],
133
+ "templates": [
134
+ "TASK"
135
+ ],
126
136
  "guardrails": [
127
137
  {
128
138
  "id": "plan-artifacts",
@@ -161,6 +171,9 @@
161
171
  "outputSchemas": [
162
172
  "flowkit.execution.v1"
163
173
  ],
174
+ "templates": [
175
+ "SUMMARY"
176
+ ],
164
177
  "guardrails": [
165
178
  {
166
179
  "id": "build-evidence",
@@ -199,6 +212,9 @@
199
212
  "outputSchemas": [
200
213
  "flowkit.handoff.v1"
201
214
  ],
215
+ "templates": [
216
+ "SUMMARY"
217
+ ],
202
218
  "guardrails": [
203
219
  {
204
220
  "id": "handoff-evidence",
@@ -244,6 +260,10 @@
244
260
  "outputSchemas": [
245
261
  "flowkit.review.v1"
246
262
  ],
263
+ "templates": [
264
+ "REVIEW",
265
+ "TEST"
266
+ ],
247
267
  "guardrails": [
248
268
  {
249
269
  "id": "review-evidence",
@@ -282,6 +302,7 @@
282
302
  "outputSchemas": [
283
303
  "flowkit.verify.v1"
284
304
  ],
305
+ "templates": [],
285
306
  "guardrails": [
286
307
  {
287
308
  "id": "verify-evidence",
@@ -320,6 +341,7 @@
320
341
  "outputSchemas": [
321
342
  "flowkit.archive.v1"
322
343
  ],
344
+ "templates": [],
323
345
  "guardrails": [
324
346
  {
325
347
  "id": "archive-evidence",
@@ -20,12 +20,17 @@
20
20
  // 只读边界:scan 零写入;apply 的写入面只有三处——项目级文档(CONTEXT.md / ARCHITECTURE.md)、
21
21
  // .specs/evolve/ 下的报告、以及 state 的 last_evolve_at(经 workflow-state.mjs 的 config set
22
22
  // 通道写入,本脚本不直写 state 文件)。扫描内容严格限定在归档设计文档的沉淀段。
23
+ //
24
+ // 另:scan 末尾输出「结构问题」段——`.specs/ARCHITECTURE.md` 在场时按模板(8 个 H2)+ §3 的
25
+ // `### ADR-<数字>` 条目形态报告结构问题;文件缺席 / 骨架不可派生时声明跳过或未校验。该段与沉淀
26
+ // 候选互不依赖,且**只读、不阻断、不写 state**(结构问题不进退出码)。
23
27
 
24
28
  import { spawnSync } from 'child_process';
25
29
  import { promises as fs } from 'fs';
26
30
  import path from 'path';
27
31
  import { fileURLToPath } from 'url';
28
32
  import { normalizeHeading } from './route-node.mjs';
33
+ import { buildSkeleton } from './lib/guard-artifact-skeleton.mjs';
29
34
  import { readProtocolFile, validateProtocolSchema } from './protocol-utils.mjs';
30
35
  import {
31
36
  writeFileAtomic,
@@ -62,6 +67,14 @@ const CONTEXT_FILE = 'CONTEXT.md';
62
67
  const ARCHITECTURE_FILE = 'ARCHITECTURE.md';
63
68
  const DOC_CONTEXT = SPECS_DIR + '/' + CONTEXT_FILE;
64
69
  const DOC_ARCHITECTURE = SPECS_DIR + '/' + ARCHITECTURE_FILE;
70
+ // 项目级工件检查的骨架键(大小写不敏感;登记表用模板基名大写)
71
+ const ARCHITECTURE_KEY = 'ARCHITECTURE';
72
+ // ADR 条目(行锚定):模板 §3 的 `### ADR-<数字> · <标题>` 形态。模板里的占位条目(`### ADR-NNN`)
73
+ // 是字段键的**形态样例**而非真 ADR,不参与条目校验。
74
+ const ADR_ENTRY = /^###[ \t]+ADR-(\d+)(?![0-9A-Za-z])/u;
75
+ const ADR_PLACEHOLDER = /^###[ \t]+ADR-(?:NNN|<)/u;
76
+ // 条目字段行 = `- **状态**:…`(半角 / 全角冒号都认)。行锚定:正文里提一句「代价」不算填了该字段。
77
+ const ADR_FIELD = /^[ \t]*[-*][ \t]+\*\*(.+?)\*\*[ \t]*[::]/u;
65
78
  const STATE_SCRIPT = 'workflow-state.mjs';
66
79
  // `## evolve 元数据` 的段名与三字段名来自 state-schema.mjs 的单一常量集(写方 = 本节 / 校验方 =
67
80
  // context-init.mjs 的格式校验同源);段侧字段序即常量序,双落点首字段与 state 的 STATE_KEY 同名。
@@ -487,9 +500,170 @@ async function printScan(plan, out = console) {
487
500
  if (plan.scanned.length > 0) {
488
501
  out.log('EVOLVE: 已扫 change 清单:' + plan.scanned.map(changeSummary).join(' · '));
489
502
  }
503
+ await printArchitectureStructure(plan.root, out);
490
504
  out.log('EVOLVE: 应用请执行 evolve.mjs apply <id> --root <根>(未应用的候选不会写入)');
491
505
  }
492
506
 
507
+ // ---------- 项目级工件:ARCHITECTURE 结构检查(只读 · 不阻断) ----------
508
+ // 依据 DESIGN-CLARIFICATIONS C19 / AC-20③:`.specs/ARCHITECTURE.md` 存在时校验模板的 8 个 H2 段
509
+ // 与 §3 下 `### ADR-<数字>` 条目的 7 个字段键(无 ADR 条目时该段可只写「暂无」,不算问题)。
510
+ // 文件缺席 → 跳过并说明;骨架不可派生(模板 / 登记表缺席)→ 未校验并说明——不内置兜底骨架,
511
+ // 但同样不得把「无法比对」静默说成「通过」。
512
+ // 只读边界:零写入、不写 state、不参与退出码——结构问题只进报告(侧命令不阻断任何流程)。
513
+ // 单一实现纪律(L-067):段形取骨架模块(模板 + 登记表);ADR 条目形态**从模板 §3 直接派生**
514
+ // (登记表未登记 ADR 条目形态,C19),字段键因此不在本文件里另写一份字面清单。
515
+ export async function collectArchitectureStructure(root) {
516
+ const display = DOC_ARCHITECTURE;
517
+ const text = await readText(path.join(root, DOC_ARCHITECTURE));
518
+ if (text === null) {
519
+ return {
520
+ display,
521
+ exists: false,
522
+ checked: false,
523
+ note: '文件不在场(可选工件,项目未采用)',
524
+ problems: [],
525
+ basis: null,
526
+ };
527
+ }
528
+ const skeleton = await buildSkeleton(ARCHITECTURE_KEY, { runRoot: root });
529
+ if (!skeleton.derived) {
530
+ return { display, exists: true, checked: false, note: skeletonGapNote(skeleton), problems: [], basis: null };
531
+ }
532
+ const templateText = skeleton.file === null
533
+ ? null
534
+ : await readText(path.resolve(root, ...skeleton.file.split('/')));
535
+ const adrFieldKeys = adrFieldKeysOfTemplate(templateText);
536
+ const problems = h2SectionProblems(skeleton, text).concat(adrEntryProblems(text.split('\n'), adrFieldKeys));
537
+ return {
538
+ display,
539
+ exists: true,
540
+ checked: true,
541
+ note: null,
542
+ problems,
543
+ basis: architectureBasis(skeleton, adrFieldKeys),
544
+ };
545
+ }
546
+
547
+ // 缺的 H2 段(段名宽容匹配委托骨架里的 headingPattern):聚合成一条问题——8 个段逐个报会把报告
548
+ // 撞成清单,读者要的是「哪几个缺」。
549
+ function h2SectionProblems(skeleton, text) {
550
+ const missing = skeleton.sections.filter((section) => !section.pattern.test(text));
551
+ if (missing.length === 0) return [];
552
+ return ['缺 H2 段 ' + missing.length + '/' + skeleton.sections.length + ':'
553
+ + missing.map((section) => section.name).join(' · ')];
554
+ }
555
+
556
+ // 报告里的「依据」行:段数与 ADR 字段键都取自实际比对用的源(骨架 / 模板),不另抄一份数字。
557
+ function architectureBasis(skeleton, adrFieldKeys) {
558
+ const sections = skeleton.sections.length + ' 个 H2 段(骨架 = `' + skeleton.file + '` + 登记表)';
559
+ return adrFieldKeys.length === 0
560
+ ? sections + ';§3 ADR 条目未校验(模板 §3 无字段样例)'
561
+ : sections + ';§3 的 `### ADR-<数字>` 条目 ' + adrFieldKeys.length + ' 个字段键(' + adrFieldKeys.join(' · ') + ')';
562
+ }
563
+
564
+ // 骨架不可派生的原因 → 人读一句(措辞与「未校验」口径一致:声明「未校验」,不冒充「通过」)
565
+ function skeletonGapNote(skeleton) {
566
+ switch (skeleton.reason) {
567
+ case 'template-missing':
568
+ return '模板缺失 · `flow-kit/templates/' + ARCHITECTURE_FILE + '`';
569
+ case 'template-undeclared':
570
+ return '登记表未声明 ARCHITECTURE 的模板路径';
571
+ case 'template-empty':
572
+ return '模板无 H2 段 · `flow-kit/templates/' + ARCHITECTURE_FILE + '`';
573
+ case 'registry-missing':
574
+ case 'registry-unreadable':
575
+ return '登记表不可读(`reference/artifact-templates.json`:' + skeleton.reason + ')';
576
+ case 'unknown-key':
577
+ return '登记表未登记 ARCHITECTURE';
578
+ default:
579
+ return '骨架不可派生(' + String(skeleton.reason) + ')';
580
+ }
581
+ }
582
+
583
+ // §3(ADR 列表)的段范围 = 标题行带 ADR 的那个 H2。段名在不同项目里可能被改写(「架构决策记录」不带
584
+ // ADR 字样),定位不到时返回 null——调用方退回全文范围;形态判据只认行锚定的 `### ADR-<数字>`,
585
+ // 正文里引用 ADR 编号不会被当成条目。
586
+ function adrSectionRange(lines) {
587
+ for (let i = 0; i < lines.length; i += 1) {
588
+ const heading = headingOf(lines[i]);
589
+ if (heading === null || heading.level !== 2) continue;
590
+ if (!/adr/iu.test(stripCr(lines[i]))) continue;
591
+ return { start: i, end: sectionEnd(lines, i, 2, lines.length) };
592
+ }
593
+ return null;
594
+ }
595
+
596
+ // 模板 §3 的 ADR 条目字段键:优先取占位条目(`### ADR-NNN`)的字段键;模板没有占位条目时取 §3 内
597
+ // 条目字段键的并集;两者都取不到 → 空列表(该项声明「未校验」,不拿空清单去判「字段齐备」)。
598
+ function adrFieldKeysOfTemplate(templateText) {
599
+ const lines = String(templateText ?? '').replace(/^\uFEFF/u, '').replace(/\r\n?/gu, '\n').split('\n');
600
+ const range = adrSectionRange(lines);
601
+ if (range === null) return [];
602
+ const entries = adrEntries(lines, range);
603
+ const placeholder = entries.find((entry) => ADR_PLACEHOLDER.test(entry.title) && entry.keys.length > 0);
604
+ return [...new Set(placeholder !== undefined ? placeholder.keys : entries.flatMap((entry) => entry.keys))];
605
+ }
606
+
607
+ // §3 条目校验:每个 `### ADR-<数字>` 条目必须在自己块内出现全部字段键(占位条目 id 为 null,不校验)。
608
+ function adrEntryProblems(lines, adrFieldKeys) {
609
+ if (adrFieldKeys.length === 0) return [];
610
+ const range = adrSectionRange(lines) ?? { start: -1, end: lines.length };
611
+ const problems = [];
612
+ for (const entry of adrEntries(lines, range)) {
613
+ if (entry.id === null) continue;
614
+ const missing = adrFieldKeys.filter((key) => !entry.keys.includes(normalizeFieldKey(key)));
615
+ if (missing.length > 0) {
616
+ problems.push('§3 ' + entry.id + ' 缺字段 ' + missing.length + '/' + adrFieldKeys.length + ':'
617
+ + missing.join(' · '));
618
+ }
619
+ }
620
+ return problems;
621
+ }
622
+
623
+ // §3 内的条目切分(**单一实现**:模板侧取字段键、工件侧校验字段都从这里来):条目 = 一个 1~3 级
624
+ // 标题开始、到下一个 1~3 级标题前的块(`####` 属于块内)。id 只对 `### ADR-<数字>` 赋值——模板里的
625
+ // `ADR-NNN` 占位条目因此只贡献字段键形态,永远不被当作真 ADR 去校验。
626
+ function adrEntries(lines, range) {
627
+ const entries = [];
628
+ let current = null;
629
+ for (let i = range.start + 1; i < range.end; i += 1) {
630
+ const line = stripCr(lines[i]);
631
+ if (/^#{1,3}[ \t]/u.test(line)) {
632
+ const adr = ADR_ENTRY.exec(line);
633
+ current = { title: line, id: adr === null ? null : 'ADR-' + adr[1], keys: [] };
634
+ entries.push(current);
635
+ continue;
636
+ }
637
+ const field = ADR_FIELD.exec(line);
638
+ if (field !== null && current !== null) current.keys.push(normalizeFieldKey(field[1]));
639
+ }
640
+ return entries;
641
+ }
642
+
643
+ function normalizeFieldKey(raw) {
644
+ return String(raw).replace(/\s+/gu, ' ').trim().toLowerCase();
645
+ }
646
+
647
+ // 「结构问题」段(AC-20③ / C19):三个分支各有独立措辞——文件缺席(跳过)/ 骨架不可派生(未校验)
648
+ // / 实际比对(0 项或逐条列出)。只读、不阻断:结构问题不进退出码,也不写 state。
649
+ async function printArchitectureStructure(root, out) {
650
+ const structure = await collectArchitectureStructure(root);
651
+ const head = 'EVOLVE: 结构问题(' + structure.display + '):';
652
+ if (!structure.exists) {
653
+ out.log(head + '跳过——' + structure.note);
654
+ return;
655
+ }
656
+ if (!structure.checked) {
657
+ out.log(head + '未校验(' + structure.note + ')');
658
+ return;
659
+ }
660
+ out.log(head + (structure.problems.length === 0
661
+ ? '0 项'
662
+ : structure.problems.length + ' 项(只读报告,不阻断)'));
663
+ for (const problem of structure.problems) out.log(' - ' + problem);
664
+ out.log('EVOLVE: 结构问题依据:' + structure.basis);
665
+ }
666
+
493
667
  // ---------- 应用 ----------
494
668
 
495
669
  function fieldLine(key, value) {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  // flow-comet 引擎自测套件(L1 回归基线的载体)
3
3
  //
4
- // 本文件 = runner + 底部自检(收口判据)。场景数据在 scenarios/{a..m}.mjs(按机制面分组),
4
+ // 本文件 = runner + 底部自检(收口判据)。场景数据在 scenarios/{a..n}.mjs(按机制面分组),
5
5
  // 夹具 / 断言 / 文本锚判据在 lib/ 下,与 system-test 共享的工具与计数派生各有单一来源模块。
6
6
  //
7
7
  // 每个场景 = 独立临时目录(fs.mkdtemp)+ 伪造 .flow-comet/flow-comet-state.json(currentNode +
@@ -54,6 +54,7 @@ import { ENTRIES as SCENARIOS_J } from './scenarios/j.mjs';
54
54
  import { ENTRIES as SCENARIOS_K } from './scenarios/k.mjs';
55
55
  import { ENTRIES as SCENARIOS_L } from './scenarios/l.mjs';
56
56
  import { ENTRIES as SCENARIOS_M } from './scenarios/m.mjs';
57
+ import { ENTRIES as SCENARIOS_N } from './scenarios/n.mjs';
57
58
 
58
59
  let passed = 0;
59
60
  const failures = [];
@@ -72,6 +73,7 @@ const SCENARIOS = [
72
73
  ...SCENARIOS_K,
73
74
  ...SCENARIOS_L,
74
75
  ...SCENARIOS_M,
76
+ ...SCENARIOS_N,
75
77
  ];
76
78
 
77
79
  // ---------- 运行 ----------
@@ -3,15 +3,16 @@
3
3
  //
4
4
  // 报告分层:
5
5
  // · 确定性层:文件 / 结构可判项——项目上下文段与格式、经验条目编号连续性、技术债表项数、
6
- // 可选工具在场判定、版本历史统计。每项都带计数与判据;同一冻结树两次运行逐字节一致。
6
+ // 可选工具在场判定、版本历史统计、架构文档结构(`.specs/ARCHITECTURE.md`,可选工件)。
7
+ // 每项都带计数与判据;同一冻结树两次运行逐字节一致。
7
8
  // · 增补层:代码体检工具(brooks-lint)在场时,由 agent 执行其 4 维体检并把结果并入同一份
8
9
  // 报告、标注来源;脚本不执行 agent 技能,缺省保留占位而不伪造结论。
9
10
  // · 降级声明:可选外部工具不在场时显式声明原因。判据只锚「确定性层完整 + 降级声明可见」——
10
11
  // 环境缺可选工具不构成失败(这些工具是可选项,不是依赖)。
11
12
  //
12
13
  // 只读边界:
13
- // · 读:.specs/CONTEXT.md、.specs/LESSONS.md、.specs/health/*.md(基线)、git 历史、
14
- // 可选工具的在场探测(文件 / 路径判定);
14
+ // · 读:.specs/CONTEXT.md、.specs/LESSONS.md、.specs/ARCHITECTURE.md(结构检查,可选)、
15
+ // .specs/health/*.md(基线)、git 历史、可选工具的在场探测(文件 / 路径判定);
15
16
  // · 写:仅一份报告 .specs/health/<日期>-HEALTH.md;`--stdout` 时把报告正文原样打到标准输出;
16
17
  // · 标准输出另**恒**输出 `HEALTH:` 审计行(报告路径 / 日期 / 增补层在场 / 基线)——不带
17
18
  // `--stdout` 时只有审计行(报告正文不回流);
@@ -38,7 +39,7 @@ import os from 'os';
38
39
  import path from 'path';
39
40
  import { fileURLToPath } from 'url';
40
41
  import { validateContext } from './context-init.mjs';
41
- import { parseSideCommandArgs, relativeLabel } from './evolve.mjs';
42
+ import { collectArchitectureStructure, parseSideCommandArgs, relativeLabel } from './evolve.mjs';
42
43
  import { archiveDateFromName, formatLocalDate, formatLocalTimestamp } from './time-utils.mjs';
43
44
 
44
45
  const SELF_FILE = fileURLToPath(import.meta.url);
@@ -468,6 +469,26 @@ function renderGitSection(push, git) {
468
469
  push('');
469
470
  }
470
471
 
472
+ // 确定性层 6:架构文档结构(C19 / AC-20③)——只读报告,不阻断:结构问题不影响退出码,也不写状态。
473
+ // 判据实现与 evolve 的「结构问题」段**同源**(evolve.mjs 的 collectArchitectureStructure):两处各写
474
+ // 一套段形比对必然分叉(同一判据两份实现的老账)。
475
+ function renderArchitectureSection(push, architecture, selfDisplay, options) {
476
+ push('### 6 · 架构文档结构(' + architecture.display + ' · 只读)', '');
477
+ push('- 文件:`' + architecture.display + '`(' + (architecture.exists ? '在场' : '缺失') + ')');
478
+ if (!architecture.exists) {
479
+ push('- 检查:跳过——' + architecture.note);
480
+ } else if (!architecture.checked) {
481
+ push('- 检查:未校验(' + architecture.note + ')');
482
+ } else {
483
+ push('- 结构问题(' + architecture.problems.length + '):' + (architecture.problems.length === 0 ? '无' : ''));
484
+ for (const problem of architecture.problems) push(' - ' + problem);
485
+ }
486
+ push('- 判据:' + (architecture.basis
487
+ ?? '8 个 H2 段 + §3 的 `### ADR-<数字>` 条目字段键(骨架来自 flow-kit/templates/ARCHITECTURE.md)')
488
+ + ';只读报告,不阻断、不写状态');
489
+ push('- 复现命令:`node ' + selfDisplay + ' --root ' + options.rootDisplay + ' --stdout`', '');
490
+ }
491
+
471
492
  function renderSupplementSection(push, brooks) {
472
493
  push('## 增补层(代码体检工具的 4 维结果 · 可选)', '');
473
494
  push('- **在场判定**:' + (brooks.present ? '在场' : '不在场——下列探测面逐项未命中(未安装 / 未加载)'));
@@ -555,6 +576,7 @@ function renderReport(input) {
555
576
  renderDebtSection(push, input.debt);
556
577
  renderRedundancySection(push, input.redundancy, input.options, input.selfDisplay);
557
578
  renderGitSection(push, input.git);
579
+ renderArchitectureSection(push, input.architecture, input.selfDisplay, input.options);
558
580
  renderSupplementSection(push, input.brooks);
559
581
  renderDegradationSection(push, input.redundancy, input.brooks);
560
582
  renderSnapshotSection(push, input.snapshot);
@@ -627,6 +649,7 @@ async function main(argv) {
627
649
  const context = await collectContext(options.root);
628
650
  const lessons = collectLessons(lessonsText);
629
651
  const debt = collectDebt(contextText);
652
+ const architecture = await collectArchitectureStructure(options.root);
630
653
  const redundancy = await collectRedundancy(options.root);
631
654
  const git = collectGit(options.root);
632
655
  const brooks = await collectBrooks(options.root);
@@ -642,6 +665,7 @@ async function main(argv) {
642
665
  context,
643
666
  lessons,
644
667
  debt,
668
+ architecture,
645
669
  redundancy,
646
670
  git,
647
671
  brooks,
@@ -11,7 +11,24 @@ import fs from 'fs';
11
11
  import path from 'path';
12
12
  import { createHash } from 'crypto';
13
13
  import { assertEqual, assertExit, assertNotOut, assertOut, assertTrue, baseState, runGuard, runHandoff, runState, writeFile, writeState } from '../lib/test-helpers.mjs';
14
- import { multiWaveTaskContent, explainContractProblems, assertExplainFailClosed, explainReverseConstructionProblems, CHANGE_ID, readStateFile, gitInit, gitBranch, writeIntakeArtifacts, fullContract, execSummaryFixture, assertNodeLine, driveThroughDesign } from '../lib/system-fixtures.mjs';
14
+ import { archiveRecordJson, multiWaveTaskContent, explainContractProblems, assertExplainFailClosed, explainReverseConstructionProblems, CHANGE_ID, readStateFile, gitInit, gitBranch, writeIntakeArtifacts, fullContract, execSummaryFixture, assertNodeLine, driveThroughDesign } from '../lib/system-fixtures.mjs';
15
+
16
+ // skill-load 的模板声明(节点级,C3/AC-13 加载链):参数化的委托驱动按节点查表——夹具是真实命令
17
+ // 序列,声明集合要与节点映射一致(集合不一致时引擎按 C11 fail-closed 拦截)。
18
+ const TEMPLATE_DECLARATION = {
19
+ open: 'CHANGE.md,REQUIREMENT.md',
20
+ design: 'DESIGN.md',
21
+ plan: 'TASK.md',
22
+ execute: 'SUMMARY.md',
23
+ 'subagent-execute': 'SUMMARY.md',
24
+ review: 'REVIEW.md,TEST.md',
25
+ };
26
+
27
+ function skillLoadArgs(nodeId, skill, prompt) {
28
+ const args = ['skill-load', nodeId, skill, '--prompt', prompt];
29
+ if (TEMPLATE_DECLARATION[nodeId]) args.push('--templates', TEMPLATE_DECLARATION[nodeId]);
30
+ return args;
31
+ }
15
32
 
16
33
  export const ENTRIES = [
17
34
  // ---------- A. 状态机与路由 ----------
@@ -116,7 +133,7 @@ export const ENTRIES = [
116
133
  name: 'A5 next:推进与状态漂移校正',
117
134
  run: (dir) => {
118
135
  assertExit(runState(['init', CHANGE_ID], dir), 0);
119
- assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md'], dir), 0);
136
+ assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
120
137
  writeIntakeArtifacts(dir);
121
138
  assertExit(runState(['record', 'open', '{"summary":"intake complete"}'], dir), 0);
122
139
  // 真实出口:exit open --apply(未激活声明机制 → 兼容警告 + 通过)
@@ -198,7 +215,7 @@ export const ENTRIES = [
198
215
  name: 'A9 record:基础证据记录',
199
216
  run: (dir, outcomes) => {
200
217
  assertExit(runState(['init', CHANGE_ID], dir), 0);
201
- assertExit(runState(['skill-load', 'open', 'flow-comet-change'], dir), 0);
218
+ assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
202
219
  // JSON payload → evidence 写入 + next 提示
203
220
  const res = runState(['record', 'open', '{"summary":"recorded"}'], dir);
204
221
  assertExit(res, 0);
@@ -360,7 +377,7 @@ export const ENTRIES = [
360
377
  // 对未实现循环路由的引擎本用例 RED 属预期(单趟限制下委托节点完成后不再路由回)。
361
378
  writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md',
362
379
  multiWaveTaskContent({ P01: 'pending', P02: 'pending', S01: 'pending', P03: 'pending' }));
363
- assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md'], dir), 0);
380
+ assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir), 0);
364
381
  assertExit(runState(['record', 'plan', '{"summary":"plan done"}'], dir), 0);
365
382
  assertExit(runGuard(['entry', 'plan'], dir), 0);
366
383
  const rPlan = runGuard(['exit', 'plan', '--apply'], dir);
@@ -369,8 +386,8 @@ export const ENTRIES = [
369
386
  // 首趟路由:首波双并行无前置依赖 → 直接进入委托节点
370
387
  assertOut(rPlan, 'NODE: subagent-execute');
371
388
  // 两层加载模型:执行域两节点的手动声明标记(record 前置门;一次声明后续趟次复用)
372
- assertExit(runState(['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md'], dir), 0);
373
- assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md'], dir), 0);
389
+ assertExit(runState(['skill-load', 'execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir), 0);
390
+ assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-dev', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir), 0);
374
391
 
375
392
  // 单趟完成动作:TASK.md 标 done(status 变更不影响任务集签名)+ SUMMARY 夹具 + 真实 handoff 委托回传
376
393
  const completeTasks = (ids) => {
@@ -485,7 +502,7 @@ export const ENTRIES = [
485
502
  '<task id="X1" parallel="true" status="pending"><action>实现 X1</action><write_files>src/x1.mjs</write_files><verify>node --check src/x1.mjs</verify><depends_on>X2</depends_on></task>\n' +
486
503
  '<task id="X2" parallel="true" status="pending"><action>实现 X2</action><write_files>src/x2.mjs</write_files><verify>node --check src/x2.mjs</verify><depends_on>X1</depends_on></task>\n';
487
504
  writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md', '# TASK\n\n' + cyclic);
488
- assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md'], dir), 0);
505
+ assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir), 0);
489
506
  assertExit(runState(['record', 'plan', '{"summary":"plan drafted"}'], dir), 0);
490
507
  assertExit(runGuard(['entry', 'plan'], dir), 0);
491
508
  const blocked = runGuard(['exit', 'plan', '--apply'], dir);
@@ -543,7 +560,7 @@ export const ENTRIES = [
543
560
  // next 对「currentNode 无 evidence 且非固定路由后继」的委托跳转态按正常推进豁免不放行,
544
561
  // 仅断言 guard 侧 NODE;直接后继/回流态(next 可确认)才做双侧收敛断言。
545
562
  const drive = (nodeId, skill, prompt, prepare, { expectedNode, converge = true } = {}) => {
546
- assertExit(runState(['skill-load', nodeId, skill, '--prompt', prompt], dir, env), 0);
563
+ assertExit(runState(skillLoadArgs(nodeId, skill, prompt), dir, env), 0);
547
564
  prepare();
548
565
  assertExit(runGuard(['entry', nodeId], dir), 0);
549
566
  const res = runGuard(['exit', nodeId, '--apply'], dir);
@@ -609,7 +626,10 @@ export const ENTRIES = [
609
626
  // 归档出口:两侧均 NEXT: done
610
627
  assertExit(runState(['skill-load', 'archive', 'flow-comet-archive', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
611
628
  writeFile(dir, '.specs/archive/2026-08-28-' + CHANGE_ID + '/KNOWN-ISSUES.md', '# 遗留问题\n\n无。\n');
612
- assertExit(runState(['record', 'archive', '{"summary":"archive complete"}'], dir, env), 0);
629
+ // 归档提名随证据落盘:本 change 写了 6 份任务 SUMMARY(并行 4 份 + 串行 2 份,扫描份数按
630
+ // 同一清单对账)。提名门缺字段即拦,与本条被测的路由收敛判据无关。
631
+ assertExit(runState(['record', 'archive',
632
+ archiveRecordJson('archive complete', ['P01', 'P02', 'S01', 'P03', 'P04', 'S02'])], dir, env), 0);
613
633
  assertExit(runGuard(['entry', 'archive'], dir), 0);
614
634
  const res = runGuard(['exit', 'archive', '--apply'], dir);
615
635
  assertExit(res, 0);
@@ -636,7 +656,7 @@ export const ENTRIES = [
636
656
  // 非 --apply 出口(弱判/强判阶段不推进状态,避免 apply 后 currentNode 偏离 plan)
637
657
  const exitPlanNoApply = () => runGuard(['exit', 'plan'], dir, planEnv);
638
658
  const exitPlanApply = () => runGuard(['exit', 'plan', '--apply'], dir, planEnv);
639
- assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md'], dir), 0);
659
+ assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir), 0);
640
660
  assertExit(runState(['record', 'plan', '{"summary":"plan drafted"}'], dir), 0);
641
661
  assertExit(runGuard(['entry', 'plan'], dir), 0);
642
662
  const planTask = (taskBody) => writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md', '# TASK\n\n' + taskBody);
@@ -800,7 +820,7 @@ export const ENTRIES = [
800
820
  };
801
821
  // drive 收敛面全量:每个转换点(含平行跳转与趟间回流)都断言 next 可达且与 guard 出口 NODE 一致
802
822
  const drive = (nodeId, skill, prompt, prepare, { expectedNode } = {}) => {
803
- assertExit(runState(['skill-load', nodeId, skill, '--prompt', prompt], dir, env), 0);
823
+ assertExit(runState(skillLoadArgs(nodeId, skill, prompt), dir, env), 0);
804
824
  prepare();
805
825
  assertExit(runGuard(['entry', nodeId], dir), 0);
806
826
  const res = runGuard(['exit', nodeId, '--apply'], dir);
@@ -865,7 +885,10 @@ export const ENTRIES = [
865
885
  // 归档出口:两侧均 NEXT: done
866
886
  assertExit(runState(['skill-load', 'archive', 'flow-comet-archive', '--prompt', 'flow-kit/prompts/7-integration.md'], dir, env), 0);
867
887
  writeFile(dir, '.specs/archive/2026-08-28-' + CHANGE_ID + '/KNOWN-ISSUES.md', '# 遗留问题\n\n无。\n');
868
- assertExit(runState(['record', 'archive', '{"summary":"archive complete"}'], dir, env), 0);
888
+ // 归档提名随证据落盘:本 change 写了 6 份任务 SUMMARY(并行 4 份 + 串行 2 份,扫描份数按
889
+ // 同一清单对账)。提名门缺字段即拦,与本条被测的路由收敛判据无关。
890
+ assertExit(runState(['record', 'archive',
891
+ archiveRecordJson('archive complete', ['P01', 'P02', 'S01', 'P03', 'P04', 'S02'])], dir, env), 0);
869
892
  assertExit(runGuard(['entry', 'archive'], dir), 0);
870
893
  const resArch = runGuard(['exit', 'archive', '--apply'], dir);
871
894
  assertExit(resArch, 0);
@@ -894,14 +917,14 @@ export const ENTRIES = [
894
917
  // 驱动至 plan 出口(真实命令:init→open→design 见 driveThroughDesign,随后 plan 三连)
895
918
  driveThroughDesign(dir);
896
919
  writeTask({ S01: 'pending' });
897
- assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md'], dir, env), 0);
920
+ assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir, env), 0);
898
921
  assertExit(runState(['record', 'plan', '{"summary":"plan complete"}'], dir, env), 0);
899
922
  assertExit(runGuard(['entry', 'plan'], dir), 0);
900
923
  assertExit(runGuard(['exit', 'plan', '--apply'], dir), 0);
901
924
  // execute 完整完成(产物 + record + entry,真实命令)——仅差 completedNodes(欠账)
902
925
  writeTask({ S01: 'done' });
903
926
  writeFile(dir, '.specs/' + CHANGE_ID + '/S01-SUMMARY.md', execSummaryFixture('S01'));
904
- assertExit(runState(['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md'], dir, env), 0);
927
+ assertExit(runState(['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
905
928
  assertExit(runState(['record', 'execute', '{"summary":"executed","parallelTakeoverApproved":true}'], dir, env), 0);
906
929
  assertExit(runGuard(['entry', 'execute'], dir), 0);
907
930
  // R-1 欠账漂移态:currentNode 漂移到文件推导下一节点 review(execute 未 completed)
@@ -940,7 +963,7 @@ export const ENTRIES = [
940
963
  };
941
964
  driveThroughDesign(dir);
942
965
  writeTask({ P01: 'pending', S01: 'pending' });
943
- assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md'], dir, env), 0);
966
+ assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir, env), 0);
944
967
  assertExit(runState(['record', 'plan', '{"summary":"plan complete"}'], dir, env), 0);
945
968
  assertExit(runGuard(['entry', 'plan'], dir), 0);
946
969
  assertExit(runGuard(['exit', 'plan', '--apply'], dir), 0);
@@ -948,7 +971,7 @@ export const ENTRIES = [
948
971
  // 发起委托前先 skill-load 声明(handoff request 前置门——先声明再发起委托,与既有委托链同序)
949
972
  writeTask({ P01: 'done', S01: 'pending' });
950
973
  writeFile(dir, '.specs/' + CHANGE_ID + '/P01-SUMMARY.md', execSummaryFixture('P01'));
951
- assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-subagent-execute', '--prompt', 'flow-kit/prompts/4-dev.md'], dir, env), 0);
974
+ assertExit(runState(['skill-load', 'subagent-execute', 'flow-comet-subagent-execute', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
952
975
  assertExit(runHandoff(['request', 'P01', 'P01 委托', '--write-files', 'src/p01.mjs'], dir), 0);
953
976
  assertExit(runHandoff(['result', 'P01', fullContract('abcd1234abcd1234abcd1234abcd1234abcd1234', 'P01')], dir), 0);
954
977
  assertExit(runState(['record', 'subagent-execute', '{"summary":"wave 1 delegated and collected"}'], dir, env), 0);
@@ -995,14 +1018,14 @@ export const ENTRIES = [
995
1018
  // 驱动至 execute(真实命令:init→open→design→plan 出口)
996
1019
  driveThroughDesign(dir);
997
1020
  writeTask({ S01: 'pending' });
998
- assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md'], dir, env), 0);
1021
+ assertExit(runState(['skill-load', 'plan', 'flow-comet-plan', '--prompt', 'flow-kit/prompts/3-task.md', '--templates', 'TASK.md'], dir, env), 0);
999
1022
  assertExit(runState(['record', 'plan', '{"summary":"plan complete"}'], dir, env), 0);
1000
1023
  assertExit(runGuard(['entry', 'plan'], dir), 0);
1001
1024
  assertExit(runGuard(['exit', 'plan', '--apply'], dir), 0);
1002
1025
  // execute 完整完成(产物 + record + entry,真实命令)
1003
1026
  writeTask({ S01: 'done' });
1004
1027
  writeFile(dir, '.specs/' + CHANGE_ID + '/S01-SUMMARY.md', execSummaryFixture('S01'));
1005
- assertExit(runState(['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md'], dir, env), 0);
1028
+ assertExit(runState(['skill-load', 'execute', 'flow-comet-execute', '--prompt', 'flow-kit/prompts/4-dev.md', '--templates', 'SUMMARY.md'], dir, env), 0);
1006
1029
  assertExit(runState(['record', 'execute', '{"summary":"executed"}'], dir, env), 0);
1007
1030
  assertExit(runGuard(['entry', 'execute'], dir), 0);
1008
1031
  // 执行者自切 direct(directOverride=true 但无授权审计记录——B 方案前的自切/遗留形态)