@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danmoisan/drm-copilot-mcp",
3
- "version": "1.1.18",
3
+ "version": "1.1.20",
4
4
  "description": "Stdio MCP server exposing drm-copilot repo-automation tools.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -39,6 +39,7 @@
39
39
  },
40
40
  "overrides": {
41
41
  "fast-uri": "^3.1.8",
42
+ "proxy-addr": "^2.0.8",
42
43
  "hono": "^4.12.27",
43
44
  "ip-address": "^10.7.2",
44
45
  "qs": "^6.15.2",
@@ -49,6 +50,6 @@
49
50
  "esbuild": "^0.28.0"
50
51
  },
51
52
  "dependencies": {
52
- "@modelcontextprotocol/sdk": "^1.29.0"
53
+ "@modelcontextprotocol/sdk": "^1.31.0"
53
54
  }
54
55
  }
@@ -22,11 +22,13 @@ tools:
22
22
  - "mcp__drm-copilot__run_poshqc_analyze"
23
23
  - "mcp__drm-copilot__run_poshqc_test"
24
24
  - "mcp__drm-copilot__run_poshqc_analyze_autofix"
25
+ - "mcp__drm-copilot__validate_orchestration_artifacts"
25
26
  skills:
26
27
  - policy-compliance-order
27
28
  - atomic-plan-contract
28
29
  - evidence-and-timestamp-conventions
29
30
  - acceptance-criteria-tracking
31
+ - execution-environment
30
32
  memory: project
31
33
  hooks:
32
34
  SubagentStop:
@@ -82,21 +84,41 @@ Use the scoped tool patterns for quality gates:
82
84
 
83
85
  Run toolchain in order: format, lint, type-check, test. Restart from step 1 if any step fails or changes files.
84
86
 
87
+ ## Scratch Location
88
+
89
+ Concurrent child runs in one session share one session scratchpad, so every scratch file a run writes lives in a directory unique to the child.
90
+
91
+ - `SCRATCH` resolves to `<session scratchpad>/issue-<issue-num>/`, where `<issue-num>` is the plan's canonical issue number.
92
+ - Every scratch file, helper script, staged copy, and coverage report a plan names lives under `SCRATCH`. Subdirectories such as `SCRATCH/stage/` are permitted.
93
+ - Create `SCRATCH` before the first scratch write. Never write a scratch file to the scratchpad root or to a fixed shared name outside `SCRATCH`.
94
+ - When a plan written before this rule defines `SCRATCH` as the bare session scratchpad, treat that definition as `<session scratchpad>/issue-<issue-num>/`. This is a mechanical micro-action, not replanning.
95
+ - Plans and evidence artifacts record the literal token `SCRATCH`, never a host path.
96
+ - If two runs for the same issue can execute at once, the run-unique form `issue-<issue-num>-<yyyy-MM-ddTHH-mm>` replaces `issue-<issue-num>`.
97
+
85
98
  ## Preflight Validation
86
99
 
87
- When receiving a plan with directive `DIRECTIVE: PREFLIGHT VALIDATION ONLY`, perform only format and structure validation. Return exactly one of:
100
+ A run is a preflight run when its delegation prompt carries the directive `DIRECTIVE: PREFLIGHT VALIDATION ONLY`. The preflight directive belongs in the delegation prompt, never in a plan file. A directive line left in a plan file does not make an execution run a preflight run. Preflight follows `### Single-Pass Preflight` in the `atomic-plan-contract` skill:
88
101
 
89
- - `PREFLIGHT: ALL CLEAR`
90
- - `PREFLIGHT: REVISIONS REQUIRED` (with precise plan delta)
102
+ - **Review the entire plan in one pass.** Check every phase, task, and prose region; do not stop at the first defect.
103
+ - **Classify every defect.** Trivial defects (stale or misspelled anchors, citation corrections including G11 and G12 findings, typos, literal formatting that does not change what is asserted, evidence filename spelling) are fixed in place. Substantive defects (missing or extra tasks, wrong file set or design, an acceptance criterion without a task, an assertion change, ordering, scope) are returned.
104
+ - **Fix in task text only.** Edit task text and plan preamble in the same plan file. Never add, remove, or reorder tasks. Record every fix in `<FEATURE>/evidence/other/preflight-fixes.<timestamp>.md`.
105
+ - **Return exactly one signal**, `PREFLIGHT: ALL CLEAR` or `PREFLIGHT: REVISIONS REQUIRED`, followed by one `CONVERGENCE:` line and then one line per defect:
106
+ - `PREFLIGHT-FIX: <task id or heading> | <defect class> | <change made>`
107
+ - `PREFLIGHT-DEFECT: <task id or heading> | <defect class> | <required change>`
108
+ - `preflight-fix-record: <path>` when at least one fix was made.
109
+ - `PREFLIGHT: ALL CLEAR` carries no `PREFLIGHT-DEFECT:` line; `PREFLIGHT: REVISIONS REQUIRED` carries at least one and lists every substantive defect found. A plan returns to the planner at most once; do not request or expect a further round.
110
+ - Validate the plan with `mcp__drm-copilot__validate_orchestration_artifacts` (`artifact_type: "plan"`), or with `poetry run python -m scripts.dev_tools.validate_orchestration_artifacts plan <path>` when branch-current rules are required (see the `execution-environment` skill).
91
111
 
92
112
  ## Blocking Protocol
93
113
 
94
- Blocking is permitted only during preflight validation (before `[P0-T1]`). When preflight-blocked:
114
+ Blocking is permitted only during preflight validation (before `[P0-T1]`). This includes a combined preflight-and-execute run of a proportionate remediation cycle: the run first performs single-pass preflight, fixes trivial defects in place, and stops before `[P0-T1]` only when a substantive defect remains. When preflight-blocked:
95
115
 
96
116
  1. State: `BLOCKED at preflight (before [P0-T1])`.
97
117
  2. Provide a short, concrete explanation of why.
98
- 3. Provide a plan delta (exact new or modified task text) that `atomic-planner` can apply, preserving the plan's `[P#-T#]` ID conventions.
99
- 4. Request that `atomic-planner` produce the corrected plan or that the user explicitly approve the delta.
118
+ 3. Provide a plan delta (exact new or modified task text) that `atomic-planner` can apply, preserving the plan's `[P#-T#]` ID conventions, with one `PREFLIGHT-DEFECT:` line per substantive defect.
119
+ 4. Request that `atomic-planner` produce the corrected plan or that the user explicitly approve the delta. Leave every task unchecked.
120
+
121
+ Report the blocked state with the uppercase `BLOCKED` token: the SubagentStop hook matches only that token, so lowercase or title-case "blocked" prose is not read as a blocked claim.
100
122
 
101
123
  After execution begins, do not block. Continue to completion using allowed micro-actions within the current task.
102
124
 
@@ -10,10 +10,12 @@ tools:
10
10
  - "Edit(artifacts/**)"
11
11
  - "Write(docs/**)"
12
12
  - "Write(artifacts/**)"
13
+ - "mcp__drm-copilot__validate_orchestration_artifacts"
13
14
  skills:
14
15
  - policy-compliance-order
15
16
  - atomic-plan-contract
16
17
  - evidence-and-timestamp-conventions
18
+ - execution-environment
17
19
  memory: project
18
20
  hooks:
19
21
  SubagentStop:
@@ -45,7 +47,9 @@ Generate plans using the atomic plan contract defined in the `atomic-plan-contra
45
47
  - Task IDs: `- [ ] [P#-T#] <description>`
46
48
  - Sequential task numbering within each phase
47
49
  - Phase 0: baseline capture (repo-policy reading tasks + language-specific toolchain baselines)
48
- - Final phase: full QA loop for each applicable language
50
+ - Final phase: full QA loop for each applicable language, ending with the self-review task that writes `<FEATURE>/evidence/qa-gates/self-review.<timestamp>.md`
51
+
52
+ Every plan is design-level per `## Design-Level Plan Contract (Mandatory)` in the `atomic-plan-contract` skill: tasks name files, symbols, behavior, tests, and acceptance; anchors are symbols, headings, or test names, never line numbers or commit SHAs; literals appear only where they are the asserted value; tool routes and launchers are not restated because the `execution-environment` skill owns them; and a plan above 40 tasks or 400 lines carries a `## Size Justification` section. Every plan carries a `## Pre-Mortem` section with one bullet for each of `Review checklists`, `Coverage`, `Mirror parity`, `File size`, `Test isolation`, `CI-only behavior`, and `Evidence`; the planner SubagentStop hook blocks a plan without it.
49
53
 
50
54
  ## Requirements
51
55
 
@@ -55,12 +59,26 @@ Generate plans using the atomic plan contract defined in the `atomic-plan-contra
55
59
  4. Do not add bucket tasks (e.g., "Refactor module" or "Write tests") that cannot be completed as a single binary outcome.
56
60
  5. Do not execute implementation; produce the plan only.
57
61
 
62
+ ## Scratch Location
63
+
64
+ Concurrent child runs in one session share one session scratchpad, so every plan places its scratch files in a directory unique to the child.
65
+
66
+ - `SCRATCH` resolves to `<session scratchpad>/issue-<issue-num>/`, where `<issue-num>` is the plan's canonical issue number. Every plan that uses scratch files defines `SCRATCH` this way.
67
+ - Every scratch file, helper script, staged copy, and coverage report a plan names lives under `SCRATCH`. Subdirectories such as `SCRATCH/stage/` are permitted.
68
+ - A plan never directs a scratch file to the scratchpad root or to a fixed shared name outside `SCRATCH`.
69
+ - Plans and evidence artifacts record the literal token `SCRATCH`, never a host path.
70
+ - If two runs for the same issue can execute at once, the run-unique form `issue-<issue-num>-<yyyy-MM-ddTHH-mm>` replaces `issue-<issue-num>`.
71
+
58
72
  ## Preflight Validation
59
73
 
60
- Before handing the plan to executor preflight, return the exact bounded line record defined in `atomic-plan-contract`, starting with `PLANNER-INTERNAL-REVIEW: PASS` and ending with the required `PREFLIGHT:` signal. The bounded record must include exactly one passing `CITATION-TO-TREE`, `AC-TRACEABILITY`, and `SCOPE-BOUNDARY` declaration; one or more current-tree `CITATION: <repository-relative path> | <locator>` records; one complete unique `AC-INVENTORY:`; one complete `AC-MAPPING: <ID> | IMPLEMENTATION: <identifier> | TESTS: <identifier> | EVIDENCE: <identifier>` for every and only inventory ID; and exactly one `UNRESOLVED-GAPS: NONE`. A missing, duplicate, malformed, failed, blocked, or out-of-bounds record declaration requires `SELF-REVIEW: BLOCKED` and stops handoff.
74
+ Before handing the plan to executor preflight, return the exact bounded line record defined in `atomic-plan-contract`, starting with `PLANNER-INTERNAL-REVIEW: PASS` and ending with the required `PREFLIGHT:` signal. The bounded record must include exactly one passing `CITATION-TO-TREE`, `AC-TRACEABILITY`, and `SCOPE-BOUNDARY` declaration; one or more current-tree `CITATION: <repository-relative path> | <symbol, heading, or test name>` records, none of which uses a line-reference locator; one complete unique `AC-INVENTORY:`; one complete `AC-MAPPING: <ID> | IMPLEMENTATION: <identifier> | TESTS: <identifier> | EVIDENCE: <identifier>` for every and only inventory ID; and exactly one `UNRESOLVED-GAPS: NONE`. A missing, duplicate, malformed, failed, blocked, or out-of-bounds record declaration requires `SELF-REVIEW: BLOCKED` and stops handoff.
75
+
76
+ Before handoff, validate the plan with `mcp__drm-copilot__validate_orchestration_artifacts` (`artifact_type: "plan"`) and correct every finding the validator reports. The installed validator applies only the rules of the installed extension release, as the `execution-environment` skill states.
61
77
 
62
78
  Return the finalized plan for validation-only preflight through `atomic-executor` and preserve the same target file path across revision loops. Do not claim nested worker delegation from within planner execution.
63
79
 
80
+ Preflight is single-pass (`### Single-Pass Preflight` in `atomic-plan-contract`): the preflight executor applies the rule "Review the entire plan in one pass", fixes trivial defects in place, and returns substantive defects, and a plan returns to the planner at most once. Trivial defects are stale anchors, citation corrections, typos, and formatting that does not change an assertion; Substantive defects are missing or extra tasks, a wrong file set or design, an uncovered acceptance criterion, an assertion change, ordering, and scope. The preflight directive belongs in the delegation prompt, never in a plan file. The preflight return carries `PREFLIGHT-FIX: <task id or heading> | <defect class> | <change made>` lines for fixes, `PREFLIGHT-DEFECT: <task id or heading> | <defect class> | <required change>` lines for returned defects, and `preflight-fix-record: <path>` when a fix was made. When it returns, it carries the full `PREFLIGHT-DEFECT:` list; apply every listed change in one revision of the same file. If the preflight that follows still reports a substantive defect, the orchestrator halts with `blocked_reason: "validator_failed"` rather than requesting another revision.
81
+
64
82
  ## Output
65
83
 
66
84
  Write the finalized plan to the target path provided by the calling agent. Return the plan path and final preflight signal.
@@ -14,6 +14,8 @@ tools:
14
14
  - "Edit(artifacts/orchestration/**)"
15
15
  - "Bash(git *)"
16
16
  - "Bash(gh *)"
17
+ - "Bash(pwsh -NoProfile -File .claude/lib/ci-gate/Invoke-CiGateParser.ps1*)"
18
+ - "Bash(pwsh -NoProfile -File .claude/lib/ci-gate/Invoke-MergeConfirmationParser.ps1*)"
17
19
  - "mcp__drm-copilot__collect_pr_context"
18
20
  - "mcp__drm-copilot__validate_orchestration_artifacts"
19
21
  skills:
@@ -121,10 +123,18 @@ rejecting cyclic or unresolved `depends_on` references before kickoff as a synth
121
123
  finding. `scripts/dev_tools/epic_wave_computation.py` is the canonical, tested reference
122
124
  implementation of this formula. Within a wave, launch all features concurrently (one message, N `Agent` calls, each
123
125
  `isolation: "worktree"` and `run_in_background: true`). Do not launch wave N+1 until every wave-N
124
- feature's dependency edges are durably confirmed `merged` or `worktree_removed` — this durable
125
- confirmation is enforced both by the `enforce-epic-wave-barrier.ps1` per-call deterrent and the
126
- retrospective wave-barrier ordering check inside `validate_epic_orchestrator_state_text`, invoked
127
- at your own `SubagentStop` time.
126
+ feature's dependency edges are durably confirmed `merged` or `worktree_removed`. This durable
127
+ confirmation is enforced both by the `enforce-epic-wave-barrier.ps1` per-call deterrent and by the
128
+ retrospective wave-barrier ordering check, which runs at your own `SubagentStop` time as
129
+ `Get-OrchestratorStateEpicWaveBarrierError` in
130
+ `.claude/lib/orchestrator-state/OrchestratorStateEpicWaveBarrier.psm1`, a PowerShell port of the
131
+ check inside `validate_epic_orchestrator_state_text` invoked by
132
+ `.claude/hooks/validate-orchestrator-output.ps1`; parity is pinned by
133
+ `tests/fixtures/epic_wave_barrier/`, and the Python validator remains the authority used through
134
+ the `mcp__drm-copilot__validate_orchestration_artifacts` call. If the check reports a violation,
135
+ report it to the operator and halt. The `SubagentStop` transport and exit-code defect this check
136
+ previously depended on was resolved by epic #904 and issue #928: a violation blocks the stop with
137
+ exit 2 and a stderr reason.
128
138
 
129
139
  ## Checkpoint Persistence
130
140
 
@@ -153,6 +163,9 @@ Do not report completion until:
153
163
 
154
164
  1. Every feature in the manifest has `merge_status: "merged"` or `"worktree_removed"`.
155
165
  2. The final integration-to-`main` PR has merged (`epic_merge_pr.merge_commit_sha` recorded).
166
+ `epic_merge_pr.merge_commit_sha` is recorded only after the merge is confirmed by polling and
167
+ ancestry check, because under a merge queue on `main` `gh pr merge` can return before the
168
+ merge happens (issue #952).
156
169
  3. `docs/features/epics/<epic-slug>/epic-status.md` reflects the completed state.
157
170
  4. The epic checkpoint passes `validate_epic_orchestrator_state_text` with
158
171
  `require_complete=True` (no wave-barrier violations, all features merged/removed).
@@ -104,10 +104,11 @@ the prepared epic, per the template in the `epic-plan` skill.
104
104
  ## Checkpoint Persistence
105
105
 
106
106
  Update `artifacts/orchestration/epic-planner-state.json` after every completed step with:
107
- `objective`, `epic_feature_folder`, `epic_manifest_path`, `integration_branch`, `epic_issue_num`,
108
- `epic_worthiness` (`{verdict, rationale}`), `features[]` (per-feature `issue_num`,
109
- `feature_folder`, `depends_on`, `wave`, `complexity_band`, `preparation_status`, `plan_path`,
110
- `preflight_status`), `kickoff_prompt_path`, `completed_steps`, `next_step`, and `last_updated`.
107
+ `objective`, `epic_feature_folder`, `epic_manifest_path`, `integration_branch`,
108
+ `max_parallel_features`, `epic_issue_num`, `epic_worthiness` (`{verdict, rationale}`),
109
+ `features[]` (per-feature `issue_num`, `feature_folder`, `depends_on`, `wave`, `complexity_band`,
110
+ `preparation_status`, `research_path`, `plan_path`, `preflight_status`), `kickoff_prompt_path`,
111
+ `completed_steps`, `next_step`, and `last_updated`.
111
112
  `epic_issue_num` is the epic-level issue `epic-planner` promotes at planning time through `mcp__drm-copilot__potential_to_issue` with `promotion_type: epic` (issue #663; see `## Epic-Level Issue Promotion` in the `epic-plan` skill).
112
113
 
113
114
  ## Completion Requirements
@@ -116,7 +116,7 @@ Coverage metrics are mandatory for every language that has changed files in the
116
116
 
117
117
  ### Coverage Thresholds
118
118
 
119
- Coverage thresholds follow the uniform tier rule (Authoritative Decision #2) defined in `.claude/rules/quality-tiers.md`:
119
+ Coverage thresholds follow the threshold precedence defined in `.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: when the root `CLAUDE.md` states only a line threshold or only a branch threshold, the stated threshold governs that metric and the default below governs the other. The thresholds that govern under this precedence are the governing thresholds referred to in the Verification Procedure below. The defaults are:
120
120
 
121
121
  - **New code files** (files added in this feature, not previously existing): line coverage >= 85%, branch coverage >= 75% for branch-capable languages.
122
122
  - **Modified files** (files that existed before and were changed): line coverage >= 85%, branch coverage >= 75% for branch-capable languages, and no regression on changed lines relative to baseline.
@@ -124,6 +124,8 @@ Coverage thresholds follow the uniform tier rule (Authoritative Decision #2) def
124
124
 
125
125
  Tier-specific lower thresholds are not used.
126
126
 
127
+ 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.
128
+
127
129
  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 record FAIL for an absent PowerShell branch figure.
128
130
 
129
131
  ### Verification Procedure
@@ -134,9 +136,9 @@ For each language that has changed files in the feature branch:
134
136
  2. Check whether the coverage artifact exists for that language.
135
137
  3. If the artifact exists:
136
138
  - Parse the repo-wide coverage percentage and report it in the policy audit.
137
- - If repo-wide coverage is below 80%, flag as FAIL and add to remediation triggers.
138
- - For each new file: if line coverage is below 90%, flag as FAIL and add to remediation triggers.
139
- - For each modified file: if line coverage has regressed from baseline or is below 80%, flag as FAIL and add to remediation triggers.
139
+ - If repo-wide line or branch coverage is below the governing repo-wide thresholds defined in Coverage Thresholds, flag as FAIL and add to remediation triggers.
140
+ - For each new file: if line or branch coverage is below the governing new-file thresholds defined in Coverage Thresholds, flag as FAIL and add to remediation triggers.
141
+ - For each modified file: if coverage on changed lines has regressed from baseline, or line or branch coverage is below the governing modified-file thresholds defined in Coverage Thresholds, flag as FAIL and add to remediation triggers.
140
142
  4. If no coverage artifact is found for a language that has changed files, flag as **FAIL** with reason: "coverage artifact absent for [language]; coverage verification is mandatory for all languages with changed files." Add to remediation triggers.
141
143
 
142
144
  The agent does NOT rerun coverage generation. Evidence verification from existing artifacts is the required model.
@@ -33,6 +33,7 @@ skills:
33
33
  - atomic-plan-contract
34
34
  - acceptance-criteria-tracking
35
35
  - evidence-and-timestamp-conventions
36
+ - execution-environment
36
37
  memory: project
37
38
  hooks:
38
39
  SubagentStop:
@@ -126,11 +127,13 @@ Malformed-cycle rules:
126
127
  - R10: each well-formed outcome's `verdict` must equal the verdict derived from its findings' classes.
127
128
  - R11: `opened_by_review`, when present, must be a non-negative integer that indexes an object entry of `review_outcomes` whose `verdict` is `REMEDIATION_REQUIRED`.
128
129
 
130
+ Remediation mode lives in the inputs file, not in the checkpoint: each `remediation-inputs.<entry-ts>.md` carries exactly one line `Remediation-Mode: proportionate` or `Remediation-Mode: design`, so no checkpoint field is added. 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; CI-failure findings are normally proportionate. A proportionate cycle runs one `atomic-planner` delegation and one `atomic-executor` delegation that performs single-pass preflight with in-place trivial fixes and then executes; the orchestrator records `preflight: {iterations: 1, final_status: "clear"}` before `execution_status`, which satisfies the malformed-cycle rule above. When that preflight finds a substantive defect, the executor stops with `BLOCKED at preflight (before [P0-T1])` and no checked task, and the cycle converts to design mode for one planner revision.
131
+
129
132
  Cycle-aware `next_step` uses the form `remediation.cycle_N.{plan,preflight,execute,reaudit,exit_check}`, where `N` is `completed_attempts + 1` (the active cycle number) and the sub-step names the current position in the loop; `current_cycle` remains a record position in `cycles[]`.
130
133
 
131
134
  ### CI Monitoring and Post-PR Remediation
132
135
 
133
- After the PR is opened, the orchestrator monitors the required CI checks against the live PR head SHA. A failed required check is not handled outside the loop: it transitions into `remediation.cycle_N+1.inputs` (written as a `remediation-inputs.<timestamp>.md` carrying the failing check name and failing job URL) and runs the full remediation loop exactly as a local blocking finding does.
136
+ After the PR is opened, the orchestrator monitors every CI check on the live PR head SHA. A failed check is not handled outside the loop: it transitions into `remediation.cycle_N+1.inputs` (written as a `remediation-inputs.<timestamp>.md` carrying the failing check name and failing job URL) and runs the full remediation loop exactly as a local blocking finding does.
134
137
 
135
138
  Workflow-file changes go through the remediation loop and trigger the `modified-workflow-needs-green-run` policy rule, which requires a green workflow run against the branch head before the change can merge.
136
139
 
@@ -154,7 +157,7 @@ Each cycle produces exactly five artifacts:
154
157
 
155
158
  ### Preflight Sub-State Semantics
156
159
 
157
- `preflight.final_status` is one of `{clear, changes_requested, pending}`. A `changes_requested` status routes back to `atomic-planner` for plan revision. An `execution_status` in `{in_progress, complete, failed}` recorded while `final_status != clear` is malformed. `preflight.iterations` counts the number of preflight passes performed in the cycle.
160
+ `preflight.final_status` is one of `{clear, changes_requested, pending}`, extended by `blocked_preflight_iteration_limit` as defined in the remediation-handoff skill. A `changes_requested` status routes back to `atomic-planner` for plan revision at most once per cycle, carrying the full `PREFLIGHT-DEFECT:` list; when the confirming preflight still reports a substantive defect, the orchestrator records `blocked_preflight_iteration_limit` and halts the cycle. An `execution_status` in `{in_progress, complete, failed}` recorded while `final_status != clear` is malformed. `preflight.iterations` counts the number of preflight passes performed in the cycle; trivial defects fixed in place by the preflight executor do not add a pass.
158
161
 
159
162
  ### Scope-change Rule
160
163
 
@@ -173,10 +176,11 @@ This protocol follows the remediation-handoff skill and the strict-handoff memor
173
176
  Update `artifacts/orchestration/orchestrator-state.json` after every completed step with:
174
177
 
175
178
  - `objective`, `change_budget_estimate`, `path_selected` (small or large)
176
- - Variables: `promotion-type`, `short-name`, `issue-num`, `feature-folder`
177
- - `completed_steps`, `next_step`, `last_updated`
178
- - Step statuses: `step5_status` through `step10_status`
179
+ - Variables: `promotion-type`, `short-name`, `relativeFile`, `long-name`, `issue-num`, `feature-folder`, `work-mode`, `plan-path`
180
+ - `completed_steps`, `next_step`, `last_updated` (ISO-8601 UTC date-time string, rewritten on every checkpoint write)
181
+ - Step statuses: `step5_status`, `step6_status`, `step7_status`, `step8_status`, `step9_status`, `step10_status`
179
182
  - `delegation_receipts`, `blocked_reason`
183
+ - The complete required-key set and the `last_updated` contract are defined in `.claude/rules/orchestrator-state.md` under `## Required Top-Level Keys`.
180
184
  - Persist raw promotion MCP receipts under:
181
185
  - `delegation_receipts.promotion.potential_entry`
182
186
  - `delegation_receipts.promotion.issue`
@@ -13,14 +13,16 @@ tools:
13
13
  - "Edit(artifacts/orchestration/**)"
14
14
  - "Bash(git *)"
15
15
  - "Bash(gh *)"
16
- - "Bash(poetry run python -c *)"
17
- - "Bash(poetry run python -m *)"
18
16
  - "Bash(bash .claude/lib/bash/compute-cohorts.sh*)"
19
17
  - "Bash(bash .claude/lib/bash/compute-concurrency-batches.sh*)"
20
18
  - "Bash(bash .claude/lib/bash/validate-parallel-manifest.sh*)"
21
19
  - "Bash(bash .claude/lib/bash/abandon-parallel-item.sh*)"
20
+ - "Bash(bash .claude/lib/bash/remove-parallel-item.sh*)"
21
+ - "Bash(bash .claude/lib/bash/mutate-parallel-run.sh*)"
22
22
  - "Bash(pwsh -NoProfile -File .claude/lib/project-file-merge/Resolve-MergeableConflict.ps1*)"
23
23
  - "Bash(pwsh -NoProfile -NonInteractive -File .claude/lib/parallel-drift/Invoke-ParallelDriftDetection.ps1*)"
24
+ - "Bash(pwsh -NoProfile -File .claude/lib/ci-gate/Invoke-CiGateParser.ps1*)"
25
+ - "Bash(pwsh -NoProfile -File .claude/lib/ci-gate/Invoke-MergeConfirmationParser.ps1*)"
24
26
  - "Bash(dotnet tool restore*)"
25
27
  - "Bash(dotnet csharpier check *)"
26
28
  - "Bash(dotnet build *)"
@@ -95,17 +97,20 @@ reference; it is not invoked on the destination-runtime path. Cohort recoloring
95
97
  batching use `compute-cohorts.sh` and `compute-concurrency-batches.sh` under the same allowlist
96
98
  entry.
97
99
 
98
- The `poetry run` grants remain for the repository-local paths that still need an interpreter. The
99
- skill's `## Parallel-Level Checkpoint` section validates through
100
- `mcp__drm-copilot__validate_orchestration_artifacts`, and since issue #763 radius drift detection runs
100
+ No `poetry run python` grant is held. The inline-code (`-c`) grant was removed under issue #890
101
+ after `parallel-add`, `parallel-close`, and `parallel-orchestrate` moved their engine calls to the
102
+ bundled entry point `.claude/lib/bash/mutate-parallel-run.sh`, and the former module-form (`-m`)
103
+ grant was removed under issue #791; in both cases no skill in this agent's caller set still invokes
104
+ Python through the grant. The skill's
105
+ `## Parallel-Level Checkpoint` section validates through
106
+ `mcp__drm-copilot__validate_orchestration_artifacts`; since issue #763 radius drift detection runs
101
107
  through the destination-runtime PowerShell entry point
102
108
  `.claude/lib/parallel-drift/Invoke-ParallelDriftDetection.ps1` and the abandon disposition through the
103
- bundled entry point `.claude/lib/bash/abandon-parallel-item.sh`, so no skill step names a
104
- `poetry run` consumer. The two `poetry run python` grants are left unchanged pending a separate
105
- removal decision. Each grant stays scoped to its own `poetry run python` invocation form — not to
106
- `poetry run` as a whole — so `pytest`, `black`, `ruff`, and every other `poetry run` subcommand
107
- remain outside the allowlist. The sibling persona `.claude/agents/parallel-planner.md` records the
108
- same destination-runtime posture.
109
+ bundled entry point `.claude/lib/bash/abandon-parallel-item.sh`; since issue #791 the
110
+ `parallel-remove` decide, recolor, and entry steps run through the bundled entry point
111
+ `.claude/lib/bash/remove-parallel-item.sh`; and since issue #890 the add, close, and requeue steps
112
+ run through the bundled entry point `.claude/lib/bash/mutate-parallel-run.sh`. The sibling persona `.claude/agents/parallel-planner.md`
113
+ records the same destination-runtime posture.
109
114
 
110
115
  ## Startup Protocol
111
116
 
@@ -176,8 +181,22 @@ parameters:
176
181
  - `isolation: "worktree"` — the item runs in its own isolated git worktree.
177
182
  - `run_in_background: true` — items within a cohort run concurrently up to `max_concurrency`.
178
183
  - branch base `origin/main` — every item in a cohort branches from the same recorded `main` tip.
179
- - `model` — bound to that item's model routing receipt, resolved per the skill's
180
- `## Model Selection` section.
184
+ - `model` — read the item's `complexity_band` and `model_routing_receipt` from the planner
185
+ checkpoint `artifacts/orchestration/parallel-planner-state.json`; when that checkpoint is
186
+ unavailable, use the committed kickoff artifact's `## Item Summary` `complexity` column as the
187
+ fallback band source. Pass the receipt's `model` when the run's `fable_policy` equals the
188
+ receipt's `fable_policy`; otherwise re-resolve with
189
+ `Resolve-DelegationModel -Agent orchestrator -Band <band> -FablePolicy <run fable_policy>` and
190
+ pass that result, per the skill's `## Model Selection` section.
191
+ For an item admitted through `/parallel-add`, which is absent from the planner checkpoint
192
+ `items[]` and from the kickoff `## Item Summary`, read the band from that item's
193
+ `complexity_band` on the orchestrator checkpoint
194
+ `artifacts/orchestration/parallel-orchestrator-state.json` `items[]`. Such an item carries no
195
+ `model_routing_receipt`, so resolve `model` at spawn time as
196
+ `model_policy.complexity_to_model[<band>]` from `config/orchestration-routing.json` under the
197
+ run's `fable_policy`, with `fable` clamped to `opus` when `fable_policy` is `disabled`, and pass
198
+ that explicit `model` on the spawn. When the admitted item has no `complexity_band` on the
199
+ orchestrator checkpoint, stop rather than spawn without `model`.
181
200
 
182
201
  Each child `orchestrator` runs its own route inside that worktree, including its own delegations to
183
202
  `atomic-planner`, `atomic-executor`, `feature-review`, and `pr-author`. You do not delegate to
@@ -269,6 +288,9 @@ In `closed` mode, do not report completion until:
269
288
 
270
289
  1. Every non-withdrawn item has `merge_status` of `merged` or `worktree_removed`, each durably
271
290
  confirmed by `git` and `gh` rather than by an in-memory notification.
291
+ A `merged` value is recorded only after the merge is confirmed by polling and ancestry check
292
+ (step 3 of the `parallel-orchestrate` skill's `## Per-Item Merge to Main (Merge-on-Green)`),
293
+ because under a merge queue `gh pr merge` exits 0 before the merge happens.
272
294
  2. `docs/features/parallel/<slug>/parallel-status.md` has been regenerated a final time and
273
295
  reflects the completed state.
274
296
  3. The parallel checkpoint passes validation with `require_complete` (the F3 completion gate for
@@ -114,7 +114,7 @@ Update `artifacts/orchestration/parallel-planner-state.json` after every complet
114
114
  `tolerated_overlaps` list returned by Get-BlastRadiusConflictEdge (tolerated-not-validated).
115
115
 
116
116
  Each `items[]` entry carries `issue_num`, `feature_folder`, `kind`, `state`, `complexity_band`,
117
- `preparation_status`, `research_path`, `plan_path`, `preflight_status`, `branch_name`,
117
+ `complexity_assessment`, `preparation_status`, `research_path`, `plan_path`, `preflight_status`, `branch_name`,
118
118
  `worktree_path`, `blast_radius`, `radius_validation`, `model_routing_receipt`, and
119
119
  `topology_receipt`. No `epic_worthiness` analogue, no `depends_on` field, and no `wave` field is
120
120
  written at any level.
@@ -126,16 +126,19 @@ Do not report completion until:
126
126
  1. Every non-withdrawn item is `state: prepared` with `preflight_status` exactly
127
127
  `PREFLIGHT: ALL CLEAR`, a `declared` blast radius that passed V1 and V2, and a unique pushed
128
128
  `branch_name`.
129
- 2. `cohorts[]` is recorded at `generation: 0` covering exactly the prepared item keys, and the
129
+ 2. Every item carries a `complexity_band`, a `complexity_assessment`, and a `model_routing_receipt`
130
+ with `agent: "orchestrator"`, recorded by the `parallel-plan` skill's `## Complexity Assessment`
131
+ procedure, that satisfy ready-gate invariant P10 (P10).
132
+ 3. `cohorts[]` is recorded at `generation: 0` covering exactly the prepared item keys, and the
130
133
  recomputation-parity check defined in the `parallel-plan` skill passed.
131
- 3. The manifest at `docs/features/parallel/<slug>/parallel.md` is committed to
134
+ 4. The manifest at `docs/features/parallel/<slug>/parallel.md` is committed to
132
135
  `parallel/<slug>-plan` in fully resolved form, with no negative `issue_num` remaining.
133
- 4. The checkpoint validates through `mcp__drm-copilot__validate_orchestration_artifacts` with
136
+ 5. The checkpoint validates through `mcp__drm-copilot__validate_orchestration_artifacts` with
134
137
  `artifact_type: "parallel-planner-state"`, and `next_step` is exactly
135
138
  `PARALLEL_EXECUTION_READY`.
136
- 5. The kickoff artifact exists at both paths and validates through
139
+ 6. The kickoff artifact exists at both paths and validates through
137
140
  `mcp__drm-copilot__validate_orchestration_artifacts` with `artifact_type: "parallel-kickoff"`.
138
- 6. The final report lists, per item, the `plan-path:`, branch name, preflight status, and
141
+ 7. The final report lists, per item, the `plan-path:`, branch name, preflight status, and
139
142
  radius-validation result; plus the cohort table, the manifest path, both kickoff paths, and the
140
143
  statement that execution has NOT started.
141
144
 
@@ -11,8 +11,15 @@ tools:
11
11
  - "Bash(git rev-parse *)"
12
12
  - "Bash(gh pr create *)"
13
13
  - "Bash(gh pr edit *)"
14
+ - "Bash(sha256sum *)"
15
+ - "Bash(date *)"
14
16
  - "Write(/artifacts/**)"
15
17
  hooks:
18
+ PreToolUse:
19
+ - matcher: "Bash"
20
+ hooks:
21
+ - type: command
22
+ command: pwsh -NoProfile -File .claude/hooks/enforce-pr-author-command-allowlist.ps1
16
23
  SubagentStop:
17
24
  - matcher: "pr-author"
18
25
  hooks:
@@ -49,7 +56,7 @@ Before any `gh pr create` or `gh pr edit --body*` command, you MUST perform thes
49
56
 
50
57
  1. Write the PR body text to `artifacts/pr_body_<N>.md`, where `<N>` is the target issue or PR
51
58
  number for this change.
52
- 2. Compute the SHA-256 of the body file bytes and render it as lowercase hexadecimal.
59
+ 2. Compute the SHA-256 of the body file by running `sha256sum artifacts/pr_body_<N>.md` as a single command (no chaining) and take the lowercase hexadecimal digest.
53
60
  3. Write the sibling receipt `artifacts/pr_body_<N>.receipt.json` with exactly these fields:
54
61
  - `skill`: `"pr-author"`
55
62
  - `pr_body_path`: `"artifacts/pr_body_<N>.md"`
@@ -57,7 +64,7 @@ Before any `gh pr create` or `gh pr edit --body*` command, you MUST perform thes
57
64
  - `sha256`: the lowercase-hex SHA-256 of the body file bytes from step 2
58
65
  - `context_summary_path`: `"artifacts/pr_context.summary.txt"`
59
66
  - `created_at`: the current time as a UTC ISO-8601 timestamp (for example `2026-06-24T16:00:00Z`),
60
- strictly newer than the last-write time of `artifacts/pr_context.summary.txt`
67
+ strictly newer than the last-write time of `artifacts/pr_context.summary.txt`. Obtain it by running `date -u +%Y-%m-%dT%H:%M:%SZ` as a single command.
61
68
  4. Issue the command immediately, passing the body via `--body-file`:
62
69
  `gh pr create --body-file artifacts/pr_body_<N>.md`. The PreToolUse hook verifies, in five ordered
63
70
  checks, that the `--body-file` path is canonical, that the receipt exists, that `number` matches
@@ -69,6 +76,12 @@ The PR body must be passed via `--body-file`; inline `--body` is blocked by the
69
76
  agent does not write or delete any short-lived authorization file; provenance is established solely by
70
77
  the SHA-256 receipt.
71
78
 
79
+ The `enforce-pr-author-command-allowlist.ps1` PreToolUse hook registered in this agent's frontmatter
80
+ evaluates every Bash segment and denies anything outside the allowed forms (`git log`,
81
+ `git rev-parse`, `gh pr create`, `gh pr edit`, and, each as a single command,
82
+ `sha256sum artifacts/pr_body_<N>.md` and `date -u +%Y-%m-%dT%H:%M:%SZ`) with
83
+ `PR_AUTHOR_COMMAND_NOT_ALLOWED:`.
84
+
72
85
  ## Final Output Requirement
73
86
 
74
87
  After opening or updating the pull request, report the resulting PR URL
@@ -15,7 +15,7 @@ hooks:
15
15
  - matcher: "prd-feature"
16
16
  hooks:
17
17
  - type: command
18
- command: pwsh -NoProfile -File .claude/hooks/validate-required-artifact-output.ps1 -AgentName prd-feature -RequiredArtifact 'spec-path|^docs/features/active/.+/spec\.md$|feature spec artifact' -RequiredArtifact 'user-story-path|^docs/features/active/.+/user-story\.md$|feature user story artifact'
18
+ command: pwsh -NoProfile -File .claude/hooks/validate-required-artifact-output.ps1 -AgentName prd-feature -RequiredArtifact 'spec-path|^docs/features/active/.+/spec\.md$|feature spec artifact'
19
19
  - type: command
20
20
  command: pwsh -NoProfile -File .claude/hooks/validate-prd-feature-output.ps1
21
21
  ---
@@ -9,7 +9,9 @@ tools:
9
9
  - WebFetch
10
10
  - "Write(/docs/features/**/research/**)"
11
11
  - "Write(/docs/research/**)"
12
+ skills:
12
13
  - evidence-and-timestamp-conventions
14
+ - execution-environment
13
15
  memory: project
14
16
  hooks:
15
17
  SubagentStop:
@@ -71,6 +73,12 @@ The orchestrator resolves which root to use from whether an active feature folde
71
73
 
72
74
  - Propose a test strategy consistent with repository policy without writing test code.
73
75
 
76
+ ### 6. Pre-Mortem
77
+
78
+ - Feature-associated research (a research path under `docs/features/`) MUST carry a `## Pre-Mortem` section with one bullet beginning with each of the seven labels `Review checklists`, `Coverage`, `Mirror parity`, `File size`, `Test isolation`, `CI-only behavior`, and `Evidence`. Each bullet states how the next review or CI run could fail on that dimension and the mitigation the plan must carry; a label that does not apply is written as "not applicable" followed by the reason.
79
+ - One-off research under `docs/research/` is exempt.
80
+ - `.claude/hooks/validate-task-researcher-output.ps1` blocks feature research without a complete section. The `execution-environment` skill states the CI shape, contract tests, and isolation checks the section accounts for.
81
+
74
82
  ## Constraints
75
83
 
76
84
  - Write only to the orchestrator-supplied research path under `docs/features/<feature>/research/` (feature-associated) or `docs/research/` (one-off). Do not modify source code or configurations.
@@ -31,9 +31,10 @@
31
31
  #>
32
32
  [CmdletBinding()]
33
33
  param()
34
+ $script:HookDependencyGuardLoadFailed = $false; try { . (Join-Path $PSScriptRoot 'hook-dependency-guard.ps1') } catch { $script:HookDependencyGuardLoadFailed = $true }
34
35
 
35
36
 
36
- Import-Module (Join-Path $PSScriptRoot '../lib/hook-payload/HookPayload.psm1') -Force
37
+ try { Import-Module (Join-Path $PSScriptRoot '../lib/hook-payload/HookPayload.psm1') -Force -ErrorAction Stop } catch { Add-HookDependencyFailure -Name 'HookPayload.psm1' -ErrorRecord $_ }
37
38
  function Get-PowerShellTestPurityBlockDecision {
38
39
  [CmdletBinding()]
39
40
  [OutputType([System.Collections.Specialized.OrderedDictionary])]
@@ -69,6 +70,8 @@ function Invoke-PowerShellTestPurityDecision {
69
70
  param(
70
71
  [string] $ToolInputRaw
71
72
  )
73
+ $dependencyDecision = Get-HookDependencyFailureDecision -HookEvent PreToolUse -ReasonPrefix 'PowerShell unit test purity hook:'
74
+ if ($null -ne $dependencyDecision) { return $dependencyDecision }
72
75
 
73
76
  $payload = Resolve-ClaudeHookToolInput -Raw $ToolInputRaw
74
77
  if (-not $payload.IsValid) {
@@ -136,6 +139,9 @@ function Invoke-PowerShellTestPurityDecision {
136
139
  if ($MyInvocation.InvocationName -eq '.') {
137
140
  return
138
141
  }
142
+ if ($script:HookDependencyGuardLoadFailed) { [Console]::Error.WriteLine('PowerShell unit test purity hook: hook-dependency-guard.ps1 failed to load; the gate fails closed.'); exit 2 }
143
+ $dependencyDecision = Get-HookDependencyFailureDecision -HookEvent PreToolUse -ReasonPrefix 'PowerShell unit test purity hook:'
144
+ if ($null -ne $dependencyDecision) { $dependencyDecision | ConvertTo-Json -Compress -Depth 5 | Write-Output; exit 0 }
139
145
 
140
146
  $decision = Invoke-PowerShellTestPurityDecision -ToolInputRaw (Read-ClaudeHookRawPayload)
141
147
  if ($null -ne $decision -and $decision.hookSpecificOutput.permissionDecision -eq 'deny') {
@@ -28,9 +28,10 @@
28
28
  #>
29
29
  [CmdletBinding()]
30
30
  param()
31
+ $script:HookDependencyGuardLoadFailed = $false; try { . (Join-Path $PSScriptRoot 'hook-dependency-guard.ps1') } catch { $script:HookDependencyGuardLoadFailed = $true }
31
32
 
32
33
 
33
- Import-Module (Join-Path $PSScriptRoot '../lib/hook-payload/HookPayload.psm1') -Force
34
+ try { Import-Module (Join-Path $PSScriptRoot '../lib/hook-payload/HookPayload.psm1') -Force -ErrorAction Stop } catch { Add-HookDependencyFailure -Name 'HookPayload.psm1' -ErrorRecord $_ }
34
35
  function Get-PythonTestPurityBlockDecision {
35
36
  [CmdletBinding()]
36
37
  [OutputType([System.Collections.Specialized.OrderedDictionary])]
@@ -66,6 +67,8 @@ function Invoke-PythonTestPurityDecision {
66
67
  param(
67
68
  [string] $ToolInputRaw
68
69
  )
70
+ $dependencyDecision = Get-HookDependencyFailureDecision -HookEvent PreToolUse -ReasonPrefix 'Python unit test purity hook:'
71
+ if ($null -ne $dependencyDecision) { return $dependencyDecision }
69
72
 
70
73
  $payload = Resolve-ClaudeHookToolInput -Raw $ToolInputRaw
71
74
  if (-not $payload.IsValid) {
@@ -138,6 +141,9 @@ function Invoke-PythonTestPurityDecision {
138
141
  if ($MyInvocation.InvocationName -eq '.') {
139
142
  return
140
143
  }
144
+ if ($script:HookDependencyGuardLoadFailed) { [Console]::Error.WriteLine('Python unit test purity hook: hook-dependency-guard.ps1 failed to load; the gate fails closed.'); exit 2 }
145
+ $dependencyDecision = Get-HookDependencyFailureDecision -HookEvent PreToolUse -ReasonPrefix 'Python unit test purity hook:'
146
+ if ($null -ne $dependencyDecision) { $dependencyDecision | ConvertTo-Json -Compress -Depth 5 | Write-Output; exit 0 }
141
147
 
142
148
  $decision = Invoke-PythonTestPurityDecision -ToolInputRaw (Read-ClaudeHookRawPayload)
143
149
  if ($null -ne $decision -and $decision.hookSpecificOutput.permissionDecision -eq 'deny') {
@@ -42,9 +42,10 @@
42
42
  #>
43
43
  [CmdletBinding()]
44
44
  param()
45
+ $script:HookDependencyGuardLoadFailed = $false; try { . (Join-Path $PSScriptRoot 'hook-dependency-guard.ps1') } catch { $script:HookDependencyGuardLoadFailed = $true }
45
46
 
46
47
 
47
- Import-Module (Join-Path $PSScriptRoot '../lib/hook-payload/HookPayload.psm1') -Force
48
+ try { Import-Module (Join-Path $PSScriptRoot '../lib/hook-payload/HookPayload.psm1') -Force -ErrorAction Stop } catch { Add-HookDependencyFailure -Name 'HookPayload.psm1' -ErrorRecord $_ }
48
49
  $script:CanonicalStepPrefixes = @(
49
50
  'S0_startup_checks',
50
51
  'S1_change_budget_estimation',
@@ -206,6 +207,8 @@ function Invoke-CheckpointMonotonicDecision {
206
207
  param(
207
208
  [string] $ToolInputRaw
208
209
  )
210
+ $dependencyDecision = Get-HookDependencyFailureDecision -HookEvent PreToolUse -ReasonPrefix 'CHECKPOINT_MONOTONIC_BLOCKED:'
211
+ if ($null -ne $dependencyDecision) { return $dependencyDecision }
209
212
 
210
213
  $envelope = Resolve-ClaudeHookToolInput -Raw $ToolInputRaw
211
214
  if (-not $envelope.IsValid) {
@@ -301,6 +304,9 @@ function Invoke-CheckpointMonotonicDecision {
301
304
  if ($MyInvocation.InvocationName -eq '.') {
302
305
  return
303
306
  }
307
+ if ($script:HookDependencyGuardLoadFailed) { [Console]::Error.WriteLine('CHECKPOINT_MONOTONIC_BLOCKED: hook-dependency-guard.ps1 failed to load; the gate fails closed.'); exit 2 }
308
+ $dependencyDecision = Get-HookDependencyFailureDecision -HookEvent PreToolUse -ReasonPrefix 'CHECKPOINT_MONOTONIC_BLOCKED:'
309
+ if ($null -ne $dependencyDecision) { $dependencyDecision | ConvertTo-Json -Compress -Depth 5 | Write-Output; exit 0 }
304
310
 
305
311
  $decision = Invoke-CheckpointMonotonicDecision -ToolInputRaw (Read-ClaudeHookRawPayload)
306
312