@danmoisan/drm-copilot-mcp 1.1.18 → 1.1.20

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 (264) hide show
  1. package/out/mcp-server.js +1149 -661
  2. package/package.json +3 -2
  3. package/resources/claude-customizations/.claude/agents/atomic-executor.md +28 -6
  4. package/resources/claude-customizations/.claude/agents/atomic-planner.md +20 -2
  5. package/resources/claude-customizations/.claude/agents/epic-orchestrator.md +17 -4
  6. package/resources/claude-customizations/.claude/agents/epic-planner.md +5 -4
  7. package/resources/claude-customizations/.claude/agents/feature-review.md +6 -4
  8. package/resources/claude-customizations/.claude/agents/orchestrator.md +9 -5
  9. package/resources/claude-customizations/.claude/agents/parallel-orchestrator.md +35 -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/agents/task-researcher.md +8 -0
  14. package/resources/claude-customizations/.claude/hooks/check-powershell-test-purity.ps1 +7 -1
  15. package/resources/claude-customizations/.claude/hooks/check-python-test-purity.ps1 +7 -1
  16. package/resources/claude-customizations/.claude/hooks/enforce-checkpoint-monotonic.ps1 +7 -1
  17. package/resources/claude-customizations/.claude/hooks/enforce-completion-consistency.ps1 +111 -46
  18. package/resources/claude-customizations/.claude/hooks/enforce-completion-helpers.ps1 +105 -0
  19. package/resources/claude-customizations/.claude/hooks/enforce-discovery-artifact-gate.ps1 +8 -1
  20. package/resources/claude-customizations/.claude/hooks/enforce-epic-invocation-origin.ps1 +7 -1
  21. package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate-command.ps1 +190 -0
  22. package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate-resolution.ps1 +116 -59
  23. package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate.ps1 +78 -77
  24. package/resources/claude-customizations/.claude/hooks/enforce-epic-wave-barrier.ps1 +74 -75
  25. package/resources/claude-customizations/.claude/hooks/enforce-epic-worktree-removal-gate-resolution.ps1 +127 -35
  26. package/resources/claude-customizations/.claude/hooks/enforce-epic-worktree-removal-gate.ps1 +61 -57
  27. package/resources/claude-customizations/.claude/hooks/enforce-evidence-locations.ps1 +7 -1
  28. package/resources/claude-customizations/.claude/hooks/enforce-feature-folder-order.ps1 +129 -39
  29. package/resources/claude-customizations/.claude/hooks/enforce-mermaid-validation.ps1 +7 -1
  30. package/resources/claude-customizations/.claude/hooks/enforce-model-routing-receipt.ps1 +9 -3
  31. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate-epic-scope.ps1 +39 -51
  32. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate-helpers.ps1 +31 -58
  33. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate-modes.ps1 +63 -47
  34. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate-targets.ps1 +433 -0
  35. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate.ps1 +17 -12
  36. package/resources/claude-customizations/.claude/hooks/enforce-parallel-abandon-gate.ps1 +9 -3
  37. package/resources/claude-customizations/.claude/hooks/enforce-parallel-cohort-barrier.ps1 +65 -50
  38. package/resources/claude-customizations/.claude/hooks/enforce-parallel-drift-gate.ps1 +49 -42
  39. package/resources/claude-customizations/.claude/hooks/enforce-parallel-worktree-removal-gate.ps1 +54 -72
  40. package/resources/claude-customizations/.claude/hooks/enforce-powershell-batch-budget.ps1 +8 -2
  41. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-command-allowlist.ps1 +279 -0
  42. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill-helpers.ps1 +129 -75
  43. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.artifact-root.ps1 +233 -0
  44. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.docs-only.ps1 +224 -0
  45. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.ps1 +69 -24
  46. package/resources/claude-customizations/.claude/hooks/enforce-prd-feature-before-planner-helpers.ps1 +29 -18
  47. package/resources/claude-customizations/.claude/hooks/enforce-prd-feature-before-planner.ps1 +10 -4
  48. package/resources/claude-customizations/.claude/hooks/enforce-promotion-mcp-only.ps1 +14 -5
  49. package/resources/claude-customizations/.claude/hooks/enforce-python-batch-budget.ps1 +8 -2
  50. package/resources/claude-customizations/.claude/hooks/feature-folder-resolution.ps1 +373 -0
  51. package/resources/claude-customizations/.claude/hooks/feature-review-coverage-thresholds.ps1 +85 -0
  52. package/resources/claude-customizations/.claude/hooks/hook-command-heredoc.ps1 +119 -0
  53. package/resources/claude-customizations/.claude/hooks/hook-command-invocation-operands.ps1 +198 -0
  54. package/resources/claude-customizations/.claude/hooks/hook-command-invocation.ps1 +254 -255
  55. package/resources/claude-customizations/.claude/hooks/hook-command-payload-powershell.ps1 +201 -0
  56. package/resources/claude-customizations/.claude/hooks/hook-command-payload.ps1 +484 -0
  57. package/resources/claude-customizations/.claude/hooks/hook-command-scanner.ps1 +27 -110
  58. package/resources/claude-customizations/.claude/hooks/hook-dependency-guard.ps1 +114 -0
  59. package/resources/claude-customizations/.claude/hooks/hook-docs-only-diff.ps1 +497 -0
  60. package/resources/claude-customizations/.claude/hooks/premortem-section.ps1 +149 -0
  61. package/resources/claude-customizations/.claude/hooks/subagentstop-envelope.ps1 +192 -0
  62. package/resources/claude-customizations/.claude/hooks/validate-bash.ps1 +9 -3
  63. package/resources/claude-customizations/.claude/hooks/validate-discovery-artifact-gate.ps1 +40 -42
  64. package/resources/claude-customizations/.claude/hooks/validate-executor-output.ps1 +267 -113
  65. package/resources/claude-customizations/.claude/hooks/validate-feature-review-coverage-metrics.ps1 +180 -0
  66. package/resources/claude-customizations/.claude/hooks/validate-feature-review-coverage-rules.ps1 +195 -0
  67. package/resources/claude-customizations/.claude/hooks/validate-feature-review-coverage.ps1 +141 -395
  68. package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output-resolution.ps1 +311 -0
  69. package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output-routing.ps1 +170 -0
  70. package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output.ps1 +115 -190
  71. package/resources/claude-customizations/.claude/hooks/validate-planner-output.ps1 +77 -33
  72. package/resources/claude-customizations/.claude/hooks/validate-pr-author-output.ps1 +39 -44
  73. package/resources/claude-customizations/.claude/hooks/validate-prd-feature-output.ps1 +43 -14
  74. package/resources/claude-customizations/.claude/hooks/validate-required-artifact-output.ps1 +66 -36
  75. package/resources/claude-customizations/.claude/hooks/validate-task-researcher-output.ps1 +52 -36
  76. package/resources/claude-customizations/.claude/lib/bash/mutate-parallel-run.sh +191 -0
  77. package/resources/claude-customizations/.claude/lib/bash/parallel-cohorts.sh +13 -3
  78. package/resources/claude-customizations/.claude/lib/bash/parallel-mutation-cli.sh +152 -0
  79. package/resources/claude-customizations/.claude/lib/bash/parallel-mutation-ops.sh +193 -0
  80. package/resources/claude-customizations/.claude/lib/bash/parallel-mutation.sh +322 -0
  81. package/resources/claude-customizations/.claude/lib/bash/remove-parallel-item.sh +146 -0
  82. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusExtraction.psm1 +23 -33
  83. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusTokenShape.psm1 +86 -6
  84. package/resources/claude-customizations/.claude/lib/ci-gate/Invoke-CiGateParser.ps1 +91 -19
  85. package/resources/claude-customizations/.claude/lib/ci-gate/Invoke-MergeConfirmationParser.ps1 +203 -0
  86. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateEpicWaveBarrier.psm1 +346 -0
  87. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateIssueAdoption.psm1 +24 -3
  88. package/resources/claude-customizations/.claude/lib/worktree-resolution/WorktreeItemResolution.psm1 +79 -2
  89. package/resources/claude-customizations/.claude/lib/worktree-resolution/WorktreeRunResolution.psm1 +3 -3
  90. package/resources/claude-customizations/.claude/rules/architecture-boundaries.md +5 -5
  91. package/resources/claude-customizations/.claude/rules/csharp.md +2 -2
  92. package/resources/claude-customizations/.claude/rules/general-code-change.md +1 -1
  93. package/resources/claude-customizations/.claude/rules/general-unit-test.md +3 -2
  94. package/resources/claude-customizations/.claude/rules/orchestrator-state.md +37 -4
  95. package/resources/claude-customizations/.claude/rules/parallel-orchestration.md +50 -5
  96. package/resources/claude-customizations/.claude/rules/plan-acceptance-gates.md +85 -10
  97. package/resources/claude-customizations/.claude/rules/quality-tiers.md +11 -7
  98. package/resources/claude-customizations/.claude/rules/shell.md +10 -8
  99. package/resources/claude-customizations/.claude/rules/typescript.md +1 -1
  100. package/resources/claude-customizations/.claude/settings.json +3 -4
  101. package/resources/claude-customizations/.claude/skills/acceptance-criteria-tracking/SKILL.md +1 -1
  102. package/resources/claude-customizations/.claude/skills/atomic-plan-contract/SKILL.md +52 -16
  103. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/SKILL.md +7 -3
  104. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/scripts/cleanup_worktrees_detached_lib.sh +1 -1
  105. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/scripts/cleanup_worktrees_enumerate_lib.sh +2 -0
  106. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/scripts/cleanup_worktrees_scan_helper.sh +2 -0
  107. package/resources/claude-customizations/.claude/skills/csharp-change-budget-router/SKILL.md +2 -2
  108. package/resources/claude-customizations/.claude/skills/epic-orchestrate/SKILL.md +45 -9
  109. package/resources/claude-customizations/.claude/skills/epic-plan/SKILL.md +5 -3
  110. package/resources/claude-customizations/.claude/skills/evidence-and-timestamp-conventions/SKILL.md +10 -1
  111. package/resources/claude-customizations/.claude/skills/execution-environment/SKILL.md +134 -0
  112. package/resources/claude-customizations/.claude/skills/feature-promotion-lifecycle/SKILL.md +1 -1
  113. package/resources/claude-customizations/.claude/skills/feature-review-workflow/SKILL.md +4 -3
  114. package/resources/claude-customizations/.claude/skills/orchestrate/SKILL.md +36 -15
  115. package/resources/claude-customizations/.claude/skills/parallel-add/SKILL.md +52 -14
  116. package/resources/claude-customizations/.claude/skills/parallel-close/SKILL.md +22 -9
  117. package/resources/claude-customizations/.claude/skills/parallel-orchestrate/SKILL.md +108 -21
  118. package/resources/claude-customizations/.claude/skills/parallel-plan/SKILL.md +63 -7
  119. package/resources/claude-customizations/.claude/skills/parallel-remove/SKILL.md +35 -12
  120. package/resources/claude-customizations/.claude/skills/powershell-change-budget-router/SKILL.md +1 -1
  121. package/resources/claude-customizations/.claude/skills/pr-author/SKILL.md +3 -1
  122. package/resources/claude-customizations/.claude/skills/python-change-budget-router/SKILL.md +1 -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 +16 -8
  125. package/resources/claude-customizations/.claude/skills/research-issue/SKILL.md +6 -0
  126. package/resources/claude-customizations/pack-manifests/core.json +27 -0
  127. package/resources/codex-and-agents-customizations/.agents/skills/README.md +1 -0
  128. package/resources/codex-and-agents-customizations/.agents/skills/acceptance-criteria-tracking/SKILL.md +1 -1
  129. package/resources/codex-and-agents-customizations/.agents/skills/architecture-boundaries/SKILL.md +5 -5
  130. package/resources/codex-and-agents-customizations/.agents/skills/atomic-executor/SKILL.md +19 -7
  131. package/resources/codex-and-agents-customizations/.agents/skills/atomic-plan-contract/SKILL.md +43 -4
  132. package/resources/codex-and-agents-customizations/.agents/skills/atomic-planner/SKILL.md +18 -6
  133. package/resources/codex-and-agents-customizations/.agents/skills/csharp/SKILL.md +2 -2
  134. package/resources/codex-and-agents-customizations/.agents/skills/csharp-change-budget-router/SKILL.md +2 -2
  135. package/resources/codex-and-agents-customizations/.agents/skills/csharp-qa-gate/SKILL.md +2 -2
  136. package/resources/codex-and-agents-customizations/.agents/skills/epic-orchestrate/SKILL.md +16 -1
  137. package/resources/codex-and-agents-customizations/.agents/skills/epic-plan/SKILL.md +17 -1
  138. package/resources/codex-and-agents-customizations/.agents/skills/epic-run/SKILL.md +2 -1
  139. package/resources/codex-and-agents-customizations/.agents/skills/evidence-and-timestamp-conventions/SKILL.md +10 -1
  140. package/resources/codex-and-agents-customizations/.agents/skills/execution-environment/SKILL.md +134 -0
  141. package/resources/codex-and-agents-customizations/.agents/skills/feature-review-workflow/SKILL.md +13 -5
  142. package/resources/codex-and-agents-customizations/.agents/skills/general-code-change/SKILL.md +1 -1
  143. package/resources/codex-and-agents-customizations/.agents/skills/general-unit-test/SKILL.md +3 -2
  144. package/resources/codex-and-agents-customizations/.agents/skills/orchestrate/SKILL.md +27 -8
  145. package/resources/codex-and-agents-customizations/.agents/skills/orchestrator-workflow/SKILL.md +1 -1
  146. package/resources/codex-and-agents-customizations/.agents/skills/powershell-change-budget-router/SKILL.md +1 -1
  147. package/resources/codex-and-agents-customizations/.agents/skills/python-change-budget-router/SKILL.md +1 -1
  148. package/resources/codex-and-agents-customizations/.agents/skills/quality-tiers/SKILL.md +11 -7
  149. package/resources/codex-and-agents-customizations/.agents/skills/remediation-handoff-atomic-planner/SKILL.md +7 -3
  150. package/resources/codex-and-agents-customizations/.agents/skills/research-issue/SKILL.md +6 -0
  151. package/resources/codex-and-agents-customizations/.agents/skills/translate-claude-to-codex/SKILL.md +1 -1
  152. package/resources/codex-and-agents-customizations/.agents-variants/csharp-legacy/skills/csharp/SKILL.md +2 -2
  153. package/resources/codex-and-agents-customizations/.agents-variants/csharp-legacy/skills/csharp-qa-gate/SKILL.md +2 -2
  154. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c1.toml +21 -6
  155. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c2.toml +21 -6
  156. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c3-elevated.toml +21 -6
  157. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c3.toml +21 -6
  158. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c4.toml +21 -6
  159. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor.toml +21 -6
  160. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c1.toml +15 -2
  161. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c2.toml +15 -2
  162. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c3-elevated.toml +15 -2
  163. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c3.toml +15 -2
  164. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c4.toml +15 -2
  165. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner.toml +15 -2
  166. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planning.toml +1 -1
  167. package/resources/codex-and-agents-customizations/.codex/agents/csharp-atomic-planning.toml +1 -1
  168. package/resources/codex-and-agents-customizations/.codex/agents/epic-orchestrator.toml +4 -1
  169. package/resources/codex-and-agents-customizations/.codex/agents/feature-review.toml +6 -6
  170. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c1.toml +7 -4
  171. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c2.toml +7 -4
  172. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c3-elevated.toml +7 -4
  173. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c3.toml +7 -4
  174. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c4.toml +7 -4
  175. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator.toml +7 -4
  176. package/resources/codex-and-agents-customizations/.codex/agents/powershell-atomic-planning.toml +1 -1
  177. package/resources/codex-and-agents-customizations/.codex/agents/python-atomic-planning.toml +1 -1
  178. package/resources/codex-and-agents-customizations/.codex/agents/task-researcher-c1.toml +6 -0
  179. package/resources/codex-and-agents-customizations/.codex/agents/task-researcher-c2.toml +6 -0
  180. package/resources/codex-and-agents-customizations/.codex/agents/task-researcher-c3-elevated.toml +6 -0
  181. package/resources/codex-and-agents-customizations/.codex/agents/task-researcher-c3.toml +6 -0
  182. package/resources/codex-and-agents-customizations/.codex/agents/task-researcher-c4.toml +6 -0
  183. package/resources/codex-and-agents-customizations/.codex/agents/task-researcher.toml +6 -0
  184. package/resources/codex-and-agents-customizations/.codex/codex-web-setup.sh +318 -273
  185. package/resources/codex-and-agents-customizations/.codex/config.toml +1 -1
  186. package/resources/codex-and-agents-customizations/.codex/hooks/check-powershell-test-purity.ps1 +7 -1
  187. package/resources/codex-and-agents-customizations/.codex/hooks/check-python-test-purity.ps1 +7 -1
  188. package/resources/codex-and-agents-customizations/.codex/hooks/codex-epic-child-launch-attestation.ps1 +1 -1
  189. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-checkpoint-monotonic.ps1 +7 -1
  190. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-codex-model-routing.ps1 +8 -2
  191. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-completion-consistency.ps1 +97 -44
  192. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-completion-helpers.ps1 +105 -0
  193. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-child-worktree-binding.ps1 +7 -1
  194. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-merge-gate-command.ps1 +190 -0
  195. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-merge-gate.ps1 +54 -43
  196. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-planning-only.ps1 +6 -0
  197. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-root-invocation.ps1 +7 -1
  198. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-wave-barrier.ps1 +7 -1
  199. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-worktree-removal-gate.ps1 +54 -41
  200. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-evidence-locations.ps1 +7 -1
  201. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate-epic-scope.ps1 +35 -14
  202. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate-helpers.ps1 +31 -58
  203. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate-modes.ps1 +63 -47
  204. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate-targets.ps1 +433 -0
  205. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate.ps1 +24 -11
  206. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-powershell-batch-budget.ps1 +8 -2
  207. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-promotion-mcp-only.ps1 +13 -4
  208. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-python-batch-budget.ps1 +8 -2
  209. package/resources/codex-and-agents-customizations/.codex/hooks/feature-folder-resolution.ps1 +373 -0
  210. package/resources/codex-and-agents-customizations/.codex/hooks/feature-review-coverage-thresholds.ps1 +85 -0
  211. package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-heredoc.ps1 +119 -0
  212. package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-invocation-operands.ps1 +198 -0
  213. package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-invocation.ps1 +254 -255
  214. package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-payload-powershell.ps1 +201 -0
  215. package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-payload.ps1 +484 -0
  216. package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-scanner.ps1 +27 -110
  217. package/resources/codex-and-agents-customizations/.codex/hooks/hook-dependency-guard.ps1 +114 -0
  218. package/resources/codex-and-agents-customizations/.codex/hooks/hook-docs-only-diff.ps1 +497 -0
  219. package/resources/codex-and-agents-customizations/.codex/hooks/validate-bash.ps1 +8 -2
  220. package/resources/codex-and-agents-customizations/.codex/hooks/validate-codex-subagent-routing.ps1 +7 -1
  221. package/resources/codex-and-agents-customizations/.codex/hooks/validate-feature-review-coverage.ps1 +24 -8
  222. package/resources/codex-and-agents-customizations/.codex/prompts/feature-review-remediate.md +6 -4
  223. package/resources/codex-and-agents-customizations/pack-manifests/core.json +11 -0
  224. package/resources/customizations/.github/agents/atomic_executor.agent.md +21 -11
  225. package/resources/customizations/.github/agents/atomic_planning.agent.md +8 -3
  226. package/resources/customizations/.github/agents/csharp-atomic-executor.agent.md +13 -9
  227. package/resources/customizations/.github/agents/csharp-atomic-planning.agent.md +2 -2
  228. package/resources/customizations/.github/agents/csharp-orchestrator.agent.md +2 -2
  229. package/resources/customizations/.github/agents/csharp-typed-engineer.agent.md +5 -5
  230. package/resources/customizations/.github/agents/orchestrator.agent.md +8 -5
  231. package/resources/customizations/.github/agents/powershell-atomic-executor.agent.md +13 -9
  232. package/resources/customizations/.github/agents/powershell-atomic-planning.agent.md +2 -2
  233. package/resources/customizations/.github/agents/powershell-orchestrator.agent.md +2 -2
  234. package/resources/customizations/.github/agents/powershell-typed-engineer.agent.md +3 -3
  235. package/resources/customizations/.github/agents/python-atomic-executor.agent.md +13 -9
  236. package/resources/customizations/.github/agents/python-atomic-planning.agent.md +2 -2
  237. package/resources/customizations/.github/agents/python-orchestrator.agent.md +2 -2
  238. package/resources/customizations/.github/agents/task-researcher.agent.md +6 -0
  239. package/resources/customizations/.github/instructions/csharp-code-change.instructions.md +4 -4
  240. package/resources/customizations/.github/instructions/csharp-unit-test.instructions.md +2 -2
  241. package/resources/customizations/.github/prompts/generate-atomic-plan.prompt.md +16 -10
  242. package/resources/customizations/.github/prompts/orchestrate-csharp-work.prompt.md +2 -2
  243. package/resources/customizations/.github/prompts/orchestrate-powershell-work.prompt.md +1 -1
  244. package/resources/customizations/.github/prompts/orchestrate-python-work.prompt.md +1 -1
  245. package/resources/customizations/.github/prompts/orchestrate-work.prompt.md +2 -2
  246. package/resources/customizations/.github/skills/acceptance-criteria-tracking/SKILL.md +1 -1
  247. package/resources/customizations/.github/skills/atomic-plan-contract/SKILL.md +43 -4
  248. package/resources/customizations/.github/skills/csharp-change-budget-router/SKILL.md +1 -1
  249. package/resources/customizations/.github/skills/evidence-and-timestamp-conventions/SKILL.md +10 -1
  250. package/resources/customizations/.github/skills/execution-environment/SKILL.md +134 -0
  251. package/resources/customizations/.github/skills/feature-review-workflow/SKILL.md +1 -1
  252. package/resources/customizations/.github/skills/powershell-change-budget-router/SKILL.md +1 -1
  253. package/resources/customizations/.github/skills/remediation-handoff-atomic-planner/SKILL.md +7 -3
  254. package/resources/feature-templates/bug/plan.yyyy-MM-ddTHH-mm.md +10 -0
  255. package/resources/feature-templates/feature/plan.yyyy-MM-ddTHH-mm.md +11 -0
  256. package/resources/feature-templates/refactor/plan.yyyy-MM-ddTHH-mm.md +11 -0
  257. package/resources/powershell/PoshQC/PoshQC.Coverage.psm1 +314 -0
  258. package/resources/powershell/PoshQC/PoshQC.CoverageMerge.psm1 +163 -0
  259. package/resources/powershell/PoshQC/PoshQC.Shard.psm1 +296 -0
  260. package/resources/powershell/PoshQC/PoshQC.Testing.psm1 +48 -32
  261. package/resources/powershell/PoshQC/PoshQC.psd1 +7 -1
  262. package/resources/powershell/PoshQC/PoshQC.psm1 +18 -5
  263. package/resources/powershell/PoshQC/README.md +21 -3
  264. package/resources/powershell/PoshQC/settings/pester.runsettings.psd1 +5 -319
@@ -70,7 +70,7 @@ Always apply:
70
70
  If the branch diff modifies any path matching `.github/workflows/**`, `scripts/benchmarks/**`, or `.github/actions/**`, the policy audit emits a Blocking finding unless evidence of a green workflow run against the branch head is present in the remediation inputs.
71
71
 
72
72
  - The rule provides a second, independent line of defense for CI-gate-modifying features, separate from and prior to the orchestrator's S9 CI green gate.
73
- - "Green workflow run against the branch head" means a workflow run whose head SHA matches the current branch head and whose conclusion is success for the affected workflow.
73
+ - "Green workflow run against the branch head" means a run of the affected workflow whose conclusion is success and which satisfies either (a) or (b): (a) its head SHA equals the current branch head; or (b) all three predecessor-head conditions hold: (1) the run's head SHA is an ancestor of, or equal to, the current branch head and contains the latest commit that changes any path outside the active feature folder (`git merge-base --is-ancestor <commit> <run-sha>`); (2) every commit after the run's head SHA changes only paths inside the active feature folder (`git log <run-sha>..HEAD -- . ":!<feature-folder>"` returns no commits); (3) the policy audit states that the orchestrator's S9 CI green gate remains responsible for `ci_gate.conclusion == "success"` with `ci_gate.head_sha` equal to the final PR head before DONE. Condition (b) exists because an in-repo evidence artifact cannot name the SHA of the commit that contains it.
74
74
  - A green `workflow_dispatch` run against the branch head also satisfies the rule, not only a PR-context run. This mitigates the chicken-and-egg case where a feature must land its CI gate before the gate can run in PR context (see spec.md Risks & Mitigations).
75
75
  - When the rule fires and no qualifying green-run evidence is present, record a Blocking finding classified `awaiting_ci` (the remediation inputs carry `Remediability: awaiting_ci` and a `Remediability-Evidence:` line naming the awaited workflow) and route it to the wait path (`AWAITING_CI` when no other class is present) instead of the remediation handoff.
76
76
 
@@ -108,12 +108,13 @@ If the branch diff modifies any path matching `.github/workflows/**`, `scripts/b
108
108
  - Python: `poetry run pytest --cov` → artifact: `artifacts/python/lcov.info`
109
109
  - PowerShell: `mcp__drm-copilot__run_poshqc_test` → artifact: `artifacts/pester/powershell-coverage.xml`
110
110
  - C#: `dotnet test --collect:"XPlat Code Coverage"` → artifact: `artifacts/csharp/coverage.xml`
111
- - Coverage thresholds (uniform tier rule per quality-tiers.md). The branch threshold applies only to branch-capable languages — TypeScript, Python, and C#. PowerShell is a coverage language and is fully subject to the line threshold and the no-regression requirement, but Pester measures command (instruction) coverage and line coverage only, so no branch percentage exists to evaluate and no branch threshold applies to it (see `.claude/rules/powershell.md`). Do not flag a missing PowerShell branch figure as FAIL:
111
+ - Coverage thresholds (threshold precedence per `.claude/rules/quality-tiers.md` and `.claude/rules/general-unit-test.md`: when the repository's root `CLAUDE.md` states line or branch coverage thresholds, those thresholds govern; otherwise the default thresholds below govern; each metric falls back independently, so a root `CLAUDE.md` that states only one of the two thresholds governs only that metric). The branch threshold applies only to branch-capable languages — TypeScript, Python, and C#. PowerShell is a coverage language and is fully subject to the line threshold and the no-regression requirement, but Pester measures command (instruction) coverage and line coverage only, so no branch percentage exists to evaluate and no branch threshold applies to it (see `.claude/rules/powershell.md`). Do not flag a missing PowerShell branch figure as FAIL:
112
112
  - New code files (added in this feature): line coverage >= 85%, and branch coverage >= 75% for branch-capable languages. Flag as FAIL otherwise.
113
113
  - Modified files (changed but previously existing): line coverage >= 85%, branch coverage >= 75% for branch-capable languages, and no regression on changed lines relative to baseline. Flag as FAIL otherwise.
114
114
  - Repo-wide per language: line coverage >= 85%, and branch coverage >= 75% for branch-capable languages. Flag as FAIL otherwise.
115
115
  - If coverage artifacts already exist from the executor run, inspect them instead of re-running.
116
116
  - If no coverage artifact exists for a language that has changed files, flag as FAIL — coverage verification is mandatory for all languages with changed files.
117
+ - Tier classification findings: report a missing or incomplete `quality-tiers.yml` only when the repository has adopted tiers, that is, when `quality-tiers.yml` exists at the repository root on the resolved base branch or the repository's CI runs a tier-classification check. Otherwise record tier classification as not applicable; it is not a finding.
117
118
  - Run the smallest relevant subset first when the repo policy permits it.
118
119
  - If a tool cannot run in the environment, mark the affected section unverified or partial with a concrete reason.
119
120
 
@@ -145,7 +146,7 @@ If the branch diff modifies any path matching `.github/workflows/**`, `scripts/b
145
146
  - toolchain checks fail
146
147
  - the code review contains blockers
147
148
  - required acceptance criteria are FAIL or PARTIAL
148
- - coverage regression below policy threshold (< 80% repo-wide per language, < 80% or regression for modified files, or < 90% for new files)
149
+ - coverage below the governing thresholds defined in step 5 (repo-wide per language, modified files including any regression on changed lines, or new files)
149
150
  - coverage artifact absent for any language that has changed files
150
151
  - Classify each blocking finding before triggering remediation: each receives one remediability class (`autonomous`, `external_dependency`, `policy_hold`, `awaiting_ci`, or `human_decision_required`; `autonomous` when no class is stated). A published MCP runtime that lags the repository contract is classified `external_dependency`.
151
152
  - Trigger the remediation handoff only when at least one blocking finding is `autonomous`. When every blocking finding is non-remediable, write the remediation inputs with the `HALT_NON_REMEDIABLE` or `AWAITING_CI` verdict and create no remediation plan target.
@@ -25,6 +25,7 @@ Before proceeding, the orchestrator must:
25
25
  1. Read `CLAUDE.md` for repository tone policy and architectural context.
26
26
  2. Read applicable `.claude/rules/` files for the languages in scope.
27
27
  3. Read the policy files listed in the compliance reading order section of `CLAUDE.md`.
28
+ 4. Read the `execution-environment` skill (`.claude/skills/execution-environment/SKILL.md`) before delegating any worker. Delegation prompts and plans reference that brief instead of restating tool routes, command-text restrictions, the batch budget, hook context, or CI shape.
28
29
 
29
30
  ## Checkpoint Handling
30
31
 
@@ -34,6 +35,7 @@ On every invocation, the main session must:
34
35
  2. If a valid checkpoint exists with a matching objective, resume from the recorded `next_step`.
35
36
  3. If no checkpoint exists or the objective is new, begin the orchestration lifecycle from the start.
36
37
  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.
38
+ 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
39
 
38
40
  ## Prepared-State Portable Handoff Intake
39
41
 
@@ -130,12 +132,18 @@ After reading `artifacts/orchestration/orchestrator-state.json`, the main sessio
130
132
 
131
133
  The orchestrator does not perform deep implementation itself. It coordinates, tracks state, and enforces completion.
132
134
 
135
+ Single-pass preflight for S4 planning (and for preparation mode). The directive `DIRECTIVE: PREFLIGHT VALIDATION ONLY` goes in the `atomic-executor` delegation prompt only, never in the plan file. Preflight follows `### Single-Pass Preflight` in the `atomic-plan-contract` skill: the preflight executor fixes trivial defects in place and returns only substantive defects as `PREFLIGHT-DEFECT:` lines. The at-most-one-return rule applies:
136
+
137
+ 1. Preflight round one returns `PREFLIGHT: ALL CLEAR` (in-place `PREFLIGHT-FIX:` lines permitted) or `PREFLIGHT: REVISIONS REQUIRED` with every substantive defect listed.
138
+ 2. On `PREFLIGHT: REVISIONS REQUIRED`, delegate one `atomic-planner` revision of the same plan file carrying the full `PREFLIGHT-DEFECT:` list, then run preflight round two. A plan returns to the planner at most once.
139
+ 3. If round two still returns a substantive defect, halt with `blocked_reason: "validator_failed"` and record both preflight returns in the checkpoint. Do not open a third round.
140
+
133
141
  ## Preparation Mode
134
142
 
135
143
  A delegation prompt carrying the literal marker `Preparation mode: true` (issued by `epic-planner` per the `.claude/skills/epic-plan/SKILL.md` kickoff line) scopes the run to planning only:
136
144
 
137
145
  - **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
- - **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`.
146
+ - **Scope.** Run promotion (MCP surface), research, feature documents (`spec.md`, `user-story.md`), atomic planning, and the atomic-executor preflight (precondition validation only, under the single-pass preflight and at-most-one-return rule stated under `## Delegation Model`). Atomic execution, PR authoring, CI monitoring, and feature review are out of scope and are executed later by `epic-orchestrator`.
139
147
  - **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.
140
148
  - **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`.
141
149
  - **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.
@@ -189,6 +197,8 @@ The mandatory sequence is:
189
197
  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.
190
198
  4. The orchestrator records `pr_author_receipt` in the checkpoint, citing the body-file path and the receipt path that were verified.
191
199
 
200
+ 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.
201
+
192
202
  `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.
193
203
 
194
204
  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.
@@ -225,10 +235,11 @@ The orchestrator must not report completion until:
225
235
 
226
236
  Before delegating to the `feature-review` subagent, the orchestrator must:
227
237
 
228
- 1. Stage all modified and new files: `git add -A`.
229
- 2. Delegate to `Agent(commit-message)` to generate a conventional commit message from the staged diff. The agent is read-only and returns message text only; it does not commit.
230
- 3. Commit using the generated message: `git commit -m "<generated message>"`. The `git add` and `git commit` actions remain on the orchestrator.
231
- 4. Only after a successful commit may the orchestrator proceed to the `feature-review` delegation.
238
+ 1. Confirm the self-review: the lexicographically greatest `self-review.*.md` under `<FEATURE>/evidence/qa-gates/` exists and records no FAIL row. If it is missing or records a FAIL row, run a proportionate correction (one planner delegation and one combined preflight-and-execute executor delegation, as under `## Remediation Loop (R1–R5)`) that fixes the failing items and rewrites the self-review, then repeat this check before the commit.
239
+ 2. Stage all modified and new files: `git add -A`.
240
+ 3. Delegate to `Agent(commit-message)` to generate a conventional commit message from the staged diff. The agent is read-only and returns message text only; it does not commit.
241
+ 4. Commit using the generated message: `git commit -m "<generated message>"`. The `git add` and `git commit` actions remain on the orchestrator.
242
+ 5. Only after a successful commit may the orchestrator proceed to the `feature-review` delegation.
232
243
 
233
244
  The review subagent compares against a base branch; uncommitted changes are invisible to the diff tool and cannot be audited.
234
245
 
@@ -256,8 +267,13 @@ A bounded loop consisting of five steps. The attempt count is `remediation_loop.
256
267
 
257
268
  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.
258
269
 
270
+ Remediation mode. Before R1, the orchestrator writes exactly one line into the cycle's `remediation-inputs.<timestamp>.md`: `Remediation-Mode: proportionate` or `Remediation-Mode: design`. The classification rule: a cycle is proportionate when every `autonomous` finding can be fixed without changing a spec acceptance criterion, a public interface, or the item's file inventory beyond the files already in the branch diff plus their tests and mirrors; otherwise the cycle is design. CI-failure findings are normally proportionate.
271
+
272
+ - **Proportionate cycle.** R1 is one `atomic-planner` delegation that writes a short remediation plan carrying a `## Pre-Mortem` section and a final self-review task. R2 and R3 run as one `atomic-executor` delegation: the executor runs single-pass preflight with in-place trivial fixes (`### Single-Pass Preflight` in `atomic-plan-contract`) and then executes the plan. Record `preflight: {iterations: 1, final_status: "clear"}` on the cycle before `execution_status`. If preflight finds a substantive defect, the executor stops with `BLOCKED at preflight (before [P0-T1])`, a plan delta, and no checked task; the orchestrator rewrites the mode line to `Remediation-Mode: design` and the cycle continues as a design cycle with one planner revision. The pre-R4 commit, R4, and R5 are unchanged.
273
+ - **Design cycle.** R1 to R5 run as listed below, and R2 follows the single-pass preflight and at-most-one-return rule.
274
+
259
275
  - **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.
260
- - **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.
276
+ - **R2 — Preflight clearance:** Delegate to `atomic-executor` for precondition validation only (no implementation), with the preflight directive in the delegation prompt. Trivial defects are fixed in place. If the executor returns `PREFLIGHT: REVISIONS REQUIRED`, return to R1 once and re-delegate to `atomic-planner` with the full `PREFLIGHT-DEFECT:` list; if the following preflight still reports a substantive defect, record `final_status: "blocked_preflight_iteration_limit"` on the cycle and halt per `.claude/skills/remediation-handoff-atomic-planner/SKILL.md`. Only after `PREFLIGHT: ALL CLEAR` may the orchestrator advance to R3.
261
277
  - **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.
262
278
  - **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.
263
279
  - **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.
@@ -267,7 +283,7 @@ Cycle accounting: a remediation attempt is complete when R3 execution finished (
267
283
 
268
284
  ## Issue Number Consistency
269
285
 
270
- 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.
286
+ 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`.
271
287
 
272
288
  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:
273
289
 
@@ -286,11 +302,16 @@ If a subagent artifact references a different issue number, the orchestrator rej
286
302
  S9 procedure:
287
303
 
288
304
  1. Resolve the live PR head SHA for the feature branch (`gh pr view --json headRefOid` or equivalent).
289
- 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.
290
- 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.
305
+ 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.
306
+
307
+ 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.
308
+
309
+ 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.
310
+
311
+ 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.
291
312
  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.
292
313
  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.
293
- 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.
314
+ 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. Merge confirmation (issue #952): a zero exit from `gh pr merge` does not prove a merge when the base branch uses a merge queue, so `epic_merge.merge_commit_sha` is recorded only after the merge is confirmed by polling and ancestry check. Read the pull-request state every 30 seconds, for at most 90 minutes, with the `gh api graphql` query and `.claude/lib/ci-gate/Invoke-MergeConfirmationParser.ps1` exactly as step 3 of `## Per-Item Merge to Main (Merge-on-Green)` in `.claude/skills/parallel-orchestrate/SKILL.md` defines them; on `merged`, run `git fetch origin <integration_branch>` and confirm that `git merge-base --is-ancestor <merge-commit-oid> origin/<integration_branch>` exits 0 before recording `epic_merge`. When the 90 minutes are exhausted, record a finding naming `awaiting_merge_queue` with `Remediability: awaiting_ci` in `remediation-inputs.<timestamp>.md` and follow the wait branch (`blocked_reason: "awaiting_ci"`, `next_step: "S9_ci_green"`). A `not_queued` outcome whose `mergeable` value is `CONFLICTING` follows "Merge-Conflict Remediation"; any other `not_queued` outcome enters `## Remediation Loop — CI-Failure Handling`; a `closed` outcome halts the run with a failure. `gh pr merge` is never re-issued in a loop after `not_queued`.
294
315
 
295
316
  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.
296
317
 
@@ -301,7 +322,7 @@ DONE is not written while `step9_status` is anything other than `passed`.
301
322
  The orchestrator checkpoint (`artifacts/orchestration/orchestrator-state.json`) is extended with:
302
323
 
303
324
  - a top-level `ci_gate` object containing:
304
- - `head_sha` — the PR head SHA that the required checks were observed against.
325
+ - `head_sha` — the PR head SHA that the queried checks were observed against.
305
326
  - `pr_pipeline_run_id` — the GitHub Actions run id for the PR Pipeline.
306
327
  - `pr_pipeline_run_url` — the URL of that run.
307
328
  - `conclusion` — one of `success`, `failure`, `pending`.
@@ -336,11 +357,11 @@ A checkpoint that predates this schema and has no `ci_gate` object (or no `step9
336
357
 
337
358
  ## Remediation Loop — CI-Failure Handling
338
359
 
339
- When S9 records `step9_status: "failed_remediation_required"` (a failed required check; a poll timeout follows the wait branch per S9 step 4):
360
+ When S9 records `step9_status: "failed_remediation_required"` (a failed check; a poll timeout follows the wait branch per S9 step 4):
340
361
 
341
362
  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.
342
363
  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.
343
- 3. The existing R1-R5 remediation loop processes that finding exactly as it processes a local blocking finding. No new loop is introduced.
364
+ 3. The existing R1-R5 remediation loop processes that finding exactly as it processes a local blocking finding. No new loop is introduced. The inputs file carries `Remediation-Mode: proportionate` unless the fix requires changing a spec acceptance criterion, a public interface, or the file inventory beyond the branch diff plus tests and mirrors, in which case it carries `Remediation-Mode: design`.
344
365
  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`.
345
366
  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.
346
367
 
@@ -355,7 +376,7 @@ The orchestrator must not create a PR, push a branch for PR purposes, or report
355
376
  4. The checkpoint `next_step` is `S8_create_pr` (precondition to entering S9).
356
377
  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`.
357
378
  6. `ci_gate.conclusion == "success"` AND `ci_gate.head_sha == current head SHA of the PR branch`. DONE is not written while either sub-condition is false.
358
- 7. `epic_mode` is `false`, OR (`epic_mode` is `true` AND the integration-branch merge (`gh pr merge --merge`) has completed and `epic_merge.merge_commit_sha` is recorded in the checkpoint).
379
+ 7. `epic_mode` is `false`, OR (`epic_mode` is `true` AND the integration-branch merge (`gh pr merge --merge`) has completed and `epic_merge.merge_commit_sha` is recorded in the checkpoint). `epic_merge.merge_commit_sha` is recorded only after the merge is confirmed by polling and ancestry check (S9 step 6).
359
380
 
360
381
  This gate is non-negotiable. Each condition is independently verified before PR creation proceeds. Conditions 1-4 are unchanged from the prior contract; conditions 5-7 (receipt handoff, CI-green gate, and epic-mode merge-on-green gate) are additive.
361
382
 
@@ -438,6 +459,6 @@ Example:
438
459
 
439
460
  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.
440
461
 
441
- 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, with a valid `potential_record` under `docs/features/potential/`, 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. 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)`.
462
+ 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)`.
442
463
 
443
464
  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
@@ -324,23 +373,48 @@ Procedure, per item:
324
373
  1. The item's child orchestration runs unmodified, with `epic_mode` `false` or absent, and finishes
325
374
  at its own DONE. The child's PR Creation Gate condition 6 already requires
326
375
  `ci_gate.conclusion == "success"`, so at child DONE the item's pull request is open against
327
- `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.
328
378
  2. On child completion, durably confirm pull-request state and check conclusion with
329
- `gh pr view --json state,mergedAt,headRefOid`, and with `gh pr checks` when the check conclusion
330
- must be re-read — never from an in-memory completion notification — then record
331
- `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`.
332
386
  Before recording `merge_status: ci_green`, confirm that the `headRefOid` value equals the
333
387
  `ci_gate.head_sha` the child reported at DONE and that the child reported no pending
334
388
  CI-dependent acceptance criteria. When either check fails, do not record
335
389
  `merge_status: ci_green` and do not run `gh pr merge`; the item waits until its child pushes
336
390
  the check-off and re-runs S9, and the parent does not commit the check-off itself.
337
391
  3. Execute `gh pr merge --merge <PR>` for that item's pull request, whose base is `main`.
338
- 4. On success, record `merge_commit_sha`, `merged_at`, and `merge_status: merged`, then regenerate
392
+ Do not pass `--delete-branch` or `--auto`. A zero exit status does not prove a merge: when
393
+ `main` uses a merge queue, `gh pr merge` exits 0 after it enqueues the pull request or enables
394
+ auto-merge (issue #952). Confirm the merge before step 4. Every 30 seconds, for at most 90
395
+ minutes, read the pull-request state with
396
+ `gh api graphql -f query='query($owner:String!,$name:String!,$number:Int!){repository(owner:$owner,name:$name){pullRequest(number:$number){state mergedAt isInMergeQueue mergeCommit{oid} autoMergeRequest{enabledAt}}}}' -F owner='{owner}' -F name='{repo}' -F number=<PR> --jq .data.repository.pullRequest`
397
+ and classify it with
398
+ `pwsh -NoProfile -File .claude/lib/ci-gate/Invoke-MergeConfirmationParser.ps1 -PrJson <snapshot-json> -AsJson`.
399
+ On `pending`, read again. When the 90 minutes are exhausted, report the item as
400
+ `awaiting_merge_queue`, leave its `merge_status` at `ci_green`, and do not record `merged`.
401
+ On `merged`, run `git fetch origin main` and
402
+ `git merge-base --is-ancestor <merge-commit-oid> origin/main`; the merge is confirmed only
403
+ when that command exits 0. On `not_queued`, read `gh pr view <PR> --json mergeable`: a
404
+ `CONFLICTING` value enters `## Per-Item Merge-Conflict Handling`, and any other value is a
405
+ merge-group CI failure that re-delegates the item's child to merge `origin/main` and re-run
406
+ S9 as one CI-failure remediation cycle, consuming a remediation attempt. On `closed`, stop
407
+ and report a failure for the item. Never re-issue `gh pr merge` in a loop after a
408
+ `not_queued` outcome.
409
+ 4. Record `merge_commit_sha`, `merged_at`, and `merge_status: merged` only after the merge is
410
+ confirmed by polling and ancestry check, then regenerate
339
411
  `docs/features/parallel/<slug>/parallel-status.md`.
340
412
  5. On a merge failure caused by a conflict, follow `## Per-Item Merge-Conflict Handling`.
341
413
 
342
414
  **Merge-gate authorization.** `.claude/hooks/enforce-epic-merge-gate.ps1` is a project-wide
343
- `PreToolUse` Bash-matcher hook that denies any `gh pr merge --merge` unless a checkpoint satisfies
415
+ `PreToolUse` Bash-matcher hook that denies every merge or merge-queue enqueue action (any
416
+ `gh pr merge` spelling except a pure `--disable-auto`, and every `gh api` merge or enqueue
417
+ mutation; issue #952) unless a checkpoint satisfies
344
418
  one of its allow conditions; its block reason is `EPIC_MERGE_GATE_BLOCKED`. The gate has
345
419
  four allow conditions
346
420
  which it evaluates in this order: a per-feature checkpoint with `epic_mode == true` and
@@ -382,7 +456,9 @@ security control; see the Standalone-Merge-Authorization section of
382
456
  Branch protection on `main` affects only the pacing of step 3, not its ownership: if `main`
383
457
  requires branches to be up to date, an automated `gh pr update-branch` plus re-green cycle is
384
458
  inserted between same-cohort merges, which serializes those merges in practice while remaining
385
- unattended.
459
+ unattended. When `main` uses a merge queue, the queue replaces that `gh pr update-branch` cycle:
460
+ step 3 enqueues each green pull request, the queue validates it against the latest `main`
461
+ together with the entries ahead of it, and step 3's confirmation polling waits for the merge.
386
462
 
387
463
  ## Per-Item Merge-Conflict Handling
388
464
 
@@ -393,7 +469,8 @@ this surface.
393
469
  Project-file conflicts are resolved by the parent first (issue #643); the numbered steps below are
394
470
  the escalation path.
395
471
 
396
- - (a) On a conflicted `gh pr merge --merge`, the parent runs the two commands
472
+ - (a) On a conflicted `gh pr merge --merge`, or a `not_queued` merge confirmation whose
473
+ `mergeable` value is `CONFLICTING`, the parent runs the two commands
397
474
  `git -C <worktree_path> fetch origin main` and
398
475
  `git -C <worktree_path> merge --no-commit origin/main`.
399
476
  - (b) The parent then runs
@@ -413,7 +490,8 @@ the escalation path.
413
490
  item, sets `merge_status: pr_open`, regenerates `parallel-status.md`, and re-enters
414
491
  `## Per-Item Merge to Main (Merge-on-Green)` at the durable `gh pr checks` confirmation step.
415
492
 
416
- 1. On a conflicted `gh pr merge --merge`, the parent detects the failure and re-delegates that item's
493
+ 1. On a conflicted `gh pr merge --merge`, or a `not_queued` merge confirmation whose `mergeable`
494
+ value is `CONFLICTING`, the parent detects the failure and re-delegates that item's
417
495
  child orchestration, passing the conflict signal and the instruction to resolve against
418
496
  `origin/main`. The conflict capture and the finding write both belong to the child's
419
497
  `atomic-executor`, which works inside the item's own worktree, the only working tree holding the
@@ -613,9 +691,10 @@ Every mutation re-derives durable state (`git worktree list --porcelain`, `git b
613
691
  `gh pr view`) before it is applied, because the checkpoint is a cache of durable state and not the
614
692
  source of truth. A rejected mutation appends no entry and changes no state.
615
693
 
616
- The decision logic for all three commands is the pure engine
617
- `scripts/dev_tools/parallel_mutation_protocol.py`. It decides; it never applies. Item keys are
618
- integers (`items[].issue_num`) everywhere on this surface.
694
+ The decision logic for all three commands runs through the bundled bash entry points, which need no
695
+ Python interpreter: `bash .claude/lib/bash/mutate-parallel-run.sh` for add, close, and requeue, and
696
+ `bash .claude/lib/bash/remove-parallel-item.sh` for remove. They decide; they never apply. Item
697
+ keys are integers (`items[].issue_num`) everywhere on this surface.
619
698
 
620
699
  ### Pinning invariant
621
700
 
@@ -719,8 +798,9 @@ lost and is not recorded in the mutation entry: it is recorded as an item-state
719
798
  with the checkpoint's lifecycle timestamps, the same mechanism that records
720
799
  `proposed` -> `admitted` -> `prepared` during preparation. `new_state` is null for `close` only, and
721
800
  `item_key` is null for `close` only. `disposition` is non-null only on a `remove` entry whose
722
- `prior_state` is `in_flight`. Every `at` timestamp comes from the engine's injected clock seam; the
723
- engine never reads the wall clock. No field and no enum member is added to `mutations[]`; the nine
801
+ `prior_state` is `in_flight`. Every `at` timestamp is supplied by the caller through `--at`; an
802
+ entry point reads the clock only when `--at` is omitted, and then stamps the current UTC minute. No
803
+ field and no enum member is added to `mutations[]`; the nine
724
804
  parallel enums of `.claude/rules/parallel-orchestration.md` are consumed, never extended.
725
805
 
726
806
  Retrospective validation of the log is the helper
@@ -768,18 +848,25 @@ command to evade the match: that defeats the only mechanism protecting a destruc
768
848
  ### Drift-requeue append contract
769
849
 
770
850
  Radius drift detection consumes this protocol rather than reimplementing it. When drift halts the
771
- later-started item of a newly conflicting pair, the requeue is recorded through the mutation
772
- engine's `build_requeue_entry` constructor and the recolor through `recolor_unstarted`:
851
+ later-started item of a newly conflicting pair, the requeue is recorded through the `requeue-entry`
852
+ subcommand of the bundled entry point and the recolor through its `recolor` subcommand:
853
+
854
+ ```bash
855
+ bash .claude/lib/bash/mutate-parallel-run.sh requeue-entry --item <key> --generation <g> --at <timestamp>
856
+ ```
773
857
 
774
858
  - Item state becomes `blocked` and per-item `merge_status` becomes `blocked_drift`.
775
859
  - Exactly one `mutations[]` entry is appended with `op: requeue`, `prior_state: in_flight`,
776
860
  `new_state: blocked`, `disposition: null`, and `recolor_generation` equal to `g` + 1 — the requeue
777
861
  is a recompute.
778
- - The recolor runs over the unstarted subgraph only, so no other in-flight item moves. Its call
779
- shape is the six-argument form
780
- `recolor_unstarted(unstarted_items, conflict_edges, pinned, current_generation, current_cohort=current_cohort, highest_pinned_cohort=highest_pinned_cohort)`,
781
- where `current_cohort` and `highest_pinned_cohort` are both required and keyword-only.
782
- `highest_pinned_cohort` is derived from re-verified durable state: the highest
862
+ - The recolor runs over the unstarted subgraph only, so no other in-flight item moves. Run it as:
863
+
864
+ ```bash
865
+ 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>
866
+ ```
867
+
868
+ where `--current-cohort` and `--highest-pinned-cohort` are both required.
869
+ `--highest-pinned-cohort` is derived from re-verified durable state: the highest
783
870
  current-generation cohort index occupied by any in-flight item.
784
871
 
785
872
  The drift event itself is recorded in `drift_events[]`, which this protocol does not write. See