@aibyzero/cm-workflow 0.17.1 → 0.19.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 (357) hide show
  1. package/.codex-plugin/plugin.json +1 -1
  2. package/AGENTS.md +23 -0
  3. package/CHANGELOG.md +242 -0
  4. package/README.md +20 -3
  5. package/THIRD_PARTY_NOTICES.md +13 -0
  6. package/VERSION +1 -1
  7. package/compat/claude-commands/cm-challenge.md +3 -0
  8. package/docs/architecture.md +11 -0
  9. package/docs/cm-control-policy-v2.md +127 -9
  10. package/docs/installation.md +310 -4
  11. package/docs/js-workflow-control.md +150 -15
  12. package/docs/live-evidence-drivers.md +28 -4
  13. package/docs/out-of-scope/README.md +25 -0
  14. package/docs/out-of-scope/background-supervisor.md +32 -0
  15. package/docs/reviewed-integration.md +48 -0
  16. package/docs/user-guide.md +50 -21
  17. package/install-codex.sh +331 -18
  18. package/install.ps1 +28 -2
  19. package/install.sh +321 -17
  20. package/package.json +2 -1
  21. package/runtime/js/autonomy.mjs +152 -0
  22. package/runtime/js/cm-ai/batch-location.mjs +55 -0
  23. package/runtime/js/cm-ai/batch-plan.mjs +242 -0
  24. package/runtime/js/cm-ai/checkpoint-package-material.mjs +162 -0
  25. package/runtime/js/cm-ai/claude-developer-proposal.schema.json +55 -1
  26. package/runtime/js/cm-ai/claude-review-stream.mjs +83 -14
  27. package/runtime/js/cm-ai/claude-tool-preview.mjs +11 -9
  28. package/runtime/js/cm-ai/cm-ai-admission.mjs +56 -17
  29. package/runtime/js/cm-ai/cm-ai-conversation-entry.mjs +91 -6
  30. package/runtime/js/cm-ai/cm-ai-qa-log.mjs +5 -1
  31. package/runtime/js/cm-ai/codex-config.mjs +6 -2
  32. package/runtime/js/cm-ai/codex-developer-basic-output.schema.json +3 -2
  33. package/runtime/js/cm-ai/codex-developer-output.schema.json +2 -1
  34. package/runtime/js/cm-ai/codex-reconnect-notice.mjs +6 -0
  35. package/runtime/js/cm-ai/codex-review-adapter.mjs +27 -7
  36. package/runtime/js/cm-ai/control-policy.mjs +21 -4
  37. package/runtime/js/cm-ai/developer-adapter.mjs +19 -5
  38. package/runtime/js/cm-ai/drive-core.mjs +115 -11
  39. package/runtime/js/cm-ai/drive-rate-limit.mjs +105 -0
  40. package/runtime/js/cm-ai/durable-runner-state.mjs +234 -33
  41. package/runtime/js/cm-ai/effect-contract.mjs +11 -2
  42. package/runtime/js/cm-ai/execution-policy.mjs +3 -1
  43. package/runtime/js/cm-ai/execution-snapshot.mjs +4 -2
  44. package/runtime/js/cm-ai/execution-store-limits.mjs +14 -7
  45. package/runtime/js/cm-ai/execution-store.mjs +60 -17
  46. package/runtime/js/cm-ai/fix-code-association.mjs +73 -2
  47. package/runtime/js/cm-ai/host-check.mjs +11 -5
  48. package/runtime/js/cm-ai/host-conversation-execution.mjs +70 -28
  49. package/runtime/js/cm-ai/host-qa-executor.mjs +38 -5
  50. package/runtime/js/cm-ai/host-qa-fix-owner.mjs +2 -2
  51. package/runtime/js/cm-ai/host-qa-policy.mjs +19 -2
  52. package/runtime/js/cm-ai/host-replay.mjs +148 -0
  53. package/runtime/js/cm-ai/host-session.mjs +1 -1
  54. package/runtime/js/cm-ai/host-workflow-capabilities.mjs +19 -2
  55. package/runtime/js/cm-ai/host.mjs +1 -1
  56. package/runtime/js/cm-ai/implicit-qa-decision.mjs +5 -0
  57. package/runtime/js/cm-ai/integration-snapshots.mjs +50 -0
  58. package/runtime/js/cm-ai/live-evidence.mjs +28 -6
  59. package/runtime/js/cm-ai/operator-guidance.mjs +9 -2
  60. package/runtime/js/cm-ai/owned-process-cleanup.mjs +27 -9
  61. package/runtime/js/cm-ai/process-group-exit.mjs +46 -0
  62. package/runtime/js/cm-ai/provider-review-observation.mjs +3 -2
  63. package/runtime/js/cm-ai/qa-attachment.mjs +22 -0
  64. package/runtime/js/cm-ai/qa-config-revision.mjs +7 -2
  65. package/runtime/js/cm-ai/requirement-evidence.mjs +102 -0
  66. package/runtime/js/cm-ai/review-package.mjs +79 -7
  67. package/runtime/js/cm-ai/review-presentation-delta.mjs +166 -0
  68. package/runtime/js/cm-ai/review-presentation.mjs +177 -8
  69. package/runtime/js/cm-ai/reviewed-evidence-supersede.mjs +70 -2
  70. package/runtime/js/cm-ai/reviewed-integration.mjs +260 -0
  71. package/runtime/js/cm-ai/scope-revision.mjs +38 -0
  72. package/runtime/js/cm-ai/specification-material.mjs +2 -2
  73. package/runtime/js/cm-ai/task-runner.mjs +242 -39
  74. package/runtime/js/cm-ai/verification-auto.mjs +38 -0
  75. package/runtime/js/cm-ai/worker-claude-developer.mjs +39 -15
  76. package/runtime/js/cm-ai/worker-claude.mjs +35 -13
  77. package/runtime/js/cm-ai/worker-codex-developer.mjs +43 -17
  78. package/runtime/js/cm-ai/worker-codex.mjs +41 -7
  79. package/runtime/js/cm-fix/cause-invocation.mjs +16 -2
  80. package/runtime/js/cm-fix/cause-package.mjs +46 -1
  81. package/runtime/js/cm-fix/command-correction.mjs +37 -0
  82. package/runtime/js/cm-fix/cooperative.mjs +12 -0
  83. package/runtime/js/cm-fix/dossier.mjs +8 -2
  84. package/runtime/js/cm-fix/execution.mjs +578 -100
  85. package/runtime/js/cm-fix/final-review.mjs +39 -8
  86. package/runtime/js/cm-fix/finish.mjs +15 -11
  87. package/runtime/js/cm-fix/host-review.mjs +65 -10
  88. package/runtime/js/cm-fix/host.mjs +35 -12
  89. package/runtime/js/cm-fix/jest-command-correction.mjs +69 -0
  90. package/runtime/js/cm-fix/metrics.mjs +18 -5
  91. package/runtime/js/cm-fix/regression-evidence.mjs +3 -2
  92. package/runtime/js/cm-fix/regression.mjs +16 -7
  93. package/runtime/js/cm-fix/repair.mjs +29 -8
  94. package/runtime/js/cm-fix/review-verification-command.mjs +135 -0
  95. package/runtime/js/cm-fix/review-verification-contract.mjs +54 -0
  96. package/runtime/js/cm-fix/review-verification-diagnostic.mjs +75 -0
  97. package/runtime/js/cm-fix/review-verification-recovery.mjs +44 -0
  98. package/runtime/js/cm-fix/review-verification-server.mjs +38 -0
  99. package/runtime/js/cm-fix/review-verification.mjs +214 -0
  100. package/runtime/js/cm-fix/source-correction-recovery.mjs +65 -0
  101. package/runtime/js/cm-fix/start.mjs +6 -3
  102. package/runtime/js/cm-fix/test-type-correction.mjs +86 -0
  103. package/runtime/js/cm-fix/test-type-recovery.mjs +51 -0
  104. package/runtime/js/cm-fix/type-import-correction.mjs +89 -0
  105. package/runtime/js/cm-prd/accepted-design.mjs +8 -0
  106. package/runtime/js/cm-prd/analysis.mjs +13 -9
  107. package/runtime/js/cm-prd/change.mjs +37 -16
  108. package/runtime/js/cm-prd/draft-save.mjs +13 -6
  109. package/runtime/js/cm-prd/draft.mjs +31 -3
  110. package/runtime/js/cm-prd/failed-correction.mjs +19 -3
  111. package/runtime/js/cm-prd/inputs-replaced.mjs +3 -0
  112. package/runtime/js/cm-prd/review-correction.mjs +6 -4
  113. package/runtime/js/cm-prd/review-disposition.mjs +7 -1
  114. package/runtime/js/cm-prd/self-check-revision.mjs +2 -2
  115. package/runtime/js/cm-prd/self-check.mjs +125 -6
  116. package/runtime/js/cm-prd/session.mjs +30 -1
  117. package/runtime/js/cm-prd/summary.mjs +11 -5
  118. package/runtime/js/cm-prd/task-scope-record.mjs +97 -0
  119. package/runtime/js/cm-prd/tree-digest.mjs +34 -0
  120. package/runtime/js/cm-prd/validation-reason.mjs +8 -4
  121. package/runtime/js/cm-security/scan.mjs +1 -1
  122. package/runtime/js/commander/decision.mjs +44 -0
  123. package/runtime/js/commander/dispatch-registry.mjs +110 -0
  124. package/runtime/js/commander/ledger.mjs +265 -0
  125. package/runtime/js/commander/preflight.mjs +107 -0
  126. package/runtime/js/notify-later.mjs +13 -0
  127. package/runtime/js/notify-send.mjs +6 -2
  128. package/runtime/js/notify.mjs +581 -65
  129. package/runtime/js/review-findings.mjs +38 -0
  130. package/runtime/js/session-boundary.mjs +56 -0
  131. package/runtime/js/session-handoff.mjs +68 -0
  132. package/runtime/js/spec-task-line.mjs +27 -13
  133. package/runtime/js/specs-status.mjs +5 -4
  134. package/runtime/js/task-scope.mjs +197 -0
  135. package/runtime/logging.md +6 -1
  136. package/runtime/model-efficiency.md +69 -10
  137. package/runtime/orchestration.md +3 -1
  138. package/runtime/project-learning.md +2 -0
  139. package/runtime/review.md +3 -2
  140. package/runtime/test-contract.md +1 -0
  141. package/scripts/ci-test-weights.json +3 -0
  142. package/scripts/cm-ai-admission.mjs +21 -7
  143. package/scripts/cm-ai-admission.test.mjs +171 -3
  144. package/scripts/cm-ai-batch-drive.mjs +79 -18
  145. package/scripts/cm-ai-batch-drive.test.mjs +169 -3
  146. package/scripts/cm-ai-batch-host.mjs +38 -9
  147. package/scripts/cm-ai-batch-host.test.mjs +6 -5
  148. package/scripts/cm-ai-batch-learning-merge.test.mjs +36 -0
  149. package/scripts/cm-ai-batch-location.test.mjs +57 -0
  150. package/scripts/cm-ai-batch-plan.mjs +52 -0
  151. package/scripts/cm-ai-batch-plan.test.mjs +397 -0
  152. package/scripts/cm-ai-batch-run-fixture.mjs +446 -35
  153. package/scripts/cm-ai-batch-run-member-stops.test.mjs +16 -0
  154. package/scripts/cm-ai-batch-run-parallel.test.mjs +28 -1
  155. package/scripts/cm-ai-batch-run.mjs +471 -57
  156. package/scripts/cm-ai-batch-run.test.mjs +23 -4
  157. package/scripts/cm-ai-batch-session-e2e.test.mjs +235 -0
  158. package/scripts/cm-ai-batch-session-member.test.mjs +293 -0
  159. package/scripts/cm-ai-batch-session-recovery.test.mjs +423 -0
  160. package/scripts/cm-ai-check-recheck-cancellation.test.mjs +247 -0
  161. package/scripts/cm-ai-checklist-coverage.test.mjs +4 -2
  162. package/scripts/cm-ai-checkpoint-package-material.test.mjs +221 -0
  163. package/scripts/cm-ai-checkpoint-package-owner.test.mjs +193 -0
  164. package/scripts/cm-ai-control-launch.test.mjs +21 -0
  165. package/scripts/cm-ai-control-policy.test.mjs +14 -0
  166. package/scripts/cm-ai-control-v2-drive.test.mjs +398 -3
  167. package/scripts/cm-ai-control-v2-supersede-race.mjs +25 -0
  168. package/scripts/cm-ai-control-v2-supersede.test.mjs +318 -0
  169. package/scripts/cm-ai-develop-driver-gaps.test.mjs +163 -0
  170. package/scripts/cm-ai-development-rework.test.mjs +423 -0
  171. package/scripts/cm-ai-drive.mjs +73 -17
  172. package/scripts/cm-ai-drive.test.mjs +34 -2
  173. package/scripts/cm-ai-execution-store-legacy-probe.test.mjs +84 -0
  174. package/scripts/cm-ai-host.mjs +60 -19
  175. package/scripts/cm-ai-integration-adoption.test.mjs +223 -0
  176. package/scripts/cm-ai-integration-independence.test.mjs +23 -0
  177. package/scripts/cm-ai-integration-launch.test.mjs +240 -0
  178. package/scripts/cm-ai-integration-preview.mjs +41 -0
  179. package/scripts/cm-ai-integration-snapshots.test.mjs +197 -0
  180. package/scripts/cm-ai-nested-execution.test.mjs +29 -1
  181. package/scripts/cm-ai-operator-guidance.test.mjs +16 -1
  182. package/scripts/cm-ai-prefinal-delivery.test.mjs +278 -0
  183. package/scripts/cm-ai-project-qa-gate.test.mjs +56 -0
  184. package/scripts/cm-ai-qa-fingerprint-config.test.mjs +28 -0
  185. package/scripts/cm-ai-qa-rerun-timeouts.test.mjs +36 -2
  186. package/scripts/cm-ai-requirement-evidence.test.mjs +65 -0
  187. package/scripts/cm-ai-review-failure.test.mjs +150 -5
  188. package/scripts/cm-ai-run.mjs +88 -21
  189. package/scripts/cm-ai-scope-revision.test.mjs +341 -0
  190. package/scripts/cm-ai-spec-rebind.test.mjs +13 -0
  191. package/scripts/cm-ai-supersede.test.mjs +28 -0
  192. package/scripts/cm-ai-verification-auto.test.mjs +99 -0
  193. package/scripts/cm-announce-hook.mjs +35 -8
  194. package/scripts/cm-announce-hook.test.mjs +25 -0
  195. package/scripts/cm-autonomy.mjs +94 -0
  196. package/scripts/cm-autonomy.test.mjs +162 -0
  197. package/scripts/cm-challenge.test.mjs +61 -0
  198. package/scripts/cm-check-drive-files.mjs +1 -1
  199. package/scripts/cm-check-runtime.sh +60 -1
  200. package/scripts/cm-claude-developer-worker.test.mjs +56 -7
  201. package/scripts/cm-claude-install-layout.test.mjs +1 -1
  202. package/scripts/cm-claude-review-diagnostics.test.mjs +235 -0
  203. package/scripts/cm-claude-review-stream.test.mjs +13 -0
  204. package/scripts/cm-codex-developer-reconnect-notice.test.mjs +98 -0
  205. package/scripts/cm-codex-developer-worker.test.mjs +120 -0
  206. package/scripts/cm-codex-install-local-edit-guard.test.mjs +436 -0
  207. package/scripts/cm-codex-prompt-input.test.mjs +153 -0
  208. package/scripts/cm-codex-reconnect-notice.test.mjs +167 -0
  209. package/scripts/cm-commander-ledger.test.mjs +260 -0
  210. package/scripts/cm-commander-p2.test.mjs +295 -0
  211. package/scripts/cm-commander-preflight.mjs +84 -0
  212. package/scripts/cm-commander.mjs +116 -0
  213. package/scripts/cm-config-lock.mjs +35 -0
  214. package/scripts/cm-controlled-correction.test.mjs +10 -1
  215. package/scripts/cm-developer-failure-code.test.mjs +62 -0
  216. package/scripts/cm-display-task-id.test.mjs +41 -0
  217. package/scripts/cm-efficiency-presentation-delta.test.mjs +218 -0
  218. package/scripts/cm-execution-snapshot-reuse.test.mjs +115 -0
  219. package/scripts/cm-external-batch-host.test.mjs +4 -3
  220. package/scripts/cm-external-process-cleanup.test.mjs +128 -0
  221. package/scripts/cm-external-qa-fix.test.mjs +89 -7
  222. package/scripts/cm-external-review-reconciliation.test.mjs +11 -0
  223. package/scripts/cm-failover.mjs +48 -10
  224. package/scripts/cm-failover.test.mjs +46 -0
  225. package/scripts/cm-fix-cause-invocation.test.mjs +19 -4
  226. package/scripts/cm-fix-command-correction.mjs +17 -0
  227. package/scripts/cm-fix-command-correction.test.mjs +211 -0
  228. package/scripts/cm-fix-cooperative-closeout.test.mjs +87 -0
  229. package/scripts/cm-fix-diagnosis-module-correction.test.mjs +217 -0
  230. package/scripts/cm-fix-drive.mjs +33 -5
  231. package/scripts/cm-fix-drive.test.mjs +49 -0
  232. package/scripts/cm-fix-host-review-assembly.test.mjs +197 -1
  233. package/scripts/cm-fix-host-review.test.mjs +21 -9
  234. package/scripts/cm-fix-host.mjs +26 -8
  235. package/scripts/cm-fix-monorepo-map.test.mjs +92 -0
  236. package/scripts/cm-fix-observation-task-id.test.mjs +122 -0
  237. package/scripts/cm-fix-regression-input-budget.test.mjs +111 -0
  238. package/scripts/cm-fix-repair-input-budget.test.mjs +119 -0
  239. package/scripts/cm-fix-review-file-paging.test.mjs +91 -0
  240. package/scripts/cm-fix-review-preflight.mjs +24 -0
  241. package/scripts/cm-fix-review-storage.test.mjs +233 -0
  242. package/scripts/cm-fix-review-verification-command.test.mjs +242 -0
  243. package/scripts/cm-fix-review-verification-evidence.test.mjs +218 -0
  244. package/scripts/cm-fix-review-verification-integration.test.mjs +81 -0
  245. package/scripts/cm-fix-review-verification-recovery.test.mjs +198 -0
  246. package/scripts/cm-fix-review-verification.test.mjs +146 -0
  247. package/scripts/cm-fix-revision-transport.test.mjs +81 -0
  248. package/scripts/cm-fix-source-correction.test.mjs +296 -0
  249. package/scripts/cm-fix-test-type-correction.mjs +18 -0
  250. package/scripts/cm-fix-test-type-correction.test.mjs +123 -0
  251. package/scripts/cm-fix-test-type-owner.test.mjs +208 -0
  252. package/scripts/cm-fix-test-type-verification-cost.test.mjs +66 -0
  253. package/scripts/cm-fix-type-import-correction.test.mjs +95 -0
  254. package/scripts/cm-fix-verification-diagnostic.test.mjs +200 -0
  255. package/scripts/cm-fix-verification-recovery.mjs +33 -0
  256. package/scripts/cm-host-qa-executor.test.mjs +77 -0
  257. package/scripts/cm-host-replay.test.mjs +176 -0
  258. package/scripts/cm-install-local-edit-guard.test.mjs +621 -0
  259. package/scripts/cm-install-manifest.sh +351 -0
  260. package/scripts/cm-live-evidence.test.mjs +59 -1
  261. package/scripts/cm-log-event.mjs +61 -10
  262. package/scripts/cm-log-event.test.mjs +121 -1
  263. package/scripts/cm-matt-skills.mjs +576 -0
  264. package/scripts/cm-matt-skills.test.mjs +550 -0
  265. package/scripts/cm-notify-command.test.mjs +42 -10
  266. package/scripts/cm-notify.mjs +14 -10
  267. package/scripts/cm-notify.test.mjs +581 -59
  268. package/scripts/cm-patrol.mjs +4 -1
  269. package/scripts/cm-patrol.test.mjs +23 -5
  270. package/scripts/cm-prd-answer-gaps.test.mjs +2 -2
  271. package/scripts/cm-prd-completion.test.mjs +56 -13
  272. package/scripts/cm-prd-design-phase.test.mjs +78 -8
  273. package/scripts/cm-prd-draft-save.test.mjs +12 -0
  274. package/scripts/cm-prd-draft.test.mjs +1 -1
  275. package/scripts/cm-prd-drive.mjs +13 -6
  276. package/scripts/cm-prd-drive.test.mjs +45 -1
  277. package/scripts/cm-prd-gate-diagnostic.test.mjs +2 -2
  278. package/scripts/cm-prd-host.mjs +10 -5
  279. package/scripts/cm-prd-host.test.mjs +4 -2
  280. package/scripts/cm-prd-inputs-replaced.test.mjs +1 -1
  281. package/scripts/cm-prd-review-disposition.test.mjs +124 -8
  282. package/scripts/cm-prd-revision.test.mjs +1 -1
  283. package/scripts/cm-prd-self-check-revision.test.mjs +1 -1
  284. package/scripts/cm-prd-self-check-rules.test.mjs +239 -0
  285. package/scripts/cm-prd-self-check.test.mjs +105 -5
  286. package/scripts/cm-prd-summary.test.mjs +24 -3
  287. package/scripts/cm-prd-task-grouping.test.mjs +6 -6
  288. package/scripts/cm-prd-tree-digest.test.mjs +74 -0
  289. package/scripts/cm-refactor-drive.mjs +2 -1
  290. package/scripts/cm-refactor-drive.test.mjs +9 -0
  291. package/scripts/cm-release-smoke.sh +1 -1
  292. package/scripts/cm-skill-hints-autowire.test.mjs +394 -0
  293. package/scripts/cm-skill-hints-exam.mjs +149 -0
  294. package/scripts/cm-skill-hints-install.test.mjs +168 -0
  295. package/scripts/cm-skill-hints.exam.json +706 -0
  296. package/scripts/cm-skill-hints.json +119 -0
  297. package/scripts/cm-skill-hints.mjs +669 -0
  298. package/scripts/cm-skill-hints.test.mjs +831 -0
  299. package/scripts/cm-skill-judge.mjs +181 -0
  300. package/scripts/cm-skill-judge.test.mjs +255 -0
  301. package/scripts/cm-specs-status.test.mjs +4 -2
  302. package/scripts/cm-start-check.mjs +323 -0
  303. package/scripts/cm-start-check.test.mjs +406 -0
  304. package/scripts/cm-task-gate.mjs +150 -29
  305. package/scripts/cm-task-gate.test.mjs +73 -1
  306. package/scripts/cm-task-id-grammar.test.mjs +66 -0
  307. package/scripts/cm-task-scope.test.mjs +308 -0
  308. package/scripts/cm-upgrade-compat-batch.test.mjs +172 -0
  309. package/scripts/cm-upgrade-compat.test.mjs +239 -0
  310. package/scripts/cm-workflow-config.mjs +12 -2
  311. package/scripts/fixtures/fix-verification-claude.mjs +44 -0
  312. package/scripts/fixtures/reviewed-integration.mjs +202 -0
  313. package/scripts/scan-public-safety.py +1 -0
  314. package/scripts/session-boundary.test.mjs +170 -0
  315. package/scripts/test-npm-install.py +14 -3
  316. package/scripts/test-shell-compat.sh +2 -0
  317. package/scripts/validate-public-repo.py +4 -0
  318. package/scripts/validate-test-cases.mjs +3 -2
  319. package/skills/cm-ai/SKILL.md +5 -2
  320. package/skills/cm-ai/references/N3-execute-task.md +1 -1
  321. package/skills/cm-ai/references/N4-review.md +2 -1
  322. package/skills/cm-ai/references/N6-qa-eval.md +3 -1
  323. package/skills/cm-ai/references/N8-finish.md +22 -0
  324. package/skills/cm-ai/references/js-host-qa-recovery.md +1 -1
  325. package/skills/cm-ai/references/js-host-recovery.md +79 -3
  326. package/skills/cm-ai/references/js-host.md +82 -16
  327. package/skills/cm-challenge/SKILL.md +65 -0
  328. package/skills/cm-challenge/evals/README.md +18 -0
  329. package/skills/cm-challenge/evals/trigger-cases.json +20 -0
  330. package/skills/cm-challenge/evals/trigger-config.json +28 -0
  331. package/skills/cm-challenge/references/examples.md +15 -0
  332. package/skills/cm-check/SKILL.md +5 -0
  333. package/skills/cm-check/references/js-host.md +2 -0
  334. package/skills/cm-fix/SKILL.md +12 -3
  335. package/skills/cm-fix/references/command-correction.md +67 -0
  336. package/skills/cm-fix/references/isolated-review.md +54 -0
  337. package/skills/cm-fix/references/js-host.md +62 -2
  338. package/skills/cm-fix/references/test-type-correction.md +72 -0
  339. package/skills/cm-fix/references/verification-recovery.md +114 -0
  340. package/skills/cm-idea/SKILL.md +2 -0
  341. package/skills/cm-idea/references/js-host.md +2 -0
  342. package/skills/cm-notify/SKILL.md +2 -0
  343. package/skills/cm-prd/SKILL.md +14 -9
  344. package/skills/cm-prd/references/brownfield.md +8 -1
  345. package/skills/cm-prd/references/change-mode.md +8 -1
  346. package/skills/cm-prd/references/greenfield.md +4 -0
  347. package/skills/cm-prd/references/js-change-recovery.md +14 -0
  348. package/skills/cm-prd/references/js-host.md +4 -2
  349. package/skills/cm-prd/references/spec-self-check.md +5 -1
  350. package/skills/cm-refactor/SKILL.md +8 -0
  351. package/skills/cm-refactor/references/js-host.md +2 -0
  352. package/skills/cm-test/SKILL.md +4 -0
  353. package/templates/dashboard/dashboard.html +2 -2
  354. package/templates/pixel/cm-pixel.html +1 -1
  355. package/templates/pixel/cm-pixel.sh +1 -1
  356. package/templates/pixel/dev/template.html +1 -1
  357. package/templates/statusline/cm-statusline.sh +1 -1
@@ -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 不认识新增事件时应拒绝读取,不能忽略事件降级执行。
@@ -76,7 +76,7 @@ Install or upgrade with the same command:
76
76
  npx @aibyzero/cm-workflow@latest install
77
77
  ```
78
78
 
79
- To pin a version, use `npx @aibyzero/cm-workflow@0.17.1 install` from outside
79
+ To pin a version, use `npx @aibyzero/cm-workflow@0.19.0 install` from outside
80
80
  the CM Workflow source checkout (for example, your home directory). Inside a
81
81
  checkout with the same package name and version, npm can select the local
82
82
  uninstalled package and report `cm-workflow: command not found`.
@@ -96,9 +96,11 @@ Running `cm-workflow install` through npm installs into the
96
96
  same `~/plugins/cm-workflow` directory and personal marketplace as the source
97
97
  installer. Existing installations require confirmation; `install --yes` accepts
98
98
  replacement. The npm `--yes` before `--package` only accepts npm's package-fetch
99
- prompt; it does not accept plugin replacement. Direct edits to the managed
100
- plugin are overwritten; source checkouts, project code and specs remain outside
101
- the managed destination. Installing older source afterward can downgrade it.
99
+ prompt; it does not accept plugin replacement. Files of the managed plugin that
100
+ were edited after the last install stop the replacement (see
101
+ [Local edits, install lock and known limitations](#local-edits-install-lock-and-known-limitations));
102
+ files the installer never recorded are removed with the old plugin directory.
103
+ Source checkouts, project code and specs remain outside the managed destination. Installing older source afterward can downgrade it.
102
104
  Start a new Codex task after an upgrade. `npx --yes` accepts npm's download
103
105
  prompt only; `install --yes` separately accepts replacing the managed plugin.
104
106
 
@@ -141,6 +143,9 @@ accept replacement of all listed CM files:
141
143
  ./install.sh --yes
142
144
  ```
143
145
 
146
+ Both Bash installers refuse to discard local edits; see
147
+ [Local edits, install lock and known limitations](#local-edits-install-lock-and-known-limitations).
148
+
144
149
  The installer runs the shared mechanical check before reporting success. Start a
145
150
  new Claude Code session, then run `/cm-check`. The installer also keeps the
146
151
  historic `/cm:check` alias on macOS/Linux. The installed manual is available at
@@ -176,6 +181,108 @@ Claude-specific workflow fork is installed.
176
181
 
177
182
  这只是启动命令的建议规则,不是 CM 的运行授权;计划文件里的操作与权限仍须逐项审查。覆盖旧审查证据的 `--supersede-reviewed-evidence`、保留前驱代码漂移的 `--accept-superseded-code-drift`、SwiftPM 的 `--disable-sandbox`、QA 重跑的 `--rerun-unknown-qa`/`--rerun-blocked-qa`、放弃审查的 `--allow-abandon-review`,以及修改权限配置,都应由用户针对本次动作确认。尤其 `--supersede-reviewed-evidence` 和 `--accept-superseded-code-drift` 可以写在驱动的 `PLAN.permissions` 中,单凭上面的 Bash 通配规则无法识别;无法逐次审阅计划时,不要启用这些通配规则。要试改驱动脚本,请把副本放在项目或临时工作目录,不在 `~/.claude/scripts/` 原地编辑。若组织级权限策略继续拒绝,即使项目规则允许也应遵循该策略。
178
183
 
184
+ ## Local edits, install lock and known limitations
185
+
186
+ Applies to `install.sh` and `install-codex.sh` (not `install.ps1`).
187
+
188
+ **Install manifest.** A successful install records the sha256 of each core file
189
+ it wrote: `<CLAUDE_HOME>/cm-workflow/install-manifest.sha256` (default
190
+ `~/.claude/...`) and `~/plugins/cm-workflow/.cm-install-manifest.sha256`.
191
+ `__pycache__` and `.DS_Store` files are copied but not recorded, and the optional
192
+ updater scripts in `~/.cm-workflow` are outside the core install and the manifest.
193
+ A file name containing a backslash is refused.
194
+
195
+ **Local edits.** On reinstall, a recorded file that still exists but whose
196
+ sha256 changed is a local edit. A symlink, a directory, or a symlinked parent at
197
+ a recorded path also counts. The installer lists the files and exits with
198
+ status 3; `--yes` and an interactive `y` do not bypass this. Pass
199
+ `--overwrite-local-edits` only to discard those edits. A manifest that is
200
+ malformed or not a regular file also stops the install, and so does any
201
+ check that cannot read its own files or cannot search a directory holding a
202
+ recorded file (that is never taken as "deleted"). Without a previous
203
+ manifest (first install or an older version) the check is skipped with a
204
+ notice, so edits made before the first manifest cannot be detected. A recorded
205
+ file that was deleted is not treated as an edit.
206
+
207
+ The check runs before anything is written, again after the overwrite prompt,
208
+ and again in the middle of the transaction:
209
+
210
+ | Installer | When the late check finds a change | What is left |
211
+ | ---- | ---- | ---- |
212
+ | `install.sh` | Right before each file is copied (content, file type and parent path) | Exit 3 after files were already written: the files written so far are rolled back; the changed file is untouched |
213
+ | `install-codex.sh` | After the old plugin directory is renamed aside | Exit 3: the old directory is moved back and the marketplace restored |
214
+
215
+ The npm entry and `$cm-check` automatic upgrades only pass `--yes`. When the
216
+ installer stops for local edits, `$cm-check` reports the upgrade as `blocked`
217
+ (its CLI exits 1, not 3). Save your edits, then run the Bash installer yourself
218
+ with `--overwrite-local-edits` if you want to discard them.
219
+
220
+ **Install lock.** One install per real target at a time. The lock is a
221
+ directory next to the target named `.<target name>.cm-install.lock`:
222
+ `~/..claude.cm-install.lock` for the default Claude target (two dots: the target
223
+ name itself starts with a dot) and `~/plugins/.cm-workflow.cm-install.lock` for
224
+ Codex. Paths are resolved to their physical location first, so `CLAUDE_HOME`
225
+ spellings such as `~/.claude/.` and a Claude install aimed at
226
+ `~/plugins/cm-workflow` share the same lock. A second install exits with status 4
227
+ and names the holder pid, its start time and whether it is still running. A
228
+ leftover lock is never taken over automatically: the installer prints a
229
+ shell-quoted `rm -rf` command to run after you confirm no install is in progress.
230
+ The lock is released on success, on failure, and on HUP/INT/TERM, including a
231
+ signal sent to the whole process group: the lock `mkdir` and the Codex rename run
232
+ with those signals ignored, so their result is always recorded before the
233
+ installer exits.
234
+
235
+ **Paths.** The install root must not be a symlink (`CLAUDE_HOME=/link/.` is
236
+ refused); its parent directories are resolved with `pwd -P`. For Codex,
237
+ `~/plugins`, `~/plugins/cm-workflow`, `~/.agents`, `~/.agents/plugins` and
238
+ `marketplace.json` must not be symlinks, and the marketplace must be a regular
239
+ file. Use real directories at those paths. The marketplace and its two parent
240
+ directories are checked again right before the marketplace is written and right
241
+ before a rollback writes it back; if a rollback finds the wrong type there, it
242
+ writes nothing, reports the rollback as incomplete and keeps the marketplace
243
+ backup.
244
+
245
+ **Rollback.** A failed install restores what it wrote. It trusts only complete
246
+ records of its own list of written files that name a file this install manages;
247
+ a record cut short (for example by a full disk) or an unknown one is not used and
248
+ makes the rollback incomplete. If a restore step itself
249
+ fails, the installer still tries the remaining steps and releases the lock, reports
250
+ that the rollback is incomplete (`回滚不完整` / `rollback is incomplete`), and keeps the recovery copies
251
+ (`.cm-claude.backup.<pid>` next to the Claude target, holding the previous files
252
+ and `.cm-previous-install-manifest`; for Codex the listed backup, failed-plugin
253
+ and marketplace-backup paths under `~/plugins`).
254
+ If `~/plugins` itself cannot be searched when a Codex install fails, the
255
+ installer cannot tell what is there: it restores nothing under it, reports the
256
+ rollback as incomplete, prints the expected recovery paths, and leaves the lock
257
+ for you to remove after restoring access.
258
+
259
+ Protection boundary (decided for this feature):
260
+
261
+ > 安装器以用户本人账号运行,「安装进行途中有人故意把受管目录或其父目录替换成符号链接」不在本功能防护范围内——能这样做的人本来就能直接改家目录任何文件,安装器挡不住。本功能要防的是别的会话手改已装文件后被静默覆盖。入口处已有的静态链接拒绝保留。
262
+
263
+ In English: the installers run as you. Deliberately swapping a managed directory
264
+ or one of its parents for a symlink while an install runs is out of scope,
265
+ because whoever can do that can already change any file in your home directory.
266
+ This feature protects files that another session edited from being silently
267
+ overwritten. The symlink refusals at the entry checks stay.
268
+
269
+ Known limitations:
270
+
271
+ | Limitation | Why / what to do |
272
+ | ---- | ---- |
273
+ | No atomic exclusion against people editing files | A file can still change between its check and its copy, and a rollback can overwrite an edit made to a file after it was written. Do not edit installed CM files while an install runs. |
274
+ | Readers see the transaction | `install.sh` copies file by file, so a running CM session can read a mix of versions or a half-written file; `install-codex.sh` leaves the plugin directory briefly missing between its two renames. Finish active CM tasks first, then start a new session after installing. |
275
+ | SIGKILL, power loss, kernel or storage failure | The exit trap cannot run and there is no persistent recovery journal. The lock and the backup directory may remain; recover by hand using them. |
276
+ | No manifest yet; deleted and unrecorded files | Without a manifest nothing can be judged. A deleted recorded file is not an edit. Codex replaces the whole directory, so unrecorded files you added there are removed; Claude leaves files it does not install in place. |
277
+ | Windows and the optional updater | `install.ps1` has none of this protection. `~/.cm-workflow/cm-update.sh` and `cm-announce.sh` are not in the manifest. |
278
+ | No forced overwrite from npm or `$cm-check` | Intentional: they stop on local edits; run the Bash installer yourself to discard edits. |
279
+ | `~/.cm-workflow/cm-update.sh` deletes first | The optional auto-updater uses its own lock and older path list and deletes files removed upstream before it runs `install.sh`, outside this lock and check. It can delete a file and then stop on a local edit. |
280
+ | Other marketplace writers and Codex internal state | The lock only coordinates CM installers. Do not manage other Codex plugins while CM installs: a rollback restores the whole previous `marketplace.json`. Cleanup does not undo Codex cache or registration side effects of `codex plugin add`. |
281
+ | Directories replaced while an install runs | Out of scope (see the boundary above). Partial checks remain: the marketplace structure is re-checked before its directory is first created, before it is written and before a rollback writes it; the Codex local-edit checks stop with status 2 when `~/plugins` is no longer the physical directory resolved at start, and then the lock is not deleted through the replaced path (remove it by hand). Other write points are not re-checked. |
282
+ | Temporary manifest | `install.sh` writes the new manifest to a random `.install-manifest.XXXXXX` file created by `mktemp` next to it and removes only that file on failure. |
283
+ | File names | The manifest is line based; names containing a newline or a backslash are not supported. |
284
+ | Test hook | `CM_INSTALL_TEST_HOOK` exists for the repository's fault-injection tests. It is unset normally; when set, the installer runs that program at fixed points, so never set it outside tests. |
285
+
179
286
  ## Claude Code on Windows
180
287
 
181
288
  ```powershell
@@ -236,6 +343,205 @@ supported Bash environment, add the following commands to Claude Code's
236
343
 
237
344
  Set `CM_UPDATE_REMOTE` when your team intentionally uses a fork.
238
345
 
346
+ ## Optional companion skills (Matt Pocock)
347
+
348
+ CM recommends thirteen skills from [mattpocock/skills](https://github.com/mattpocock/skills)
349
+ (MIT) for work between CM stages, such as grilling a plan before `cm-prd` or finding
350
+ refactoring opportunities before `cm-refactor`, or a `retro` of the session once
351
+ `cm-ai` has finished (N8 prints one line pointing at it). CM never depends on them.
352
+
353
+ Installers put them in by default: `install.sh`, `install-codex.sh` and `install.ps1`
354
+ copy the ones missing from `~/.claude/skills` and `~/.agents/skills`, with the same
355
+ fetch and checks as the manual command below, and print what was added. A fetch that
356
+ fails (no network, no `git`) only warns; CM itself is installed either way, and the
357
+ manual command is printed for later. `/cm-check` reports the status and whether the
358
+ install-time default is on.
359
+
360
+ An install does not add the skills when:
361
+
362
+ - you pass `--no-matt-skills` (`-NoMattSkills` for `install.ps1`) or set
363
+ `CM_MATT_SKILLS_INSTALL=off`. This covers that run only: the next install without
364
+ them adds the skills as usual; skills already there are kept;
365
+ - `~/.cm-workflow/matt-skills.local.json` has `"install": false`, which turns the
366
+ default off for good; or that file cannot be read, is empty, or has the wrong shape
367
+ (`install` must be `true`/`false`). Then it warns and changes nothing until you fix
368
+ the file;
369
+ - a skill is settled: CM records every skill it has seen in a skills directory (put in
370
+ by it, or already there, including a same-named skill with other content) in
371
+ `~/.cm-workflow/matt-skills.auto.json`. A settled skill that is missing later was
372
+ removed by you, and no install puts it back. If that record cannot be read or has
373
+ another shape, it is kept as it is and no install adds anything until you fix or
374
+ delete it.
375
+
376
+ Upgrade boundary: versions before this one kept no record, so a skill you installed by
377
+ hand and removed earlier cannot be told from one you never had, and the first install of
378
+ this version adds every missing skill once. To keep that choice, opt out first (the flag or
379
+ the environment variable for that run, or `"install": false`). The fetch is bounded (two
380
+ minutes per git call); a stalled network ends in the same warning as a failed one.
381
+
382
+ A skill whose name already exists with other content is never overwritten, by the
383
+ default or by the manual command. To install by hand (for example after opting out),
384
+ run the printed command:
385
+
386
+ ```bash
387
+ node ~/.claude/scripts/cm-matt-skills.mjs install
388
+ ```
389
+
390
+ The command fetches only commit `5beb35b` into a private temporary repository,
391
+ reads files straight from git without a checkout, and checks every file and the
392
+ upstream `LICENSE` against the SHA-256 list built into the script. Any mismatch,
393
+ extra or missing file, or non-regular file aborts the whole install before
394
+ anything is written. Each skill is copied with `LICENSE` into both skill
395
+ directories; a skill whose name already exists is skipped and reported, never
396
+ overwritten, and a skills directory that is not a usable directory is reported
397
+ as a failure. Nothing downloaded is executed: git runs without your git
398
+ configuration, hooks or credential helpers, over https or local paths only;
399
+ proxy settings are taken from `https_proxy`-style environment variables.
400
+ `--source <https URL or path>` uses a mirror, which must serve the pinned commit
401
+ by id; the commit and checksums still apply. Start a new session to see newly
402
+ installed skills.
403
+
404
+ ## Optional skill hints (trial)
405
+
406
+ A `UserPromptSubmit` hook that reads each message you type, matches it against a
407
+ keyword table and, when a skill fits, shows you a one-line hint such as
408
+ `💡 技能提醒:可以试 /grill-me——…`. The hint is shown to you directly
409
+ (`systemMessage`) and is not added to the model's context. For these hints,
410
+ matching is local keyword and optional regex matching: nothing is sent anywhere
411
+ and no tokens are spent on it. The three auto-started skills below are the
412
+ exception: when a TypeSafe key is available, the first 500 characters of each
413
+ message are sent to TypeSafe's Jev to judge them. Messages over 2000 characters and text inside ``` fences are
414
+ skipped, at most two skills are hinted per message, and each skill at most once
415
+ per session. Sessions that CM itself launches set `CM_SKILL_HINTS=off`.
416
+
417
+ Three author skills that the model cannot start on its own (they are marked
418
+ `disable-model-invocation`) are started instead of hinted, when their pinned author
419
+ version is installed for that host:
420
+
421
+ - `handoff`: the hook adds one sentence to the model's context telling it to read
422
+ that skill's `SKILL.md` and follow it, and shows you
423
+ `🤖 技能自动调用:已让模型用 /handoff`.
424
+ - `wayfinder` and `improve-codebase-architecture`: the model is told to ask you
425
+ first and to read the skill only after you agree
426
+ (`🤖 技能自动调用:已让模型先问你要不要用 /wayfinder`).
427
+
428
+ Whether one of them fits is judged by TypeSafe's Jev when a TypeSafe key is
429
+ available (`TYPESAFE_API_KEY`, or on macOS a keychain item named
430
+ `TYPESAFE_API_KEY` for your user). Only the first 500 characters of the message
431
+ are sent. A message is kept local, and the keyword table decides for it, when:
432
+
433
+ - after folding it contains one of a fixed
434
+ list of credential words: password, passwd, pwd, passcode, token, secret, API key,
435
+ access key, private key, credential, `密码`, `密钥`, `口令`, `令牌`, `凭证`, `凭据`
436
+ and their traditional Chinese forms. Folding works character by character: a letter
437
+ or digit becomes its plain form (full-width and other compatibility forms made plain,
438
+ accents split off), a symbol stays only when it stands for exactly one letter or digit
439
+ (a circled letter), and everything else is dropped (spaces, punctuation, zero-width
440
+ and control characters, modifier letters, Hangul fillers, symbols such as `№`); then
441
+ lower case. So `API key`, `api_key`, `API key` and a zero-width space inside the
442
+ word all count;
443
+ - or it holds a known key shape (API keys, tokens, private keys), a long mixed-case run,
444
+ or the TypeSafe key itself.
445
+
446
+ This is pattern matching, not a guarantee. It does not catch: a credential pasted with
447
+ no recognisable shape and no credential word; look-alike letters from other scripts
448
+ (a Cyrillic `а` in `pаssword`); letters with no decomposition (`tøken`); extra, missing,
449
+ swapped or digit-for-letter characters (`passXword`, `t0ken`); escapes and encodings
450
+ (`pass%77ord`); text reordered with bidirectional controls; other wording or languages. Jev gets at most 3
451
+ seconds, with a second request when the first fails or has not answered within 1
452
+ second. Without a key, on a credential-looking message, or when Jev fails, the
453
+ same keyword table decides. A message that opens with a command (`/handoff …`) is
454
+ left to the host. `"judge": false` in your local file keeps it to keywords even
455
+ with a key. The log records which skill was started and whether Jev or keywords
456
+ decided, never the message or the key.
457
+
458
+ Installers turn it on by default. `install.sh` and `install.ps1` add the hook to
459
+ `~/.claude/settings.json`, and `install-codex.sh` adds it to `~/.codex/hooks.json`,
460
+ once per host; the output says so in one line, with how to turn hints off and the
461
+ TypeSafe note above. Codex asks you to trust the new hook the first time it runs;
462
+ CM does not trust it for you. A later install does not add it again.
463
+
464
+ To turn hints off, write `"enabled": false` in
465
+ `~/.cm-workflow/skill-hints.local.json`: the hook stays in place but does nothing
466
+ and sends nothing. `--no-skill-hints` does not turn anything off; it only stops
467
+ installs from adding the hook. An install does not wire the hook when:
468
+
469
+ - you pass `--no-skill-hints` (`-NoSkillHints` for `install.ps1`) or set
470
+ `CM_SKILL_HINTS_INSTALL=off` (this also works for `cm-workflow install`). This
471
+ covers that run only: the next install without them wires the host as usual, and
472
+ a hook already there is kept;
473
+ - `~/.cm-workflow/skill-hints.local.json` has `"enabled": false`; or it cannot be
474
+ read, is empty, or is not an object, or a known field has the wrong type (`enabled` and
475
+ `judge` must be `true`/`false`, `rules` a list, `disable` a list of strings). Then
476
+ it warns and changes nothing until you fix the file;
477
+ - that host is settled: the hook was there before and you removed it. CM keeps the
478
+ hosts it has wired or found wired in
479
+ `~/.cm-workflow/skill-hints.auto.json` (`{"version": 1, "hosts": [...]}`), written
480
+ under the same lock as its other config writes and before any copy is made. If
481
+ `~/.cm-workflow/skill-hints/` exists but that file does not (you ran `enable`
482
+ before installers did this), both hosts count as settled, and nothing is added;
483
+ - `skill-hints.auto.json` cannot be read or has another shape: it is kept as it is,
484
+ with a warning, and no install adds the hook until you fix or delete it;
485
+ - the host config cannot be read or has the wrong shape: it is left untouched and
486
+ reported in one line, and the next install tries again.
487
+
488
+ In every case the install itself still succeeds; a problem here is a warning. To add
489
+ the hook by hand (for example to a settled host):
490
+
491
+ ```bash
492
+ node ~/.claude/scripts/cm-skill-hints.mjs enable
493
+ ```
494
+
495
+ This copies the script, CM's table, the author-skill checker
496
+ (`cm-matt-skills.mjs`) and the Jev judge (`cm-skill-judge.mjs`) to
497
+ `~/.cm-workflow/skill-hints/` and adds
498
+ one `UserPromptSubmit` hook to `~/.claude/settings.json` and `~/.codex/hooks.json`
499
+ (`--claude` or `--codex` for one side), keeping every other setting and hook. A
500
+ file it cannot parse is left untouched. If the file changes while
501
+ `enable` is writing it, nothing is written and you are asked to run it again.
502
+
503
+ Once hints are on (the hook is wired, or `~/.cm-workflow/skill-hints/` exists),
504
+ every run of `install.sh`, `install-codex.sh` or `install.ps1` refreshes that copy
505
+ (`node ~/.claude/scripts/cm-skill-hints.mjs refresh` does the same by hand). It
506
+ replaces only the script, the table and the three helper scripts; Codex
507
+ trust, session state and logs are left alone, and a host config is only written
508
+ when the hook is added as described above. A failed refresh is a warning, not an
509
+ install failure.
510
+
511
+ Your own rules live in `~/.cm-workflow/skill-hints.local.json`, which CM never
512
+ overwrites. They take precedence over CM's table:
513
+
514
+ ```json
515
+ {
516
+ "enabled": true,
517
+ "disable": ["fix-bug"],
518
+ "rules": [
519
+ {"id": "my-review", "skill": "codex-review", "keywords": ["二审", "交叉审查"], "reason": "让 Codex 独立审一遍"}
520
+ ]
521
+ }
522
+ ```
523
+
524
+ If the local file has any problem (it cannot be read, is empty or only whitespace,
525
+ is not JSON or not an object, or a known field has the wrong type), hints pause as a whole: no hint, no skill started and
526
+ nothing sent to Jev, so a valid `"enabled": false` next to a broken field still holds.
527
+ `/cm-check` shows "本地配置格式异常,提醒已暂停" with the cause; a missing or valid file
528
+ works as before. `"enabled": false` turns hints off; `disable` lists CM rule ids to switch off; a
529
+ user rule with the same `id` as a CM rule replaces it, and a user rule only ever
530
+ hints (it never starts a skill). `patterns` (regular
531
+ expressions) share a 200 ms budget per message; past it they count as no match. An
532
+ author skill (`grill-me`, `grill-with-docs`, `handoff`, `wayfinder`,
533
+ `improve-codebase-architecture`, `prototype`) is only hinted when its pinned
534
+ author version (see above) is installed for that host; otherwise its CM
535
+ counterpart is hinted, if there is one. Per-session state (a few hundred bytes
536
+ each, under `~/.cm-workflow/skill-hints/state/`) is never removed, so a session
537
+ resumed later does not repeat a hint.
538
+ `~/.cm-workflow/logs/skill-hints.jsonl` records rule id, skill, host and time of
539
+ each hint and of each adoption (you typed the skill within the next five
540
+ messages), never message text; it drops its older half past 1 MB. `/cm-check`
541
+ reports whether the hook is wired, the switch, whether installs wire it and which
542
+ hosts are already settled, the rule counts and whether the copy matches the
543
+ installed version (with the `refresh` command when it does not).
544
+
239
545
  ## Uninstall
240
546
 
241
547
  For a Codex install registered by the installer, remove the enabled plugin and