@aibyzero/cm-workflow 0.17.0 → 0.18.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 (372) hide show
  1. package/.codex-plugin/plugin.json +1 -1
  2. package/AGENTS.md +27 -0
  3. package/CHANGELOG.md +230 -1
  4. package/CONTRIBUTING.md +47 -0
  5. package/README.md +21 -3
  6. package/THIRD_PARTY_NOTICES.md +13 -0
  7. package/VERSION +1 -1
  8. package/compat/claude-commands/cm-challenge.md +3 -0
  9. package/docs/architecture.md +40 -13
  10. package/docs/cm-control-policy-v2.md +127 -9
  11. package/docs/fixes/20261013-claude-preinit-ui-invalidate.md +48 -0
  12. package/docs/installation.md +310 -4
  13. package/docs/js-workflow-control.md +153 -16
  14. package/docs/live-evidence-drivers.md +28 -4
  15. package/docs/out-of-scope/README.md +25 -0
  16. package/docs/out-of-scope/background-supervisor.md +32 -0
  17. package/docs/reviewed-integration.md +48 -0
  18. package/docs/user-guide.md +50 -21
  19. package/install-codex.sh +331 -18
  20. package/install.ps1 +28 -2
  21. package/install.sh +321 -17
  22. package/package.json +2 -1
  23. package/runtime/js/cm-ai/batch-location.mjs +55 -0
  24. package/runtime/js/cm-ai/batch-plan.mjs +242 -0
  25. package/runtime/js/cm-ai/checkpoint-package-material.mjs +162 -0
  26. package/runtime/js/cm-ai/claude-developer-proposal.schema.json +55 -1
  27. package/runtime/js/cm-ai/claude-review-stream.mjs +94 -21
  28. package/runtime/js/cm-ai/claude-tool-preview.mjs +11 -9
  29. package/runtime/js/cm-ai/cm-ai-admission.mjs +18 -12
  30. package/runtime/js/cm-ai/cm-ai-conversation-entry.mjs +91 -6
  31. package/runtime/js/cm-ai/cm-ai-qa-log.mjs +5 -1
  32. package/runtime/js/cm-ai/codex-config.mjs +6 -2
  33. package/runtime/js/cm-ai/codex-developer-basic-output.schema.json +3 -2
  34. package/runtime/js/cm-ai/codex-developer-output.schema.json +2 -1
  35. package/runtime/js/cm-ai/codex-reconnect-notice.mjs +6 -0
  36. package/runtime/js/cm-ai/codex-review-adapter.mjs +27 -7
  37. package/runtime/js/cm-ai/control-policy.mjs +24 -6
  38. package/runtime/js/cm-ai/developer-adapter.mjs +19 -5
  39. package/runtime/js/cm-ai/drive-core.mjs +236 -34
  40. package/runtime/js/cm-ai/drive-rate-limit.mjs +105 -0
  41. package/runtime/js/cm-ai/durable-runner-state.mjs +234 -33
  42. package/runtime/js/cm-ai/effect-contract.mjs +11 -2
  43. package/runtime/js/cm-ai/execution-policy.mjs +3 -1
  44. package/runtime/js/cm-ai/execution-snapshot.mjs +4 -2
  45. package/runtime/js/cm-ai/execution-store-limits.mjs +14 -7
  46. package/runtime/js/cm-ai/execution-store.mjs +60 -17
  47. package/runtime/js/cm-ai/fix-code-association.mjs +73 -2
  48. package/runtime/js/cm-ai/host-check.mjs +14 -6
  49. package/runtime/js/cm-ai/host-conversation-execution.mjs +70 -28
  50. package/runtime/js/cm-ai/host-qa-executor.mjs +38 -5
  51. package/runtime/js/cm-ai/host-qa-fix-owner.mjs +2 -2
  52. package/runtime/js/cm-ai/host-qa-policy.mjs +19 -2
  53. package/runtime/js/cm-ai/host-replay.mjs +148 -0
  54. package/runtime/js/cm-ai/host-session.mjs +42 -9
  55. package/runtime/js/cm-ai/host-stage-observer.mjs +26 -0
  56. package/runtime/js/cm-ai/host-tool-bridge.mjs +22 -9
  57. package/runtime/js/cm-ai/host-workflow-capabilities.mjs +19 -2
  58. package/runtime/js/cm-ai/host.mjs +1 -1
  59. package/runtime/js/cm-ai/implicit-qa-decision.mjs +5 -0
  60. package/runtime/js/cm-ai/integration-snapshots.mjs +50 -0
  61. package/runtime/js/cm-ai/live-evidence.mjs +28 -6
  62. package/runtime/js/cm-ai/operator-guidance.mjs +63 -30
  63. package/runtime/js/cm-ai/owned-process-cleanup.mjs +27 -9
  64. package/runtime/js/cm-ai/process-group-exit.mjs +46 -0
  65. package/runtime/js/cm-ai/provider-review-observation.mjs +3 -2
  66. package/runtime/js/cm-ai/qa-attachment.mjs +22 -0
  67. package/runtime/js/cm-ai/qa-config-revision.mjs +7 -2
  68. package/runtime/js/cm-ai/requirement-evidence.mjs +102 -0
  69. package/runtime/js/cm-ai/review-package.mjs +79 -7
  70. package/runtime/js/cm-ai/review-presentation-delta.mjs +166 -0
  71. package/runtime/js/cm-ai/review-presentation.mjs +177 -8
  72. package/runtime/js/cm-ai/reviewed-evidence-supersede.mjs +70 -2
  73. package/runtime/js/cm-ai/reviewed-integration.mjs +260 -0
  74. package/runtime/js/cm-ai/scope-revision.mjs +38 -0
  75. package/runtime/js/cm-ai/specification-material.mjs +2 -2
  76. package/runtime/js/cm-ai/task-runner.mjs +247 -41
  77. package/runtime/js/cm-ai/verification-auto.mjs +38 -0
  78. package/runtime/js/cm-ai/worker-claude-developer.mjs +39 -15
  79. package/runtime/js/cm-ai/worker-claude.mjs +35 -13
  80. package/runtime/js/cm-ai/worker-codex-developer.mjs +43 -17
  81. package/runtime/js/cm-ai/worker-codex.mjs +41 -7
  82. package/runtime/js/cm-fix/cause-invocation.mjs +16 -2
  83. package/runtime/js/cm-fix/cause-package.mjs +46 -1
  84. package/runtime/js/cm-fix/command-correction.mjs +37 -0
  85. package/runtime/js/cm-fix/cooperative.mjs +12 -0
  86. package/runtime/js/cm-fix/dossier.mjs +8 -2
  87. package/runtime/js/cm-fix/execution.mjs +578 -100
  88. package/runtime/js/cm-fix/final-review.mjs +39 -8
  89. package/runtime/js/cm-fix/finish.mjs +15 -11
  90. package/runtime/js/cm-fix/host-review.mjs +65 -10
  91. package/runtime/js/cm-fix/host.mjs +35 -12
  92. package/runtime/js/cm-fix/jest-command-correction.mjs +69 -0
  93. package/runtime/js/cm-fix/metrics.mjs +18 -5
  94. package/runtime/js/cm-fix/regression-evidence.mjs +3 -2
  95. package/runtime/js/cm-fix/regression.mjs +16 -7
  96. package/runtime/js/cm-fix/repair.mjs +29 -8
  97. package/runtime/js/cm-fix/review-verification-command.mjs +135 -0
  98. package/runtime/js/cm-fix/review-verification-contract.mjs +54 -0
  99. package/runtime/js/cm-fix/review-verification-diagnostic.mjs +75 -0
  100. package/runtime/js/cm-fix/review-verification-recovery.mjs +44 -0
  101. package/runtime/js/cm-fix/review-verification-server.mjs +38 -0
  102. package/runtime/js/cm-fix/review-verification.mjs +214 -0
  103. package/runtime/js/cm-fix/source-correction-recovery.mjs +65 -0
  104. package/runtime/js/cm-fix/start.mjs +6 -3
  105. package/runtime/js/cm-fix/test-type-correction.mjs +86 -0
  106. package/runtime/js/cm-fix/test-type-recovery.mjs +51 -0
  107. package/runtime/js/cm-fix/type-import-correction.mjs +89 -0
  108. package/runtime/js/cm-prd/accepted-design.mjs +8 -0
  109. package/runtime/js/cm-prd/analysis.mjs +13 -9
  110. package/runtime/js/cm-prd/change.mjs +37 -16
  111. package/runtime/js/cm-prd/draft-save.mjs +13 -6
  112. package/runtime/js/cm-prd/draft.mjs +31 -3
  113. package/runtime/js/cm-prd/failed-correction.mjs +19 -3
  114. package/runtime/js/cm-prd/inputs-replaced.mjs +3 -0
  115. package/runtime/js/cm-prd/review-correction.mjs +6 -4
  116. package/runtime/js/cm-prd/review-disposition.mjs +7 -1
  117. package/runtime/js/cm-prd/self-check-revision.mjs +2 -2
  118. package/runtime/js/cm-prd/self-check.mjs +125 -6
  119. package/runtime/js/cm-prd/session.mjs +30 -1
  120. package/runtime/js/cm-prd/summary.mjs +38 -17
  121. package/runtime/js/cm-prd/task-scope-record.mjs +97 -0
  122. package/runtime/js/cm-prd/tree-digest.mjs +34 -0
  123. package/runtime/js/cm-prd/validation-reason.mjs +8 -4
  124. package/runtime/js/cm-security/scan.mjs +1 -1
  125. package/runtime/js/commander/decision.mjs +44 -0
  126. package/runtime/js/commander/dispatch-registry.mjs +110 -0
  127. package/runtime/js/commander/ledger.mjs +265 -0
  128. package/runtime/js/commander/preflight.mjs +107 -0
  129. package/runtime/js/notify-later.mjs +13 -0
  130. package/runtime/js/notify-send.mjs +6 -2
  131. package/runtime/js/notify.mjs +570 -63
  132. package/runtime/js/review-findings.mjs +38 -0
  133. package/runtime/js/session-boundary.mjs +56 -0
  134. package/runtime/js/session-handoff.mjs +68 -0
  135. package/runtime/js/spec-task-line.mjs +27 -13
  136. package/runtime/js/specs-status.mjs +1 -1
  137. package/runtime/js/task-scope.mjs +197 -0
  138. package/runtime/logging.md +6 -1
  139. package/runtime/model-efficiency.md +69 -10
  140. package/runtime/orchestration.md +3 -1
  141. package/runtime/project-learning.md +2 -0
  142. package/runtime/review.md +12 -2
  143. package/runtime/test-contract.md +1 -0
  144. package/scripts/ci-test-weights.json +3 -0
  145. package/scripts/cm-ai-admission.mjs +11 -5
  146. package/scripts/cm-ai-admission.test.mjs +23 -2
  147. package/scripts/cm-ai-batch-drive.mjs +79 -18
  148. package/scripts/cm-ai-batch-drive.test.mjs +169 -3
  149. package/scripts/cm-ai-batch-host.mjs +38 -9
  150. package/scripts/cm-ai-batch-host.test.mjs +27 -14
  151. package/scripts/cm-ai-batch-learning-merge.test.mjs +36 -0
  152. package/scripts/cm-ai-batch-location.test.mjs +57 -0
  153. package/scripts/cm-ai-batch-plan.mjs +52 -0
  154. package/scripts/cm-ai-batch-plan.test.mjs +397 -0
  155. package/scripts/cm-ai-batch-run-fixture.mjs +446 -35
  156. package/scripts/cm-ai-batch-run-member-stops.test.mjs +16 -0
  157. package/scripts/cm-ai-batch-run-parallel.test.mjs +28 -1
  158. package/scripts/cm-ai-batch-run.mjs +483 -63
  159. package/scripts/cm-ai-batch-run.test.mjs +23 -4
  160. package/scripts/cm-ai-batch-session-e2e.test.mjs +235 -0
  161. package/scripts/cm-ai-batch-session-member.test.mjs +293 -0
  162. package/scripts/cm-ai-batch-session-recovery.test.mjs +423 -0
  163. package/scripts/cm-ai-check-recheck-cancellation.test.mjs +247 -0
  164. package/scripts/cm-ai-checklist-coverage.test.mjs +4 -2
  165. package/scripts/cm-ai-checkpoint-package-material.test.mjs +221 -0
  166. package/scripts/cm-ai-checkpoint-package-owner.test.mjs +193 -0
  167. package/scripts/cm-ai-control-launch.test.mjs +21 -0
  168. package/scripts/cm-ai-control-policy.test.mjs +82 -0
  169. package/scripts/cm-ai-control-v2-drive.test.mjs +398 -3
  170. package/scripts/cm-ai-control-v2-supersede-race.mjs +25 -0
  171. package/scripts/cm-ai-control-v2-supersede.test.mjs +318 -0
  172. package/scripts/cm-ai-develop-driver-gaps.test.mjs +163 -0
  173. package/scripts/cm-ai-development-rework.test.mjs +423 -0
  174. package/scripts/cm-ai-drive-bootstrap-rules.test.mjs +3 -2
  175. package/scripts/cm-ai-drive.mjs +73 -17
  176. package/scripts/cm-ai-drive.test.mjs +37 -5
  177. package/scripts/cm-ai-execution-store-legacy-probe.test.mjs +84 -0
  178. package/scripts/cm-ai-host-fixture.mjs +9 -6
  179. package/scripts/cm-ai-host-protected.test.mjs +1 -1
  180. package/scripts/cm-ai-host.mjs +60 -19
  181. package/scripts/cm-ai-host.test.mjs +15 -0
  182. package/scripts/cm-ai-integration-adoption.test.mjs +223 -0
  183. package/scripts/cm-ai-integration-independence.test.mjs +23 -0
  184. package/scripts/cm-ai-integration-launch.test.mjs +240 -0
  185. package/scripts/cm-ai-integration-preview.mjs +41 -0
  186. package/scripts/cm-ai-integration-snapshots.test.mjs +197 -0
  187. package/scripts/cm-ai-nested-execution.test.mjs +29 -1
  188. package/scripts/cm-ai-operator-guidance.test.mjs +71 -0
  189. package/scripts/cm-ai-prefinal-delivery.test.mjs +278 -0
  190. package/scripts/cm-ai-project-qa-gate.test.mjs +56 -0
  191. package/scripts/cm-ai-qa-fingerprint-config.test.mjs +28 -0
  192. package/scripts/cm-ai-qa-rerun-timeouts.test.mjs +36 -2
  193. package/scripts/cm-ai-requirement-evidence.test.mjs +65 -0
  194. package/scripts/cm-ai-review-failure.test.mjs +150 -5
  195. package/scripts/cm-ai-review-timeout.test.mjs +20 -0
  196. package/scripts/cm-ai-run.mjs +88 -21
  197. package/scripts/cm-ai-scope-revision.test.mjs +341 -0
  198. package/scripts/cm-ai-spec-rebind.test.mjs +13 -0
  199. package/scripts/cm-ai-supersede.test.mjs +28 -0
  200. package/scripts/cm-ai-verification-auto.test.mjs +99 -0
  201. package/scripts/cm-announce-hook.mjs +35 -8
  202. package/scripts/cm-announce-hook.test.mjs +25 -0
  203. package/scripts/cm-challenge.test.mjs +61 -0
  204. package/scripts/cm-check-drive-files.mjs +2 -2
  205. package/scripts/cm-check-host.test.mjs +1 -1
  206. package/scripts/cm-check-runtime.sh +58 -1
  207. package/scripts/cm-claude-developer-worker.test.mjs +56 -7
  208. package/scripts/cm-claude-install-layout.test.mjs +1 -1
  209. package/scripts/cm-claude-probe.test.mjs +26 -0
  210. package/scripts/cm-claude-review-diagnostics.test.mjs +235 -0
  211. package/scripts/cm-claude-review-stream.test.mjs +49 -0
  212. package/scripts/cm-claude-worker.test.mjs +16 -0
  213. package/scripts/cm-codex-developer-reconnect-notice.test.mjs +98 -0
  214. package/scripts/cm-codex-developer-worker.test.mjs +120 -0
  215. package/scripts/cm-codex-install-local-edit-guard.test.mjs +436 -0
  216. package/scripts/cm-codex-prompt-input.test.mjs +153 -0
  217. package/scripts/cm-codex-reconnect-notice.test.mjs +167 -0
  218. package/scripts/cm-commander-ledger.test.mjs +260 -0
  219. package/scripts/cm-commander-p2.test.mjs +295 -0
  220. package/scripts/cm-commander-preflight.mjs +84 -0
  221. package/scripts/cm-commander.mjs +116 -0
  222. package/scripts/cm-config-lock.mjs +35 -0
  223. package/scripts/cm-controlled-correction.test.mjs +10 -1
  224. package/scripts/cm-developer-failure-code.test.mjs +62 -0
  225. package/scripts/cm-display-task-id.test.mjs +41 -0
  226. package/scripts/cm-drive-liveness.test.mjs +83 -0
  227. package/scripts/cm-efficiency-presentation-delta.test.mjs +218 -0
  228. package/scripts/cm-execution-snapshot-reuse.test.mjs +115 -0
  229. package/scripts/cm-external-batch-host.test.mjs +12 -9
  230. package/scripts/cm-external-process-cleanup.test.mjs +128 -0
  231. package/scripts/cm-external-qa-fix.test.mjs +89 -7
  232. package/scripts/cm-external-review-reconciliation.test.mjs +11 -0
  233. package/scripts/cm-failover.mjs +48 -10
  234. package/scripts/cm-failover.test.mjs +46 -0
  235. package/scripts/cm-fix-cause-invocation.test.mjs +19 -4
  236. package/scripts/cm-fix-command-correction.mjs +17 -0
  237. package/scripts/cm-fix-command-correction.test.mjs +211 -0
  238. package/scripts/cm-fix-cooperative-closeout.test.mjs +87 -0
  239. package/scripts/cm-fix-diagnosis-module-correction.test.mjs +217 -0
  240. package/scripts/cm-fix-drive.mjs +33 -5
  241. package/scripts/cm-fix-drive.test.mjs +49 -0
  242. package/scripts/cm-fix-host-review-assembly.test.mjs +197 -1
  243. package/scripts/cm-fix-host-review.test.mjs +21 -9
  244. package/scripts/cm-fix-host.mjs +26 -8
  245. package/scripts/cm-fix-monorepo-map.test.mjs +92 -0
  246. package/scripts/cm-fix-observation-task-id.test.mjs +122 -0
  247. package/scripts/cm-fix-regression-input-budget.test.mjs +111 -0
  248. package/scripts/cm-fix-repair-input-budget.test.mjs +119 -0
  249. package/scripts/cm-fix-review-file-paging.test.mjs +91 -0
  250. package/scripts/cm-fix-review-preflight.mjs +24 -0
  251. package/scripts/cm-fix-review-storage.test.mjs +233 -0
  252. package/scripts/cm-fix-review-verification-command.test.mjs +242 -0
  253. package/scripts/cm-fix-review-verification-evidence.test.mjs +218 -0
  254. package/scripts/cm-fix-review-verification-integration.test.mjs +81 -0
  255. package/scripts/cm-fix-review-verification-recovery.test.mjs +198 -0
  256. package/scripts/cm-fix-review-verification.test.mjs +146 -0
  257. package/scripts/cm-fix-revision-transport.test.mjs +81 -0
  258. package/scripts/cm-fix-source-correction.test.mjs +296 -0
  259. package/scripts/cm-fix-test-type-correction.mjs +18 -0
  260. package/scripts/cm-fix-test-type-correction.test.mjs +123 -0
  261. package/scripts/cm-fix-test-type-owner.test.mjs +208 -0
  262. package/scripts/cm-fix-test-type-verification-cost.test.mjs +66 -0
  263. package/scripts/cm-fix-type-import-correction.test.mjs +95 -0
  264. package/scripts/cm-fix-verification-diagnostic.test.mjs +200 -0
  265. package/scripts/cm-fix-verification-recovery.mjs +33 -0
  266. package/scripts/cm-host-diagnostic.test.mjs +33 -0
  267. package/scripts/cm-host-liveness.test.mjs +150 -0
  268. package/scripts/cm-host-qa-executor.test.mjs +77 -0
  269. package/scripts/cm-host-replay.test.mjs +176 -0
  270. package/scripts/cm-host-stage-observer.test.mjs +41 -0
  271. package/scripts/cm-install-local-edit-guard.test.mjs +621 -0
  272. package/scripts/cm-install-manifest.sh +351 -0
  273. package/scripts/cm-live-evidence.test.mjs +59 -1
  274. package/scripts/cm-log-event.mjs +61 -10
  275. package/scripts/cm-log-event.test.mjs +121 -1
  276. package/scripts/cm-matt-skills.mjs +576 -0
  277. package/scripts/cm-matt-skills.test.mjs +550 -0
  278. package/scripts/cm-notify-command.test.mjs +42 -10
  279. package/scripts/cm-notify.mjs +14 -10
  280. package/scripts/cm-notify.test.mjs +625 -75
  281. package/scripts/cm-patrol.mjs +4 -1
  282. package/scripts/cm-patrol.test.mjs +23 -5
  283. package/scripts/cm-prd-answer-gaps.test.mjs +2 -2
  284. package/scripts/cm-prd-completion.test.mjs +56 -13
  285. package/scripts/cm-prd-design-phase.test.mjs +78 -8
  286. package/scripts/cm-prd-draft-save.test.mjs +12 -0
  287. package/scripts/cm-prd-draft.test.mjs +1 -1
  288. package/scripts/cm-prd-drive.mjs +13 -6
  289. package/scripts/cm-prd-drive.test.mjs +46 -2
  290. package/scripts/cm-prd-gate-diagnostic.test.mjs +2 -2
  291. package/scripts/cm-prd-host.mjs +10 -5
  292. package/scripts/cm-prd-host.test.mjs +4 -2
  293. package/scripts/cm-prd-inputs-replaced.test.mjs +1 -1
  294. package/scripts/cm-prd-review-disposition.test.mjs +124 -8
  295. package/scripts/cm-prd-revision.test.mjs +1 -1
  296. package/scripts/cm-prd-self-check-revision.test.mjs +16 -1
  297. package/scripts/cm-prd-self-check-rules.test.mjs +239 -0
  298. package/scripts/cm-prd-self-check.test.mjs +105 -5
  299. package/scripts/cm-prd-session-recovery.test.mjs +5 -3
  300. package/scripts/cm-prd-summary.test.mjs +55 -3
  301. package/scripts/cm-prd-task-grouping.test.mjs +6 -6
  302. package/scripts/cm-prd-tree-digest.test.mjs +74 -0
  303. package/scripts/cm-refactor-drive.mjs +2 -1
  304. package/scripts/cm-refactor-drive.test.mjs +9 -0
  305. package/scripts/cm-release-smoke.sh +3 -15
  306. package/scripts/cm-skill-hints-autowire.test.mjs +394 -0
  307. package/scripts/cm-skill-hints-exam.mjs +149 -0
  308. package/scripts/cm-skill-hints-install.test.mjs +168 -0
  309. package/scripts/cm-skill-hints.exam.json +706 -0
  310. package/scripts/cm-skill-hints.json +119 -0
  311. package/scripts/cm-skill-hints.mjs +669 -0
  312. package/scripts/cm-skill-hints.test.mjs +831 -0
  313. package/scripts/cm-skill-judge.mjs +181 -0
  314. package/scripts/cm-skill-judge.test.mjs +255 -0
  315. package/scripts/cm-specs-status.test.mjs +4 -2
  316. package/scripts/cm-start-check.mjs +208 -0
  317. package/scripts/cm-start-check.test.mjs +321 -0
  318. package/scripts/cm-task-gate.mjs +150 -29
  319. package/scripts/cm-task-gate.test.mjs +73 -1
  320. package/scripts/cm-task-id-grammar.test.mjs +66 -0
  321. package/scripts/cm-task-scope.test.mjs +308 -0
  322. package/scripts/cm-test-suite.mjs +109 -0
  323. package/scripts/cm-test-suite.test.mjs +162 -0
  324. package/scripts/cm-upgrade-compat-batch.test.mjs +172 -0
  325. package/scripts/cm-upgrade-compat.test.mjs +239 -0
  326. package/scripts/cm-workflow-config.mjs +12 -2
  327. package/scripts/fixtures/fix-verification-claude.mjs +44 -0
  328. package/scripts/fixtures/host-diagnostic.mjs +33 -0
  329. package/scripts/fixtures/reviewed-integration.mjs +202 -0
  330. package/scripts/scan-public-safety.py +1 -0
  331. package/scripts/session-boundary.test.mjs +170 -0
  332. package/scripts/test-npm-install.py +14 -3
  333. package/scripts/test-shell-compat.sh +2 -0
  334. package/scripts/validate-public-repo.py +1 -0
  335. package/scripts/validate-test-cases.mjs +3 -2
  336. package/skills/cm-ai/SKILL.md +5 -2
  337. package/skills/cm-ai/references/N4-review.md +2 -1
  338. package/skills/cm-ai/references/N6-qa-eval.md +3 -1
  339. package/skills/cm-ai/references/N8-finish.md +22 -0
  340. package/skills/cm-ai/references/js-host-qa-recovery.md +1 -1
  341. package/skills/cm-ai/references/js-host-recovery.md +79 -3
  342. package/skills/cm-ai/references/js-host.md +89 -17
  343. package/skills/cm-challenge/SKILL.md +65 -0
  344. package/skills/cm-challenge/evals/README.md +18 -0
  345. package/skills/cm-challenge/evals/trigger-cases.json +20 -0
  346. package/skills/cm-challenge/evals/trigger-config.json +28 -0
  347. package/skills/cm-challenge/references/examples.md +15 -0
  348. package/skills/cm-check/SKILL.md +5 -0
  349. package/skills/cm-check/references/js-host.md +2 -0
  350. package/skills/cm-fix/SKILL.md +12 -3
  351. package/skills/cm-fix/references/command-correction.md +67 -0
  352. package/skills/cm-fix/references/isolated-review.md +54 -0
  353. package/skills/cm-fix/references/js-host.md +62 -2
  354. package/skills/cm-fix/references/test-type-correction.md +72 -0
  355. package/skills/cm-fix/references/verification-recovery.md +114 -0
  356. package/skills/cm-idea/SKILL.md +2 -0
  357. package/skills/cm-idea/references/js-host.md +2 -0
  358. package/skills/cm-notify/SKILL.md +2 -0
  359. package/skills/cm-prd/SKILL.md +12 -8
  360. package/skills/cm-prd/references/brownfield.md +8 -1
  361. package/skills/cm-prd/references/change-mode.md +6 -0
  362. package/skills/cm-prd/references/greenfield.md +4 -0
  363. package/skills/cm-prd/references/js-host.md +4 -2
  364. package/skills/cm-prd/references/spec-self-check.md +5 -1
  365. package/skills/cm-refactor/SKILL.md +8 -0
  366. package/skills/cm-refactor/references/js-host.md +2 -0
  367. package/skills/cm-test/SKILL.md +4 -0
  368. package/templates/dashboard/dashboard.html +2 -2
  369. package/templates/pixel/cm-pixel.html +1 -1
  370. package/templates/pixel/cm-pixel.sh +1 -1
  371. package/templates/pixel/dev/template.html +1 -1
  372. package/templates/statusline/cm-statusline.sh +1 -1
@@ -14,7 +14,12 @@ flowchart LR
14
14
  Skills --> TaskGates["runtime/task-gates.md"]
15
15
  Skills --> Logging["runtime/logging.md"]
16
16
  Skills --> External["runtime/external-expert.md"]
17
- RuntimeJS["runtime/js/cm-ai: shipped source + active N1/N2 admission"]
17
+ Skills --> Driver["scripts/cm-ai-drive / cm-ai-batch-drive"]
18
+ Driver --> Host["cm-ai-host / cm-ai-batch-host"]
19
+ Host --> RuntimeJS["runtime/js/cm-ai: owner / runner / gates"]
20
+ RuntimeJS --> Durable["specs .reviews/.execution: journal + checkpoints"]
21
+ RuntimeJS --> ToolRequest["current-session tool requests / configured workers"]
22
+ ToolRequest --> RuntimeJS
18
23
  Skills --> References["flow references: N1-N8 / PRD modes"]
19
24
  Skills --> Templates["templates/"]
20
25
  Skills --> Specs["requirements / design / tasks / optional test-cases"]
@@ -36,6 +41,11 @@ flowchart LR
36
41
  Check -. validates .-> RuntimeJS
37
42
  ```
38
43
 
44
+ `cm-challenge` is an optional conversation-only entry. It reads the existing
45
+ `runtime/steelman-review.md` method and produces proposals, without starting a
46
+ host, creating run records, changing approval state or replacing formal review.
47
+ Its three analysis passes are not three independent review attempts.
48
+
39
49
  ## Sources of truth
40
50
 
41
51
  - Each numbered feature's `tasks.md` is the authoritative business-task state.
@@ -81,13 +91,21 @@ native filenames. Workflow assets resolve relative to the active Skill; no flow
81
91
  may hardcode a Codex cache path or treat `~/.claude` as the universal source
82
92
  root.
83
93
 
84
- `runtime/js/cm-ai/` is the sole source root for the accepted JS orchestration
85
- modules. `experiments/js-orchestration/` keeps thin re-exports plus historical
86
- fixtures so prior evidence paths remain readable. The active `cm-ai` Skill owns
87
- conversation/tool orchestration and invokes the shared JS gates directly; the
88
- dormant full-host factory is not a prerequisite and Claude does not need a second
89
- adapter protocol. Platform installation evidence and real task dogfood remain
90
- separate F09 work.
94
+ `runtime/js/cm-ai/` is the sole source root for JS orchestration modules.
95
+ `experiments/js-orchestration/` keeps thin re-exports plus historical fixtures
96
+ so prior evidence paths remain readable. New cm-ai tasks use the shared JS host
97
+ by default. The Skill selects the supported entry and fulfills its tool requests;
98
+ the driver transports requests and responses, and the host/runner owns phase
99
+ transitions, durable evidence and completion gates. `scripts/cm-ai-host.mjs`
100
+ assembles the single-task host through `scripts/cm-ai-run.mjs`; the batch host
101
+ coordinates the same task owners. Codex and Claude use this shared chain with
102
+ their configured execution adapters.
103
+
104
+ Existing JS runs resume with their original identity and stored configuration.
105
+ The explicitly selected legacy conversation flow still uses the shared task
106
+ gates; it does not take ownership of an existing JS run or migrate its journal.
107
+ Source wiring, isolated CLI fixtures, installation and real-provider dogfood are
108
+ separate evidence: one does not establish the others or universal platform support.
91
109
 
92
110
  The npm package includes root release notes through the `package.json` files
93
111
  allowlist. The Codex installer copies `CHANGELOG.md` alongside `README.md` and
@@ -129,11 +147,14 @@ them. Historical completed tasks are not automatically reopened.
129
147
  Parallel writers also pass the same gate tool with distinct registered
130
148
  worktrees and branches; failure downgrades execution to serial.
131
149
 
132
- This gate checks declarations and content-bound review evidence; it does not make
133
- one provider's result evidence for another provider. Codex and Claude both keep
134
- conversation orchestration in the active Skill and use the same JS gates, while a
135
- fresh context supplies independent review. Real durable N1–N8 dogfood and authorized
136
- installation evidence remain later work; no Claude-native adapter is required.
150
+ This gate checks source declarations and content-bound review evidence; it does
151
+ not authenticate a reviewer or resist a session with full filesystem write access.
152
+ The default JS owner records review results and controls completion; the current
153
+ session fulfills host requests without replacing that durable state. The legacy
154
+ conversation flow invokes the same completion gates explicitly. Fresh review
155
+ contexts and package bindings limit accidental self-review and stale evidence;
156
+ neither provider names nor `independent: true` prove identity. Platform support
157
+ and real-provider execution must be reported against their own verified evidence.
137
158
 
138
159
  ## Current-session driver evidence
139
160
 
@@ -257,3 +278,9 @@ gaps. The current host reviews business boundaries and checks the source digest
257
278
  scanner output is candidate evidence, never a task-completion or release gate.
258
279
 
259
280
  人工补正合同:`docs/human-correction.md`。第二轮 blocked 后,仅经明确人审范围的一次性 task-gate 入口可封存独立补正审查;原证据与普通 attempt 上限保留,宿主 journal 不自动重开。
281
+
282
+ Explicit completed-run integration uses reviewed-integration.mjs and the read-only cm-ai-integration-preview.mjs. The existing owner accepts a fixed independently reviewed plan under its original writer lock; ordinary discovery, history and budgets stay authoritative. See [the integration contract](reviewed-integration.md).
283
+
284
+ integration-snapshots.mjs binds explicitly reviewed additions of evidence copies to their exact paths, original modes and full bytes. The normal inventory still protects every AGENTS.md. Copies cannot cover an existing baseline file or an applicable instruction for a reviewed scope; source provenance and deduplicated data files belong to the independent review package.
285
+
286
+ For explicitly selected new maintenance reviews, review-presentation-delta.mjs encodes exact before/after shared ranges with complete inline inserts and verifies the full reconstruction before dispatch. The V2 prompt policy does not change V1/null defaults, canonical review evidence or journal storage encoding.
@@ -5,7 +5,7 @@ control policy v2 把运行能力集中到一个严格的策略文件。原配
5
5
 
6
6
  ## 策略文件与能力
7
7
 
8
- `POLICY.json` 必须完整包含以下五个字段,不接受额外字段、缺失字段、布尔值或旧权限数组:
8
+ `POLICY.json` 必须完整包含以下五个必填字段,另可带一个可选字段 `verification`;不接受其他字段、缺失字段、布尔值或旧权限数组。新建运行建议写成下例(含 `verification`):
9
9
 
10
10
  ```json
11
11
  {
@@ -13,7 +13,8 @@ control policy v2 把运行能力集中到一个严格的策略文件。原配
13
13
  "development": "conversation",
14
14
  "bootstrap": "disabled",
15
15
  "qa": "disabled",
16
- "qaFix": "disabled"
16
+ "qaFix": "disabled",
17
+ "verification": "precheck"
17
18
  }
18
19
  ```
19
20
 
@@ -24,6 +25,7 @@ control policy v2 把运行能力集中到一个严格的策略文件。原配
24
25
  | `bootstrap` | `disabled`、`write` | 禁用或启用已批准 bootstrap 目标的规范写入;启用仍需原 bootstrap 配置与固定目标 |
25
26
  | `qa` | `disabled`、`run` | 禁用或运行原测试合同与 QA 配置;必需 QA 不能靠 disabled 跳过 |
26
27
  | `qaFix` | `disabled`、`manual`、`auto` | 禁用 QA 修复、显式选择原修复入口,或使用原已配置的自动修复;不改变修复子运行的门禁 |
28
+ | `verification`(可选) | `disabled`、`precheck` | 省略等同 `disabled`。`precheck` 开启交付前验证闸门:审查前逐条核对任务描述与验证要求,答案的证据写进交接文件供独立审查阅读。驾驶员 PLAN 须配置 `liveEvidence` 的 `verification_precheck` |
27
29
 
28
30
  `qaFix` 选择 `manual` 或 `auto` 时,`qa` 必须为 `run`;不满足时返回 `invalid_input`。
29
31
  批次目前不支持 QA 修复,`qaFix` 必须为 `disabled`。其他值返回 `invalid_arguments`。
@@ -31,7 +33,15 @@ control policy v2 把运行能力集中到一个严格的策略文件。原配
31
33
  `qa:"disabled"` 只关闭实际 QA executor,仍执行 `qa_assess` 清单来源确认和固定检查点判定;驾驶员只需合法的 `{"confirmed":true}` 答案。
32
34
  关键路径登记使用现有工作流配置的 `qa.criticalPaths`,详见 [JS workflow control](js-workflow-control.md)。未登记关键路径的项目,N6 不做任何风险识别,只有这两个固定点。两点为 feature 完成及连续五项未 QA。`policies.tests` 只控制执行类型,不取消必跑;blocking cases 与环境 BLOCKED 合同不变。
33
35
  触发必需 QA 却没有 executor 时,真实停点为 `qa_triggered`、`pendingAction:"qa_execution"`;不得报告 QA PASS 或 `run_done`。
36
+ 已完成运行补开 QA:用 `qa:"disabled"` 建的单任务运行到了 `fixture_completed` 后,可以 `mode:"resume"` 换一份只把 `qa` 改成 `run`
37
+ (其余字段逐字不变)的策略,并带含 `qa` 的 `--workflow-config`。宿主按原策略与去掉 QA 的原配置核对原指纹,
38
+ 在运行存档追加一条 `qa-attached`(与旧版「已完成任务的一次性 QA 附加」同一记录),日志写 `decision/qa_attach`,
39
+ 然后按原 N6 门禁执行 QA;存档里保存的原策略不改写,运行器仍按原策略恢复。之后的恢复都要用补开后的策略和同一份 QA 配置,
40
+ 不能再退回 `qa:"disabled"`。补开那次不能同时做其他启动恢复(QA 重跑、配置修订、范围修订等),补开以后照常可用。
41
+ 目前只对单任务驾驶员验证过;批次成员没有覆盖测试。
42
+ 策略的其他字段一起变、任务未完成、或没有 QA 工作流时仍报 `fingerprint_mismatch`(或原有的参数错误)。
34
43
  `qaFix:"auto"` 只启用原自动修复能力,不替代其故障分型、范围、诊断、测试、fresh Review 和完成门禁。
44
+ `verification` 随策略写进运行配置并参与指纹,恢复时必须用同一份策略;此前创建、没有该字段的运行保持原样,恢复时也不能补加。旧的启动参数 `--verification-precheck` 仍可按次开启。
35
45
 
36
46
  审查不另加策略开关。当前已选任务在已确认范围内自动走最多两轮常规独立审查。
37
47
  第 1 轮要求修改时,修订后使用 fresh Review;第 2 轮仍有阻断就停止,不创建第 3 轮。
@@ -98,6 +108,7 @@ transport、模型选择与保护配置仍沿原合同;策略不是任意命
98
108
  "hostContext": "{当前真实会话ID}",
99
109
  "runtime": "codex",
100
110
  "permissions": ["--review-config", "review.json"],
111
+ "liveEvidence": {"directory": "../private-exchange", "kinds": ["verification_precheck"]},
101
112
  "answers": "answers",
102
113
  "checks": [{"id": "syntax", "command": ["node", "--check", "target.mjs"]}]
103
114
  }
@@ -120,7 +131,7 @@ node "{CM_WORKFLOW_ROOT}/scripts/cm-ai-drive.mjs" --plan PLAN.json advance
120
131
 
121
132
  ## 显式恢复:先展示目标,再固定它
122
133
 
123
- `abandon_review`、`abandon_effect`、`develop_redo`、`bootstrap_review_recover`、`reconcile_review`
134
+ `abandon_review`、`abandon_effect`、`develop_redo`、`bootstrap_review_recover`、`completion_rework`、`reconcile_review`
124
135
  及原 QA 修复 `fix_action` 的显式恢复子操作,
125
136
  必须绑定操作者实际看到并选择的原状态。普通 `advance` 的自动推进不需要这个绑定。
126
137
 
@@ -178,7 +189,7 @@ node "{CM_WORKFLOW_ROOT}/scripts/cm-ai-batch-host.mjs" serve \
178
189
 
179
190
  ## 单任务启动型恢复:launchControlTarget
180
191
 
181
- QA 重跑、QA 配置修订与规格换绑在创建 host 前改变恢复输入,使用单独的启动快照。
192
+ QA 重跑、QA 配置修订、规格换绑、范围追加和一次开发续次在创建 host 前改变恢复输入,使用单独的启动快照。
182
193
  先按原配置只读 status,展示操作和前提,把原 `status.launchControlTarget` 完整保存到普通 UTF-8 JSON 文件,
183
194
  再在原 `serve --mode resume` 启动中提供 `--expected-control FILE`。不能用 `status.controlTarget` 代替启动快照。
184
195
  目标文件严格校验,拒绝重复键、软链接或硬链接;不自动计算或刷新目标。
@@ -189,6 +200,8 @@ QA 重跑、QA 配置修订与规格换绑在创建 host 前改变恢复输入
189
200
  | 重跑未知 QA | `--rerun-unknown-qa`;环境故障还可提供原 `--qa-environment-failure REASON` |
190
201
  | 重跑已阻断 QA | `--rerun-blocked-qa`;仍满足原可重跑条件与预算 |
191
202
  | QA 配置修订 | `--revise-qa-config OLD_WORKFLOW.json --qa-config-revision-reason REASON`;当前 `--workflow-config` 提供已核对的新配置 |
203
+ | 原运行范围追加 | `--revise-scope SCOPE.json --scope-revision-reason REASON`;SCOPE.json 是包含全部原路径的完整 JSON 数组 |
204
+ | 一次 a2 开发续次 | `--development-rework --development-rework-reason REASON`;不改变 scope |
192
205
  | 已批准规格材料换绑 | `--rebind-spec-material --spec-rebind-reason REASON`;保留原重新批准与漂移门禁 |
193
206
 
194
207
  例如重跑符合原条件的已阻断 QA:
@@ -201,9 +214,23 @@ node "{CM_WORKFLOW_ROOT}/scripts/cm-ai-host.mjs" serve \
201
214
  ```
202
215
 
203
216
  `launch-target.json` 保存此前展示的完整 launchControlTarget,不能从本次启动的新状态替换它。
204
- 这些入口仍保留原 QA/规格恢复条件;新快照绑定不扩大可恢复状态、预算或范围。
217
+ 这些入口仍保留各自原恢复条件。范围追加与一次开发续次必须由人工在启动时显式开启,不能由会话 wire 请求自行开启;批准原因与实际追加时间写入原 journal。它们互斥,也不能与其他启动恢复合用。启动参数不是人工身份认证机制,执行者仍须遵守当前对话的人工批准边界。
205
218
  普通 wire 操作的 `expectedControl` 与启动参数 `--expected-control` 是两种用途,不可互换。
206
- v2 create supersede 尚未开放,返回 `supersede_unavailable`;保留原证据,不通过 legacy 作废旧运行。
219
+ ### 卡死任务重开:v2 create supersede
220
+
221
+ 旧运行已终止(blocked、cancelled、unknown 或符合原条件的 fixture_completed),且原运行没有剩余的合法恢复入口时,可用新 runId 重开同一任务:
222
+
223
+ 1. 用旧运行的原配置只读查看:`node "{CM_WORKFLOW_ROOT}/scripts/cm-ai-run.mjs" inspect-history --config 旧run.json`,把返回的 `supersedeTarget` 原样保存为普通 UTF-8 JSON 文件,并向用户展示旧运行状态与重开原因。
224
+ 2. 用户批准后,新运行定义(同 feature、同 task、新 runId)启动:
225
+
226
+ ```bash
227
+ node "{CM_WORKFLOW_ROOT}/scripts/cm-ai-host.mjs" serve \
228
+ --config 新run.json --mode create --host-context "{当前真实会话ID}" \
229
+ --control-config POLICY.json --review-config review.json --runtime codex \
230
+ --supersede-reviewed-evidence --supersede-reason "单行原因" --supersede-target target.json
231
+ ```
232
+
233
+ 宿主在建新 journal 前沿用旧版重开的全部前提(tasks.md 未勾选、旧 writer 已关闭、无未结 effect、代码漂移规则不变),并额外要求:只有一条未被取代的直接前驱运行,且它当前的启动投影与 `target.json` 完全一致;宿主先锁住旧运行的 writer,再比较目标并**在锁内重新发现同任务运行**(必须仍只有这一条未被取代的直接前驱,且 `.execution` 下的运行目录集合与本次调用首次发现时完全相同(新增或消失的目录,包括尚无 journal 记录的失败残留目录,都算变化;首次发现之前就存在、无法归属任务的历史空目录不在此保证内)——否则 `snapshot_changed`;错开时间的第二次重开因此也被拒),并一直持有到新运行写完替代记录、归档完成(或失败)才释放;本次调用自己持有的这把锁不会被「旧运行 writer 是否被占用」的检查(含执行优化的 prior-writer guard)误判为外部占用,其他进程同时打开该文件时仍判占用:预览后旧运行已变化返回 `snapshot_changed`;旧运行正被恢复或另一次重开占用时返回 `supersede_unavailable`。两种情况都不自动刷新目标、不归档证据、不建新运行。缺少目标返回 `invalid_input`;legacy 入口带 `--supersede-target` 返回 `invalid_arguments`。新运行从第 1 轮开始,旧运行 journal 原样保留,旧 handoff/回执按旧版规则归档到 `.reviews/.superseded/`,最后一次审查结论作为参考带入。驾驶脚本 PLAN 把三项放进 `permissions`(`--supersede-target` 路径相对 PLAN)。
207
234
 
208
235
  ## 旧运行与迁移拒绝
209
236
 
@@ -218,14 +245,15 @@ v2 create supersede 尚未开放,返回 `supersede_unavailable`;保留原证
218
245
  | 批次 `qaFix` 不是 disabled | `invalid_arguments` |
219
246
  | 显式恢复缺固定目标 | `invalid_input` 或驾驶员启动前拒绝 |
220
247
  | 固定目标已陈旧或不匹配当前状态 | `snapshot_changed`,不自动刷新 |
221
- | 恢复时策略改变 | `fingerprint_mismatch`,不替换原策略 |
248
+ | 恢复时策略改变 | `fingerprint_mismatch`,不替换原策略;唯一例外是下文「已完成运行补开 QA」 |
222
249
  | 恢复时原配置发生变化 | 沿原指纹与配置漂移门禁拒绝 |
223
- | v2 create supersede | `supersede_unavailable`,不走旧入口作废运行 |
250
+ | v2 create supersede 缺 `--supersede-target` | `supersede_unavailable` 或 `invalid_input`,不走旧入口作废运行 |
251
+ | v2 create supersede 目标与旧运行当前状态不符 | `snapshot_changed`,不归档、不建新运行 |
224
252
 
225
253
  v2 策略随新运行持久化并纳入新版执行指纹。旧 metadata 中该字段缺省时,原格式与字节保持原样。
226
254
  不重写旧 journal、旧指纹或旧控制记录,不把能回放旧记录扩称允许跨入口执行。
227
255
  只读 status 可用于核对历史;执行入口仍必须匹配原协议。迁移需要独立的新运行决定,不能就地换入口规避旧证据。
228
- 单任务 QA 重跑、QA 配置修订与规格换绑使用上节 launchControlTarget;批次和 supersede 等出口以实际支持为准,不把单任务恢复合同理解成全部旧出口已开放。
256
+ 单任务 QA 重跑、QA 配置修订、规格换绑、范围追加和一次开发续次使用上节 launchControlTarget;批次出口以实际支持为准(单任务 supersede 见上节),不把单任务恢复合同理解成全部旧出口已开放。
229
257
 
230
258
  ## 兼容 taskgate 的一次受控补正
231
259
 
@@ -329,3 +357,93 @@ owner 仍活跃或无法核实是否退出时保留锁与证据,不删锁重
329
357
  定向夹具和源码审查结果见本轮交接记录;本文示例不等于真实 provider 或业务运行验收。
330
358
  cm-ai 新单任务/批次的 r2 blocked correction completion 未支持;上方独立 taskgate 补正不提供原 runner 或 batch 的完成路径。
331
359
  本次本地方案不包含安装、提交、push、发布、部署或资金动作。
360
+
361
+
362
+ ## 完成检查失败后原运行返工
363
+
364
+ `completion_rework` 只在 v2 单任务、未受保护的原配置 resume 且 `development:conversation` 使用,提交真实单行 `reason`(最多 500 UTF-8 字节)及先前 status 返回的固定 `expectedControl`。它不执行开发;成功后发送 `advance`,实际 develop 请求到达后才能修改代码。
365
+
366
+ 仅未完成任务的第 1 轮、有效 approved 回执、最后 complete 检查失败 `completion_checks_changed`、代码/handoff/规格仍精确等于旧包且还有 develop+review 预算时允许。已有 a2 handoff 或 r2 文件拒绝。已完成、取消、pending、提交开始、其他漂移、重复及第 2 轮都拒绝。
367
+
368
+ 宿主追加 `completion-rework-requested`,绑定原失败 checkpoint、effect、包、receipt、artifact/handoff 摘要及原因,保留旧 r1、a1 handoff、journal 与失败记录;把原运行推进 a2,清当前完成凭证,不改旧批准 verdict。a2 须改变已审代码并产出 fresh r2;旧批准不能完成新交付。第 2 轮未通过仍按既有上限停止,不开启第 3 轮。
369
+
370
+ 该操作不提供 legacy、batch、bootstrap、跨运行 supersede 或已完成任务重开的入口。原 `complete` 仍支持仅修环境后对同一包复查。
371
+
372
+ 当前入口仅支持原会话开发;provider 模式缺少绑定失败上下文的开发请求合同,因此明确拒绝,不将原 approved 当作修改指令。该能力须另行设计,不随本次原运行恢复扩大。
373
+
374
+ ## 开发检查失败后追加原运行范围
375
+
376
+ `revise_scope` 只用于 v2 单任务、未受保护的 `development:conversation` 原配置 resume。
377
+ 第 1 轮必须停在 `blocked/develop_checks_not_passed`,没有在途 effect、Review、提交或取消。
378
+ `bootstrap`、`qaFix` 必须 disabled;`qa:run` 保留原 QA 配置、执行及完成门禁。
379
+ 每个运行只追加一次,不缩减原范围,不变更 run、attempt、规格或冻结配置,也不替代当前对话对具体新增路径的批准。
380
+
381
+ 先展示 status 的真实 `launchControlTarget` 与具体新增路径,由人工批准后保存原启动快照。
382
+ `SCOPE.json` 为包含全部原路径的完整 JSON 数组,原因是非空单行文本(最多 500 UTF-8 字节)。
383
+ 在原 `serve --mode resume` 增加 `--expected-control launch-target.json --revise-scope SCOPE.json --scope-revision-reason REASON`。
384
+ 驾驶脚本 PLAN 的 `permissions` 同样包含这些启动参数;文件路径相对 PLAN 解析。运行 `status` 检查追加结果,再用原配置 `advance`。
385
+ 不再使用 PLAN.scope、PLAN.reason 或 PLAN.expectedControl 发 `revise_scope`;wire 请求即使带正确 controlTarget 也拒绝。
386
+ 陈旧目标、重复或缩减路径、保护路径、越界、链接、缺来源、漂移、已送审或名额不足均拒绝。
387
+
388
+ 宿主追加 `scope-revised`,绑定原失败 checkpoint、原范围、创建基线、前一记录及原因。
389
+ 新增既有路径必须与创建时全代码根 inventory 的 SHA、大小和文件模式一致;仅为这些路径有界补齐原字节。
390
+ 新增文件路径必须在原 inventory 和当前磁盘均不存在,父目录不得由链接改写。
391
+ 扩展必须使用创建时 version 2 的完整 inventory;version 1 基线或缺少冻结忽略路径清单的旧 version 1 ignore 证据返回 `scope_revision_unsupported_baseline`,普通旧运行读取和恢复保持兼容。
392
+ 忽略、依赖和保护路径不通过该操作开放。原范围中的已改业务文件不重新取基线。
393
+ 固定依赖、杂项及原 ignore 的路径限制由同一纯函数供执行和回放核对。该恢复入口也拒绝父目录名 Pods;它不改通用快照的 CocoaPods 判定。父目录、链接、当前存在性和文件读取仍在执行时核对。
394
+
395
+ 成功后 status.effectiveScope 展示追加后的真实范围。关闭并按原 run.json、POLICY resume 后,
396
+ 驾驶员预检、真实开发与检查请求、handoff、Review 和完成复查使用回放派生的完整范围。
397
+ 业务旧 diff 保留,新增文件在 Review 中仍为创建 diff;新增既有文件若暂未修改,
398
+ 其完整原字节、SHA 和模式仍进入 unchangedScope,并在送审和完成前验证。
399
+ 成功追加不代表开发、检查、Review 或完成已通过;继续 advance,实际 develop 请求到达后才写入。
400
+ 该入口不开放 legacy、provider、受保护开发、bootstrap、batch、QA 修复或已完成任务重开。
401
+
402
+ ### 一次受控的 a2 开发续次
403
+
404
+ `development_rework` 仅用于原 v2 单任务、未受保护的 `development:conversation` resume。
405
+ 由人工核对并保存原 `status.launchControlTarget` 为 `launch-target.json`,在 `serve --mode resume` 增加
406
+ `--expected-control launch-target.json --development-rework --development-rework-reason REASON`。
407
+ 原因用于审计,须为非空单行文本(最多 500 UTF-8 字节);不根据新 status 自动刷新旧目标。
408
+
409
+ 只有 attempt2 已持久化 `develop_retry_limit`,紧前记录是有成功开发调用、完整 Learning 和真实 failed check
410
+ 的 `develop_checks_not_passed` checkpoint,且已有 a1 `changes_requested` 原包/凭证时允许。
411
+ 固定计数必须是 4 calls / 5 effects;没有 pending、r2 登记或凭证、提交、取消、workflow error 或 QA。
412
+ 任务已完成、r2/handoff 占位文件、provider、protected、parallel batch 及规格漂移均拒绝。
413
+
414
+ 操作只追加 `development-rework-authorized`,绑定原失败、limit、r1、配置、有效 scope、原基线和当前源摘要。
415
+ 不重拍原基线,不改变 attempt 或 scope,不减免旧成功重查,不重写历史。
416
+ 默认 6 calls / 6 effects 保留;事件只给绑定的下一 developer 和 fresh `review-2` 配对一个额外 effect。
417
+ 开发 intent 即消费单次开发许可;失败、超时、中断和重启不会恢复第二次开发权限。
418
+ 新开发开始前仍核对源和规格;若在许可后漂移则拒绝,不能自动更新绑定。
419
+ 当前源摘要只说明新增许可时的源,并不声称旧失败时的代码已经被历史快照证明。
420
+
421
+ 驾驶脚本使用 `cm-ai-drive.mjs --plan PLAN.json status`,PLAN 示例(原 review、workflow 等配置保持不变):
422
+
423
+ ```json
424
+ {
425
+ "config": "run.json",
426
+ "controlConfig": "control.json",
427
+ "mode": "resume",
428
+ "hostContext": "{当前真实会话ID}",
429
+ "permissions": [
430
+ "--review-config", "review.json",
431
+ "--workflow-config", "workflow.json",
432
+ "--expected-control", "launch-target.json",
433
+ "--development-rework", "--development-rework-reason", "{人工批准本次续次的实际原因}"
434
+ ]
435
+ }
436
+ ```
437
+
438
+ 范围追加用 `--revise-scope SCOPE.json --scope-revision-reason REASON` 替换上述两项开发续次参数。
439
+ 两个动作都不新增 `--allow-*`,不发送 `development_rework` / `revise_scope` wire 操作。
440
+ 启动追加一次记录后,从后续 PLAN.permissions 移除专用恢复参数及 `--expected-control`,再按原配置 `advance`;不能重复消费旧启动目标。
441
+ 成功返回原 attempt2 的 `blocked/develop_checks_not_passed`,随后 `advance` 才会发真实 develop 请求。
442
+ 等待请求后修改代码,重新检查、生成交付包并派发独立 r2;r1 不替代 r2。
443
+ 开发许可消费后,合法 `blocked/check_answer_*` 的只重跑检查仍沿原两次重查上限执行,不派第二次开发。
444
+ 返工轮审查保留现有无结论重派策略:`review-2-retry-N` / `review-2-resume-N` 及组合 ID 可使用绑定 review 的额外 effect 名额,
445
+ 但仍须通过原 transport/abandon、fresh invocation、调用计数和重派上限校验;不因该名额接受旧 verdict、第三轮或任意 review ID。
446
+ 没有 Review 批准就不能 complete;完成前复查、任务门禁及原 QA 合同继续执行。
447
+ 回放按记录顺序验证原默认上限,然后从已验证的新增事件派生许可;checkpoint/config/模型自报额度无效。
448
+ 已知限制:已消费一次性返工许可的运行,若之后最后任务的文档同步失败,文档同步重发不可用(返工预算已用满,名额门与总预算预检都会拒绝),只能用 supersede 重开。
449
+ 旧 runtime 不认识新增事件时应拒绝读取,不能忽略事件降级执行。
@@ -0,0 +1,48 @@
1
+ # Claude review preflight rejects a display notice before init
2
+
3
+ ## Symptom and reproduction
4
+
5
+ Claude Code 2.1.289 emits `system/ui_invalidate` before `system/init` during a
6
+ local, synthetic review preflight. The old decoder returns `missing_init`; the
7
+ worker then stops its own process group. The probe observes only an empty
8
+ startup health request and no messages request, so it correctly refuses to pass.
9
+ Exit 143 is the cleanup consequence, not evidence of a user cancellation or a
10
+ timeout. This probe does not establish the user's account or model access.
11
+
12
+ ## Affected chain and minimal change
13
+
14
+ `cm-ai-host.mjs preflight` → `previewClaudeTools` → `claudeWorker` →
15
+ `createClaudeReviewStream`. The decoder is the first failing edge. It already
16
+ accepts a bounded `dev_intent` notice before init. It now accepts the observed
17
+ `ui_invalidate` subtype there and after init, reporting only a fixed notice.
18
+
19
+ The existing session validation and shared 32-notice cap still apply. This
20
+ notice cannot initialize a turn or provide a verdict. Missing init, mismatched
21
+ sessions, unknown subtypes, post-terminal messages and tool/content violations
22
+ remain failures. Probe HTTP checks, sandbox rules, timeouts, arguments,
23
+ fingerprints, execution storage and developer parsing are unchanged.
24
+
25
+ The reproduction also used a short CLI model alias. The CLI resolves aliases
26
+ to full model IDs, while the existing probe requires the outgoing model to
27
+ equal the configured ID. Live comparisons therefore use the observed full ID;
28
+ model equality is not weakened to make the preflight pass.
29
+
30
+ ## Regression evidence
31
+
32
+ - `cm-claude-review-stream.test.mjs`: pre/post-init notices preserve results and
33
+ observer events; body-free output, session, incomplete/terminal and shared
34
+ budget boundaries remain enforced.
35
+ - `cm-claude-worker.test.mjs`: the startup prefix no longer causes premature
36
+ cleanup; no init or a different session cannot produce success.
37
+ - `cm-claude-probe.test.mjs`: a local sandboxed child emits the prefix before
38
+ POST, exercising the actual failed ordering. Startup-only requests still fail.
39
+
40
+ Before the fix, six of the seven selected regression cases failed. After the
41
+ fix, all 57 tests in these three files passed. Removing only the pre-init
42
+ whitelist entry makes the selected POST regression fail again. Adjacent tests,
43
+ independent implementation review and live two-scenario outcomes are retained
44
+ in the task's local evidence; those checks are not implied by a preflight pass.
45
+
46
+ Applied project lessons: provider dialects belong at the adapter boundary;
47
+ process termination is not user cancellation; tests must be collected by CI;
48
+ real review evidence must precede task completion. 已复盘,无新增项目教训。