@danmoisan/drm-copilot-mcp 1.1.17 → 1.1.19

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 (225) hide show
  1. package/out/mcp-server.js +1405 -684
  2. package/package.json +6 -4
  3. package/resources/claude-customizations/.claude/agents/atomic-executor.md +11 -0
  4. package/resources/claude-customizations/.claude/agents/atomic-planner.md +10 -0
  5. package/resources/claude-customizations/.claude/agents/epic-orchestrator.md +12 -4
  6. package/resources/claude-customizations/.claude/agents/epic-planner.md +5 -4
  7. package/resources/claude-customizations/.claude/agents/feature-review.md +16 -5
  8. package/resources/claude-customizations/.claude/agents/orchestrator.md +21 -7
  9. package/resources/claude-customizations/.claude/agents/parallel-orchestrator.md +37 -13
  10. package/resources/claude-customizations/.claude/agents/parallel-planner.md +9 -6
  11. package/resources/claude-customizations/.claude/agents/pr-author.md +15 -2
  12. package/resources/claude-customizations/.claude/agents/prd-feature.md +1 -1
  13. package/resources/claude-customizations/.claude/hooks/check-powershell-test-purity.ps1 +7 -1
  14. package/resources/claude-customizations/.claude/hooks/check-python-test-purity.ps1 +7 -1
  15. package/resources/claude-customizations/.claude/hooks/enforce-checkpoint-monotonic.ps1 +7 -1
  16. package/resources/claude-customizations/.claude/hooks/enforce-completion-consistency.ps1 +111 -46
  17. package/resources/claude-customizations/.claude/hooks/enforce-completion-helpers.ps1 +105 -0
  18. package/resources/claude-customizations/.claude/hooks/enforce-discovery-artifact-gate.ps1 +8 -1
  19. package/resources/claude-customizations/.claude/hooks/enforce-epic-invocation-origin.ps1 +7 -1
  20. package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate-resolution.ps1 +116 -59
  21. package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate.ps1 +55 -23
  22. package/resources/claude-customizations/.claude/hooks/enforce-epic-wave-barrier.ps1 +74 -75
  23. package/resources/claude-customizations/.claude/hooks/enforce-epic-worktree-removal-gate-resolution.ps1 +127 -35
  24. package/resources/claude-customizations/.claude/hooks/enforce-epic-worktree-removal-gate.ps1 +61 -57
  25. package/resources/claude-customizations/.claude/hooks/enforce-evidence-locations.ps1 +7 -1
  26. package/resources/claude-customizations/.claude/hooks/enforce-feature-folder-order.ps1 +129 -39
  27. package/resources/claude-customizations/.claude/hooks/enforce-mermaid-validation.ps1 +7 -1
  28. package/resources/claude-customizations/.claude/hooks/enforce-model-routing-receipt.ps1 +9 -3
  29. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate-epic-scope.ps1 +39 -51
  30. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate-helpers.ps1 +31 -58
  31. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate-modes.ps1 +63 -47
  32. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate-targets.ps1 +433 -0
  33. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate.ps1 +17 -12
  34. package/resources/claude-customizations/.claude/hooks/enforce-parallel-abandon-gate.ps1 +9 -3
  35. package/resources/claude-customizations/.claude/hooks/enforce-parallel-cohort-barrier.ps1 +65 -50
  36. package/resources/claude-customizations/.claude/hooks/enforce-parallel-drift-gate.ps1 +49 -42
  37. package/resources/claude-customizations/.claude/hooks/enforce-parallel-worktree-removal-gate.ps1 +54 -72
  38. package/resources/claude-customizations/.claude/hooks/enforce-powershell-batch-budget.ps1 +8 -2
  39. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-command-allowlist.ps1 +279 -0
  40. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill-helpers.ps1 +129 -75
  41. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.artifact-root.ps1 +233 -0
  42. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.docs-only.ps1 +224 -0
  43. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.ps1 +69 -24
  44. package/resources/claude-customizations/.claude/hooks/enforce-prd-feature-before-planner-helpers.ps1 +29 -18
  45. package/resources/claude-customizations/.claude/hooks/enforce-prd-feature-before-planner.ps1 +10 -4
  46. package/resources/claude-customizations/.claude/hooks/enforce-promotion-mcp-only.ps1 +14 -5
  47. package/resources/claude-customizations/.claude/hooks/enforce-python-batch-budget.ps1 +8 -2
  48. package/resources/claude-customizations/.claude/hooks/feature-folder-resolution.ps1 +373 -0
  49. package/resources/claude-customizations/.claude/hooks/feature-review-coverage-thresholds.ps1 +85 -0
  50. package/resources/claude-customizations/.claude/hooks/hook-command-heredoc.ps1 +119 -0
  51. package/resources/claude-customizations/.claude/hooks/hook-command-invocation-operands.ps1 +198 -0
  52. package/resources/claude-customizations/.claude/hooks/hook-command-invocation.ps1 +254 -255
  53. package/resources/claude-customizations/.claude/hooks/hook-command-payload-powershell.ps1 +201 -0
  54. package/resources/claude-customizations/.claude/hooks/hook-command-payload.ps1 +484 -0
  55. package/resources/claude-customizations/.claude/hooks/hook-command-scanner.ps1 +27 -110
  56. package/resources/claude-customizations/.claude/hooks/hook-dependency-guard.ps1 +114 -0
  57. package/resources/claude-customizations/.claude/hooks/hook-docs-only-diff.ps1 +493 -0
  58. package/resources/claude-customizations/.claude/hooks/subagentstop-envelope.ps1 +192 -0
  59. package/resources/claude-customizations/.claude/hooks/validate-bash.ps1 +9 -3
  60. package/resources/claude-customizations/.claude/hooks/validate-discovery-artifact-gate.ps1 +40 -42
  61. package/resources/claude-customizations/.claude/hooks/validate-executor-output.ps1 +66 -38
  62. package/resources/claude-customizations/.claude/hooks/validate-feature-review-coverage-metrics.ps1 +180 -0
  63. package/resources/claude-customizations/.claude/hooks/validate-feature-review-coverage-rules.ps1 +195 -0
  64. package/resources/claude-customizations/.claude/hooks/validate-feature-review-coverage.ps1 +141 -395
  65. package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output-resolution.ps1 +311 -0
  66. package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output-routing.ps1 +170 -0
  67. package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output.ps1 +115 -190
  68. package/resources/claude-customizations/.claude/hooks/validate-planner-output.ps1 +64 -32
  69. package/resources/claude-customizations/.claude/hooks/validate-pr-author-output.ps1 +39 -44
  70. package/resources/claude-customizations/.claude/hooks/validate-prd-feature-output.ps1 +43 -14
  71. package/resources/claude-customizations/.claude/hooks/validate-required-artifact-output.ps1 +66 -36
  72. package/resources/claude-customizations/.claude/hooks/validate-task-researcher-output.ps1 +31 -34
  73. package/resources/claude-customizations/.claude/lib/bash/mutate-parallel-run.sh +191 -0
  74. package/resources/claude-customizations/.claude/lib/bash/parallel-cohorts.sh +13 -3
  75. package/resources/claude-customizations/.claude/lib/bash/parallel-lane-assertion.sh +4 -2
  76. package/resources/claude-customizations/.claude/lib/bash/parallel-mutation-cli.sh +152 -0
  77. package/resources/claude-customizations/.claude/lib/bash/parallel-mutation-ops.sh +193 -0
  78. package/resources/claude-customizations/.claude/lib/bash/parallel-mutation.sh +322 -0
  79. package/resources/claude-customizations/.claude/lib/bash/remove-parallel-item.sh +146 -0
  80. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusExtraction.psm1 +23 -33
  81. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusTokenShape.psm1 +86 -6
  82. package/resources/claude-customizations/.claude/lib/ci-gate/Invoke-CiGateParser.ps1 +91 -19
  83. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorState.psm1 +6 -13
  84. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateEpicWaveBarrier.psm1 +346 -0
  85. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateIssueAdoption.psm1 +396 -0
  86. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateReceipts.psm1 +22 -15
  87. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateRemediationAccounting.psm1 +337 -0
  88. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateRoutingContract.psm1 +9 -1
  89. package/resources/claude-customizations/.claude/lib/worktree-resolution/WorktreeItemResolution.psm1 +79 -2
  90. package/resources/claude-customizations/.claude/lib/worktree-resolution/WorktreeRunResolution.psm1 +3 -3
  91. package/resources/claude-customizations/.claude/rules/architecture-boundaries.md +5 -5
  92. package/resources/claude-customizations/.claude/rules/csharp.md +2 -2
  93. package/resources/claude-customizations/.claude/rules/general-code-change.md +1 -1
  94. package/resources/claude-customizations/.claude/rules/general-unit-test.md +3 -2
  95. package/resources/claude-customizations/.claude/rules/orchestrator-state.md +153 -4
  96. package/resources/claude-customizations/.claude/rules/parallel-orchestration.md +50 -5
  97. package/resources/claude-customizations/.claude/rules/plan-acceptance-gates.md +47 -8
  98. package/resources/claude-customizations/.claude/rules/quality-tiers.md +11 -7
  99. package/resources/claude-customizations/.claude/rules/shell.md +10 -8
  100. package/resources/claude-customizations/.claude/rules/typescript.md +1 -1
  101. package/resources/claude-customizations/.claude/settings.json +3 -4
  102. package/resources/claude-customizations/.claude/skills/acceptance-criteria-tracking/SKILL.md +9 -1
  103. package/resources/claude-customizations/.claude/skills/atomic-plan-contract/SKILL.md +7 -1
  104. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/SKILL.md +11 -3
  105. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/scripts/cleanup-worktrees.sh +11 -2
  106. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/scripts/cleanup_worktrees_detached_lib.sh +1 -1
  107. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/scripts/cleanup_worktrees_enumerate_lib.sh +171 -5
  108. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/scripts/cleanup_worktrees_preserve_lib.sh +1 -1
  109. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/scripts/cleanup_worktrees_report_records_lib.sh +6 -43
  110. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/scripts/cleanup_worktrees_scan_helper.sh +6 -15
  111. package/resources/claude-customizations/.claude/skills/epic-orchestrate/SKILL.md +45 -11
  112. package/resources/claude-customizations/.claude/skills/epic-plan/SKILL.md +1 -1
  113. package/resources/claude-customizations/.claude/skills/evidence-and-timestamp-conventions/SKILL.md +13 -0
  114. package/resources/claude-customizations/.claude/skills/feature-promotion-lifecycle/SKILL.md +10 -0
  115. package/resources/claude-customizations/.claude/skills/feature-review-workflow/SKILL.md +7 -4
  116. package/resources/claude-customizations/.claude/skills/orchestrate/SKILL.md +42 -16
  117. package/resources/claude-customizations/.claude/skills/parallel-add/SKILL.md +52 -14
  118. package/resources/claude-customizations/.claude/skills/parallel-close/SKILL.md +22 -9
  119. package/resources/claude-customizations/.claude/skills/parallel-orchestrate/SKILL.md +97 -19
  120. package/resources/claude-customizations/.claude/skills/parallel-plan/SKILL.md +63 -7
  121. package/resources/claude-customizations/.claude/skills/parallel-remove/SKILL.md +35 -12
  122. package/resources/claude-customizations/.claude/skills/pr-author/SKILL.md +3 -1
  123. package/resources/claude-customizations/.claude/skills/quota-throttling/SKILL.md +1 -1
  124. package/resources/claude-customizations/.claude/skills/remediation-handoff-atomic-planner/SKILL.md +7 -3
  125. package/resources/claude-customizations/pack-manifests/core.json +25 -0
  126. package/resources/codex-and-agents-customizations/.agents/skills/acceptance-criteria-tracking/SKILL.md +9 -1
  127. package/resources/codex-and-agents-customizations/.agents/skills/architecture-boundaries/SKILL.md +5 -5
  128. package/resources/codex-and-agents-customizations/.agents/skills/atomic-executor/SKILL.md +11 -0
  129. package/resources/codex-and-agents-customizations/.agents/skills/atomic-plan-contract/SKILL.md +4 -0
  130. package/resources/codex-and-agents-customizations/.agents/skills/atomic-planner/SKILL.md +10 -0
  131. package/resources/codex-and-agents-customizations/.agents/skills/csharp/SKILL.md +2 -2
  132. package/resources/codex-and-agents-customizations/.agents/skills/csharp-qa-gate/SKILL.md +2 -2
  133. package/resources/codex-and-agents-customizations/.agents/skills/epic-orchestrate/SKILL.md +13 -3
  134. package/resources/codex-and-agents-customizations/.agents/skills/epic-plan/SKILL.md +17 -1
  135. package/resources/codex-and-agents-customizations/.agents/skills/epic-run/SKILL.md +2 -1
  136. package/resources/codex-and-agents-customizations/.agents/skills/evidence-and-timestamp-conventions/SKILL.md +13 -0
  137. package/resources/codex-and-agents-customizations/.agents/skills/feature-promotion-lifecycle/SKILL.md +1 -1
  138. package/resources/codex-and-agents-customizations/.agents/skills/feature-review/SKILL.md +30 -6
  139. package/resources/codex-and-agents-customizations/.agents/skills/feature-review-workflow/SKILL.md +16 -6
  140. package/resources/codex-and-agents-customizations/.agents/skills/general-code-change/SKILL.md +1 -1
  141. package/resources/codex-and-agents-customizations/.agents/skills/general-unit-test/SKILL.md +3 -2
  142. package/resources/codex-and-agents-customizations/.agents/skills/orchestrate/SKILL.md +43 -11
  143. package/resources/codex-and-agents-customizations/.agents/skills/orchestrator-state/SKILL.md +41 -2
  144. package/resources/codex-and-agents-customizations/.agents/skills/orchestrator-workflow/SKILL.md +19 -4
  145. package/resources/codex-and-agents-customizations/.agents/skills/quality-tiers/SKILL.md +11 -7
  146. package/resources/codex-and-agents-customizations/.agents/skills/remediation-handoff-atomic-planner/SKILL.md +2 -0
  147. package/resources/codex-and-agents-customizations/.agents/skills/translate-claude-to-codex/SKILL.md +1 -1
  148. package/resources/codex-and-agents-customizations/.agents-variants/csharp-legacy/skills/csharp/SKILL.md +2 -2
  149. package/resources/codex-and-agents-customizations/.agents-variants/csharp-legacy/skills/csharp-qa-gate/SKILL.md +2 -2
  150. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c1.toml +11 -0
  151. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c2.toml +11 -0
  152. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c3-elevated.toml +11 -0
  153. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c3.toml +11 -0
  154. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c4.toml +11 -0
  155. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor.toml +11 -0
  156. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c1.toml +10 -0
  157. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c2.toml +10 -0
  158. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c3-elevated.toml +10 -0
  159. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c3.toml +10 -0
  160. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c4.toml +10 -0
  161. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner.toml +10 -0
  162. package/resources/codex-and-agents-customizations/.codex/agents/epic-orchestrator.toml +2 -1
  163. package/resources/codex-and-agents-customizations/.codex/agents/feature-review.toml +6 -6
  164. package/resources/codex-and-agents-customizations/.codex/agents/feature-reviewer-c1.toml +1 -0
  165. package/resources/codex-and-agents-customizations/.codex/agents/feature-reviewer-c2.toml +1 -0
  166. package/resources/codex-and-agents-customizations/.codex/agents/feature-reviewer-c3-elevated.toml +1 -0
  167. package/resources/codex-and-agents-customizations/.codex/agents/feature-reviewer-c3.toml +1 -0
  168. package/resources/codex-and-agents-customizations/.codex/agents/feature-reviewer-c4.toml +1 -0
  169. package/resources/codex-and-agents-customizations/.codex/agents/feature-reviewer.toml +1 -0
  170. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c1.toml +3 -3
  171. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c2.toml +3 -3
  172. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c3-elevated.toml +3 -3
  173. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c3.toml +3 -3
  174. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c4.toml +3 -3
  175. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator.toml +3 -3
  176. package/resources/codex-and-agents-customizations/.codex/codex-web-setup.sh +318 -273
  177. package/resources/codex-and-agents-customizations/.codex/config.toml +1 -1
  178. package/resources/codex-and-agents-customizations/.codex/hooks/check-powershell-test-purity.ps1 +7 -1
  179. package/resources/codex-and-agents-customizations/.codex/hooks/check-python-test-purity.ps1 +7 -1
  180. package/resources/codex-and-agents-customizations/.codex/hooks/codex-epic-child-launch-attestation.ps1 +1 -1
  181. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-checkpoint-monotonic.ps1 +7 -1
  182. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-codex-model-routing.ps1 +8 -2
  183. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-completion-consistency.ps1 +97 -44
  184. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-completion-helpers.ps1 +105 -0
  185. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-child-worktree-binding.ps1 +7 -1
  186. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-merge-gate.ps1 +37 -5
  187. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-planning-only.ps1 +6 -0
  188. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-root-invocation.ps1 +7 -1
  189. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-wave-barrier.ps1 +7 -1
  190. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-worktree-removal-gate.ps1 +54 -41
  191. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-evidence-locations.ps1 +7 -1
  192. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate-epic-scope.ps1 +35 -14
  193. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate-helpers.ps1 +31 -58
  194. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate-modes.ps1 +63 -47
  195. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate-targets.ps1 +433 -0
  196. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate.ps1 +24 -11
  197. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-powershell-batch-budget.ps1 +8 -2
  198. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-promotion-mcp-only.ps1 +13 -4
  199. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-python-batch-budget.ps1 +8 -2
  200. package/resources/codex-and-agents-customizations/.codex/hooks/feature-folder-resolution.ps1 +373 -0
  201. package/resources/codex-and-agents-customizations/.codex/hooks/feature-review-coverage-thresholds.ps1 +85 -0
  202. package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-heredoc.ps1 +119 -0
  203. package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-invocation-operands.ps1 +198 -0
  204. package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-invocation.ps1 +254 -255
  205. package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-payload-powershell.ps1 +201 -0
  206. package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-payload.ps1 +484 -0
  207. package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-scanner.ps1 +27 -110
  208. package/resources/codex-and-agents-customizations/.codex/hooks/hook-dependency-guard.ps1 +114 -0
  209. package/resources/codex-and-agents-customizations/.codex/hooks/hook-docs-only-diff.ps1 +493 -0
  210. package/resources/codex-and-agents-customizations/.codex/hooks/validate-bash.ps1 +8 -2
  211. package/resources/codex-and-agents-customizations/.codex/hooks/validate-codex-subagent-routing.ps1 +7 -1
  212. package/resources/codex-and-agents-customizations/.codex/hooks/validate-feature-review-coverage.ps1 +24 -8
  213. package/resources/codex-and-agents-customizations/pack-manifests/core.json +9 -0
  214. package/resources/customizations/.github/agents/csharp-typed-engineer.agent.md +2 -2
  215. package/resources/customizations/.github/instructions/csharp-code-change.instructions.md +4 -4
  216. package/resources/customizations/.github/instructions/csharp-unit-test.instructions.md +2 -2
  217. package/resources/customizations/.github/skills/acceptance-criteria-tracking/SKILL.md +9 -1
  218. package/resources/customizations/.github/skills/atomic-plan-contract/SKILL.md +4 -0
  219. package/resources/customizations/.github/skills/evidence-and-timestamp-conventions/SKILL.md +13 -0
  220. package/resources/customizations/.github/skills/feature-review-workflow/SKILL.md +1 -1
  221. package/resources/powershell/PoshQC/PoshQC.Coverage.psm1 +314 -0
  222. package/resources/powershell/PoshQC/PoshQC.Testing.psm1 +25 -28
  223. package/resources/powershell/PoshQC/PoshQC.psm1 +1 -0
  224. package/resources/powershell/PoshQC/README.md +8 -2
  225. package/resources/powershell/PoshQC/settings/pester.runsettings.psd1 +2 -315
@@ -34,6 +34,7 @@ On every invocation, the main session must:
34
34
  2. If a valid checkpoint exists with a matching objective, resume from the recorded `next_step`.
35
35
  3. If no checkpoint exists or the objective is new, begin the orchestration lifecycle from the start.
36
36
  4. **Checkpoint hygiene (issue #673).** When the checkpoint at `artifacts/orchestration/orchestrator-state.json` records an `issue-num` other than the item this invocation is about, move it to `artifacts/orchestration/handoff/orchestrator-state.issue-<issue-num>.<yyyy-MM-ddTHH-mm>.json` before writing a new checkpoint, rather than overwriting it or leaving it in place. Apply the same move when this session hands an item whose checkpoint it holds to another session or worktree. A checkpoint left at a session root is read by gates that resolve against that root, so a foreign one there is state a gate can answer from.
37
+ 5. **Required checkpoint keys (issue #798).** Every checkpoint write carries each top-level key listed in `.claude/rules/orchestrator-state.md` under `## Required Top-Level Keys`; plain validation reports each absent key as `Checkpoint missing required key: <key>` under every flag combination. The list includes `last_updated`, an ISO-8601 UTC date-time string (for example `2026-10-08T17:28:00Z`) that is rewritten on every checkpoint write: after every completed step and every state transition, including halts.
37
38
 
38
39
  ## Prepared-State Portable Handoff Intake
39
40
 
@@ -81,7 +82,7 @@ blocked result before launch.
81
82
 
82
83
  Because model selection is required once delegation occurs (see `## Model Selection`), a resuming orchestrator must repair a missing model choice deterministically before delegating at a delegating `next_step`. When the resumed `next_step` is a delegating step:
83
84
 
84
- a. **Preflight the checkpoint.** Run the orchestrator-state validator with `--require-model-routing` (via `mcp__drm-copilot__validate_orchestration_artifacts` or the local CLI) against `artifacts/orchestration/orchestrator-state.json` before the first delegation. Record the result in a `model_routing_preflight` block `{ status ("pass"|"fail"), checked_at (ISO-8601 UTC), validator_command, output_summary }`.
85
+ a. **Preflight the checkpoint.** Run the orchestrator-state validator with `--require-model-routing` (via `mcp__drm-copilot__validate_orchestration_artifacts` or the repository-local validator CLI documented in `.claude/rules/orchestrator-state.md`) against `artifacts/orchestration/orchestrator-state.json` before the first delegation. Record the result in a `model_routing_preflight` block `{ status ("pass"|"fail"), checked_at (ISO-8601 UTC), validator_command, output_summary }`.
85
86
  b. **Recompute the floor.** For the upcoming phase, recompute the complexity floor with `Get-ComplexityFloor -SignalsPresent <names>` (`.claude/lib/model-routing/ModelRouting.psm1`); do not reimplement the formula.
86
87
  c. **Record the assessment.** Write a `complexity_assessments[]` entry `{ phase, band, floor, signals_present[], rationale, assessed_at }` with `floor` equal to the recomputed value and `band >= floor`.
87
88
  d. **Resolve and record the receipt.** Resolve the model with `Resolve-DelegationModel -Agent <agent> -Band <complexity_band> -FablePolicy <fable_policy>` (`.claude/lib/model-routing/ModelRouting.psm1`) and write a `model_routing_receipts[]` entry `{ agent, phase, complexity_band, fable_policy, table_model, clamped_from | null, model }`.
@@ -137,6 +138,7 @@ A delegation prompt carrying the literal marker `Preparation mode: true` (issued
137
138
  - **Route.** Select `route_id: preparation`. The route's routing-matrix entry requires receipts for `task-researcher`, `prd-feature`, `atomic-planner`, and `atomic-executor`; the skills `orchestrate`, `feature-promotion-lifecycle`, and `atomic-plan-contract`; and the promotion plus validator MCP tools.
138
139
  - **Scope.** Run promotion (MCP surface), research, feature documents (`spec.md`, `user-story.md`), atomic planning, and the atomic-executor preflight (precondition validation only, R2 semantics: iterate plan revisions until `PREFLIGHT: ALL CLEAR`). Atomic execution, PR authoring, CI monitoring, and feature review are out of scope and are executed later by `epic-orchestrator`.
139
140
  - **Terminal checkpoint.** Stop with `completed_steps` containing `S3_promotion` and `S4_atomic_planning`, `next_step: "S5_atomic_execution"`, out-of-scope step statuses set to `not-applicable`, and `blocked_reason: "none"`. Do NOT assert completion (`next_step: "complete"`, `S12_complete`, or a `completed` step8/9/10 status): the run has no PR or CI evidence, and the route's `requires_ci_gate: false` exempts it from `ci_gate` at the completion validator instead.
141
+ - **Premise-falsified halt.** Use `blocked_reason: "premise_falsified"` when every delegation and validator succeeded but evidence gathered during execution falsified the plan's premise. Still record the evidence path in free-form checkpoint keys; `blocked_reason` carries only the classification. The preparation terminal checkpoint above still sets `blocked_reason: "none"`. The full `blocked_reason` vocabulary and its partition are in `.claude/rules/orchestrator-state.md`.
140
142
  - **Commit.** Commit the prepared feature folder and plan to the current branch (the worktree branch created off the epic integration branch) before stopping, and report the `plan-path` and preflight status in the final output.
141
143
 
142
144
  ## Epic Mode Bounded Return
@@ -184,10 +186,12 @@ PR creation and PR body edits are delegated work, not orchestrator work. The orc
184
186
  The mandatory sequence is:
185
187
 
186
188
  1. The orchestrator first refreshes the PR-context artifact via `mcp__drm-copilot__collect_pr_context` (or the equivalent context-collection mechanism), which writes `artifacts/pr_context.summary.txt`.
187
- 2. The orchestrator runs the orchestrator-state validator (`mcp__drm-copilot__validate_orchestration_artifacts` or the equivalent local CLI call) against `artifacts/orchestration/orchestrator-state.json --require-pr-creation-ready` and records the pass/fail result under a new `pr_author_preflight` field in the checkpoint, alongside `pr_author_receipt`: `{status ("pass"|"fail"), checked_at (ISO-8601 UTC), checkpoint_path, validator_command, output_summary}`. The orchestrator must not delegate to `Agent(pr-author)` when this preflight fails. The validator's full-lifecycle completion flag (`ci_gate`/`pr_gate`/routing-contract receipts) remains reserved for the post-PR/CI completion context (Step S9 / PR Creation Gate condition 6), not this pre-PR-creation preflight, because those values cannot exist before the first `gh pr create` of a branch.
189
+ 2. The orchestrator runs the orchestrator-state validator (`mcp__drm-copilot__validate_orchestration_artifacts` or the equivalent repository-local validator CLI documented in `.claude/rules/orchestrator-state.md`) against `artifacts/orchestration/orchestrator-state.json --require-pr-creation-ready` and records the pass/fail result under a new `pr_author_preflight` field in the checkpoint, alongside `pr_author_receipt`: `{status ("pass"|"fail"), checked_at (ISO-8601 UTC), checkpoint_path, validator_command, output_summary}`. The orchestrator must not delegate to `Agent(pr-author)` when this preflight fails. The validator's full-lifecycle completion flag (`ci_gate`/`pr_gate`/routing-contract receipts) remains reserved for the post-PR/CI completion context (Step S9 / PR Creation Gate condition 6), not this pre-PR-creation preflight, because those values cannot exist before the first `gh pr create` of a branch.
188
190
  3. The orchestrator then delegates PR creation and any PR body edits to `Agent(pr-author)`. The `pr-author` agent runs the `pr-author` skill to author the body, writes the body file `artifacts/pr_body_<N>.md` and the sibling receipt `artifacts/pr_body_<N>.receipt.json` with the shape `{skill, pr_body_path, number, sha256 (lowercase hex of the body bytes), context_summary_path, created_at (ISO-8601 UTC, strictly newer than `artifacts/pr_context.summary.txt` last-write)}`, issues `gh pr create --body-file artifacts/pr_body_<N>.md` (or `gh pr edit --body-file ...`), and reports the resulting PR URL or PR number.
189
191
  4. The orchestrator records `pr_author_receipt` in the checkpoint, citing the body-file path and the receipt path that were verified.
190
192
 
193
+ When the pr-author agent runs outside the item worktree (its process directory is not the worktree that holds the item's `artifacts/` tree), it passes the absolute canonical path `<item worktree>/artifacts/pr_body_<N>.md` to `--body-file`. The `enforce-pr-author-skill.ps1` hook resolves the item worktree from `--head` and reads the PR context summary, the body, and the receipt beneath it; in that topology it denies a relative `--body-file` with `PR_BODY_PATH_NONCANONICAL`, because `gh` would read the relative path from its own process directory.
194
+
191
195
  `Agent(pr-author)` is the mandatory delegate for PR creation and PR body edits. Direct `gh pr create`/`gh pr edit --body*` from the main thread is prohibited and is blocked by the hook. Before the five receipt checks, the `enforce-pr-author-skill.ps1` PreToolUse hook independently re-validates the orchestrator-state checkpoint against `--require-pr-creation-ready` (via an injectable `$Invoker` subprocess seam) and blocks with `ORCHESTRATOR_STATE_PREFLIGHT_FAILED` when the checkpoint is missing or invalid — this is the local, hook-level enforcement mechanism that closes the bypass path (it runs inside the same hook that already intercepts `gh pr create`/`gh pr edit`, not as a CI check). The PreToolUse hook then verifies the receipt in five ordered checks: canonical body-file path, receipt present, `number` match, `sha256` match against the body bytes, and `created_at` strictly newer than the context summary last-write.
192
196
 
193
197
  The SHA-256 receipt is a policy-level integrity check, not a cryptographic or security boundary; any actor with `Write(/artifacts/**)` access can replace both the body file and its receipt together with a matching SHA-256. It binds the body bytes to the receipt, prevents accidental bypass, and requires a deliberate, documented act to circumvent.
@@ -237,24 +241,36 @@ After each `feature-review` delegation returns:
237
241
 
238
242
  1. Locate `remediation-inputs.<timestamp>.md` in the active feature folder (match the highest ISO-8601 timestamp).
239
243
  2. If no such file exists, treat as zero blocking findings and advance to the PR creation gate.
240
- 3. If the file exists, count lines matching `BLOCKING` or `Severity: Blocking` (case-sensitive). If count >= 1, enter the remediation loop. If count = 0, advance to the PR creation gate.
244
+ 3. If the file exists, count lines matching `BLOCKING` or `Severity: Blocking` (case-sensitive). If count >= 1, enter the remediation loop. If count = 0, advance to the PR creation gate. This count rule applies unchanged when the file carries no `Review-Verdict:` line: a count of at least 1 is `REMEDIATION_REQUIRED` and every finding is treated as `autonomous`.
245
+ 4. If the file carries a `Review-Verdict:` line, recompute the verdict from the `Remediability:` lines of the blocking findings (a blocking finding block without a `Remediability:` line counts as `autonomous`): no blocking finding is `PASS`; any `autonomous` finding is `REMEDIATION_REQUIRED`; otherwise any `external_dependency`, `policy_hold`, or `human_decision_required` finding is `HALT_NON_REMEDIABLE`; otherwise `AWAITING_CI`. The `remediation-inputs` file is authoritative; the optional `review-status:` token in the review result is a cross-check.
246
+ 5. A mismatch between the declared and recomputed verdicts is a reviewer contract error: record it under `artifact_errors`, re-request the review once, and halt with `blocked_reason: "delegate_contract_incomplete"` if it persists.
247
+ 6. Append a `remediation_loop.review_outcomes[]` entry (`verdict` plus one `findings[]` object with `remediability` per blocking finding) for every review, including `PASS`.
248
+ 7. Act on the verdict: `PASS` advances to the PR creation gate; `REMEDIATION_REQUIRED` enters the remediation loop with the plan scoped to the `autonomous` findings, carrying the non-remediable findings forward unchanged; `HALT_NON_REMEDIABLE` follows the halt branch; `AWAITING_CI` follows the wait branch.
249
+
250
+ Halt branch (`HALT_NON_REMEDIABLE`): set `blocked_reason` to the highest-precedence halt class present, append one `human_interaction.requirements[]` entry with `response: "halt"` for each halt class present (`external_dependency`, `policy_hold`, `human_decision_required`) describing the human action needed, leave `remediation_loop.completed_attempts` unchanged, write no cycle, create no remediation plan, and stop. The precedence is:
251
+
252
+ Halt precedence: human_decision_required > policy_hold > external_dependency
253
+
254
+ Wait branch (`AWAITING_CI`): set `blocked_reason: "awaiting_ci"` and set `next_step` to the step that re-checks (`S7_feature_review` for a review-time wait, `S9_ci_green` for an S9 poll timeout). Record no `human_interaction.requirements[]` entry for a wait, write no cycle, and create no remediation plan. Poll within the existing bounded S9 interval and timeout; when the bound is exhausted, persist and stop. On resume, set `blocked_reason: "none"` and re-run the named step. For S9, the awaited run is identified by `ci_gate.head_sha` and `ci_gate.pr_pipeline_run_id` with `conclusion: "pending"`; for a review-time wait, the awaited workflow is named in the finding's `Remediability-Evidence:` line.
241
255
 
242
256
  ## Remediation Loop (R1–R5)
243
257
 
244
- A bounded loop consisting of five steps. The loop variable `remediation_pass` starts at 1 and increments at R5 before returning to R1.
258
+ A bounded loop consisting of five steps. The attempt count is `remediation_loop.completed_attempts`, and `remediation_pass` equals `remediation_loop.completed_attempts`. The active cycle number is `completed_attempts + 1`, and `remediation.cycle_N` in `next_step` uses that number; `remediation_loop.current_cycle` is a record position in `cycles[]`, not a count. A halt or wait verdict never opens a cycle, and every cycle opened from a review records `opened_by_review`, the zero-based index of that `review_outcomes[]` entry.
259
+
260
+ Cycle accounting: a remediation attempt is complete when R3 execution finished (`execution_status: "complete"`) and the pre-R4 commit recorded a non-empty change set; only then set `candidate_applied: true` on that cycle and increment `completed_attempts`. A cycle that ends without a candidate (execution not started, execution failed, or an empty staged change set) records `candidate_applied: false` and consumes no number. It is followed by at most one re-plan under the same number when the executor output identifies an autonomous plan defect; otherwise reclassify the blocker (typically `external_dependency`) and halt. Two consecutive no-candidate cycles halt with `step6_status: "blocked_remediation_loop_limit"`. Local, CI-failure, merge-conflict, and parallel-drift cycles share the one count.
245
261
 
246
262
  - **R1 — Remediation planning:** Delegate to `atomic-planner` with `remediation-inputs.<timestamp>.md` path as primary context. Receive `remediation-plan.<timestamp>.md` in the active feature folder.
247
263
  - **R2 — Preflight clearance:** Delegate to `atomic-executor` for precondition validation only (no implementation). If the executor does not return `PREFLIGHT: ALL CLEAR`, return to R1 and re-delegate to `atomic-planner` with the required-changes output from the executor. Only after `PREFLIGHT: ALL CLEAR` may the orchestrator advance to R3.
248
264
  - **R3 — Remediation execution:** Delegate to `atomic-executor` with full execution authorization. Each task's toolchain loop (format → lint → type-check → test) is mandatory; no skipping.
249
265
  - **Pre-R4 commit:** Stage all changes (`git add -A`), delegate to `Agent(commit-message)` to generate a commit message from the staged diff (the agent returns message text only and does not commit), then commit with the generated message. The `git commit` action remains on the orchestrator. Advance to R4 only after a successful commit.
250
266
  - **R4 — Re-audit:** Delegate to `feature-review` with the same inputs as the original review (resolved base branch, feature folder, refreshed PR context artifacts, acceptance-criteria source). No scope narrowing. The canonical issue number line must be included.
251
- - **R5 — Loop-exit decision:** If the re-audit produces zero blocking findings, exit the loop and advance to the PR creation gate. Otherwise, record `remediation_pass` increment in the checkpoint and return to R1.
267
+ - **R5 — Loop-exit decision:** Evaluate the re-audit per Post-Review Outcome Evaluation. If it produces zero blocking findings, exit the loop and advance to the PR creation gate. If its verdict is `HALT_NON_REMEDIABLE` or `AWAITING_CI`, follow the halt or wait branch instead of opening the next cycle. Otherwise, record the cycle's `candidate_applied` value and the resulting `completed_attempts` in the checkpoint and return to R1.
252
268
 
253
- **Termination guard:** If `remediation_pass` reaches 3 without resolution, the orchestrator records `step6_status: "blocked_remediation_loop_limit"` in the checkpoint and halts. No further automation is attempted.
269
+ **Termination guard:** Halt after three completed attempts: when `remediation_loop.completed_attempts` equals 3 and the latest verdict is not `PASS`, the orchestrator records `step6_status: "blocked_remediation_loop_limit"` in the checkpoint and halts. No further automation is attempted.
254
270
 
255
271
  ## Issue Number Consistency
256
272
 
257
- The canonical issue number is derived once from the active feature folder name: extract the trailing integer from the folder base name (e.g., `2026-04-26-push-down-claude-customizations-162` yields `162`). Record as `issue_num` in the checkpoint.
273
+ The canonical issue number is derived once from the active feature folder name: extract the trailing integer from the folder base name (e.g., `2026-04-26-push-down-claude-customizations-162` yields `162`). Record as `issue-num` in the checkpoint; the hyphenated key is the one listed in `.claude/rules/orchestrator-state.md` under `## Required Top-Level Keys`.
258
274
 
259
275
  Every delegation prompt to a receipt-gated subagent type — `atomic-planner`, `atomic-executor`, `feature-review`, `task-researcher`, `prd-feature`, and `pr-author` — must include the line:
260
276
 
@@ -273,12 +289,19 @@ If a subagent artifact references a different issue number, the orchestrator rej
273
289
  S9 procedure:
274
290
 
275
291
  1. Resolve the live PR head SHA for the feature branch (`gh pr view --json headRefOid` or equivalent).
276
- 2. Invoke `gh pr checks --required --json bucket,name,state,link,workflow` (or an equivalent JSON-emitting command) against that head SHA. `gh` is the only sanctioned channel for querying GitHub Actions state.
277
- 3. Parse the JSON by running `pwsh -NoProfile -File .claude/lib/ci-gate/Invoke-CiGateParser.ps1 -ChecksJson <checks-json> -HeadSha <head-sha>`, which emits the `ci_gate` object defined below and derives `ci_gate.conclusion` as `success` when all required checks pass, `failure` when any required check failed, and `pending` when any required check is still in progress.
278
- 4. Poll with a bounded interval and a documented total timeout while `conclusion == "pending"`. When the timeout is exhausted, set `step9_status: "failed_remediation_required"` and enter the remediation-loop CI-failure handling below with a timeout log.
292
+ 2. Invoke `gh pr checks --json bucket,name,state,link,workflow` (or an equivalent JSON-emitting command) against that head SHA. The query covers every check on the head SHA for every PR, whether or not branch protection marks the check as required. `gh` is the only sanctioned channel for querying GitHub Actions state.
293
+
294
+ No-checks rule: when `gh pr checks` fails with a `no checks reported` error, that error is never treated as green for any PR. On a non-epic PR the gate stays `pending` and step 4 continues the bounded poll. On an epic child, step 3 runs the parser with `-ChecksJson '[]'` and `-RequireWorkflow CI`, which returns `pending`. The parser is never run with `-ChecksJson '[]'` without `-RequireWorkflow CI`, because its default path returns `success` for an empty set.
295
+
296
+ Epic-child rule: when the PR base branch is an `epic/<slug>-integration` branch (checkpoint `epic_mode` is `true`), the step 2 query is the same unfiltered query; integration branches carry no required-status-check protection. An empty check list is not accepted as green for such a PR: the gate must observe at least one check whose `workflow` is `CI` against the child head SHA, and every observed `CI` check must succeed before `ci_gate.conclusion` is accepted as `success`. Every check returned by the unfiltered query counts: a failing or cancelled non-`CI` check fails the gate, and a pending one keeps it pending. Step 3 enforces this rule by passing `-RequireWorkflow CI` to the parser, which never returns `success` until at least one passing `CI` check is observed. When `gh pr checks` fails with a `no checks reported` error on the child branch, step 3 runs the parser with `-ChecksJson '[]'`; that error is never treated as green, and the parser returns `pending` for it.
297
+
298
+ 3. Parse the JSON by running `pwsh -NoProfile -File .claude/lib/ci-gate/Invoke-CiGateParser.ps1 -ChecksJson <checks-json> -HeadSha <head-sha>`, appending `-RequireWorkflow CI` when `epic_mode` is `true`. The parser emits the `ci_gate` object defined below and derives `ci_gate.conclusion` over the queried checks (every check on the PR head SHA, for every PR): `success` when every queried check passed or was skipped, `failure` when any queried check failed or was cancelled, and `pending` when any queried check is still in progress. With `-RequireWorkflow CI`, the parser returns `pending` instead of `success` until at least one check whose `workflow` is `CI` has passed.
299
+ 4. Poll with a bounded interval and a documented total timeout while `conclusion == "pending"`. When the timeout is exhausted, record the timeout as a finding with `Remediability: awaiting_ci` in `remediation-inputs.<timestamp>.md` and follow the wait branch in Post-Review Outcome Evaluation (`blocked_reason: "awaiting_ci"`, `next_step: "S9_ci_green"`); `step9_status` stays `pending`. A poll timeout does not enter the remediation loop.
279
300
  5. Write the `ci_gate` object and `last_verified_ci_sha` to the checkpoint, and set `step9_status` to `passed` only when `ci_gate.conclusion == "success"` AND `ci_gate.head_sha` equals the current PR head SHA.
280
301
  6. If the checkpoint's `epic_mode` is `true`, execute `gh pr merge --merge <PR>` merging the feature branch into `epic_context.integration_branch` (already the PR's base branch per the epic-mode `--base` override applied at S8). On success, record `epic_merge: { merge_commit_sha, target_branch, merged_at }` in the checkpoint. On failure due to merge conflict (non-mergeable PR), do not retry blindly: convert the conflict into a synthetic Blocking finding per "Merge-Conflict Remediation" below and re-enter the standard R1–R5 remediation loop; do not proceed to DONE.
281
302
 
303
+ CI-dependent acceptance criteria: when the item has acceptance criteria whose verification requires the result of CI on the PR head, the item's own orchestrator run owns their check-off, and a parent or coordinating session never commits them from its own root. After step 5 records `ci_gate.conclusion == "success"`, check off each CI-dependent criterion in the item's own worktree, commit, push to the PR branch, and re-run S9 from step 1 against the new head SHA, so that `ci_gate.head_sha` equals the final PR head before DONE. In epic mode this completes before step 6 merges. A failed re-run enters `## Remediation Loop — CI-Failure Handling` below; the shared `remediation_loop.completed_attempts` count and its halt after three completed attempts are unchanged.
304
+
282
305
  DONE is not written while `step9_status` is anything other than `passed`.
283
306
 
284
307
  ## Checkpoint Schema — CI Gate Fields
@@ -286,7 +309,7 @@ DONE is not written while `step9_status` is anything other than `passed`.
286
309
  The orchestrator checkpoint (`artifacts/orchestration/orchestrator-state.json`) is extended with:
287
310
 
288
311
  - a top-level `ci_gate` object containing:
289
- - `head_sha` — the PR head SHA that the required checks were observed against.
312
+ - `head_sha` — the PR head SHA that the queried checks were observed against.
290
313
  - `pr_pipeline_run_id` — the GitHub Actions run id for the PR Pipeline.
291
314
  - `pr_pipeline_run_url` — the URL of that run.
292
315
  - `conclusion` — one of `success`, `failure`, `pending`.
@@ -321,13 +344,13 @@ A checkpoint that predates this schema and has no `ci_gate` object (or no `step9
321
344
 
322
345
  ## Remediation Loop — CI-Failure Handling
323
346
 
324
- When S9 records `step9_status: "failed_remediation_required"` (a failed required check or an exhausted poll timeout):
347
+ When S9 records `step9_status: "failed_remediation_required"` (a failed check; a poll timeout follows the wait branch per S9 step 4):
325
348
 
326
- 1. The failed-check log from `gh run view <run-id> --log-failed` (or the timeout log) is written as `remediation-inputs.<timestamp>.md` in the active feature folder.
349
+ 1. The failed-check log from `gh run view <run-id> --log-failed` is written as `remediation-inputs.<timestamp>.md` in the active feature folder.
327
350
  2. The failure is converted to a synthetic finding with severity `Blocking` that identifies the failing check by name and the failing job by URL.
328
351
  3. The existing R1-R5 remediation loop processes that finding exactly as it processes a local blocking finding. No new loop is introduced.
329
- 4. The `remediation_pass` counter is shared with local-finding passes; the cap is 3.
330
- 5. On the third CI-failure pass without resolution, the orchestrator records `step9_status: "blocked_ci_loop_limit"`, does not write DONE, and halts. No further automation is attempted.
352
+ 4. CI-failure cycles share `remediation_loop.completed_attempts` with local-finding cycles; a CI-failure finding stays `autonomous`, and the active cycle number is `completed_attempts + 1`.
353
+ 5. The shared guard applies: after three completed attempts without a passing result, the orchestrator records `step9_status: "blocked_ci_loop_limit"`, does not write DONE, and halts. No further automation is attempted.
331
354
 
332
355
  ## PR Creation Gate
333
356
 
@@ -335,6 +358,7 @@ The orchestrator must not create a PR, push a branch for PR purposes, or report
335
358
 
336
359
  1. `blocking_findings_resolved: true` — the most recent `feature-review` produced zero blocking findings.
337
360
  2. The AC verification artifact (`p14-acceptance-criteria-checkoff.md` or equivalent) confirms all acceptance criteria pass.
361
+ A CI-dependent acceptance criterion, one whose verification requires the result of CI on the PR head, cannot pass before CI exists: condition 2 is satisfied when every other criterion passes and each CI-dependent criterion is listed as pending-CI in the AC verification artifact. Pending-CI criteria are checked off under S9 before DONE. This clarifies condition 2 and adds no condition.
338
362
  3. The mandatory toolchain passed in its most recent run on the branch (no linting/type-check/test failures).
339
363
  4. The checkpoint `next_step` is `S8_create_pr` (precondition to entering S9).
340
364
  5. PR body produced via the pr-author handoff: `artifacts/pr_body_<N>.md` exists with a matching `artifacts/pr_body_<N>.receipt.json`, created with `--body-file`.
@@ -420,6 +444,8 @@ Example:
420
444
  ]
421
445
  ```
422
446
 
423
- The validator counts an MCP receipt as successful only when `tool` is a non-empty string, `ok` is exactly `true`, and `evidence` is a non-empty string. Every `required_mcp_tools` entry must have such a receipt.
447
+ The validator counts an MCP receipt as successful only when `tool` is a non-empty string, `ok` is exactly `true`, and `evidence` is a non-empty string. Every `required_mcp_tools` entry must have such a receipt unless a valid `issue_adoption` record waives it.
448
+
449
+ When the GitHub issue already exists before orchestration starts (transferred, filed by hand, or created by epic decomposition) and has been verified read-only (`gh issue view`, a `gh api` GET, or a GitHub MCP issue read), do not call `potential_to_issue`. Record a top-level `issue_adoption` object in the checkpoint instead of a `potential_to_issue` receipt. It may waive only `potential_to_issue` and the checkpoint's promotion-entry tool (`new_potential_entry`, or `new_potential_bug_entry` for a bug-type checkpoint); `potential_to_issue` must always be listed. For a promotion-entry waiver, `potential_record` (a markdown path under `docs/features/potential/`) is required when `origin` is `epic_decomposition`, optional when `origin` is `transferred` or `filed_before_orchestration`, and validated whenever it is present. Every other required tool still needs a successful receipt. Any adoption error waives nothing. The field rules, the closed waivable set, and the error placement are defined in `.claude/rules/orchestrator-state.md` under `## Invariants (issue_adoption object)`.
424
450
 
425
451
  These three receipt arrays, populated with the retained required names of the selected route, are what allow the routing-contract validation under `require_complete: true` to pass.
@@ -56,7 +56,21 @@ re-derivation is mandatory and is not an optimization to skip when the checkpoin
56
56
  contract for parallel admission. Preparation yields the item's DECLARED blast radius, and only
57
57
  the planner-computed declared radius is authoritative for scheduling. The item's lifecycle
58
58
  advances `proposed` -> `admitted` -> `prepared` during this step, recorded as item-state updates in
59
- `items[]` with the checkpoint's lifecycle timestamps.
59
+ `items[]` with the checkpoint's lifecycle timestamps. After the admitted item's preflight
60
+ clearance, perform the `parallel-plan` skill's `## Complexity Assessment` procedure for it, and
61
+ record the resulting `complexity_band` on the admitted orchestrator-checkpoint item so step 3's
62
+ edge derivation and the parent's model routing read the same band.
63
+ The admitted item records `complexity_band` and no `model_routing_receipt`; the parent resolves
64
+ the item's model from that band at spawn time per `parallel-orchestrate` `## Model Selection`.
65
+ For an issue-number item, the preparation delegation prompt carries the issue-adoption line used
66
+ by `/parallel-plan` `## Preparation Fan-Out`, quoted verbatim: `Issue adoption: this item's GitHub
67
+ issue already exists. Verify it read-only (gh issue view), do not call potential_to_issue or the
68
+ promotion-entry tool, and record a top-level issue_adoption object in the checkpoint per
69
+ .claude/rules/orchestrator-state.md with origin filed_before_orchestration (or transferred when
70
+ the issue was transferred), waiving potential_to_issue and the promotion-entry tool for the
71
+ checkpoint's promotion-type. When a lifecycle record for the item exists under
72
+ docs/features/potential/promoted/, cite it as potential_record.` The line is omitted for a
73
+ potential-entry item, whose child promotes it.
60
74
 
61
75
  3. **Compute conflict edges over ALL items, including in-flight ones.** Invoke the scheduling
62
76
  entry point Get-BlastRadiusConflictEdge from the destination-runtime PowerShell port
@@ -91,17 +105,28 @@ re-derivation is mandatory and is not an optimization to skip when the checkpoin
91
105
  barrier, and the later-merging item merges `origin/main` under the existing per-item
92
106
  merge-conflict handling and re-passes CI before it merges.
93
107
 
94
- 4. **Decide admission.** Call
95
- `decide_admission(candidate, conflict_edges, in_flight, current_cohort_members=current_cohort_members)`
96
- from `scripts/dev_tools/parallel_mutation_protocol.py`.
97
- - `ADMIT_CURRENT_COHORT` — the candidate shares no edge with any member of the current cohort,
108
+ 4. **Decide admission.** Call the bundled entry point, which needs no Python interpreter:
109
+
110
+ ```bash
111
+ bash .claude/lib/bash/mutate-parallel-run.sh admit --candidate <key> --edges "<a>:<b> ..." --in-flight "<k> ..." --current-cohort-members "<k> ..."
112
+ ```
113
+
114
+ `--edges` carries the step-3 conflict edges over ALL items, `--in-flight` the in-flight (pinned)
115
+ keys, and `--current-cohort-members` the full current-cohort membership. The command prints one
116
+ JSON object whose `outcome` field is one of:
117
+ - `admit_current_cohort` — the candidate shares no edge with any member of the current cohort,
98
118
  pinned or unstarted. Admit it into the current cohort. NO recompute occurs and
99
119
  `recolor_generation` is unchanged — precisely because the candidate conflicts with no
100
120
  current-cohort member, so no cohort assignment needs to change.
101
- - `DEFER_AND_RECOLOR` — the candidate shares an edge with at least one member of the current
102
- cohort, pinned or not-yet-launched. Defer it to a future cohort and recolor by calling
103
- `recolor_unstarted(unstarted_items, conflict_edges, pinned, current_generation, current_cohort=current_cohort, highest_pinned_cohort=highest_pinned_cohort)`.
104
- `highest_pinned_cohort` is derived from re-verified durable state: the highest
121
+ - `defer_and_recolor` — the candidate shares an edge with at least one member of the current
122
+ cohort, pinned or not-yet-launched. Defer it to a future cohort and recolor through the
123
+ bundled entry point:
124
+
125
+ ```bash
126
+ bash .claude/lib/bash/mutate-parallel-run.sh recolor --unstarted "<k> ..." --edges "<a>:<b> ..." --pinned "<k> ..." --generation <g> --current-cohort <c> --highest-pinned-cohort <h>
127
+ ```
128
+
129
+ `--highest-pinned-cohort` is derived from re-verified durable state: the highest
105
130
  current-generation cohort index occupied by any in-flight item.
106
131
  The recolor is a recompute: `recolor_generation` increments by exactly one, and it places every
107
132
  unstarted item at an index at or above `current_cohort`, strictly above
@@ -125,8 +150,9 @@ re-derivation is mandatory and is not an optimization to skip when the checkpoin
125
150
  with an unstarted item OUTSIDE the current cohort does not defer: the cohort barrier keeps the
126
151
  two from running concurrently, so the coloring's existing separation already resolves it.
127
152
 
128
- 5. **Apply the recolor result.** Write `RecolorResult.cohort_assignments` into `cohorts[]` and set
129
- the top-level `recolor_generation` to `RecolorResult.generation`. The result's key set equals the
153
+ 5. **Apply the recolor result.** Write the recolor output field `cohort_assignments` into
154
+ `cohorts[]` and set the top-level `recolor_generation` to the output field `generation`. The
155
+ result's key set equals the
130
156
  unstarted set exactly and contains no pinned key: no in-flight item changes cohort or state as a
131
157
  result of this admission. Verify that before writing, and stop rather than write a result that
132
158
  names a pinned key. The admit branch performs no recolor at all, precisely because the candidate
@@ -141,8 +167,17 @@ re-derivation is mandatory and is not an optimization to skip when the checkpoin
141
167
  values to be unique (`scripts/dev_tools/_parallel_state_structures.py:282-305` — duplicate-index
142
168
  detection at 282-293, error emission at 301-305).
143
169
 
144
- 6. **Append exactly one `mutations[]` entry**, at admission-decision time, built by
145
- `build_add_entry` from `scripts/dev_tools/parallel_mutation_protocol.py`:
170
+ 6. **Append exactly one `mutations[]` entry**, at admission-decision time, built by the bundled
171
+ entry point. Run the first line on the admit branch (`--deferred false`) and the second on the
172
+ defer branch (`--deferred true`):
173
+
174
+ ```bash
175
+ bash .claude/lib/bash/mutate-parallel-run.sh add-entry --item <key> --deferred false --generation <g> --at <timestamp>
176
+ bash .claude/lib/bash/mutate-parallel-run.sh add-entry --item <key> --deferred true --generation <g> --at <timestamp>
177
+ ```
178
+
179
+ `--generation` is the run's generation before this admission, read before any step-5 recolor;
180
+ the printed entry stamps it unchanged or plus one per the table below:
146
181
 
147
182
  | Case | `op` | `item_key` | `prior_state` | `new_state` | `disposition` | `recolor_generation` |
148
183
  | --- | --- | --- | --- | --- | --- | --- |
@@ -152,7 +187,8 @@ re-derivation is mandatory and is not an optimization to skip when the checkpoin
152
187
  `prior_state` is null on BOTH add rows. The accompanying `prepared` -> `scheduled` transition is
153
188
  not lost and is not recorded in the mutation entry: it is recorded as an item-state update in
154
189
  `items[]`, the same mechanism that records `proposed` -> `admitted` -> `prepared` in step 2. The
155
- `at` timestamp comes from the engine's injected clock seam.
190
+ `at` timestamp is supplied through `--at`; when `--at` is omitted the entry point stamps the
191
+ current UTC minute.
156
192
 
157
193
  7. **Validate the checkpoint** before treating the admission as applied. Run the
158
194
  `validate_orchestration_artifacts` MCP tool with `artifact_type:
@@ -168,6 +204,8 @@ re-derivation is mandatory and is not an optimization to skip when the checkpoin
168
204
  and `benefit` (tolerated-not-validated, returned by the scheduling entry point), and no reason
169
205
  member is added: the four `conflict_edges[].reason` members are unchanged. The nine parallel
170
206
  enums are owned by `.claude/rules/parallel-orchestration.md` and are consumed, never extended.
207
+ The `complexity_band` recorded in step 2 is not a new field: it is an existing scheduling field
208
+ read by drift re-scheduling.
171
209
  - This operation never moves, restates, or re-derives an in-flight item's cohort or state.
172
210
  - This operation performs no destructive side effect: it closes no pull request and removes no
173
211
  worktree. Those belong to `/parallel-remove` with `--disposition abandon`.
@@ -45,24 +45,37 @@ which is exactly what the gate exists to prevent. The re-derivation is mandatory
45
45
 
46
46
  1. Re-derive durable state as above and resolve the run's `items[]`.
47
47
 
48
- 2. **Gate the close on no item being in flight.** Call `decide_close(items)` from
49
- `scripts/dev_tools/parallel_mutation_protocol.py`. It raises the dedicated rejection exception
50
- carrying EVERY in-flight key, so the rejection names all the work that must finish first rather
51
- than one item at a time. On rejection: report the blocking keys and stop. A rejected close
52
- appends NO `mutations[]` entry and makes NO state change — do not record the attempt.
48
+ 2. **Gate the close on no item being in flight.** Pass every re-derived item, as one
49
+ `<key>:<state>` token each, to the bundled entry point, which needs no Python interpreter:
53
50
 
54
- 3. **Append exactly one run-scoped `mutations[]` entry** for a successful close, built by
55
- `build_close_entry` from `scripts/dev_tools/parallel_mutation_protocol.py`:
51
+ ```bash
52
+ bash .claude/lib/bash/mutate-parallel-run.sh close --items "<k>:<state> ..."
53
+ ```
54
+
55
+ Exit 0 (stdout `{"close_permitted":true}`) permits the close. Exit 1 rejects it and prints one
56
+ stderr line naming EVERY in-flight key, so the rejection names all the work that must finish
57
+ first rather than one item at a time. On rejection: report the blocking keys and stop. A
58
+ rejected close appends NO `mutations[]` entry and makes NO state change — do not record the
59
+ attempt.
60
+
61
+ 3. **Append exactly one run-scoped `mutations[]` entry** for a successful close, built by the
62
+ bundled entry point:
63
+
64
+ ```bash
65
+ bash .claude/lib/bash/mutate-parallel-run.sh close-entry --generation <g> --at <timestamp>
66
+ ```
56
67
 
57
68
  | Case | `op` | `item_key` | `prior_state` | `new_state` | `disposition` | `recolor_generation` |
58
69
  | --- | --- | --- | --- | --- | --- | --- |
59
70
  | Close | `close` | null (run-scoped) | null | null | null | `g` (unchanged) |
60
71
 
61
72
  The entry is run-scoped, so `item_key` is null: the close acts on the run, not on an item. The
62
- `at` timestamp comes from the engine's injected clock seam.
73
+ `at` timestamp is supplied through `--at`; when `--at` is omitted the entry point stamps the
74
+ current UTC minute.
63
75
 
64
76
  4. **Do not recompute.** Run termination changes no cohort assignment, so `recolor_generation` is
65
- UNCHANGED and `cohorts[]` is not rewritten. Do not call `recolor_unstarted` as part of a close.
77
+ UNCHANGED and `cohorts[]` is not rewritten.
78
+ Do not run the `recolor` subcommand as part of a close.
66
79
 
67
80
  5. **Stop admitting.** After the close is recorded, the run accepts no further `/parallel-add`. The
68
81
  close record is the run's final mutation; nothing may be appended to `mutations[]` after it.
@@ -256,12 +256,40 @@ carries exactly these five elements.
256
256
  execution from that plan rather than re-running promotion, research, or planning. The item's
257
257
  prepared feature folder and approved atomic plan are already committed and preflight-clear on the
258
258
  item's own pushed feature branch.
259
+ The execution child starts a new checkpoint in its own worktree, and the preparation checkpoint
260
+ does not carry over, so the prompt also instructs the child to verify the item's GitHub issue
261
+ read-only (gh issue view), not to call `potential_to_issue` or the promotion-entry tool, and to
262
+ record its own top-level `issue_adoption` object per `.claude/rules/orchestrator-state.md`,
263
+ with origin `filed_before_orchestration` unless the issue was transferred, waiving
264
+ `potential_to_issue` and the promotion-entry tool for the checkpoint's promotion-type. When a
265
+ lifecycle record for the item exists under `docs/features/potential/promoted/`, the child cites
266
+ it as `potential_record`.
259
267
  5. The model-budget marker line `model_budget.fable_policy: <disabled|available|preferred>.`
260
268
 
261
269
  Spawn parameters, passed on the `Agent` call and never written into the prompt text:
262
270
  `isolation: "worktree"`, `run_in_background: true`, branch base `origin/main`, and `model` equal to
263
271
  that item's model routing receipt's resolved model.
264
272
 
273
+ **Band and receipt source.** The parent reads each item's `complexity_band` and
274
+ `model_routing_receipt` from the planner checkpoint `artifacts/orchestration/parallel-planner-state.json`.
275
+ When the planner checkpoint is unavailable, the committed kickoff artifact's `## Item Summary`
276
+ `complexity` column is the fallback band source. The parent passes `model` equal to the receipt's
277
+ `model` when the run's `fable_policy` equals the receipt's `fable_policy`; otherwise it re-resolves
278
+ with `Resolve-DelegationModel -Agent orchestrator -Band <band> -FablePolicy <run fable_policy>` and
279
+ passes that result.
280
+ An item admitted through `/parallel-add` appears neither in the planner checkpoint
281
+ `artifacts/orchestration/parallel-planner-state.json` `items[]` nor in the kickoff
282
+ `## Item Summary`; for such an item the band source is that item's `complexity_band` on the
283
+ orchestrator checkpoint `artifacts/orchestration/parallel-orchestrator-state.json` `items[]`. An
284
+ admitted item carries no `model_routing_receipt`, so the parent resolves `model` at spawn time as
285
+ `model_policy.complexity_to_model[<band>]` from `config/orchestration-routing.json` under the
286
+ run's `fable_policy`, with `fable` clamped to `opus` when `fable_policy` is `disabled`. That result
287
+ equals `Resolve-DelegationModel -Agent orchestrator -Band <band> -FablePolicy <run fable_policy>`
288
+ because `preferred_overlay.agents` does not include `orchestrator`. The parent passes that explicit
289
+ `model` on the spawn rather than relying on the frontmatter default, and it stops rather than
290
+ spawning without `model` when the admitted item has no `complexity_band` on the orchestrator
291
+ checkpoint.
292
+
265
293
  Negative obligations on the prompt:
266
294
 
267
295
  - It never carries `Preparation mode: true`. Preparation fan-out belongs to `parallel-planner` and
@@ -301,6 +329,27 @@ omitted `model` falls back to the delegate's frontmatter default, `opus`, which
301
329
  `fable` resolution — and MUST NOT hard-code `model=opus` in a way that overrides the resolved
302
330
  routing model.
303
331
 
332
+ The band and receipt for each item come from the planner checkpoint
333
+ `artifacts/orchestration/parallel-planner-state.json`: the parent reads the item's `complexity_band`
334
+ and `model_routing_receipt` there. When the planner checkpoint is unavailable, the committed kickoff
335
+ artifact's `## Item Summary` `complexity` column is the fallback band source. The parent passes
336
+ `model` equal to the receipt's `model` when the run's `fable_policy` equals the receipt's
337
+ `fable_policy`; otherwise it re-resolves with
338
+ `Resolve-DelegationModel -Agent orchestrator -Band <band> -FablePolicy <run fable_policy>` and
339
+ passes that result.
340
+ An item admitted through `/parallel-add` appears neither in the planner checkpoint
341
+ `artifacts/orchestration/parallel-planner-state.json` `items[]` nor in the kickoff
342
+ `## Item Summary`; for such an item the band source is that item's `complexity_band` on the
343
+ orchestrator checkpoint `artifacts/orchestration/parallel-orchestrator-state.json` `items[]`. An
344
+ admitted item carries no `model_routing_receipt`, so the parent resolves `model` at spawn time as
345
+ `model_policy.complexity_to_model[<band>]` from `config/orchestration-routing.json` under the
346
+ run's `fable_policy`, with `fable` clamped to `opus` when `fable_policy` is `disabled`. That result
347
+ equals `Resolve-DelegationModel -Agent orchestrator -Band <band> -FablePolicy <run fable_policy>`
348
+ because `preferred_overlay.agents` does not include `orchestrator`. The parent passes that explicit
349
+ `model` on the spawn rather than relying on the frontmatter default, and it stops rather than
350
+ spawning without `model` when the admitted item has no `complexity_band` on the orchestrator
351
+ checkpoint.
352
+
304
353
  `route` is never an input to model selection. `route` remains file-count driven and governs only
305
354
  agents, skills, and MCP tools. A skill whose frontmatter `context` field holds the value `fork`
306
355
  inherits the parent model and ignores a model override, so model selection applies to agent
@@ -313,16 +362,32 @@ unchanged: `.claude/skills/orchestrate/SKILL.md` is **not modified by this featu
313
362
  `parallel_mode` clause in its step 9, no `parallel_merge` object in the child checkpoint, and no
314
363
  additional condition on the child's PR Creation Gate.
315
364
 
365
+ Issue #744 later amended two parts of that child contract for CI-dependent acceptance criteria,
366
+ whose verification requires the result of CI on the item's pull-request head: PR Creation Gate
367
+ condition 2 and step S9 of `.claude/skills/orchestrate/SKILL.md`. The child checks those criteria
368
+ off in its own worktree, pushes the check-off commit to its pull-request branch, and re-runs S9
369
+ before DONE. The parent never commits acceptance-criteria check-offs from the coordinator root.
370
+
316
371
  Procedure, per item:
317
372
 
318
373
  1. The item's child orchestration runs unmodified, with `epic_mode` `false` or absent, and finishes
319
374
  at its own DONE. The child's PR Creation Gate condition 6 already requires
320
375
  `ci_gate.conclusion == "success"`, so at child DONE the item's pull request is open against
321
- `main` and its checks are green. The child is never instructed to merge its own pull request.
376
+ `main` and every check on its head SHA passed or was skipped. The child is never instructed to
377
+ merge its own pull request.
322
378
  2. On child completion, durably confirm pull-request state and check conclusion with
323
- `gh pr view --json state,mergedAt,headRefOid`, and with `gh pr checks` when the check conclusion
324
- must be re-read — never from an in-memory completion notification — then record
325
- `merge_status: ci_green`.
379
+ `gh pr view --json state,mergedAt,headRefOid` and an unconditional re-read of every check on
380
+ that head, never from an in-memory completion notification or from the child's DONE report
381
+ alone. Run `gh pr checks <PR> --json bucket,name,state,link,workflow` and parse its output with
382
+ `pwsh -NoProfile -File .claude/lib/ci-gate/Invoke-CiGateParser.ps1 -ChecksJson <checks-json> -HeadSha <headRefOid>`.
383
+ Record `merge_status: ci_green` only when that parser conclusion is `success`; on `failure` or
384
+ `pending`, or when `gh pr checks` fails with a "no checks reported" error, do not record
385
+ `merge_status: ci_green` and do not run `gh pr merge`.
386
+ Before recording `merge_status: ci_green`, confirm that the `headRefOid` value equals the
387
+ `ci_gate.head_sha` the child reported at DONE and that the child reported no pending
388
+ CI-dependent acceptance criteria. When either check fails, do not record
389
+ `merge_status: ci_green` and do not run `gh pr merge`; the item waits until its child pushes
390
+ the check-off and re-runs S9, and the parent does not commit the check-off itself.
326
391
  3. Execute `gh pr merge --merge <PR>` for that item's pull request, whose base is `main`.
327
392
  4. On success, record `merge_commit_sha`, `merged_at`, and `merge_status: merged`, then regenerate
328
393
  `docs/features/parallel/<slug>/parallel-status.md`.
@@ -417,8 +482,10 @@ the escalation path.
417
482
  2. The parent re-delegates that item's child orchestration. The child processes the finding through
418
483
  its unmodified R1 through R5 remediation loop exactly as it processes any local Blocking
419
484
  finding. No new remediation loop is introduced by this procedure.
420
- 3. The child's `remediation_pass` counter is shared with its local-finding and CI-failure passes,
421
- with the cap of 3, unmodified.
485
+ 3. Drift cycles share the child's `remediation_loop.completed_attempts` count with its
486
+ local-finding and CI-failure cycles, and the child halts after three completed attempts. The
487
+ active cycle number is `completed_attempts + 1`, and a cycle without an applied candidate
488
+ consumes no number.
422
489
  4. Each remediated pass ends again at child DONE with the pull request open and CI green, after
423
490
  which the parent retries the merge per `## Per-Item Merge to Main (Merge-on-Green)`. During
424
491
  remediation the item's `merge_status` legitimately remains `pr_open` or `ci_green`: the
@@ -567,6 +634,8 @@ hold:
567
634
  `artifact_type: "parallel-orchestrator-state"`.
568
635
  4. Each item's acceptance criteria have been checked off in that item's own acceptance-criteria
569
636
  source files by that item's own run, per the `acceptance-criteria-tracking` skill.
637
+ A CI-dependent criterion is checked off and pushed by that item's own run before its DONE, so
638
+ the head the parent merges already contains the check-off; the parent never commits it.
570
639
 
571
640
  In `open` mode there is no automatic completion. The run is a standing queue and terminates only via
572
641
  `/parallel-close`, which is owned by F6 and is neither specified nor shipped by this feature. Do not
@@ -598,9 +667,10 @@ Every mutation re-derives durable state (`git worktree list --porcelain`, `git b
598
667
  `gh pr view`) before it is applied, because the checkpoint is a cache of durable state and not the
599
668
  source of truth. A rejected mutation appends no entry and changes no state.
600
669
 
601
- The decision logic for all three commands is the pure engine
602
- `scripts/dev_tools/parallel_mutation_protocol.py`. It decides; it never applies. Item keys are
603
- integers (`items[].issue_num`) everywhere on this surface.
670
+ The decision logic for all three commands runs through the bundled bash entry points, which need no
671
+ Python interpreter: `bash .claude/lib/bash/mutate-parallel-run.sh` for add, close, and requeue, and
672
+ `bash .claude/lib/bash/remove-parallel-item.sh` for remove. They decide; they never apply. Item
673
+ keys are integers (`items[].issue_num`) everywhere on this surface.
604
674
 
605
675
  ### Pinning invariant
606
676
 
@@ -704,8 +774,9 @@ lost and is not recorded in the mutation entry: it is recorded as an item-state
704
774
  with the checkpoint's lifecycle timestamps, the same mechanism that records
705
775
  `proposed` -> `admitted` -> `prepared` during preparation. `new_state` is null for `close` only, and
706
776
  `item_key` is null for `close` only. `disposition` is non-null only on a `remove` entry whose
707
- `prior_state` is `in_flight`. Every `at` timestamp comes from the engine's injected clock seam; the
708
- engine never reads the wall clock. No field and no enum member is added to `mutations[]`; the nine
777
+ `prior_state` is `in_flight`. Every `at` timestamp is supplied by the caller through `--at`; an
778
+ entry point reads the clock only when `--at` is omitted, and then stamps the current UTC minute. No
779
+ field and no enum member is added to `mutations[]`; the nine
709
780
  parallel enums of `.claude/rules/parallel-orchestration.md` are consumed, never extended.
710
781
 
711
782
  Retrospective validation of the log is the helper
@@ -753,18 +824,25 @@ command to evade the match: that defeats the only mechanism protecting a destruc
753
824
  ### Drift-requeue append contract
754
825
 
755
826
  Radius drift detection consumes this protocol rather than reimplementing it. When drift halts the
756
- later-started item of a newly conflicting pair, the requeue is recorded through the mutation
757
- engine's `build_requeue_entry` constructor and the recolor through `recolor_unstarted`:
827
+ later-started item of a newly conflicting pair, the requeue is recorded through the `requeue-entry`
828
+ subcommand of the bundled entry point and the recolor through its `recolor` subcommand:
829
+
830
+ ```bash
831
+ bash .claude/lib/bash/mutate-parallel-run.sh requeue-entry --item <key> --generation <g> --at <timestamp>
832
+ ```
758
833
 
759
834
  - Item state becomes `blocked` and per-item `merge_status` becomes `blocked_drift`.
760
835
  - Exactly one `mutations[]` entry is appended with `op: requeue`, `prior_state: in_flight`,
761
836
  `new_state: blocked`, `disposition: null`, and `recolor_generation` equal to `g` + 1 — the requeue
762
837
  is a recompute.
763
- - The recolor runs over the unstarted subgraph only, so no other in-flight item moves. Its call
764
- shape is the six-argument form
765
- `recolor_unstarted(unstarted_items, conflict_edges, pinned, current_generation, current_cohort=current_cohort, highest_pinned_cohort=highest_pinned_cohort)`,
766
- where `current_cohort` and `highest_pinned_cohort` are both required and keyword-only.
767
- `highest_pinned_cohort` is derived from re-verified durable state: the highest
838
+ - The recolor runs over the unstarted subgraph only, so no other in-flight item moves. Run it as:
839
+
840
+ ```bash
841
+ bash .claude/lib/bash/mutate-parallel-run.sh recolor --unstarted "<k> ..." --edges "<a>:<b> ..." --pinned "<k> ..." --generation <g> --current-cohort <c> --highest-pinned-cohort <h>
842
+ ```
843
+
844
+ where `--current-cohort` and `--highest-pinned-cohort` are both required.
845
+ `--highest-pinned-cohort` is derived from re-verified durable state: the highest
768
846
  current-generation cohort index occupied by any in-flight item.
769
847
 
770
848
  The drift event itself is recorded in `drift_events[]`, which this protocol does not write. See
@@ -1113,7 +1191,7 @@ R5 loop that drives the remediation preceding either write is **reused
1113
1191
  unmodified**: `atomic-planner` plans the resolution, `atomic-executor` performs preflight then
1114
1192
  resolves, `feature-review` re-audits, and the loop exits on zero blocking findings. No new
1115
1193
  remediation loop is authored, no line of the existing loop is modified, and the shared
1116
- `remediation_pass` cap of 3 applies. `.claude/skills/orchestrate/SKILL.md` is not modified by this
1194
+ `remediation_loop.completed_attempts` count applies, with the halt after three completed attempts. `.claude/skills/orchestrate/SKILL.md` is not modified by this
1117
1195
  feature.
1118
1196
 
1119
1197
  #### Layer-1 Narrowing — a Documented Limitation