flow-comet 1.6.4 → 1.7.0

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 (85) hide show
  1. package/.flow-comet/skills/flow-comet/INSTALLED_VERSION +1 -1
  2. package/.flow-comet/skills/flow-comet/SKILL.md +36 -6
  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/commit-discipline.md +1 -1
  6. package/.flow-comet/skills/flow-comet/reference/entry-detail.md +29 -4
  7. package/.flow-comet/skills/flow-comet/reference/workflow-protocol.json +22 -0
  8. package/.flow-comet/skills/flow-comet/scripts/context-init.mjs +26 -23
  9. package/.flow-comet/skills/flow-comet/scripts/evolve.mjs +174 -0
  10. package/.flow-comet/skills/flow-comet/scripts/guard-self-test.mjs +17 -95
  11. package/.flow-comet/skills/flow-comet/scripts/health.mjs +28 -4
  12. package/.flow-comet/skills/flow-comet/scripts/items/a.mjs +136 -19
  13. package/.flow-comet/skills/flow-comet/scripts/items/b.mjs +54 -18
  14. package/.flow-comet/skills/flow-comet/scripts/items/c.mjs +6 -6
  15. package/.flow-comet/skills/flow-comet/scripts/items/e.mjs +52 -10
  16. package/.flow-comet/skills/flow-comet/scripts/items/h.mjs +25 -10
  17. package/.flow-comet/skills/flow-comet/scripts/items/l.mjs +4 -2
  18. package/.flow-comet/skills/flow-comet/scripts/items/m.mjs +21 -13
  19. package/.flow-comet/skills/flow-comet/scripts/items/n.mjs +163 -0
  20. package/.flow-comet/skills/flow-comet/scripts/lib/ac-coverage.mjs +317 -0
  21. package/.flow-comet/skills/flow-comet/scripts/lib/guard-artifact-skeleton.mjs +448 -0
  22. package/.flow-comet/skills/flow-comet/scripts/lib/guard-evidence-gates.mjs +396 -27
  23. package/.flow-comet/skills/flow-comet/scripts/lib/guard-gates.mjs +1035 -172
  24. package/.flow-comet/skills/flow-comet/scripts/lib/guard-routing.mjs +129 -98
  25. package/.flow-comet/skills/flow-comet/scripts/lib/guard-state-io.mjs +8 -6
  26. package/.flow-comet/skills/flow-comet/scripts/lib/guard-template-fidelity.mjs +797 -232
  27. package/.flow-comet/skills/flow-comet/scripts/lib/guard-uidesign.mjs +91 -22
  28. package/.flow-comet/skills/flow-comet/scripts/lib/lessons-hits.mjs +160 -0
  29. package/.flow-comet/skills/flow-comet/scripts/lib/run-root.mjs +21 -0
  30. package/.flow-comet/skills/flow-comet/scripts/lib/section-body.mjs +92 -0
  31. package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-admin.mjs +69 -13
  32. package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-flow.mjs +454 -135
  33. package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-recovery.mjs +66 -0
  34. package/.flow-comet/skills/flow-comet/scripts/lib/state-explain.mjs +109 -13
  35. package/.flow-comet/skills/flow-comet/scripts/lib/state-io.mjs +55 -2
  36. package/.flow-comet/skills/flow-comet/scripts/lib/state-skillmarkers.mjs +149 -34
  37. package/.flow-comet/skills/flow-comet/scripts/lib/system-fixtures.mjs +79 -9
  38. package/.flow-comet/skills/flow-comet/scripts/lib/task-graph.mjs +84 -31
  39. package/.flow-comet/skills/flow-comet/scripts/lib/test-fixtures.mjs +78 -8
  40. package/.flow-comet/skills/flow-comet/scripts/lib/test-helpers.mjs +60 -3
  41. package/.flow-comet/skills/flow-comet/scripts/lib/text-anchor-checks.mjs +167 -3
  42. package/.flow-comet/skills/flow-comet/scripts/lib/wave-projection.mjs +341 -0
  43. package/.flow-comet/skills/flow-comet/scripts/protocol-utils.mjs +287 -0
  44. package/.flow-comet/skills/flow-comet/scripts/scenarios/a.mjs +1454 -16
  45. package/.flow-comet/skills/flow-comet/scripts/scenarios/b.mjs +1202 -8
  46. package/.flow-comet/skills/flow-comet/scripts/scenarios/c.mjs +1205 -77
  47. package/.flow-comet/skills/flow-comet/scripts/scenarios/d.mjs +753 -5
  48. package/.flow-comet/skills/flow-comet/scripts/scenarios/e.mjs +52 -11
  49. package/.flow-comet/skills/flow-comet/scripts/scenarios/f.mjs +582 -3
  50. package/.flow-comet/skills/flow-comet/scripts/scenarios/g.mjs +9 -1
  51. package/.flow-comet/skills/flow-comet/scripts/scenarios/i.mjs +5 -0
  52. package/.flow-comet/skills/flow-comet/scripts/scenarios/j.mjs +22 -6
  53. package/.flow-comet/skills/flow-comet/scripts/scenarios/k.mjs +2 -0
  54. package/.flow-comet/skills/flow-comet/scripts/scenarios/l.mjs +18 -5
  55. package/.flow-comet/skills/flow-comet/scripts/scenarios/n.mjs +4100 -0
  56. package/.flow-comet/skills/flow-comet/scripts/state-schema.mjs +135 -0
  57. package/.flow-comet/skills/flow-comet/scripts/system-test.mjs +6 -5
  58. package/.flow-comet/skills/flow-comet/scripts/workflow-guard.mjs +203 -4
  59. package/.flow-comet/skills/flow-comet/scripts/workflow-handoff.mjs +312 -63
  60. package/.flow-comet/skills/flow-comet/scripts/workflow-state.mjs +5 -2
  61. package/.flow-comet/skills/flow-comet-archive/SKILL.md +6 -2
  62. package/.flow-comet/skills/flow-comet-change/SKILL.md +6 -2
  63. package/.flow-comet/skills/flow-comet-design/GUIDANCE.md +13 -3
  64. package/.flow-comet/skills/flow-comet-design/SKILL.md +15 -8
  65. package/.flow-comet/skills/flow-comet-dev/SKILL.md +1 -1
  66. package/.flow-comet/skills/flow-comet-evolve/SKILL.md +1 -0
  67. package/.flow-comet/skills/flow-comet-execute/SKILL.md +42 -15
  68. package/.flow-comet/skills/flow-comet-health/SKILL.md +1 -1
  69. package/.flow-comet/skills/flow-comet-integration/SKILL.md +1 -1
  70. package/.flow-comet/skills/flow-comet-open/GUIDANCE.md +14 -4
  71. package/.flow-comet/skills/flow-comet-open/SKILL.md +11 -9
  72. package/.flow-comet/skills/flow-comet-plan/GUIDANCE.md +13 -3
  73. package/.flow-comet/skills/flow-comet-plan/SKILL.md +21 -10
  74. package/.flow-comet/skills/flow-comet-requirement/SKILL.md +1 -1
  75. package/.flow-comet/skills/flow-comet-review/SKILL.md +33 -18
  76. package/.flow-comet/skills/flow-comet-subagent-execute/GUIDANCE.md +13 -3
  77. package/.flow-comet/skills/flow-comet-subagent-execute/SKILL.md +44 -16
  78. package/.flow-comet/skills/flow-comet-task/SKILL.md +3 -2
  79. package/.flow-comet/skills/flow-comet-test/SKILL.md +6 -2
  80. package/.flow-comet/skills/flow-comet-ui-design/SKILL.md +2 -2
  81. package/.flow-comet/skills/flow-comet-verify/SKILL.md +12 -8
  82. package/README.md +3 -3
  83. package/package.json +1 -1
  84. package/scripts/dsh-bridge.mjs +2 -2
  85. package/scripts/lib/installer-flowkit.mjs +43 -3
@@ -28,6 +28,7 @@ import {
28
28
  TASK_VALID_SP,
29
29
  engineDefinitionHits,
30
30
  engineDefinitionModule,
31
+ engineScriptTexts,
31
32
  handoffFor,
32
33
  renderMultiWaveTasks,
33
34
  runPlanExit,
@@ -43,8 +44,10 @@ import {
43
44
  COMMIT_DISCIPLINE_AUTHORITY_PHRASES,
44
45
  COMMIT_DISCIPLINE_ELEMENT_GROUPS,
45
46
  COMMIT_DISCIPLINE_REL,
47
+ COMMIT_FORM_TOKEN,
46
48
  CONTRACT_EVIDENCE_AUTHORITY_PHRASES,
47
49
  DELEGATION_POINTER_RELS,
50
+ ENTRY_COMMIT_FORM_REL,
48
51
  IDENTITY_UPGRADE_AUTHORITY_PHRASES,
49
52
  IDENTITY_UPGRADE_ENTRY_PHRASES,
50
53
  IDENTITY_UPGRADE_STALE_PHRASES,
@@ -59,6 +62,7 @@ import {
59
62
  SKILL_TREE_REFERENCE_RE,
60
63
  TEMPLATE_AUTHORITY_SKILLS,
61
64
  delegationDisciplineProblems,
65
+ entryCommitFormProblems,
62
66
  identityUpgradeProblems,
63
67
  pairedGuidancePointerProblems,
64
68
  platformFactsAuthorityProblems,
@@ -70,6 +74,56 @@ import {
70
74
  templateAuthorityRegistrationProblems,
71
75
  } from '../lib/text-anchor-checks.mjs';
72
76
 
77
+ // ---------- 文档口径锚(「文档口径与实现一致」的判据单一实现)----------
78
+ // 判据 = 文档里写的口径必须与实现同形:每条口径给出 required(新口径在场)与 stale(旧口径零残留),
79
+ // 两种静默失配都判——文档丢了新说法、或旧说法回流。真实核对与反向构造探针共用本实现(各写一份必然
80
+ // 分叉:锚与探针各自演化后,判别力会在两次改动后静默归零)。
81
+ function docWordingProblems(cases) {
82
+ const out = [];
83
+ for (const item of cases) {
84
+ for (const phrase of item.required ?? []) {
85
+ if (!item.text.includes(phrase)) out.push(item.rel + ' 缺新口径「' + phrase + '」');
86
+ }
87
+ for (const phrase of item.stale ?? []) {
88
+ if (item.text.includes(phrase)) out.push(item.rel + ' 残留旧口径「' + phrase + '」');
89
+ }
90
+ }
91
+ return out;
92
+ }
93
+
94
+ // 反向构造:抽掉任一新口径句 ⇒ 必报缺;注入任一旧口径句 ⇒ 必报残留。探针随真实判据同流——
95
+ // 抽掉后仍绿即锚没有判别力,本条与真实判据因此互为判别。
96
+ function docWordingChecks(cases) {
97
+ const problems = docWordingProblems(cases);
98
+ for (const item of cases) {
99
+ for (const phrase of item.required ?? []) {
100
+ if (!item.text.includes(phrase)) continue; // 缺失已由真实判据报告,不叠第二条
101
+ const stripped = [{ ...item, text: item.text.split(phrase).join('(反向构造:抽掉)') }];
102
+ if (!docWordingProblems(stripped).some((problem) => problem.includes('缺新口径'))) {
103
+ problems.push('反向构造判别力缺失(' + item.rel + ': 抽掉「' + phrase + '」未被判缺)');
104
+ }
105
+ }
106
+ for (const phrase of item.stale ?? []) {
107
+ const restored = [{ ...item, text: item.text + String.fromCharCode(10) + phrase }];
108
+ if (!docWordingProblems(restored).some((problem) => problem.includes('残留旧口径'))) {
109
+ problems.push('反向构造判别力缺失(' + item.rel + ': 注入「' + phrase + '」未被判残留)');
110
+ }
111
+ }
112
+ }
113
+ return problems;
114
+ }
115
+
116
+ // 对象字面量的顶层键(引擎侧成因表的取值口径;解析不出时返回 null——调用方据此显式报前提失效,
117
+ // 不静默当「成因表没变」)。
118
+ function literalObjectKeys(code, name) {
119
+ const start = String(code).indexOf('const ' + name + ' = {');
120
+ if (start < 0) return null;
121
+ const end = String(code).indexOf(String.fromCharCode(10) + '};', start);
122
+ if (end < 0) return null;
123
+ const keys = [...String(code).slice(start, end).matchAll(/^\s*'([^']+)':/gmu)].map((matched) => matched[1]);
124
+ return keys.length > 0 ? keys : null;
125
+ }
126
+
73
127
  export const ENTRIES = [
74
128
 
75
129
  // ---------- 场景(多趟路由核心——多趟推进完成 / 零进展防呆 / 委托节点二次进入完成判定 / 向后兼容等价) ----------
@@ -781,9 +835,11 @@ export const ENTRIES = [
781
835
  },
782
836
 
783
837
  // 184c: 纪律判别句式族——入口 archive 读法三要素、plan/task 判别句式 + GUIDANCE 委托消化、
784
- // Codex 平台事实与支持面(权威处唯一 + 引用册指针在场 + 判别句不回流)。
838
+ // 波次与 AC 覆盖判据句、Codex 平台事实与支持面(权威处唯一 + 引用册指针在场 + 判别句不回流)、
839
+ // 声明门禁与旧 change 分级的文档口径(多 --prompt 形态 + exit 全部覆盖 + 入口只拦错路径 +
840
+ // 旧 change 按 `newChange` 标记表述)。场景名随覆盖族补齐一并点名。
785
841
  {
786
- name: '184c 技能文本锁:入口 archive 读法 + 规划约束判别句 + Codex 平台事实',
842
+ name: '184c 技能文本锁:入口 archive 读法 + 规划约束 + 波次与 AC 覆盖 + 声明门禁与旧 change 分级口径 + 判不了口径与段形门分写 + Codex 平台事实',
787
843
  run: () => {
788
844
  const problems = [];
789
845
  // —— 入口 archive 读法:三要素关键词在场 ——
@@ -830,6 +886,75 @@ export const ENTRIES = [
830
886
  problems.push(guidanceRel + ' 缺「仍必须由 subagent-execute 委托消化」(direct 委托消化判别句)');
831
887
  }
832
888
  }
889
+ // —— 波次投影与 AC 覆盖判据句(本批新增判据的文本锁)——
890
+ // 判据 = 关键句在**该在场的册**里逐条在案:plan / task 两册锁「波次 = 依赖层级的投影」的规则
891
+ // 三句与出口行为(依赖面与波次编号是两套判据 / 恢复出路两条 / 判不了按成因二分 / 未声明任务
892
+ // 必须被 Wave 行覆盖 / replan 同源 / 不恢复旧形态约束),review 册锁 AC 覆盖的出口口径
893
+ //(verify 判红 + 判不了按成因二分 + review 一条汇总、不改退出码)。
894
+ // 反向构造:逐册逐句抽掉 ⇒ 必报该册缺该句(抽掉用全量 split/join,不是只替换首处)——
895
+ // 抽掉仍绿即锚失效,本条与真实判据同一次运行里互为判别力。
896
+ {
897
+ const waveAnchorsZh = [
898
+ ['波次投影 · 规则本体(中文)', '波次 = 依赖层级的投影'],
899
+ ['波次投影 · 无依赖 = 第 1 波(中文)', '无依赖 = 第 1 波'],
900
+ ['波次投影 · 同波任务彼此无依赖(中文)', '同波任务必须彼此没有依赖'],
901
+ ['波次投影 · 用 depends_on 表达先后(中文)', '就写 `depends_on` 把顺序声明出来'],
902
+ ['波次投影 · 恢复出路两条(中文)', '把该任务移到第 N 波,或补 `depends_on` 把顺序声明出来'],
903
+ ['波次投影 · 解析不到即未校验(中文)', '未校验(无波次段)'],
904
+ ['波次投影 · replan 同源(中文)', '`replan` 重校走同一判据、同一报文'],
905
+ ['波次投影 · 不恢复旧形态约束(中文)', '不恢复旧的「并行块必须连续成组」形态约束'],
906
+ ['波次投影 · 段在场而内容不可判按分级(中文)', '波次划分段内容不可判'],
907
+ ['波次投影 · 未声明任务必须被 Wave 行覆盖(中文)', 'TASK 里的每个非修复族任务都必须被某个 Wave 行覆盖'],
908
+ ];
909
+ // plan 册专属:约束本体那一段只写在规划册(task 册讲同一判据的形态与出口,不复述「依赖面」的
910
+ // 限定)——放共享列表会让 task 册被要求出现它本来不该有的句子。
911
+ const planOnlyWaveAnchorsZh = [
912
+ ['波次投影 · 依赖面的合法性(中文)', '依赖面的合法性只取决于依赖图本身'],
913
+ ['波次投影 · 依赖面合法不等于波次合法(中文)', '依赖面合法不等于波次声明合法'],
914
+ ];
915
+ const waveAnchorsEn = [
916
+ ['波次投影 · 规则本体(英文)', 'Waves are a projection of dependency levels'],
917
+ ['波次投影 · 同波任务彼此无依赖(英文)', 'tasks in the same wave must not depend on one another'],
918
+ ['波次投影 · 解析不到即未校验(英文)', 'not checked (no wave section)'],
919
+ ['波次投影 · 不恢复旧形态约束(英文)', 'does not bring back the old "parallel blocks must be contiguous" shape constraint'],
920
+ ['波次投影 · 段在场而内容不可判按分级(英文)', 'no Wave line resolves to a real task'],
921
+ ['波次投影 · 未声明任务必须被 Wave 行覆盖(英文)', 'must be covered by some Wave line'],
922
+ ];
923
+ const acAnchorsZh = [
924
+ ['AC 覆盖 · review 汇总行(中文)', 'REVIEW WARN: TEST.md 的 1.1 测试矩阵缺 AC 覆盖: AC-…'],
925
+ ['AC 覆盖 · 恢复句(中文)', '在 TEST.md 的 1.1 测试矩阵为这些 AC 补行'],
926
+ ['AC 覆盖 · 判不了即未校验(中文)', '未校验(<原因>)'],
927
+ ['AC 覆盖 · 不改退出码(中文)', '不改变退出码'],
928
+ ['AC 覆盖 · 内容不可判按分级(中文)', 'AC 覆盖判据无法执行'],
929
+ ['AC 覆盖 · 内容不可判进 WARN 计数(中文)', '该行进入 WARN 计数'],
930
+ ];
931
+ const acAnchorsEn = [
932
+ ['AC 覆盖 · 判不了即未校验(英文)', 'not checked (<reason>)'],
933
+ ['AC 覆盖 · 恢复句(英文)', "add the rows to TEST.md's 1.1 test matrix"],
934
+ ['AC 覆盖 · 内容不可判按分级(英文)', 'the AC coverage rule cannot run'],
935
+ ];
936
+ const projectionBooks = [
937
+ ['flow-comet-plan/SKILL.md', [...planOnlyWaveAnchorsZh, ...waveAnchorsZh, ...waveAnchorsEn]],
938
+ ['flow-comet-task/SKILL.md', waveAnchorsZh],
939
+ ['flow-comet-review/SKILL.md', [...acAnchorsZh, ...acAnchorsEn]],
940
+ ];
941
+ const missingAnchors = (text, anchors) => anchors
942
+ .filter(([, target]) => !text.includes(target))
943
+ .map(([label]) => label);
944
+ for (const [rel, anchors] of projectionBooks) {
945
+ const text = fs.readFileSync(path.join(SCRIPTS_DIR, '..', '..', rel.split('/')[0], 'SKILL.md'), 'utf8');
946
+ for (const label of missingAnchors(text, anchors)) {
947
+ problems.push(rel + ' 缺「' + label + '」(本批判据的判别句式)');
948
+ }
949
+ for (const [label, target] of anchors) {
950
+ if (!text.includes(target)) continue; // 缺失已由真实判据报告,不叠第二条
951
+ const probed = text.split(target).join('(反向构造:抽掉)');
952
+ if (!missingAnchors(probed, anchors).includes(label)) {
953
+ problems.push('反向构造判别力缺失(' + rel + ' 抽掉「' + label + '」未被判缺)');
954
+ }
955
+ }
956
+ }
957
+ }
833
958
  // —— ⑤ Codex 平台事实与支持面(**判别句随 `worktree-notes.md` 移出技能树而迁入
834
959
  // `reference/platform-facts.md`**,ADR-016):判据 = 权威文件在场 + 判别句在权威处
835
960
  //(含被反驳引用形态、适用范围限定、fail-open / 未闭合的现判据)+ 各引用册指针在场 +
@@ -887,14 +1012,379 @@ export const ENTRIES = [
887
1012
  }
888
1013
  }
889
1014
  }
1015
+ // —— ⑥ 声明门禁的文档口径(入口册 + 入口展开册)——
1016
+ // 判据 = 「多 --prompt 形态」与「exit 全部覆盖」两组判别句逐条在其所属文档在场 + 旧的
1017
+ // 单 --prompt 声明口径零残留。锚取可辨认的整句片段,不取裸词(裸词「全部覆盖」「--prompt」
1018
+ // 在别处也出现,改宽即恒真);每条锚各配反向构造:抽掉所属文档里的该锚 ⇒ 必报缺该锚,
1019
+ // 把旧句子还原进任一册 ⇒ 必报残留。既有锚(分条等价 / 两层加载 / 模板权威)一条不删。
1020
+ // 恢复命令的锚落在**规范句**上(报文按协议派生、一次给全、照抄即通)——缺声明时的恢复形态是
1021
+ // 这段最容易被读成操作指引的地方,锚错句等于给已废弃的写法背书;旧的「补缺项、漏模板清单」
1022
+ // 写法只允许以「已废弃」的对照形态留在册子里(抽掉该标记,同一句就读回规范做法)。
1023
+ {
1024
+ const declarationBookRels = ['flow-comet/SKILL.md', 'flow-comet/reference/entry-detail.md'];
1025
+ const declarationDocAnchors = [
1026
+ ['入口册 · 一份命令可给多个 --prompt', 'flow-comet/SKILL.md',
1027
+ '一份命令可以给多个 `--prompt`'],
1028
+ ['入口册 · open 多协议示例(同行两个 --prompt)', 'flow-comet/SKILL.md',
1029
+ 'skill-load open flow-comet-change --prompt flow-kit/prompts/0-change.md --prompt flow-kit/prompts/1-requirement.md'],
1030
+ ['入口册 · exit 判据是全部覆盖', 'flow-comet/SKILL.md',
1031
+ 'exit 的判据是「全部覆盖」而不是「任一命中」'],
1032
+ ['入口册 · handoff-guarded 不在节点标记判据内', 'flow-comet/SKILL.md',
1033
+ '`handoff-guarded` 是子代理侧义务,由 Return Contract 负责,不在节点标记判据内'],
1034
+ ['展开册 · 一份命令可给多个 --prompt', 'flow-comet/reference/entry-detail.md',
1035
+ '一份命令可以给多个 `--prompt`'],
1036
+ ['展开册 · open 多协议示例(同行两个 --prompt)', 'flow-comet/reference/entry-detail.md',
1037
+ 'skill-load open flow-comet-change --prompt flow-kit/prompts/0-change.md --prompt flow-kit/prompts/1-requirement.md'],
1038
+ ['展开册 · 协议文件面逐份覆盖', 'flow-comet/reference/entry-detail.md',
1039
+ '该节点该读的**每一份**协议文件都要被声明过'],
1040
+ ['展开册 · 技能面逐份覆盖', 'flow-comet/reference/entry-detail.md',
1041
+ '都要有一个属于它的标记'],
1042
+ ['展开册 · handoff-guarded 不在判据内', 'flow-comet/reference/entry-detail.md',
1043
+ '**`handoff-guarded` 不在判据内**'],
1044
+ ['展开册 · 恢复命令按协议派生(每个必需技能各一条)', 'flow-comet/reference/entry-detail.md',
1045
+ '报文按**协议派生**给出该节点**每个** `guarded` 必需技能各一条命令'],
1046
+ ['展开册 · 恢复命令一次给全、照抄即通', 'flow-comet/reference/entry-detail.md',
1047
+ '三个面一次给全,照抄即通'],
1048
+ ['展开册 · 分级(新 BLOCKED / 旧 WARN)', 'flow-comet/reference/entry-detail.md',
1049
+ '新 change BLOCKED(强制全部覆盖)、旧 change 只 WARN'],
1050
+ ['展开册 · 旧单值标记按 basename 计入覆盖', 'flow-comet/reference/entry-detail.md',
1051
+ '照样按 basename 计入覆盖'],
1052
+ ];
1053
+ // 旧口径的两条判别形态:单 --prompt 的教学句、以及「每个协议文件对应一条声明命令」的
1054
+ // 分条强制句。收紧后两者都不成立(分条与合并等价),回流即红。
1055
+ const staleDeclarationSentences = [
1056
+ '每个协议文件对应一条声明命令',
1057
+ 'skill-load <node> <skill> --prompt flow-kit/prompts/<阶段>.md',
1058
+ ];
1059
+ // 旧的「只补缺项、漏模板清单」恢复形态**允许作为对照留档**,但只能以「已废弃」的对照形态
1060
+ // 出现:抽掉这个标记,同一句就被读回规范做法——规范句的两条锚判的是「规范句在不在」,判不了
1061
+ // 「旧句有没有被当成规范」,两句因此互为规范 / 对照的分界。
1062
+ const deprecatedRecoveryForm = 'skill-load <node> <skill> --prompt <缺的那份协议文件>';
1063
+ const deprecatedRecoveryMarker = '已废弃';
1064
+ const declarationDocProblems = (docs) => {
1065
+ const out = [];
1066
+ for (const [label, rel, anchor] of declarationDocAnchors) {
1067
+ const text = docs.get(rel);
1068
+ if (typeof text !== 'string') { out.push(rel + ' 不在场(' + label + ' 无法核对)'); continue; }
1069
+ if (!text.includes(anchor)) out.push(rel + ' 缺「' + label + '」');
1070
+ }
1071
+ for (const [rel, text] of docs) {
1072
+ if (typeof text !== 'string') continue;
1073
+ for (const stale of staleDeclarationSentences) {
1074
+ if (text.includes(stale)) out.push(rel + ' 残留旧声明口径「' + stale + '」');
1075
+ }
1076
+ // 旧恢复形态只允许留在对照句里:同句(以句号 / 换行为界)须带「已废弃」标记
1077
+ let from = 0;
1078
+ for (;;) {
1079
+ const at = text.indexOf(deprecatedRecoveryForm, from);
1080
+ if (at < 0) break;
1081
+ from = at + deprecatedRecoveryForm.length;
1082
+ const head = Math.max(text.lastIndexOf('。', at), text.lastIndexOf(String.fromCharCode(10), at));
1083
+ const stops = [text.indexOf('。', from), text.indexOf(String.fromCharCode(10), from)]
1084
+ .filter((index) => index >= 0);
1085
+ const sentence = text.slice(head + 1, stops.length > 0 ? Math.min(...stops) : text.length);
1086
+ if (!sentence.includes(deprecatedRecoveryMarker)) {
1087
+ out.push(rel + ' 把旧恢复形态写成规范做法(只允许作为「' + deprecatedRecoveryMarker + '」的对照保留)');
1088
+ }
1089
+ }
1090
+ }
1091
+ return out;
1092
+ };
1093
+ const declarationDocs = new Map(declarationBookRels.map((rel) => [rel,
1094
+ fs.readFileSync(path.join(SCRIPTS_DIR, '..', rel.replace('flow-comet/', '')), 'utf8')]));
1095
+ problems.push(...declarationDocProblems(declarationDocs));
1096
+ for (const [label, rel, anchor] of declarationDocAnchors) {
1097
+ const text = declarationDocs.get(rel);
1098
+ if (typeof text !== 'string' || !text.includes(anchor)) continue; // 缺失已由真实判据报告,不叠第二条
1099
+ const probed = new Map(declarationDocs).set(rel, text.split(anchor).join('(反向构造:抽掉)'));
1100
+ if (!declarationDocProblems(probed).some((p) => p.includes('缺「' + label + '」'))) {
1101
+ problems.push('反向构造判别力缺失(声明口径: 抽掉「' + label + '」未被判缺)');
1102
+ }
1103
+ }
1104
+ for (const stale of staleDeclarationSentences) {
1105
+ const probed = new Map(declarationDocs);
1106
+ for (const [rel, text] of declarationDocs) {
1107
+ if (typeof text === 'string') probed.set(rel, text + '\n' + stale + '\n');
1108
+ }
1109
+ if (!declarationDocProblems(probed).some((p) => p.includes('残留旧声明口径'))) {
1110
+ problems.push('反向构造判别力缺失(声明口径: 还原旧句「' + stale + '」未被判残留)');
1111
+ }
1112
+ }
1113
+ // 反向构造(旧形态的对照标记):摘掉「已废弃」⇒ 必报「把旧恢复形态写成规范做法」
1114
+ // (只在对照句确实在场时探;对照句被整句删掉是允许的)
1115
+ {
1116
+ const detailRel = 'flow-comet/reference/entry-detail.md';
1117
+ const detailText = declarationDocs.get(detailRel);
1118
+ if (typeof detailText === 'string' && detailText.includes(deprecatedRecoveryForm)
1119
+ && detailText.includes(deprecatedRecoveryMarker)) {
1120
+ const probed = new Map(declarationDocs)
1121
+ .set(detailRel, detailText.split(deprecatedRecoveryMarker).join('(对照)'));
1122
+ if (!declarationDocProblems(probed).some((p) => p.includes('把旧恢复形态写成规范做法'))) {
1123
+ problems.push('反向构造判别力缺失(声明口径: 摘掉旧形态的「'
1124
+ + deprecatedRecoveryMarker + '」对照标记未被判违规)');
1125
+ }
1126
+ }
1127
+ }
1128
+ }
1129
+ // —— ⑦ 文档口径与实现一致:入口只拦错路径 / 旧 change 按 `newChange` 标记分级 ——
1130
+ // 与实现逐条对账(不在断言里写第二份判据):
1131
+ // ① 入口侧的声明核对只判「已写下的每条声明是否落在节点协议面内」——缺失不在入口判;
1132
+ // 「该读的每份是否都声明过」只在出口判。两册必须这样写——旧口径「错路径与少声明都由入口拦」
1133
+ // 把出口的判据说成了入口的,读者会以为少声明也能在入口被挡下。
1134
+ // ② 旧 change 的分级判据是 `state.newChange === true`(`isNewChange`)——排障册不得再写成
1135
+ // 「本规则之前创建的 change」:那是拿时间猜判据,而判据只有一个输入(初始化标记在不在)。
1136
+ // 公开面不直写机器状态字段名(键名黑名单在场景 105),故文档侧一律写行为描述。
1137
+ // 判据 = 锚句逐条在其所属册在场 + 旧句零残留 + 排障册每处旧 change 分级句都按标记表述;
1138
+ // 反向构造:抽掉任一锚 ⇒ 必报缺该锚;还原旧句 / 摘掉某行的标记 ⇒ 必报残留或该行违规。
1139
+ {
1140
+ const skillRoot = path.join(SCRIPTS_DIR, '..');
1141
+ const wordingDocs = {
1142
+ entry: new Map([
1143
+ ['flow-comet/SKILL.md', fs.readFileSync(path.join(skillRoot, 'SKILL.md'), 'utf8')],
1144
+ ['flow-comet/reference/entry-detail.md',
1145
+ fs.readFileSync(path.join(skillRoot, 'reference', 'entry-detail.md'), 'utf8')],
1146
+ ]),
1147
+ troubleshooting: new Map(['docs/TROUBLESHOOTING.md', 'docs/TROUBLESHOOTING-zh.md',
1148
+ 'docs/MECHANISM.md', 'docs/MECHANISM-zh.md'].map((rel) => {
1149
+ const abs = path.join(REPO_ROOT, rel);
1150
+ return [rel, fs.existsSync(abs) ? fs.readFileSync(abs, 'utf8') : null];
1151
+ })),
1152
+ };
1153
+ const entrySideAnchors = [
1154
+ ['入口册 · 入口只拦错路径', 'flow-comet/SKILL.md', '入口只拦错路径'],
1155
+ ['入口册 · 缺失由出口拦', 'flow-comet/SKILL.md', '缺失由出口拦'],
1156
+ ['展开册 · 入口只判已写下的每条声明', 'flow-comet/reference/entry-detail.md',
1157
+ '入口只判「写下的每条声明对不对」'],
1158
+ ];
1159
+ const staleWording = {
1160
+ entry: ['错路径与少声明',
1161
+ '以及**该节点该读却没声明的那几份**,都会在下一次入口被拦下'],
1162
+ // 只收「按时间猜判据」的旧句;机制册里「旧 change 只告警」的其它行是行为描述,不在此列
1163
+ // (故机制册只做旧句零残留,不套逐行规则——否则会把正确的行为描述一起判红)。
1164
+ troubleshooting: {
1165
+ 'docs/TROUBLESHOOTING.md': ['created before this rule', 'created before the rule'],
1166
+ 'docs/TROUBLESHOOTING-zh.md': ['在本规则之前创建', '规则生效前创建'],
1167
+ 'docs/MECHANISM.md': ['created before the rule', 'created before this rule'],
1168
+ 'docs/MECHANISM-zh.md': ['规则生效之前创建', '在本规则之前创建'],
1169
+ },
1170
+ };
1171
+ // 排障册里每一处「旧 change 只告警」都别写成按时间判——判据只有「标记在不在」这一个输入。
1172
+ // 判别句不是键名而是**行为描述**:公开面不直写机器状态字段名(场景 105 的黑名单),
1173
+ // 所以文档只能写「初始化标记」这类说法——判据锚它,锚键名会与那条纪律直接打架。
1174
+ const markerWordingRules = {
1175
+ 'docs/TROUBLESHOOTING.md': { line: /\bchange\b[^.]*\bwarn/i, marker: 'initialization marker' },
1176
+ 'docs/TROUBLESHOOTING-zh.md': { line: /change[^。]*只告警/, marker: '初始化标记' },
1177
+ };
1178
+ // 单一判据实现:真实核对与反向构造探针共用(两份实现必然分叉)。
1179
+ const wordingProblems = ({ entry, troubleshooting }) => {
1180
+ const out = [];
1181
+ for (const [label, rel, anchor] of entrySideAnchors) {
1182
+ const text = entry.get(rel);
1183
+ if (typeof text !== 'string') { out.push(rel + ' 不在场(' + label + ' 无法核对)'); continue; }
1184
+ if (!text.includes(anchor)) out.push(rel + ' 缺「' + label + '」');
1185
+ }
1186
+ for (const [rel, text] of entry) {
1187
+ if (typeof text !== 'string') continue;
1188
+ for (const stale of staleWording.entry) {
1189
+ if (text.includes(stale)) out.push(rel + ' 残留旧口径「' + stale + '」');
1190
+ }
1191
+ }
1192
+ for (const [rel, text] of troubleshooting) {
1193
+ if (typeof text !== 'string') continue;
1194
+ for (const stale of (staleWording.troubleshooting[rel] || [])) {
1195
+ if (text.includes(stale)) out.push(rel + ' 残留旧口径「' + stale + '」');
1196
+ }
1197
+ const rule = markerWordingRules[rel];
1198
+ if (!rule) continue; // 该册只做旧句零残留(机制册:其余「告警」句是行为描述)
1199
+ text.split(String.fromCharCode(10)).forEach((line, index) => {
1200
+ if (!rule.line.test(line)) return;
1201
+ if (!line.includes(rule.marker)) {
1202
+ out.push(rel + ' 第 ' + (index + 1) + ' 行把旧 change 分级写成按时间判(缺「' + rule.marker + '」标记)');
1203
+ }
1204
+ });
1205
+ }
1206
+ return out;
1207
+ };
1208
+ const missingTroubleshootingFaces = [...wordingDocs.troubleshooting]
1209
+ .filter(([, text]) => text === null).map(([rel]) => rel);
1210
+ if (missingTroubleshootingFaces.length > 0) {
1211
+ console.log('SKIP: 184 的文档口径锚(' + missingTroubleshootingFaces.join(', ') + ')——本次检出无该公开文档面,'
1212
+ + '未校验「旧 change 分级句按初始化标记表述」,请在权威源检出重跑本套件');
1213
+ }
1214
+ problems.push(...wordingProblems(wordingDocs));
1215
+ // 反向构造 ①:抽掉任一入口侧锚 ⇒ 必报缺该锚
1216
+ for (const [label, rel, anchor] of entrySideAnchors) {
1217
+ const text = wordingDocs.entry.get(rel);
1218
+ if (!text.includes(anchor)) continue; // 缺失已由真实判据报告,不叠第二条
1219
+ const probed = {
1220
+ entry: new Map(wordingDocs.entry).set(rel, text.split(anchor).join('(反向构造:抽掉)')),
1221
+ troubleshooting: wordingDocs.troubleshooting,
1222
+ };
1223
+ if (!wordingProblems(probed).some((p) => p.includes('缺「' + label + '」'))) {
1224
+ problems.push('反向构造判别力缺失(文档口径: 抽掉「' + label + '」未被判缺)');
1225
+ }
1226
+ }
1227
+ // 反向构造 ②:把任一入口侧的旧口径还原进任一册 ⇒ 必报残留
1228
+ for (const stale of staleWording.entry) {
1229
+ const probed = { entry: new Map(), troubleshooting: wordingDocs.troubleshooting };
1230
+ for (const [rel, text] of wordingDocs.entry) probed.entry.set(rel, text + String.fromCharCode(10) + stale);
1231
+ if (!wordingProblems(probed).some((p) => p.includes('残留旧口径'))) {
1232
+ problems.push('反向构造判别力缺失(文档口径: 还原旧句「' + stale + '」未被判残留)');
1233
+ }
1234
+ }
1235
+ // 反向构造 ③:公共文档面——还原按时间判的旧句、摘掉某行的标记 ⇒ 必报残留 / 必报该行
1236
+ for (const [rel, text] of wordingDocs.troubleshooting) {
1237
+ if (typeof text !== 'string') continue;
1238
+ const staleSentence = staleWording.troubleshooting[rel][0];
1239
+ const restored = { entry: wordingDocs.entry,
1240
+ troubleshooting: new Map(wordingDocs.troubleshooting).set(rel, text + String.fromCharCode(10) + staleSentence) };
1241
+ if (!wordingProblems(restored).some((p) => p.includes(rel + ' 残留旧口径'))) {
1242
+ problems.push('反向构造判别力缺失(' + rel + ': 还原旧句「' + staleSentence + '」未被判残留)');
1243
+ }
1244
+ const rule = markerWordingRules[rel];
1245
+ if (!rule) continue; // 只做旧句零残留的册(机制册)不走逐行探针
1246
+ const lines = text.split(String.fromCharCode(10));
1247
+ const hitIndex = lines.findIndex((line) => rule.line.test(line) && line.includes(rule.marker));
1248
+ if (hitIndex < 0) {
1249
+ problems.push('反向构造的前提不成立(' + rel + ': 找不到按标记表述旧 change 分级的行)');
1250
+ continue;
1251
+ }
1252
+ const mutated = lines.slice();
1253
+ mutated[hitIndex] = mutated[hitIndex].split(rule.marker).join('(标记)');
1254
+ const stripped = { entry: wordingDocs.entry,
1255
+ troubleshooting: new Map(wordingDocs.troubleshooting)
1256
+ .set(rel, mutated.join(String.fromCharCode(10))) };
1257
+ if (!wordingProblems(stripped).some((p) => p.includes('第 ' + (hitIndex + 1) + ' 行'))) {
1258
+ problems.push('反向构造判别力缺失(' + rel + ': 摘掉第 ' + (hitIndex + 1) + ' 行的标记未被判违规)');
1259
+ }
1260
+ }
1261
+ }
1262
+ // —— ⑧ 文档口径与实现一致:判不了的二分与「波次未校验 / TASK 段形门」分写 ——
1263
+ // 两处口径都曾与实现分叉,且都是「文档比实现旧」而不是实现坏了:
1264
+ // ① 载体缺席曾被写成五件事(含「没有验收段 / 没有承载矩阵的第 1 轮段」)。承载段被删属
1265
+ // 「内容不可判」——新 change BLOCKED、旧 change WARN 并进 WARN 计数;载体缺席只剩三件事:
1266
+ // 缺 REQUIREMENT、缺 TEST.md、缺模板。作者能动的东西(段在不在)不是「无从判断」。
1267
+ // ② 「完全没有波次段」曾只留一句「未校验、不改退出码」。那是波次判据自己的结论,不是整个
1268
+ // 出口的结论:模板要求而工件里没有的段由 TASK 段形门判,plan 出口与受控 replan 重签跑
1269
+ // 同一套骨架判据(缺段 ⇒ 新 change BLOCKED / 旧 change WARN)。两条边界分开写,读者才
1270
+ // 不会以为「删段」是绕过波次判据的写法。
1271
+ // 判据 = 每处新口径在其所属文档逐条在场 + 旧口径零残留;实现侧同源核对 = 载体缺席的成因集合
1272
+ // 仍由 ac-coverage 的成因表表达(三条,且两条「承载段被删」属内容不可判)——成因集合一变,
1273
+ // 本节先红,逼着文档与锚同批跟上。反向构造:抽掉任一新句 ⇒ 必报缺;把旧口径还原进任一册 ⇒
1274
+ // 必报残留(探针与真实判据共用同一判据实现,不另写第二份)。
1275
+ {
1276
+ const reviewBook = fs.readFileSync(
1277
+ path.join(SCRIPTS_DIR, '..', '..', 'flow-comet-review', 'SKILL.md'), 'utf8');
1278
+ const publicFaceRels = ['CHANGELOG.md', 'CHANGELOG-zh.md', 'docs/MECHANISM.md', 'docs/MECHANISM-zh.md',
1279
+ 'docs/TROUBLESHOOTING.md', 'docs/TROUBLESHOOTING-zh.md'];
1280
+ const publicFaces = new Map(publicFaceRels.map((rel) => {
1281
+ const abs = path.join(REPO_ROOT, rel);
1282
+ return [rel, fs.existsSync(abs) ? fs.readFileSync(abs, 'utf8') : null];
1283
+ }));
1284
+ const absentFaces = [...publicFaces].filter(([, text]) => text === null).map(([rel]) => rel);
1285
+ if (absentFaces.length > 0) {
1286
+ console.log('SKIP: 184 的判不了口径锚(' + absentFaces.join(', ') + ')——本次检出无该公开文档面,'
1287
+ + '未校验「载体缺席三分 / 波次未校验与 TASK 段形门分写」,请在权威源检出重跑本套件');
1288
+ }
1289
+ const wordingCase = (rel, text, required, stale) => ({ rel, text, required, stale });
1290
+ const wordingCases = [
1291
+ wordingCase('flow-comet-review/SKILL.md(中文侧)', reviewBook, [
1292
+ '**模板缺席**(段名无从派生)→ 打印「未校验(<原因>)」且不改退出码',
1293
+ '**change 自己的载体文件本身缺席**(`REQUIREMENT.md` 缺席 / `TEST.md` 缺席)',
1294
+ '验收准则段被删掉',
1295
+ '围栏代码块里的示例行也不算覆盖',
1296
+ ], ['**载体缺席**(`REQUIREMENT.md` 缺席 / 无验收准则段 / `TEST.md` 缺席 / 无第 1 轮承载段 / 模板缺席)']),
1297
+ wordingCase('flow-comet-review/SKILL.md(英文侧)', reviewBook, [
1298
+ 'a missing template — the section names cannot be derived — prints "not checked (<reason>)" and keeps the exit code',
1299
+ 'a carrier document of the change itself being gone — `REQUIREMENT.md` absent or `TEST.md` absent',
1300
+ 'the acceptance section deleted from `REQUIREMENT.md`',
1301
+ 'a sample row inside a fenced code block counts as neither coverage nor a declared criterion',
1302
+ ], ['a missing carrier — `REQUIREMENT.md` absent, `TEST.md` absent, or the template absent']),
1303
+ wordingCase('CHANGELOG.md', publicFaces.get('CHANGELOG.md'), [
1304
+ '**only the template missing** (the section names cannot be derived) is reported as not checked with the exit code untouched',
1305
+ '**a carrier document of the change itself missing (`REQUIREMENT.md` / `TEST.md`)**',
1306
+ 'a deleted acceptance section',
1307
+ '**A sample row inside a fenced code block counts as neither coverage nor a declaration**',
1308
+ ], ['no acceptance section, no round-1 section', 'no requirement document, no test document, no template']),
1309
+ wordingCase('CHANGELOG-zh.md', publicFaces.get('CHANGELOG-zh.md'), [
1310
+ '**模板缺席**(段名无从派生)才明说未校验、不改退出码',
1311
+ '**change 自己的 `REQUIREMENT.md` / `TEST.md` 缺席**',
1312
+ '验收段被删掉',
1313
+ '围栏代码块里的示例行既不算覆盖也不构成声明',
1314
+ ], ['载体缺席只指三件事——缺 REQUIREMENT、缺 TEST.md、缺模板', '缺 REQUIREMENT、缺 TEST.md、缺模板、没有验收段、没有承载矩阵的第 1 轮段']),
1315
+ wordingCase('docs/MECHANISM.md', publicFaces.get('docs/MECHANISM.md'), [
1316
+ 'does not block on that ground',
1317
+ 'also runs when a plan is re-signed through a controlled `replan`',
1318
+ '**Only the template missing** — the section names cannot be derived — is reported as not checked and leaves the exit code alone',
1319
+ '**A carrier document of the change itself missing (`REQUIREMENT.md` / `TEST.md`) is content the check cannot judge**',
1320
+ '**A sample row inside a fenced code block is not coverage**',
1321
+ ], ['is reported as not checked and keeps its exit code',
1322
+ 'A missing carrier — no requirement document, no test document, no template to derive the section names from']),
1323
+ wordingCase('docs/MECHANISM-zh.md', publicFaces.get('docs/MECHANISM-zh.md'), [
1324
+ '它报「未校验」、也不据此阻断',
1325
+ '这道门在 plan 出口与受控 `replan` 重签时都会跑',
1326
+ '**模板缺席**(段名无从派生)才报「未校验」、不改退出码',
1327
+ '**change 自己的 `REQUIREMENT.md` / `TEST.md` 缺席属内容不可判**',
1328
+ '围栏代码块里的示例行不算覆盖',
1329
+ ], ['而完全没有波次段时,报「未校验」且不改变退出码',
1330
+ '载体缺席——没有需求文档、没有测试文档、没有可派生段名的模板']),
1331
+ wordingCase('docs/TROUBLESHOOTING.md', publicFaces.get('docs/TROUBLESHOOTING.md'), [
1332
+ 'the TASK section-shape gate judges its absence',
1333
+ 'again when the plan is re-signed through `replan`',
1334
+ 'Only the **template missing** (the section names cannot be derived) is reported as not checked and leaves the exit code alone',
1335
+ '**a carrier document of the change itself missing (`REQUIREMENT.md` / `TEST.md`) is content the check cannot judge**',
1336
+ '**A sample row inside a fenced code block is not coverage**',
1337
+ ], ['and keeps its exit code',
1338
+ 'a carrier is missing only when the requirement document, the test document or the template the section names are derived from is not there at all']),
1339
+ wordingCase('docs/TROUBLESHOOTING-zh.md', publicFaces.get('docs/TROUBLESHOOTING-zh.md'), [
1340
+ '缺段仍由 TASK 段形门判定',
1341
+ '这道门在 plan 出口与 `replan` 重签时都会跑',
1342
+ '只有**模板缺席**(段名无从派生)才报「未校验」、不改退出码',
1343
+ '**change 自己的 `REQUIREMENT.md` / `TEST.md` 缺席属内容不可判**',
1344
+ '围栏代码块里的示例行不算覆盖',
1345
+ ], ['完全没有波次段时打印「未校验(无波次段)」、不改变退出码',
1346
+ '而载体缺席只指三件事:缺 REQUIREMENT、缺 TEST.md、缺可派生段名的模板']),
1347
+ ].filter((item) => item.text !== null);
1348
+ problems.push(...docWordingChecks(wordingCases));
1349
+ // 实现侧同源核对:成因集合由 ac-coverage 的两张成因表表达——**未校验一侧只剩模板缺席**
1350
+ // (模板不是 change 的文件),**内容不可判一侧含 change 自己的两个载体文件缺席**与两条
1351
+ // 「承载段被删」的成因。三件事任一漂移(成因搬家 / 改判 / 少一条),本节先红,逼着六处
1352
+ // 文档口径与锚同批跟上。取不到表即报告前提失效(不静默当「没变化」)。
1353
+ const acCoverageText = engineScriptTexts().get('lib/ac-coverage.mjs') ?? '';
1354
+ const carrierCauses = literalObjectKeys(acCoverageText, 'UNVERIFIED_EXPLANATIONS');
1355
+ const contentCauses = literalObjectKeys(acCoverageText, 'UNJUDGEABLE_CAUSES');
1356
+ if (carrierCauses === null || contentCauses === null) {
1357
+ problems.push('实现侧成因表取不到(ac-coverage 的载体缺席 / 内容不可判成因表)——文档的两分口径无从对账');
1358
+ } else {
1359
+ if (carrierCauses.length !== 1 || carrierCauses[0] !== '模板缺席(段名无从派生)') {
1360
+ problems.push('「未校验」一侧不再只剩模板缺席(实现 ' + carrierCauses.length + ' 条: '
1361
+ + carrierCauses.join('、') + ')——文档「只有模板缺席报未校验」的口径要同批改');
1362
+ }
1363
+ const documentCauses = contentCauses.filter((cause) => cause === 'REQUIREMENT 缺席'
1364
+ || cause === 'TEST.md 缺席');
1365
+ if (documentCauses.length !== 2) {
1366
+ problems.push('change 自己的载体文件缺席没有落在「内容不可判」一侧(实现: '
1367
+ + contentCauses.join('、') + ')——删文件换到「未校验」放行的口子必须继续关着');
1368
+ }
1369
+ const deletedSectionCauses = contentCauses.filter((cause) => cause.includes('无验收准则段')
1370
+ || cause.includes('无第 1 轮段'));
1371
+ if (deletedSectionCauses.length !== 2) {
1372
+ problems.push('承载段被删的成因不再落在「内容不可判」一侧(实现: ' + contentCauses.join('、')
1373
+ + ')——文档把它写成载体缺席或另立一支都要重判');
1374
+ }
1375
+ }
1376
+ }
890
1377
  if (problems.length > 0) throw new Error('技能文本锁(纪律判别句式族)不符: ' + problems.join('; '));
891
1378
  },
892
1379
  },
893
1380
 
894
1381
  // 184d: 三块归一处(ADR-016)——pathspec / 集成纪律归 `reference/commit-discipline.md`、四属性
895
1382
  // 契约归入口册与平台事实册;「要点句在场 + 权威处唯一 + 判别句不再要求两册逐字一致」。
1383
+ // 原位扩展(反馈面纪律):两册各自的流程步骤须含「每任务预检」(跑完整出口门禁但不带 --apply、
1384
+ // 不推进状态)与「先 request 成功再启动子代理」的硬顺序句(禁放进同一个并发调用;如实注明是
1385
+ // 执行纪律而非机制拦截),中英双语同册一致;每条锚自带反向构造(抽掉即红)。
896
1386
  {
897
- name: '184d 技能文本锁:三块归一处与委托契约纪律要点句',
1387
+ name: '184d 技能文本锁:三块归一处、委托契约纪律要点句与每任务预检顺序',
898
1388
  run: () => {
899
1389
  const problems = [];
900
1390
  // —— ⑥ 三块归一处(ADR-016):原「两册三块逐字一致(切片 ≥400 字符)+ 两册各持 41 条判别句」
@@ -917,6 +1407,24 @@ export const ENTRIES = [
917
1407
  ]);
918
1408
  const disciplineSources = { books: bookTexts, elementDocs, authorityTexts };
919
1409
  problems.push(...delegationDisciplineProblems(disciplineSources));
1410
+ // 入口册的提交形态(存在性 + 反否定):两册与权威处的要素 token 都被锁,入口册那一行却没有
1411
+ // ——退回「`git commit -- <路径>`」(不给 -m)时套件不会红。反向构造常驻:抽掉要点句、把
1412
+ // 那一行换回旧形态,两种改动都必须被判红(后者就是本次实测的反向构造形态)。
1413
+ const entryCommitText = authorityTexts.get(ENTRY_COMMIT_FORM_REL);
1414
+ problems.push(...entryCommitFormProblems(ENTRY_COMMIT_FORM_REL, entryCommitText));
1415
+ // 反向构造以要点句在场为前提(缺失已由真实判据报告——同一处不叠两条,与上方各组同一写法)。
1416
+ if (entryCommitText.includes(COMMIT_FORM_TOKEN)) {
1417
+ const withoutCommitForm = entryCommitText.split(COMMIT_FORM_TOKEN).join('');
1418
+ if (!entryCommitFormProblems(ENTRY_COMMIT_FORM_REL, withoutCommitForm)
1419
+ .some((p) => p.includes('缺带消息的提交形态要点句'))) {
1420
+ problems.push('反向构造判别力缺失(抽掉入口册提交形态要点句未被判缺)');
1421
+ }
1422
+ const revertedCommitForm = entryCommitText.split(COMMIT_FORM_TOKEN).join('`git commit -- <同一路径>`');
1423
+ if (!entryCommitFormProblems(ENTRY_COMMIT_FORM_REL, revertedCommitForm)
1424
+ .some((p) => p.includes('缺 `-m` 的旧提交形态'))) {
1425
+ problems.push('反向构造判别力缺失(把入口册那一行换回缺 -m 的旧形态未被判违规)');
1426
+ }
1427
+ }
920
1428
  // 反向构造(同一判据驱动):逐条抽掉 ⇒ 必报;逐条回流 ⇒ 必报。判别力不依赖人工实验:
921
1429
  // 要素级 token / 权威处判别句 / 能力契约判别句 / 条件句指针 / 证据与判级判别句五组各取全量。
922
1430
  const subRel = 'flow-comet-subagent-execute/SKILL.md';
@@ -1188,6 +1696,77 @@ export const ENTRIES = [
1188
1696
  problems.push('反向构造判别力缺失(' + probeLabel + ' 未被判不一致)');
1189
1697
  }
1190
1698
  }
1699
+ // —— 每任务预检(--preflight)+ 委托顺序纪律 + 节点视图三字段(文本锁 · 两册中英双语)——
1700
+ // 判据 = 三组关键句在**两册各自**的正文里逐条在案:预检(--preflight 只跑结构门禁 / 只读不写
1701
+ // state 与账本 / 完整 exit 仍是全链预演)、委托顺序(先 request 成功再启动子代理 / 禁放进同一个
1702
+ // 并发调用 / 纪律不是机制拦截)、节点视图三字段(currentNode 产物推导 / stateCurrentNode 原值 /
1703
+ // routeNode 路由视图 / Fix 批次以 FIX-BATCH 行与 next 的 NODE 为准),中英各一份。
1704
+ // 反向构造:逐册逐句抽掉 ⇒ 必报该册缺该句(抽掉用全量 split/join,不是只替换首处)。
1705
+ {
1706
+ const preflightOrderAnchors = [
1707
+ ['每任务预检 · 用 --preflight(中文)', '每任务预检(`--preflight` · 只报结构问题)'],
1708
+ ['每任务预检 · 只跑结构门禁(中文)', '它只跑**结构性门禁**'],
1709
+ ['每任务预检 · 不写 state 与账本(中文)', '不推进状态、不写 state、也不写模板提示账本'],
1710
+ ['每任务预检 · 完整 exit 仍是全链预演(中文)', '**完整 `exit`(不带 `--apply`)仍是节点收尾的全链预演**'],
1711
+ ['每任务预检(英文)', '**Per-task preflight (`--preflight`, structural only)**'],
1712
+ ['每任务预检 · 只跑结构门禁(英文)', 'it runs only the structural gates'],
1713
+ ['每任务预检 · 不写 state 与账本(英文)', 'does not write workflow state, and does not write the template hint ledger'],
1714
+ ['每任务预检 · 完整 exit 仍是全链预演(英文)', "the **full `exit` without `--apply` remains the node's whole-chain rehearsal**"],
1715
+ ['委托顺序 · 先 request 后委托(中文)', '先让 request 成功,再启动子代理'],
1716
+ ['委托顺序 · 禁同一并发调用(中文)', '禁止把 request 与子代理启动放进同一个并发调用'],
1717
+ ['委托顺序 · 纪律不是拦截(中文)', '这是执行纪律,不是机制拦截'],
1718
+ ['委托顺序(英文)', 'a successful request first, then launch the subagent'],
1719
+ ['委托顺序 · 禁同一并发调用(英文)', 'never inside one concurrent call'],
1720
+ ['委托顺序 · 纪律不是拦截(英文)', 'execution discipline, not a mechanism interception'],
1721
+ ];
1722
+ const nodeFieldAnchors = [
1723
+ ['节点视图 · currentNode 产物推导(中文)', '**currentNode** = **产物推导**'],
1724
+ ['节点视图 · stateCurrentNode 原值(中文)', '**stateCurrentNode** = **state 文件原值**'],
1725
+ ['节点视图 · routeNode 路由视图(中文)', '**routeNode** = **路由视图**'],
1726
+ ['节点视图 · Fix 批次以 FIX-BATCH 与 next 为准(中文)', '**Fix 批次以 `FIX-BATCH` 行与 `next` 的 `NODE` 为准**'],
1727
+ ['节点视图 · currentNode 产物推导(英文)', '**currentNode** = artifact-derived'],
1728
+ ['节点视图 · stateCurrentNode 原值(英文)', '**stateCurrentNode** = the raw state-file value'],
1729
+ ['节点视图 · routeNode 路由视图(英文)', '**routeNode** = the routing view'],
1730
+ ['节点视图 · Fix batch(英文)', '**For a Fix batch, trust the `FIX-BATCH` line and the `NODE` printed by `next`**'],
1731
+ ];
1732
+ // 委托记账与委托顺序分工(本批):两册各自须写清「`result` 需要 request 是机制保证」与
1733
+ // 「request 与子代理启动的先后仍是执行纪律」两件事——旧表述把前者写成「经验/事实陈述」,
1734
+ // 读者会以为补 request 只是顺序纪律;后者那句(平台层无挂点)保持原文。
1735
+ const delegationLedgerAnchors = [
1736
+ ['委托记账 · result 写盘前校验 request(中文)', '`result` 在写盘前校验该任务存在 request 记录'],
1737
+ // 恢复指引描述的是引擎**打印出来的形态**(命令单独成行 + description 可省略):书册照抄旧句子时,
1738
+ // 读者会照着一个脚本名去敲(bash 下缺路径 = command not found),文字与引擎两套说法。
1739
+ ['委托记账 · 恢复句(中文)', '先照抄下面的命令记录委托(`description` 可省略),再重录 result'],
1740
+ ['委托记账 · 零提交与只交 SUMMARY 同拦(中文)', '两种形态同样被拦'],
1741
+ ['委托记账 · 判定先于零提交与子集校验(中文)', '该校验先于零提交语义与提交子集校验'],
1742
+ ['委托顺序 · 两件事别混(中文)', '本条管的是「request 与子代理启动的先后」'],
1743
+ ['result 需 request · 机制保证(英文)', 'is a mechanism guarantee'],
1744
+ ['委托记账 · 写盘前拒绝(英文)', 'refused before anything is written (a new change blocks'],
1745
+ ['委托顺序 · 两件事别混(英文)', 'this rule is about the order of the request and the subagent launch'],
1746
+ ];
1747
+ const bookAnchorProblems = (books, anchors) => {
1748
+ const out = [];
1749
+ for (const [rel, text] of books) {
1750
+ for (const [label, anchor] of anchors) {
1751
+ if (!text.includes(anchor)) {
1752
+ out.push(rel + ' 缺「' + label + '」(关键句不在场:' + anchor.slice(0, 28) + '…)');
1753
+ }
1754
+ }
1755
+ }
1756
+ return out;
1757
+ };
1758
+ for (const [groupLabel, anchors] of [['预检与委托顺序', preflightOrderAnchors], ['节点视图三字段', nodeFieldAnchors], ['委托记账与委托顺序分工', delegationLedgerAnchors]]) {
1759
+ problems.push(...bookAnchorProblems(bookTexts, anchors));
1760
+ for (const [rel, text] of bookTexts) {
1761
+ for (const [label, anchor] of anchors) {
1762
+ const probed = new Map(bookTexts).set(rel, text.split(anchor).join('(反向构造:抽掉)'));
1763
+ if (!bookAnchorProblems(probed, anchors).some((p) => p.startsWith(rel) && p.includes(label))) {
1764
+ problems.push('反向构造判别力缺失(' + groupLabel + ':' + rel + ' 抽掉「' + label + '」未被判缺)');
1765
+ }
1766
+ }
1767
+ }
1768
+ }
1769
+ }
1191
1770
  }
1192
1771
  if (problems.length > 0) throw new Error('技能文本锁(三块归一处族)不符: ' + problems.join('; '));
1193
1772
  },