@danmoisan/drm-copilot-mcp 1.1.18 → 1.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/out/mcp-server.js +989 -662
  2. package/package.json +3 -2
  3. package/resources/claude-customizations/.claude/agents/atomic-executor.md +11 -0
  4. package/resources/claude-customizations/.claude/agents/atomic-planner.md +10 -0
  5. package/resources/claude-customizations/.claude/agents/epic-orchestrator.md +12 -4
  6. package/resources/claude-customizations/.claude/agents/epic-planner.md +5 -4
  7. package/resources/claude-customizations/.claude/agents/feature-review.md +6 -4
  8. package/resources/claude-customizations/.claude/agents/orchestrator.md +5 -4
  9. package/resources/claude-customizations/.claude/agents/parallel-orchestrator.md +31 -13
  10. package/resources/claude-customizations/.claude/agents/parallel-planner.md +9 -6
  11. package/resources/claude-customizations/.claude/agents/pr-author.md +15 -2
  12. package/resources/claude-customizations/.claude/agents/prd-feature.md +1 -1
  13. package/resources/claude-customizations/.claude/hooks/check-powershell-test-purity.ps1 +7 -1
  14. package/resources/claude-customizations/.claude/hooks/check-python-test-purity.ps1 +7 -1
  15. package/resources/claude-customizations/.claude/hooks/enforce-checkpoint-monotonic.ps1 +7 -1
  16. package/resources/claude-customizations/.claude/hooks/enforce-completion-consistency.ps1 +111 -46
  17. package/resources/claude-customizations/.claude/hooks/enforce-completion-helpers.ps1 +105 -0
  18. package/resources/claude-customizations/.claude/hooks/enforce-discovery-artifact-gate.ps1 +8 -1
  19. package/resources/claude-customizations/.claude/hooks/enforce-epic-invocation-origin.ps1 +7 -1
  20. package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate-resolution.ps1 +116 -59
  21. package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate.ps1 +55 -23
  22. package/resources/claude-customizations/.claude/hooks/enforce-epic-wave-barrier.ps1 +74 -75
  23. package/resources/claude-customizations/.claude/hooks/enforce-epic-worktree-removal-gate-resolution.ps1 +127 -35
  24. package/resources/claude-customizations/.claude/hooks/enforce-epic-worktree-removal-gate.ps1 +61 -57
  25. package/resources/claude-customizations/.claude/hooks/enforce-evidence-locations.ps1 +7 -1
  26. package/resources/claude-customizations/.claude/hooks/enforce-feature-folder-order.ps1 +129 -39
  27. package/resources/claude-customizations/.claude/hooks/enforce-mermaid-validation.ps1 +7 -1
  28. package/resources/claude-customizations/.claude/hooks/enforce-model-routing-receipt.ps1 +9 -3
  29. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate-epic-scope.ps1 +39 -51
  30. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate-helpers.ps1 +31 -58
  31. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate-modes.ps1 +63 -47
  32. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate-targets.ps1 +433 -0
  33. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate.ps1 +17 -12
  34. package/resources/claude-customizations/.claude/hooks/enforce-parallel-abandon-gate.ps1 +9 -3
  35. package/resources/claude-customizations/.claude/hooks/enforce-parallel-cohort-barrier.ps1 +65 -50
  36. package/resources/claude-customizations/.claude/hooks/enforce-parallel-drift-gate.ps1 +49 -42
  37. package/resources/claude-customizations/.claude/hooks/enforce-parallel-worktree-removal-gate.ps1 +54 -72
  38. package/resources/claude-customizations/.claude/hooks/enforce-powershell-batch-budget.ps1 +8 -2
  39. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-command-allowlist.ps1 +279 -0
  40. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill-helpers.ps1 +129 -75
  41. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.artifact-root.ps1 +233 -0
  42. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.docs-only.ps1 +224 -0
  43. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.ps1 +69 -24
  44. package/resources/claude-customizations/.claude/hooks/enforce-prd-feature-before-planner-helpers.ps1 +29 -18
  45. package/resources/claude-customizations/.claude/hooks/enforce-prd-feature-before-planner.ps1 +10 -4
  46. package/resources/claude-customizations/.claude/hooks/enforce-promotion-mcp-only.ps1 +14 -5
  47. package/resources/claude-customizations/.claude/hooks/enforce-python-batch-budget.ps1 +8 -2
  48. package/resources/claude-customizations/.claude/hooks/feature-folder-resolution.ps1 +373 -0
  49. package/resources/claude-customizations/.claude/hooks/feature-review-coverage-thresholds.ps1 +85 -0
  50. package/resources/claude-customizations/.claude/hooks/hook-command-heredoc.ps1 +119 -0
  51. package/resources/claude-customizations/.claude/hooks/hook-command-invocation-operands.ps1 +198 -0
  52. package/resources/claude-customizations/.claude/hooks/hook-command-invocation.ps1 +254 -255
  53. package/resources/claude-customizations/.claude/hooks/hook-command-payload-powershell.ps1 +201 -0
  54. package/resources/claude-customizations/.claude/hooks/hook-command-payload.ps1 +484 -0
  55. package/resources/claude-customizations/.claude/hooks/hook-command-scanner.ps1 +27 -110
  56. package/resources/claude-customizations/.claude/hooks/hook-dependency-guard.ps1 +114 -0
  57. package/resources/claude-customizations/.claude/hooks/hook-docs-only-diff.ps1 +493 -0
  58. package/resources/claude-customizations/.claude/hooks/subagentstop-envelope.ps1 +192 -0
  59. package/resources/claude-customizations/.claude/hooks/validate-bash.ps1 +9 -3
  60. package/resources/claude-customizations/.claude/hooks/validate-discovery-artifact-gate.ps1 +40 -42
  61. package/resources/claude-customizations/.claude/hooks/validate-executor-output.ps1 +66 -38
  62. package/resources/claude-customizations/.claude/hooks/validate-feature-review-coverage-metrics.ps1 +180 -0
  63. package/resources/claude-customizations/.claude/hooks/validate-feature-review-coverage-rules.ps1 +195 -0
  64. package/resources/claude-customizations/.claude/hooks/validate-feature-review-coverage.ps1 +141 -395
  65. package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output-resolution.ps1 +311 -0
  66. package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output-routing.ps1 +170 -0
  67. package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output.ps1 +115 -190
  68. package/resources/claude-customizations/.claude/hooks/validate-planner-output.ps1 +64 -32
  69. package/resources/claude-customizations/.claude/hooks/validate-pr-author-output.ps1 +39 -44
  70. package/resources/claude-customizations/.claude/hooks/validate-prd-feature-output.ps1 +43 -14
  71. package/resources/claude-customizations/.claude/hooks/validate-required-artifact-output.ps1 +66 -36
  72. package/resources/claude-customizations/.claude/hooks/validate-task-researcher-output.ps1 +31 -34
  73. package/resources/claude-customizations/.claude/lib/bash/mutate-parallel-run.sh +191 -0
  74. package/resources/claude-customizations/.claude/lib/bash/parallel-cohorts.sh +13 -3
  75. package/resources/claude-customizations/.claude/lib/bash/parallel-mutation-cli.sh +152 -0
  76. package/resources/claude-customizations/.claude/lib/bash/parallel-mutation-ops.sh +193 -0
  77. package/resources/claude-customizations/.claude/lib/bash/parallel-mutation.sh +322 -0
  78. package/resources/claude-customizations/.claude/lib/bash/remove-parallel-item.sh +146 -0
  79. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusExtraction.psm1 +23 -33
  80. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusTokenShape.psm1 +86 -6
  81. package/resources/claude-customizations/.claude/lib/ci-gate/Invoke-CiGateParser.ps1 +91 -19
  82. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateEpicWaveBarrier.psm1 +346 -0
  83. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateIssueAdoption.psm1 +24 -3
  84. package/resources/claude-customizations/.claude/lib/worktree-resolution/WorktreeItemResolution.psm1 +79 -2
  85. package/resources/claude-customizations/.claude/lib/worktree-resolution/WorktreeRunResolution.psm1 +3 -3
  86. package/resources/claude-customizations/.claude/rules/architecture-boundaries.md +5 -5
  87. package/resources/claude-customizations/.claude/rules/csharp.md +2 -2
  88. package/resources/claude-customizations/.claude/rules/general-code-change.md +1 -1
  89. package/resources/claude-customizations/.claude/rules/general-unit-test.md +3 -2
  90. package/resources/claude-customizations/.claude/rules/orchestrator-state.md +37 -4
  91. package/resources/claude-customizations/.claude/rules/parallel-orchestration.md +50 -5
  92. package/resources/claude-customizations/.claude/rules/plan-acceptance-gates.md +47 -8
  93. package/resources/claude-customizations/.claude/rules/quality-tiers.md +11 -7
  94. package/resources/claude-customizations/.claude/rules/shell.md +10 -8
  95. package/resources/claude-customizations/.claude/rules/typescript.md +1 -1
  96. package/resources/claude-customizations/.claude/settings.json +3 -4
  97. package/resources/claude-customizations/.claude/skills/acceptance-criteria-tracking/SKILL.md +1 -1
  98. package/resources/claude-customizations/.claude/skills/atomic-plan-contract/SKILL.md +5 -1
  99. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/scripts/cleanup_worktrees_detached_lib.sh +1 -1
  100. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/scripts/cleanup_worktrees_enumerate_lib.sh +2 -0
  101. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/scripts/cleanup_worktrees_scan_helper.sh +2 -0
  102. package/resources/claude-customizations/.claude/skills/epic-orchestrate/SKILL.md +33 -6
  103. package/resources/claude-customizations/.claude/skills/epic-plan/SKILL.md +1 -1
  104. package/resources/claude-customizations/.claude/skills/evidence-and-timestamp-conventions/SKILL.md +10 -1
  105. package/resources/claude-customizations/.claude/skills/feature-promotion-lifecycle/SKILL.md +1 -1
  106. package/resources/claude-customizations/.claude/skills/feature-review-workflow/SKILL.md +4 -3
  107. package/resources/claude-customizations/.claude/skills/orchestrate/SKILL.md +14 -6
  108. package/resources/claude-customizations/.claude/skills/parallel-add/SKILL.md +52 -14
  109. package/resources/claude-customizations/.claude/skills/parallel-close/SKILL.md +22 -9
  110. package/resources/claude-customizations/.claude/skills/parallel-orchestrate/SKILL.md +79 -16
  111. package/resources/claude-customizations/.claude/skills/parallel-plan/SKILL.md +63 -7
  112. package/resources/claude-customizations/.claude/skills/parallel-remove/SKILL.md +35 -12
  113. package/resources/claude-customizations/.claude/skills/pr-author/SKILL.md +3 -1
  114. package/resources/claude-customizations/.claude/skills/quota-throttling/SKILL.md +1 -1
  115. package/resources/claude-customizations/.claude/skills/remediation-handoff-atomic-planner/SKILL.md +2 -2
  116. package/resources/claude-customizations/pack-manifests/core.json +23 -0
  117. package/resources/codex-and-agents-customizations/.agents/skills/acceptance-criteria-tracking/SKILL.md +1 -1
  118. package/resources/codex-and-agents-customizations/.agents/skills/architecture-boundaries/SKILL.md +5 -5
  119. package/resources/codex-and-agents-customizations/.agents/skills/atomic-executor/SKILL.md +11 -0
  120. package/resources/codex-and-agents-customizations/.agents/skills/atomic-plan-contract/SKILL.md +4 -0
  121. package/resources/codex-and-agents-customizations/.agents/skills/atomic-planner/SKILL.md +10 -0
  122. package/resources/codex-and-agents-customizations/.agents/skills/csharp/SKILL.md +2 -2
  123. package/resources/codex-and-agents-customizations/.agents/skills/csharp-qa-gate/SKILL.md +2 -2
  124. package/resources/codex-and-agents-customizations/.agents/skills/epic-orchestrate/SKILL.md +8 -0
  125. package/resources/codex-and-agents-customizations/.agents/skills/epic-plan/SKILL.md +17 -1
  126. package/resources/codex-and-agents-customizations/.agents/skills/epic-run/SKILL.md +2 -1
  127. package/resources/codex-and-agents-customizations/.agents/skills/evidence-and-timestamp-conventions/SKILL.md +10 -1
  128. package/resources/codex-and-agents-customizations/.agents/skills/feature-review-workflow/SKILL.md +13 -5
  129. package/resources/codex-and-agents-customizations/.agents/skills/general-code-change/SKILL.md +1 -1
  130. package/resources/codex-and-agents-customizations/.agents/skills/general-unit-test/SKILL.md +3 -2
  131. package/resources/codex-and-agents-customizations/.agents/skills/orchestrate/SKILL.md +15 -6
  132. package/resources/codex-and-agents-customizations/.agents/skills/orchestrator-workflow/SKILL.md +1 -1
  133. package/resources/codex-and-agents-customizations/.agents/skills/quality-tiers/SKILL.md +11 -7
  134. package/resources/codex-and-agents-customizations/.agents/skills/translate-claude-to-codex/SKILL.md +1 -1
  135. package/resources/codex-and-agents-customizations/.agents-variants/csharp-legacy/skills/csharp/SKILL.md +2 -2
  136. package/resources/codex-and-agents-customizations/.agents-variants/csharp-legacy/skills/csharp-qa-gate/SKILL.md +2 -2
  137. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c1.toml +11 -0
  138. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c2.toml +11 -0
  139. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c3-elevated.toml +11 -0
  140. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c3.toml +11 -0
  141. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c4.toml +11 -0
  142. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor.toml +11 -0
  143. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c1.toml +10 -0
  144. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c2.toml +10 -0
  145. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c3-elevated.toml +10 -0
  146. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c3.toml +10 -0
  147. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c4.toml +10 -0
  148. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner.toml +10 -0
  149. package/resources/codex-and-agents-customizations/.codex/agents/epic-orchestrator.toml +2 -1
  150. package/resources/codex-and-agents-customizations/.codex/agents/feature-review.toml +6 -6
  151. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c1.toml +2 -2
  152. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c2.toml +2 -2
  153. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c3-elevated.toml +2 -2
  154. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c3.toml +2 -2
  155. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c4.toml +2 -2
  156. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator.toml +2 -2
  157. package/resources/codex-and-agents-customizations/.codex/codex-web-setup.sh +318 -273
  158. package/resources/codex-and-agents-customizations/.codex/config.toml +1 -1
  159. package/resources/codex-and-agents-customizations/.codex/hooks/check-powershell-test-purity.ps1 +7 -1
  160. package/resources/codex-and-agents-customizations/.codex/hooks/check-python-test-purity.ps1 +7 -1
  161. package/resources/codex-and-agents-customizations/.codex/hooks/codex-epic-child-launch-attestation.ps1 +1 -1
  162. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-checkpoint-monotonic.ps1 +7 -1
  163. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-codex-model-routing.ps1 +8 -2
  164. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-completion-consistency.ps1 +97 -44
  165. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-completion-helpers.ps1 +105 -0
  166. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-child-worktree-binding.ps1 +7 -1
  167. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-merge-gate.ps1 +37 -5
  168. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-planning-only.ps1 +6 -0
  169. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-root-invocation.ps1 +7 -1
  170. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-wave-barrier.ps1 +7 -1
  171. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-worktree-removal-gate.ps1 +54 -41
  172. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-evidence-locations.ps1 +7 -1
  173. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate-epic-scope.ps1 +35 -14
  174. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate-helpers.ps1 +31 -58
  175. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate-modes.ps1 +63 -47
  176. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate-targets.ps1 +433 -0
  177. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate.ps1 +24 -11
  178. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-powershell-batch-budget.ps1 +8 -2
  179. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-promotion-mcp-only.ps1 +13 -4
  180. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-python-batch-budget.ps1 +8 -2
  181. package/resources/codex-and-agents-customizations/.codex/hooks/feature-folder-resolution.ps1 +373 -0
  182. package/resources/codex-and-agents-customizations/.codex/hooks/feature-review-coverage-thresholds.ps1 +85 -0
  183. package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-heredoc.ps1 +119 -0
  184. package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-invocation-operands.ps1 +198 -0
  185. package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-invocation.ps1 +254 -255
  186. package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-payload-powershell.ps1 +201 -0
  187. package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-payload.ps1 +484 -0
  188. package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-scanner.ps1 +27 -110
  189. package/resources/codex-and-agents-customizations/.codex/hooks/hook-dependency-guard.ps1 +114 -0
  190. package/resources/codex-and-agents-customizations/.codex/hooks/hook-docs-only-diff.ps1 +493 -0
  191. package/resources/codex-and-agents-customizations/.codex/hooks/validate-bash.ps1 +8 -2
  192. package/resources/codex-and-agents-customizations/.codex/hooks/validate-codex-subagent-routing.ps1 +7 -1
  193. package/resources/codex-and-agents-customizations/.codex/hooks/validate-feature-review-coverage.ps1 +24 -8
  194. package/resources/codex-and-agents-customizations/pack-manifests/core.json +9 -0
  195. package/resources/customizations/.github/agents/csharp-typed-engineer.agent.md +2 -2
  196. package/resources/customizations/.github/instructions/csharp-code-change.instructions.md +4 -4
  197. package/resources/customizations/.github/instructions/csharp-unit-test.instructions.md +2 -2
  198. package/resources/customizations/.github/skills/acceptance-criteria-tracking/SKILL.md +1 -1
  199. package/resources/customizations/.github/skills/atomic-plan-contract/SKILL.md +4 -0
  200. package/resources/customizations/.github/skills/evidence-and-timestamp-conventions/SKILL.md +10 -1
  201. package/resources/customizations/.github/skills/feature-review-workflow/SKILL.md +1 -1
  202. package/resources/powershell/PoshQC/PoshQC.Coverage.psm1 +314 -0
  203. package/resources/powershell/PoshQC/PoshQC.Testing.psm1 +25 -28
  204. package/resources/powershell/PoshQC/PoshQC.psm1 +1 -0
  205. package/resources/powershell/PoshQC/README.md +8 -2
  206. package/resources/powershell/PoshQC/settings/pester.runsettings.psd1 +2 -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.19",
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
  }
@@ -82,6 +82,17 @@ Use the scoped tool patterns for quality gates:
82
82
 
83
83
  Run toolchain in order: format, lint, type-check, test. Restart from step 1 if any step fails or changes files.
84
84
 
85
+ ## Scratch Location
86
+
87
+ 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.
88
+
89
+ - `SCRATCH` resolves to `<session scratchpad>/issue-<issue-num>/`, where `<issue-num>` is the plan's canonical issue number.
90
+ - Every scratch file, helper script, staged copy, and coverage report a plan names lives under `SCRATCH`. Subdirectories such as `SCRATCH/stage/` are permitted.
91
+ - Create `SCRATCH` before the first scratch write. Never write a scratch file to the scratchpad root or to a fixed shared name outside `SCRATCH`.
92
+ - 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.
93
+ - Plans and evidence artifacts record the literal token `SCRATCH`, never a host path.
94
+ - 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>`.
95
+
85
96
  ## Preflight Validation
86
97
 
87
98
  When receiving a plan with directive `DIRECTIVE: PREFLIGHT VALIDATION ONLY`, perform only format and structure validation. Return exactly one of:
@@ -55,6 +55,16 @@ Generate plans using the atomic plan contract defined in the `atomic-plan-contra
55
55
  4. Do not add bucket tasks (e.g., "Refactor module" or "Write tests") that cannot be completed as a single binary outcome.
56
56
  5. Do not execute implementation; produce the plan only.
57
57
 
58
+ ## Scratch Location
59
+
60
+ Concurrent child runs in one session share one session scratchpad, so every plan places its scratch files in a directory unique to the child.
61
+
62
+ - `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.
63
+ - Every scratch file, helper script, staged copy, and coverage report a plan names lives under `SCRATCH`. Subdirectories such as `SCRATCH/stage/` are permitted.
64
+ - A plan never directs a scratch file to the scratchpad root or to a fixed shared name outside `SCRATCH`.
65
+ - Plans and evidence artifacts record the literal token `SCRATCH`, never a host path.
66
+ - 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>`.
67
+
58
68
  ## Preflight Validation
59
69
 
60
70
  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.
@@ -121,10 +121,18 @@ rejecting cyclic or unresolved `depends_on` references before kickoff as a synth
121
121
  finding. `scripts/dev_tools/epic_wave_computation.py` is the canonical, tested reference
122
122
  implementation of this formula. Within a wave, launch all features concurrently (one message, N `Agent` calls, each
123
123
  `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.
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 by the
126
+ retrospective wave-barrier ordering check, which runs at your own `SubagentStop` time as
127
+ `Get-OrchestratorStateEpicWaveBarrierError` in
128
+ `.claude/lib/orchestrator-state/OrchestratorStateEpicWaveBarrier.psm1`, a PowerShell port of the
129
+ check inside `validate_epic_orchestrator_state_text` invoked by
130
+ `.claude/hooks/validate-orchestrator-output.ps1`; parity is pinned by
131
+ `tests/fixtures/epic_wave_barrier/`, and the Python validator remains the authority used through
132
+ the `mcp__drm-copilot__validate_orchestration_artifacts` call. If the check reports a violation,
133
+ report it to the operator and halt. The `SubagentStop` transport and exit-code defect this check
134
+ previously depended on was resolved by epic #904 and issue #928: a violation blocks the stop with
135
+ exit 2 and a stderr reason.
128
136
 
129
137
  ## Checkpoint Persistence
130
138
 
@@ -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.
@@ -130,7 +130,7 @@ Cycle-aware `next_step` uses the form `remediation.cycle_N.{plan,preflight,execu
130
130
 
131
131
  ### CI Monitoring and Post-PR Remediation
132
132
 
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.
133
+ 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
134
 
135
135
  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
136
 
@@ -173,10 +173,11 @@ This protocol follows the remediation-handoff skill and the strict-handoff memor
173
173
  Update `artifacts/orchestration/orchestrator-state.json` after every completed step with:
174
174
 
175
175
  - `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`
176
+ - Variables: `promotion-type`, `short-name`, `relativeFile`, `long-name`, `issue-num`, `feature-folder`, `work-mode`, `plan-path`
177
+ - `completed_steps`, `next_step`, `last_updated` (ISO-8601 UTC date-time string, rewritten on every checkpoint write)
178
+ - Step statuses: `step5_status`, `step6_status`, `step7_status`, `step8_status`, `step9_status`, `step10_status`
179
179
  - `delegation_receipts`, `blocked_reason`
180
+ - The complete required-key set and the `last_updated` contract are defined in `.claude/rules/orchestrator-state.md` under `## Required Top-Level Keys`.
180
181
  - Persist raw promotion MCP receipts under:
181
182
  - `delegation_receipts.promotion.potential_entry`
182
183
  - `delegation_receipts.promotion.issue`
@@ -13,14 +13,15 @@ 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*)"
24
25
  - "Bash(dotnet tool restore*)"
25
26
  - "Bash(dotnet csharpier check *)"
26
27
  - "Bash(dotnet build *)"
@@ -95,17 +96,20 @@ reference; it is not invoked on the destination-runtime path. Cohort recoloring
95
96
  batching use `compute-cohorts.sh` and `compute-concurrency-batches.sh` under the same allowlist
96
97
  entry.
97
98
 
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
99
+ No `poetry run python` grant is held. The inline-code (`-c`) grant was removed under issue #890
100
+ after `parallel-add`, `parallel-close`, and `parallel-orchestrate` moved their engine calls to the
101
+ bundled entry point `.claude/lib/bash/mutate-parallel-run.sh`, and the former module-form (`-m`)
102
+ grant was removed under issue #791; in both cases no skill in this agent's caller set still invokes
103
+ Python through the grant. The skill's
104
+ `## Parallel-Level Checkpoint` section validates through
105
+ `mcp__drm-copilot__validate_orchestration_artifacts`; since issue #763 radius drift detection runs
101
106
  through the destination-runtime PowerShell entry point
102
107
  `.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.
108
+ bundled entry point `.claude/lib/bash/abandon-parallel-item.sh`; since issue #791 the
109
+ `parallel-remove` decide, recolor, and entry steps run through the bundled entry point
110
+ `.claude/lib/bash/remove-parallel-item.sh`; and since issue #890 the add, close, and requeue steps
111
+ run through the bundled entry point `.claude/lib/bash/mutate-parallel-run.sh`. The sibling persona `.claude/agents/parallel-planner.md`
112
+ records the same destination-runtime posture.
109
113
 
110
114
  ## Startup Protocol
111
115
 
@@ -176,8 +180,22 @@ parameters:
176
180
  - `isolation: "worktree"` — the item runs in its own isolated git worktree.
177
181
  - `run_in_background: true` — items within a cohort run concurrently up to `max_concurrency`.
178
182
  - 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.
183
+ - `model` — read the item's `complexity_band` and `model_routing_receipt` from the planner
184
+ checkpoint `artifacts/orchestration/parallel-planner-state.json`; when that checkpoint is
185
+ unavailable, use the committed kickoff artifact's `## Item Summary` `complexity` column as the
186
+ fallback band source. Pass the receipt's `model` when the run's `fable_policy` equals the
187
+ receipt's `fable_policy`; otherwise re-resolve with
188
+ `Resolve-DelegationModel -Agent orchestrator -Band <band> -FablePolicy <run fable_policy>` and
189
+ pass that result, per the skill's `## Model Selection` section.
190
+ For an item admitted through `/parallel-add`, which is absent from the planner checkpoint
191
+ `items[]` and from the kickoff `## Item Summary`, read the band from that item's
192
+ `complexity_band` on the orchestrator checkpoint
193
+ `artifacts/orchestration/parallel-orchestrator-state.json` `items[]`. Such an item carries no
194
+ `model_routing_receipt`, so resolve `model` at spawn time as
195
+ `model_policy.complexity_to_model[<band>]` from `config/orchestration-routing.json` under the
196
+ run's `fable_policy`, with `fable` clamped to `opus` when `fable_policy` is `disabled`, and pass
197
+ that explicit `model` on the spawn. When the admitted item has no `complexity_band` on the
198
+ orchestrator checkpoint, stop rather than spawn without `model`.
181
199
 
182
200
  Each child `orchestrator` runs its own route inside that worktree, including its own delegations to
183
201
  `atomic-planner`, `atomic-executor`, `feature-review`, and `pr-author`. You do not delegate to
@@ -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
  ---
@@ -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