@danmoisan/drm-copilot-mcp 1.1.19 → 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 (112) hide show
  1. package/out/mcp-server.js +165 -4
  2. package/package.json +1 -1
  3. package/resources/claude-customizations/.claude/agents/atomic-executor.md +17 -6
  4. package/resources/claude-customizations/.claude/agents/atomic-planner.md +10 -2
  5. package/resources/claude-customizations/.claude/agents/epic-orchestrator.md +5 -0
  6. package/resources/claude-customizations/.claude/agents/orchestrator.md +4 -1
  7. package/resources/claude-customizations/.claude/agents/parallel-orchestrator.md +4 -0
  8. package/resources/claude-customizations/.claude/agents/task-researcher.md +8 -0
  9. package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate-command.ps1 +190 -0
  10. package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate.ps1 +22 -53
  11. package/resources/claude-customizations/.claude/hooks/hook-docs-only-diff.ps1 +5 -1
  12. package/resources/claude-customizations/.claude/hooks/premortem-section.ps1 +149 -0
  13. package/resources/claude-customizations/.claude/hooks/validate-executor-output.ps1 +210 -84
  14. package/resources/claude-customizations/.claude/hooks/validate-planner-output.ps1 +13 -1
  15. package/resources/claude-customizations/.claude/hooks/validate-task-researcher-output.ps1 +24 -5
  16. package/resources/claude-customizations/.claude/lib/ci-gate/Invoke-MergeConfirmationParser.ps1 +203 -0
  17. package/resources/claude-customizations/.claude/rules/plan-acceptance-gates.md +46 -10
  18. package/resources/claude-customizations/.claude/skills/atomic-plan-contract/SKILL.md +48 -16
  19. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/SKILL.md +7 -3
  20. package/resources/claude-customizations/.claude/skills/csharp-change-budget-router/SKILL.md +2 -2
  21. package/resources/claude-customizations/.claude/skills/epic-orchestrate/SKILL.md +12 -3
  22. package/resources/claude-customizations/.claude/skills/epic-plan/SKILL.md +4 -2
  23. package/resources/claude-customizations/.claude/skills/execution-environment/SKILL.md +134 -0
  24. package/resources/claude-customizations/.claude/skills/orchestrate/SKILL.md +22 -9
  25. package/resources/claude-customizations/.claude/skills/parallel-orchestrate/SKILL.md +29 -5
  26. package/resources/claude-customizations/.claude/skills/powershell-change-budget-router/SKILL.md +1 -1
  27. package/resources/claude-customizations/.claude/skills/python-change-budget-router/SKILL.md +1 -1
  28. package/resources/claude-customizations/.claude/skills/remediation-handoff-atomic-planner/SKILL.md +14 -6
  29. package/resources/claude-customizations/.claude/skills/research-issue/SKILL.md +6 -0
  30. package/resources/claude-customizations/pack-manifests/core.json +4 -0
  31. package/resources/codex-and-agents-customizations/.agents/skills/README.md +1 -0
  32. package/resources/codex-and-agents-customizations/.agents/skills/atomic-executor/SKILL.md +8 -7
  33. package/resources/codex-and-agents-customizations/.agents/skills/atomic-plan-contract/SKILL.md +39 -4
  34. package/resources/codex-and-agents-customizations/.agents/skills/atomic-planner/SKILL.md +8 -6
  35. package/resources/codex-and-agents-customizations/.agents/skills/csharp-change-budget-router/SKILL.md +2 -2
  36. package/resources/codex-and-agents-customizations/.agents/skills/epic-orchestrate/SKILL.md +8 -1
  37. package/resources/codex-and-agents-customizations/.agents/skills/execution-environment/SKILL.md +134 -0
  38. package/resources/codex-and-agents-customizations/.agents/skills/orchestrate/SKILL.md +12 -2
  39. package/resources/codex-and-agents-customizations/.agents/skills/powershell-change-budget-router/SKILL.md +1 -1
  40. package/resources/codex-and-agents-customizations/.agents/skills/python-change-budget-router/SKILL.md +1 -1
  41. package/resources/codex-and-agents-customizations/.agents/skills/remediation-handoff-atomic-planner/SKILL.md +7 -3
  42. package/resources/codex-and-agents-customizations/.agents/skills/research-issue/SKILL.md +6 -0
  43. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c1.toml +10 -6
  44. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c2.toml +10 -6
  45. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c3-elevated.toml +10 -6
  46. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c3.toml +10 -6
  47. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c4.toml +10 -6
  48. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor.toml +10 -6
  49. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c1.toml +5 -2
  50. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c2.toml +5 -2
  51. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c3-elevated.toml +5 -2
  52. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c3.toml +5 -2
  53. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c4.toml +5 -2
  54. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner.toml +5 -2
  55. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planning.toml +1 -1
  56. package/resources/codex-and-agents-customizations/.codex/agents/csharp-atomic-planning.toml +1 -1
  57. package/resources/codex-and-agents-customizations/.codex/agents/epic-orchestrator.toml +2 -0
  58. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c1.toml +5 -2
  59. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c2.toml +5 -2
  60. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c3-elevated.toml +5 -2
  61. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c3.toml +5 -2
  62. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c4.toml +5 -2
  63. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator.toml +5 -2
  64. package/resources/codex-and-agents-customizations/.codex/agents/powershell-atomic-planning.toml +1 -1
  65. package/resources/codex-and-agents-customizations/.codex/agents/python-atomic-planning.toml +1 -1
  66. package/resources/codex-and-agents-customizations/.codex/agents/task-researcher-c1.toml +6 -0
  67. package/resources/codex-and-agents-customizations/.codex/agents/task-researcher-c2.toml +6 -0
  68. package/resources/codex-and-agents-customizations/.codex/agents/task-researcher-c3-elevated.toml +6 -0
  69. package/resources/codex-and-agents-customizations/.codex/agents/task-researcher-c3.toml +6 -0
  70. package/resources/codex-and-agents-customizations/.codex/agents/task-researcher-c4.toml +6 -0
  71. package/resources/codex-and-agents-customizations/.codex/agents/task-researcher.toml +6 -0
  72. package/resources/codex-and-agents-customizations/.codex/config.toml +1 -1
  73. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-merge-gate-command.ps1 +190 -0
  74. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-merge-gate.ps1 +17 -38
  75. package/resources/codex-and-agents-customizations/.codex/hooks/hook-docs-only-diff.ps1 +5 -1
  76. package/resources/codex-and-agents-customizations/.codex/prompts/feature-review-remediate.md +6 -4
  77. package/resources/codex-and-agents-customizations/pack-manifests/core.json +2 -0
  78. package/resources/customizations/.github/agents/atomic_executor.agent.md +21 -11
  79. package/resources/customizations/.github/agents/atomic_planning.agent.md +8 -3
  80. package/resources/customizations/.github/agents/csharp-atomic-executor.agent.md +13 -9
  81. package/resources/customizations/.github/agents/csharp-atomic-planning.agent.md +2 -2
  82. package/resources/customizations/.github/agents/csharp-orchestrator.agent.md +2 -2
  83. package/resources/customizations/.github/agents/csharp-typed-engineer.agent.md +3 -3
  84. package/resources/customizations/.github/agents/orchestrator.agent.md +8 -5
  85. package/resources/customizations/.github/agents/powershell-atomic-executor.agent.md +13 -9
  86. package/resources/customizations/.github/agents/powershell-atomic-planning.agent.md +2 -2
  87. package/resources/customizations/.github/agents/powershell-orchestrator.agent.md +2 -2
  88. package/resources/customizations/.github/agents/powershell-typed-engineer.agent.md +3 -3
  89. package/resources/customizations/.github/agents/python-atomic-executor.agent.md +13 -9
  90. package/resources/customizations/.github/agents/python-atomic-planning.agent.md +2 -2
  91. package/resources/customizations/.github/agents/python-orchestrator.agent.md +2 -2
  92. package/resources/customizations/.github/agents/task-researcher.agent.md +6 -0
  93. package/resources/customizations/.github/prompts/generate-atomic-plan.prompt.md +16 -10
  94. package/resources/customizations/.github/prompts/orchestrate-csharp-work.prompt.md +2 -2
  95. package/resources/customizations/.github/prompts/orchestrate-powershell-work.prompt.md +1 -1
  96. package/resources/customizations/.github/prompts/orchestrate-python-work.prompt.md +1 -1
  97. package/resources/customizations/.github/prompts/orchestrate-work.prompt.md +2 -2
  98. package/resources/customizations/.github/skills/atomic-plan-contract/SKILL.md +39 -4
  99. package/resources/customizations/.github/skills/csharp-change-budget-router/SKILL.md +1 -1
  100. package/resources/customizations/.github/skills/execution-environment/SKILL.md +134 -0
  101. package/resources/customizations/.github/skills/powershell-change-budget-router/SKILL.md +1 -1
  102. package/resources/customizations/.github/skills/remediation-handoff-atomic-planner/SKILL.md +7 -3
  103. package/resources/feature-templates/bug/plan.yyyy-MM-ddTHH-mm.md +10 -0
  104. package/resources/feature-templates/feature/plan.yyyy-MM-ddTHH-mm.md +11 -0
  105. package/resources/feature-templates/refactor/plan.yyyy-MM-ddTHH-mm.md +11 -0
  106. package/resources/powershell/PoshQC/PoshQC.CoverageMerge.psm1 +163 -0
  107. package/resources/powershell/PoshQC/PoshQC.Shard.psm1 +296 -0
  108. package/resources/powershell/PoshQC/PoshQC.Testing.psm1 +23 -4
  109. package/resources/powershell/PoshQC/PoshQC.psd1 +7 -1
  110. package/resources/powershell/PoshQC/PoshQC.psm1 +17 -5
  111. package/resources/powershell/PoshQC/README.md +13 -1
  112. package/resources/powershell/PoshQC/settings/pester.runsettings.psd1 +3 -0
@@ -0,0 +1,190 @@
1
+ <#
2
+ .SYNOPSIS
3
+ Scope predicate and pull-request selector reader for the epic merge gate (issue #952).
4
+ .DESCRIPTION
5
+ Dot-sourced by enforce-epic-merge-gate.ps1 on both runtimes; this file is byte-identical in
6
+ .claude/hooks and .codex/hooks. Under a merge queue every gh pr merge spelling (--merge, -m,
7
+ --squash, -s, --rebase, -r, --auto, --admin, or no method flag) adds the pull request to the
8
+ queue, and the gh api mutations enqueuePullRequest, enablePullRequestAutoMerge, and
9
+ mergePullRequest and the REST pulls/<n>/merge endpoint also reach the base branch. All of
10
+ them are in scope. A gh pr merge whose only action flag is --disable-auto is out of scope.
11
+
12
+ Pure string logic only: no disk, process, network, clock, or environment access. The file
13
+ dot-sources and imports nothing; it consumes Get-CommandLineInvocation and
14
+ Get-CommandLineStructuralMatch, which the gate loads from hook-command-invocation.ps1 first.
15
+
16
+ Known limitation (issue #952 code review CR-5): the gh api scope reads the command text
17
+ only. A GraphQL mutation supplied from a file (gh api graphql -F query=@mutation.graphql,
18
+ or gh api --input payload.json) is not visible to this text-based scope and is not gated.
19
+ #>
20
+
21
+ # gh pr merge flags that perform or schedule a merge. Any of them keeps a command in scope even
22
+ # when it also carries --disable-auto.
23
+ $script:EpicMergeGateActionFlags = @('--merge', '-m', '--squash', '-s', '--rebase', '-r', '--auto', '--admin')
24
+
25
+ # gh pr merge flags, including the inherited --repo, that consume the following token as a value.
26
+ $script:EpicMergeGateValueFlags = @('-b', '--body', '-F', '--body-file', '-t', '--subject', '-A', '--author-email', '--match-head-commit', '-R', '--repo')
27
+
28
+ # GraphQL mutations that merge, enqueue, or schedule the merge of a pull request.
29
+ $script:EpicMergeGateMutationNames = @('enqueuePullRequest', 'enablePullRequestAutoMerge', 'mergePullRequest')
30
+
31
+ # The REST merge endpoint path; group 1 is the pull-request number.
32
+ $script:EpicMergeGateRestMergePattern = '(?:^|/)pulls/(\d+)/merge(?:$|[^\w-])'
33
+
34
+ function Get-EpicMergeGateFlagName {
35
+ <#
36
+ .SYNOPSIS
37
+ Return the flag name of a dash-led token without any '=value' suffix.
38
+ .OUTPUTS
39
+ System.String
40
+ #>
41
+ [CmdletBinding()]
42
+ [OutputType([string])]
43
+ param([Parameter(Mandatory)][AllowEmptyString()][string] $Token)
44
+
45
+ $split = $Token.IndexOf('=')
46
+ if ($split -gt 0) { return $Token.Substring(0, $split) }
47
+ return $Token
48
+ }
49
+
50
+ function ConvertFrom-EpicMergeGateSelector {
51
+ <#
52
+ .SYNOPSIS
53
+ Convert a gh pr merge selector to a pull-request number, or $null.
54
+ .DESCRIPTION
55
+ Accepts an all-digit selector or a URL whose path ends in /pull/<n>. A branch-name
56
+ selector carries no number and yields $null.
57
+ .OUTPUTS
58
+ System.Nullable[int]
59
+ #>
60
+ [CmdletBinding()]
61
+ [OutputType([int])]
62
+ param([Parameter(Mandatory)][AllowEmptyString()][string] $Selector)
63
+
64
+ $digits = $null
65
+ if ($Selector -match '^\d+$') {
66
+ $digits = $Selector
67
+ } elseif ($Selector -match '/pull/(\d+)/?(?:[?#].*)?$') {
68
+ $digits = $Matches[1]
69
+ }
70
+ $number = 0
71
+ if ($null -ne $digits -and [int]::TryParse($digits, [ref] $number)) { return $number }
72
+ return $null
73
+ }
74
+
75
+ function Test-EpicMergeGateDisableAutoOnly {
76
+ <#
77
+ .SYNOPSIS
78
+ Report whether a Structural gh pr merge match carries --disable-auto and no action flag.
79
+ .OUTPUTS
80
+ System.Boolean
81
+ #>
82
+ [CmdletBinding()]
83
+ [OutputType([bool])]
84
+ param([Parameter(Mandatory)][pscustomobject] $Match)
85
+
86
+ $tokens = [string[]]@($Match.Segment.Tokens)
87
+ $hasDisableAuto = $false
88
+ for ($index = $Match.OperandIndex; $index -lt $tokens.Count; $index++) {
89
+ $name = Get-EpicMergeGateFlagName -Token $tokens[$index]
90
+ if ($script:EpicMergeGateActionFlags -ccontains $name) { return $false }
91
+ if ($name -ceq '--disable-auto') { $hasDisableAuto = $true }
92
+ }
93
+ return $hasDisableAuto
94
+ }
95
+
96
+ function Test-EpicMergeGateApiMutationText {
97
+ <#
98
+ .SYNOPSIS
99
+ Report whether gh api text names a merge or enqueue mutation or the REST merge endpoint.
100
+ .OUTPUTS
101
+ System.Boolean
102
+ #>
103
+ [CmdletBinding()]
104
+ [OutputType([bool])]
105
+ param([Parameter(Mandatory)][AllowEmptyString()][AllowNull()][string] $Text)
106
+
107
+ if ([string]::IsNullOrEmpty($Text)) { return $false }
108
+ foreach ($name in $script:EpicMergeGateMutationNames) {
109
+ if ($Text.IndexOf($name, [System.StringComparison]::OrdinalIgnoreCase) -ge 0) { return $true }
110
+ }
111
+ return [regex]::IsMatch($Text, $script:EpicMergeGateRestMergePattern)
112
+ }
113
+
114
+ function Test-EpicMergeGateCommandInScope {
115
+ <#
116
+ .SYNOPSIS
117
+ Report whether a command line is a gated merge or enqueue action (issue #952).
118
+ .DESCRIPTION
119
+ True for any gh pr merge match, Structural or Indeterminate, unless the match is Structural
120
+ and its only action flag is --disable-auto; true for any gh api match whose tokens name a
121
+ merge or enqueue mutation or a pulls/<n>/merge path. Text that only mentions these words
122
+ produces no match and stays out of scope. An Indeterminate gh pr merge match stays in scope
123
+ (fail closed).
124
+ .OUTPUTS
125
+ System.Boolean
126
+ #>
127
+ [CmdletBinding()]
128
+ [OutputType([bool])]
129
+ param([Parameter(Mandatory)][AllowEmptyString()][AllowNull()][string] $CommandText)
130
+
131
+ foreach ($match in @(Get-CommandLineInvocation -CommandText $CommandText -CommandWord 'gh' -SubcommandPath @('pr', 'merge'))) {
132
+ if ($match.Status -ne 'Structural' -or -not (Test-EpicMergeGateDisableAutoOnly -Match $match)) { return $true }
133
+ }
134
+ foreach ($match in @(Get-CommandLineInvocation -CommandText $CommandText -CommandWord 'gh' -SubcommandPath @('api'))) {
135
+ if (Test-EpicMergeGateApiMutationText -Text (@($match.Segment.Tokens) -join ' ')) { return $true }
136
+ }
137
+ return $false
138
+ }
139
+
140
+ function Get-EpicMergeGateSelectorPrNumber {
141
+ <#
142
+ .SYNOPSIS
143
+ Resolve the pull-request number of a gated merge or enqueue command, or $null.
144
+ .DESCRIPTION
145
+ For gh pr merge, only the first Structural match is read. Value flags are skipped with
146
+ their values, other flags are skipped, an equals-joined --merge=<digits> yields its
147
+ digits (an equals-joined value that is not a number is skipped like any other flag),
148
+ and the first non-flag token (or the token after a bare '--') is the selector.
149
+ For gh api, the number comes from a pulls/<n>/merge token. Any other command yields
150
+ $null, which the gate handles through its no-number branches.
151
+ .OUTPUTS
152
+ System.Nullable[int]
153
+ #>
154
+ [CmdletBinding()]
155
+ [OutputType([int])]
156
+ param([Parameter(Mandatory)][AllowEmptyString()][AllowNull()][string] $CommandText)
157
+
158
+ $match = Get-CommandLineStructuralMatch -CommandText $CommandText -CommandWord 'gh' -SubcommandPath @('pr', 'merge')
159
+ if ($null -ne $match) {
160
+ $tokens = [string[]]@($match.Segment.Tokens)
161
+ $index = $match.OperandIndex
162
+ while ($index -lt $tokens.Count) {
163
+ $token = $tokens[$index]
164
+ if ($token -ceq '--') {
165
+ if ($index + 1 -lt $tokens.Count) { return ConvertFrom-EpicMergeGateSelector -Selector $tokens[$index + 1] }
166
+ return $null
167
+ }
168
+ if ($token.StartsWith('-') -and $token.Length -gt 1) {
169
+ $name = Get-EpicMergeGateFlagName -Token $token
170
+ if ($name -ceq '--merge' -and $token.Length -gt $name.Length) {
171
+ $equalsNumber = ConvertFrom-EpicMergeGateSelector -Selector $token.Substring($name.Length + 1)
172
+ if ($null -ne $equalsNumber) { return $equalsNumber }
173
+ }
174
+ $index += if ($script:EpicMergeGateValueFlags -ccontains $token) { 2 } else { 1 }
175
+ continue
176
+ }
177
+ return ConvertFrom-EpicMergeGateSelector -Selector $token
178
+ }
179
+ return $null
180
+ }
181
+
182
+ foreach ($apiMatch in @(Get-CommandLineInvocation -CommandText $CommandText -CommandWord 'gh' -SubcommandPath @('api'))) {
183
+ foreach ($token in @($apiMatch.Segment.Tokens)) {
184
+ $rest = [regex]::Match([string]$token, $script:EpicMergeGateRestMergePattern)
185
+ $number = 0
186
+ if ($rest.Success -and [int]::TryParse($rest.Groups[1].Value, [ref] $number)) { return $number }
187
+ }
188
+ }
189
+ return $null
190
+ }
@@ -3,6 +3,11 @@
3
3
  Gates epic child and integration PR merges behind checkpointed green state.
4
4
 
5
5
  .DESCRIPTION
6
+ Trigger scope (issue #952): every gh pr merge invocation (any merge method, --auto, --admin,
7
+ or no method flag) and every gh api merge or enqueue mutation is gated, because under a merge
8
+ queue each of them reaches the base branch; only a pure --disable-auto is out of scope. The
9
+ predicate and the PR selector reader live in enforce-epic-merge-gate-command.ps1.
10
+
6
11
  Docs-only branch (issue #927): after the standalone branch denies an explicit PR number,
7
12
  and only when no checkpoint is present at the repository root (both checkpoint texts are
8
13
  blank; operator decision OD-1, stricter than the Claude per-PR rule), the gate calls
@@ -25,6 +30,9 @@ $script:HookDependencyGuardLoadFailed = $false; try { . (Join-Path $PSScriptRoot
25
30
  # the two runtimes on one implementation of the same concern.
26
31
  try { . (Join-Path $PSScriptRoot 'hook-command-scanner.ps1') } catch { Add-HookDependencyFailure -Name 'hook-command-scanner.ps1' -ErrorRecord $_ }
27
32
  try { . (Join-Path $PSScriptRoot 'hook-command-invocation.ps1') } catch { Add-HookDependencyFailure -Name 'hook-command-invocation.ps1' -ErrorRecord $_ }
33
+ # Merge and enqueue scope predicate and the PR selector reader (issue #952), byte-identical to the
34
+ # Claude copy.
35
+ try { . (Join-Path $PSScriptRoot 'enforce-epic-merge-gate-command.ps1') } catch { Add-HookDependencyFailure -Name 'enforce-epic-merge-gate-command.ps1' -ErrorRecord $_ }
28
36
  # Shared docs-only diff classification and the merge-side docs-only exemption (issue #927).
29
37
  try { . (Join-Path $PSScriptRoot 'hook-docs-only-diff.ps1') } catch { Add-HookDependencyFailure -Name 'hook-docs-only-diff.ps1' -ErrorRecord $_ }
30
38
 
@@ -61,15 +69,11 @@ function Get-CodexMergeCommandPrNumber {
61
69
  .SYNOPSIS
62
70
  Resolve the explicit pull-request number of a gh pr merge invocation, or $null.
63
71
  .DESCRIPTION
64
- The number is taken from the segment that structurally invokes `gh pr merge` and
65
- from nowhere else: the positional spelling through Get-CommandLineOperand, the
66
- flag-led and equals-joined spellings through Get-CommandLineFlagValue. A leading
67
- `cd <path>` segment contributes no operand and no flag value, so no digit run
72
+ The number is resolved by Get-EpicMergeGateSelectorPrNumber in
73
+ enforce-epic-merge-gate-command.ps1 (issue #952), the file shared byte-identically with
74
+ the Claude runtime, from the segment that structurally invokes gh pr merge or gh api and
75
+ from nowhere else. A leading cd <path> segment contributes no selector, so no digit run
68
76
  outside the merge segment can be mistaken for a pull-request number.
69
-
70
- This copy has never carried the Claude copy's unanchored whole-text digit scan and
71
- deliberately does not acquire one. No regular expression matching a bare digit run
72
- is introduced here; the only pattern below anchors an all-digit token end to end.
73
77
  .OUTPUTS
74
78
  System.Nullable[int]
75
79
  #>
@@ -77,18 +81,7 @@ function Get-CodexMergeCommandPrNumber {
77
81
  [OutputType([int])]
78
82
  param([Parameter(Mandatory)][string] $Command)
79
83
 
80
- foreach ($operand in @(Get-CommandLineOperand -CommandText $Command -CommandWord 'gh' -SubcommandPath @('pr', 'merge'))) {
81
- if ($operand -match '^\d+$') {
82
- return [int]$operand
83
- }
84
- }
85
-
86
- $flagValue = Get-CommandLineFlagValue -CommandText $Command -CommandWord 'gh' -SubcommandPath @('pr', 'merge') -FlagName '--merge'
87
- if ($null -ne $flagValue -and $flagValue -match '^\d+$') {
88
- return [int]$flagValue
89
- }
90
-
91
- return $null
84
+ return Get-EpicMergeGateSelectorPrNumber -CommandText $Command
92
85
  }
93
86
 
94
87
  function Test-CodexChildMergeReady {
@@ -153,23 +146,9 @@ function Invoke-CodexEpicMergeDecision {
153
146
  return $null
154
147
  }
155
148
  $command = [string]$payload.tool_input.command
156
- # Both legs are read structurally from the segment that invokes the command, so a
157
- # quoted mention of the phrase no longer brings a command into scope. The flag leg needs
158
- # a raw-scan fallback: a wrapper's quoted argument collapses into ONE token, so a flag
159
- # inside it is never read as a token, and the token-only read took
160
- # bash -c "gh pr merge --merge 688" out of scope.
161
- $isMergeInvocation = Test-CommandLineInvocation -CommandText $command -CommandWord 'gh' -SubcommandPath @('pr', 'merge')
162
- $hasMergeFlag = Test-CommandLineFlag -CommandText $command -CommandWord 'gh' -SubcommandPath @('pr', 'merge') -FlagName '--merge'
163
- if (-not $hasMergeFlag) {
164
- foreach ($segment in @(Read-CommandLineSegment -CommandText $command)) {
165
- if ((Test-CommandLineSegmentRawScan -Segment $segment) -and
166
- $segment.ScanText.IndexOf('--merge', [System.StringComparison]::OrdinalIgnoreCase) -ge 0) {
167
- $hasMergeFlag = $true
168
- break
169
- }
170
- }
171
- }
172
- if (-not $isMergeInvocation -or -not $hasMergeFlag) {
149
+ # Scope (issue #952): every gh pr merge invocation except a pure --disable-auto, and every gh api
150
+ # merge or enqueue mutation, is gated; Test-EpicMergeGateCommandInScope holds the predicate.
151
+ if (-not (Test-EpicMergeGateCommandInScope -CommandText $command)) {
173
152
  return $null
174
153
  }
175
154
 
@@ -214,7 +193,7 @@ function Invoke-CodexEpicMergeDecision {
214
193
  hookSpecificOutput = [ordered]@{
215
194
  hookEventName = 'PreToolUse'
216
195
  permissionDecision = 'deny'
217
- permissionDecisionReason = 'EPIC_MERGE_GATE_BLOCKED: gh pr merge --merge requires a safe epic child checkpoint or a successful final epic CI gate with a matching PR number.'
196
+ permissionDecisionReason = 'EPIC_MERGE_GATE_BLOCKED: a pull-request merge or merge-queue enqueue (gh pr merge with any method, --auto, or --admin, or a gh api merge or enqueue mutation) requires a safe epic child checkpoint or a successful final epic CI gate with a matching PR number.'
218
197
  }
219
198
  }
220
199
  }
@@ -19,7 +19,8 @@
19
19
  is balanced; a structural gh pr merge; no inline
20
20
  VAR= prefix token (GH_REPO=, GH_HOST=); no
21
21
  single-dash token containing R; no --repo or
22
- --repo= token; no --auto token.
22
+ --repo= token; no --auto token; no token
23
+ containing /pull/ (a URL selector).
23
24
  M2 DOCS_ONLY_EXEMPTION_PR_UNRESOLVED - the worktree root is an existing directory.
24
25
  M3 DOCS_ONLY_EXEMPTION_PR_UNRESOLVED - gh pr view <N> --json baseRefName,headRefOid
25
26
  exits 0 and returns a JSON object; headRefOid
@@ -368,6 +369,9 @@ function Get-DocsOnlyMergeShapeViolation {
368
369
  if ($text -eq '--repo' -or $text.StartsWith('--repo=', [System.StringComparison]::OrdinalIgnoreCase)) {
369
370
  return $prefix + "the repository override '$text' is not accepted."
370
371
  }
372
+ if ($text.Contains('/pull/')) {
373
+ return $prefix + "the URL selector '$text' is not accepted."
374
+ }
371
375
  if ($text -eq '--auto' -or $text.StartsWith('--auto=', [System.StringComparison]::OrdinalIgnoreCase)) {
372
376
  return $prefix + 'auto-merge (--auto) is not eligible.'
373
377
  }
@@ -4,7 +4,9 @@ description: Run feature review and, if needed, remediation planning with execut
4
4
 
5
5
  $feature-review
6
6
  Use pr_context as authoritative if present and valid. Only fall back to an explicit base branch if pr_context is missing, stale, or ambiguous.
7
- If remediation is required, explicitly spawn atomic-planner to create or revise the remediation plan.
8
- Before atomic-planner finalizes the plan, it must explicitly spawn atomic-executor in preflight-validation-only mode against that same file.
9
- If atomic-executor returns PREFLIGHT: REVISIONS REQUIRED, atomic-planner must revise the same file and repeat until PREFLIGHT: ALL CLEAR.
10
- Only then finalize the remediation plan and report all generated artifacts.
7
+ If remediation is required, write exactly one mode line into the remediation inputs: `Remediation-Mode: proportionate` when every autonomous finding can be fixed without changing a spec acceptance criterion, a public interface, or the file inventory beyond the branch diff plus tests and mirrors, otherwise `Remediation-Mode: design`. CI-failure findings are normally proportionate.
8
+ Then explicitly spawn atomic-planner to create or revise the remediation plan.
9
+ Before atomic-planner finalizes the plan, it must explicitly spawn atomic-executor in preflight-validation-only mode against that same file, with the preflight directive in the delegation prompt and never in the plan file. Preflight is single-pass: trivial defects are fixed in place.
10
+ If atomic-executor returns PREFLIGHT: REVISIONS REQUIRED, atomic-planner must revise the same file once with the full PREFLIGHT-DEFECT list, and one confirming preflight runs; a second substantive result halts the cycle with `blocked_preflight_iteration_limit`.
11
+ For `Remediation-Mode: proportionate`, preflight and execution may run as one atomic-executor delegation that stops with `BLOCKED at preflight (before [P0-T1])` on a substantive defect, which converts the cycle to `Remediation-Mode: design`.
12
+ Only after PREFLIGHT: ALL CLEAR finalize the remediation plan and report all generated artifacts.
@@ -14,6 +14,7 @@
14
14
  ".agents/skills/epic-plan/SKILL.md",
15
15
  ".agents/skills/epic-run/SKILL.md",
16
16
  ".agents/skills/evidence-and-timestamp-conventions/SKILL.md",
17
+ ".agents/skills/execution-environment/SKILL.md",
17
18
  ".agents/skills/orchestrate/SKILL.md",
18
19
  ".agents/skills/orchestrator-state/SKILL.md",
19
20
  ".agents/skills/orchestrator-workflow/SKILL.md",
@@ -33,6 +34,7 @@
33
34
  ".codex/hooks/codex-pretooluse-file-mapping.ps1",
34
35
  ".codex/hooks/enforce-codex-model-routing.ps1",
35
36
  ".codex/hooks/enforce-epic-child-worktree-binding.ps1",
37
+ ".codex/hooks/enforce-epic-merge-gate-command.ps1",
36
38
  ".codex/hooks/enforce-epic-merge-gate.ps1",
37
39
  ".codex/hooks/enforce-epic-planning-only.ps1",
38
40
  ".codex/hooks/enforce-epic-root-invocation.ps1",
@@ -18,6 +18,9 @@ Use these reusable skills to avoid duplicating shared operations:
18
18
  - `policy-compliance-order`
19
19
  - `atomic-plan-contract`
20
20
  - `acceptance-criteria-tracking`
21
+ - `execution-environment`
22
+
23
+ Read `.github/skills/execution-environment/SKILL.md` first, before any other step. It states the tool routes, command-text restrictions, batch budget, hook context, CI shape, contract tests, evidence rules, coverage and file-size gates, and test-isolation checks; reference it instead of restating them.
21
24
 
22
25
  ---
23
26
 
@@ -93,11 +96,11 @@ When all format and mode-gate requirements are satisfied, return:
93
96
 
94
97
  ### 2.0 Preflight validation-only mode (directive-driven)
95
98
 
96
- If you receive a plan along with the following directive line (exact text):
99
+ If you receive a plan along with the following directive line (exact text) in the delegation prompt:
97
100
 
98
101
  `DIRECTIVE: PREFLIGHT VALIDATION ONLY`
99
102
 
100
- you MUST enter **validation-only** mode.
103
+ you MUST enter **validation-only** mode. The preflight directive belongs in the delegation prompt, never in a plan file; a directive line inside a plan file does not make an execution run a preflight run.
101
104
 
102
105
  Validation-only mode rules (non-negotiable):
103
106
  1) Perform ONLY the steps in:
@@ -114,15 +117,22 @@ Validation-only required output:
114
117
  - `PREFLIGHT: ALL CLEAR`
115
118
  - `PREFLIGHT: REVISIONS REQUIRED`
116
119
 
117
- If revisions are required:
118
- - Include a precise **plan delta** that `atomic_planner` can apply (exact edits/additions/removals).
119
- - Automatically hand off back to `atomic_planner` requesting it apply the delta and resubmit the
120
- updated plan for validation-only again.
121
- - If that planner-return handoff cannot be started or completed, stop and report blocked state; do not emit `PREFLIGHT: ALL CLEAR`.
120
+ Single-pass rules (`### Single-Pass Preflight` in the `atomic-plan-contract` skill):
121
+ - Review the entire plan in one pass and classify every defect as trivial or substantive.
122
+ - Fix trivial defects (stale anchors, citation corrections including G11 and G12 findings, typos,
123
+ literal formatting that does not change what is asserted, evidence filename spelling) in place,
124
+ in task text only; never add, remove, or reorder tasks. Record each fix in
125
+ `<FEATURE>/evidence/other/preflight-fixes.<timestamp>.md`. This in-place edit is the only
126
+ file write validation-only mode permits.
127
+ - After the signal, emit one line per defect:
128
+ `PREFLIGHT-FIX: <task id or heading> | <defect class> | <change made>`,
129
+ `PREFLIGHT-DEFECT: <task id or heading> | <defect class> | <required change>`, and
130
+ `preflight-fix-record: <path>` when at least one fix was made.
122
131
 
123
- Loop requirement:
124
- Continue this validate → delta → planner-revise → validate loop until you can return
125
- `PREFLIGHT: ALL CLEAR`.
132
+ If revisions are required:
133
+ - Include a precise **plan delta** that `atomic_planner` can apply (exact edits/additions/removals), with one `PREFLIGHT-DEFECT:` line for every substantive defect found.
134
+ - Return the result to the caller. A plan returns to the planner at most once; the orchestrator routes the full defect list for one revision and runs one confirming preflight.
135
+ - If the required handoff cannot be started or completed, stop and report blocked state; do not emit `PREFLIGHT: ALL CLEAR`.
126
136
 
127
137
  When the user provides a plan (in chat or via file path), you must:
128
138
 
@@ -208,7 +218,7 @@ At the end of each message, include an updated copy of the plan’s checklist (o
208
218
 
209
219
  ## 4. Blocking Protocol (When You Must Stop)
210
220
 
211
- Blocking is only permitted during **preflight validation (before [P0-T1])**. If any of the following are detected preflight, stop and request an updated plan from `atomic_planner`:
221
+ Blocking is only permitted during **preflight validation (before [P0-T1])**, including the preflight that opens a combined preflight-and-execute run of a proportionate remediation cycle (`Remediation-Mode: proportionate`). Trivial defects are fixed in place rather than blocked on. If any of the following substantive defects are detected preflight, stop and request an updated plan from `atomic_planner`:
212
222
  - The plan violates repo policy and cannot be executed as-written.
213
223
  - A task is non-atomic / non-verifiable (bucket task).
214
224
  - Required work exceeds task scope (needs additional independent outcomes).
@@ -18,6 +18,9 @@ You are a **planning-only agent**. Your job is to generate precise, executable p
18
18
  Use these reusable skills to avoid duplicating shared operations:
19
19
  - `policy-compliance-order`
20
20
  - `atomic-plan-contract`
21
+ - `execution-environment`
22
+
23
+ Read `.github/skills/execution-environment/SKILL.md` first, before any other step. It states the tool routes, command-text restrictions, batch budget, hook context, CI shape, contract tests, evidence rules, coverage and file-size gates, and test-isolation checks; plans reference it instead of restating them.
21
24
 
22
25
  Your output must always be structured, binary, and free of “work in progress” tasks.
23
26
 
@@ -102,9 +105,11 @@ For `minor-audit`, preflight-required plan gates MUST include baseline evidence,
102
105
 
103
106
  ---
104
107
 
105
- ### 2.5.1 Mandatory preflight validation loop via `atomic_executor`
108
+ ### 2.5.1 Mandatory single-pass preflight via `atomic_executor`
109
+
110
+ Follow `### Single-Pass Preflight` in the `atomic-plan-contract` skill. The preflight directive belongs in the delegation prompt, never in the plan file. The preflight executor fixes trivial defects in place and returns only substantive defects as `PREFLIGHT-DEFECT:` lines. A plan returns to the planner at most once: apply every listed change in one revision of the same file; if the confirming preflight still reports a substantive defect, the orchestrator halts with `blocked_reason: "validator_failed"`.
106
111
 
107
- Follow the preflight validation loop rules in the `atomic-plan-contract` skill.
112
+ Every plan follows `## Design-Level Plan Contract (Mandatory)` in the `atomic-plan-contract` skill: anchors are symbols, headings, or test names (never line numbers or commit SHAs), literals appear only where they are the asserted value, tool routes are not restated, a plan above 40 tasks or 400 lines carries `## Size Justification`, every plan carries a `## Pre-Mortem` section with the seven labels, and the final phase ends with the self-review task.
108
113
 
109
114
  If the `atomic_executor` delegation cannot be started, resumed, or completed, you MUST stop and report blocked state. You MUST NOT self-approve or finalize the plan.
110
115
 
@@ -537,7 +542,7 @@ When updating an existing file, preserve non-plan content (for example, problem
537
542
  When the calling system or handoff provides an explicit target plan file path (for example `${file}` or `${plan-path}`), you MUST:
538
543
 
539
544
  - Update that exact file in place.
540
- - Reuse that same file for every preflight revision iteration.
545
+ - Reuse that same file for the single permitted preflight revision.
541
546
  - Return the same path in `plan-path` outputs unless the caller explicitly changes it.
542
547
 
543
548
  You MUST NOT create additional timestamped sibling files (for example `plan.<timestamp>.md`) when an authoritative target path has been supplied.
@@ -95,11 +95,11 @@ When all format and mode-gate requirements are satisfied, return:
95
95
 
96
96
  ### 2.0 Preflight validation-only mode (directive-driven)
97
97
 
98
- If you receive a plan along with the following directive line (exact text):
98
+ If you receive a plan along with the following directive line (exact text) in the delegation prompt:
99
99
 
100
100
  `DIRECTIVE: PREFLIGHT VALIDATION ONLY`
101
101
 
102
- you MUST enter **validation-only** mode.
102
+ you MUST enter **validation-only** mode. The preflight directive belongs in the delegation prompt, never in a plan file; a directive line inside a plan file does not make an execution run a preflight run.
103
103
 
104
104
  Validation-only mode rules (non-negotiable):
105
105
  1) Perform ONLY the steps in:
@@ -116,14 +116,18 @@ Validation-only required output:
116
116
  - `PREFLIGHT: ALL CLEAR`
117
117
  - `PREFLIGHT: REVISIONS REQUIRED`
118
118
 
119
- If revisions are required:
120
- - Include a precise **plan delta** that `atomic_planner` can apply (exact edits/additions/removals).
121
- - Automatically hand off back to `atomic_planner` requesting it apply the delta and resubmit the
122
- updated plan for validation-only again.
119
+ Single-pass rules (`### Single-Pass Preflight` in the `atomic-plan-contract` skill):
120
+ - Review the entire plan in one pass and classify every defect as trivial or substantive.
121
+ - Fix trivial defects in place, in task text only; never add, remove, or reorder tasks. Record each
122
+ fix in `<FEATURE>/evidence/other/preflight-fixes.<timestamp>.md`. This in-place edit is the only file
123
+ write validation-only mode permits.
124
+ - After the signal, emit one line per defect: `PREFLIGHT-FIX: <task id or heading> | <defect class> | <change made>`,
125
+ `PREFLIGHT-DEFECT: <task id or heading> | <defect class> | <required change>`, and
126
+ `preflight-fix-record: <path>` when at least one fix was made.
123
127
 
124
- Loop requirement:
125
- Continue this validate → delta → planner-revise → validate loop until you can return
126
- `PREFLIGHT: ALL CLEAR`.
128
+ If revisions are required:
129
+ - Include a precise **plan delta** that `atomic_planner` can apply (exact edits/additions/removals), with one `PREFLIGHT-DEFECT:` line for every substantive defect found.
130
+ - Return the result to the caller. A plan returns to the planner at most once; the orchestrator routes the full defect list for one revision and runs one confirming preflight.
127
131
 
128
132
  When the user provides a plan (in chat or via file path), you must:
129
133
 
@@ -105,9 +105,9 @@ Branch-specific required task sets:
105
105
 
106
106
  ---
107
107
 
108
- ### 2.5.1 Mandatory preflight validation loop via `csharp-atomic-executor`
108
+ ### 2.5.1 Mandatory single-pass preflight via `csharp-atomic-executor`
109
109
 
110
- Follow the preflight validation loop rules in the `atomic-plan-contract` skill.
110
+ Follow `### Single-Pass Preflight` in the `atomic-plan-contract` skill. The preflight directive belongs in the delegation prompt, never in the plan file. The preflight executor fixes trivial defects in place and returns only substantive defects as `PREFLIGHT-DEFECT:` lines. A plan returns to the planner at most once: apply every listed change in one revision of the same file; if the confirming preflight still reports a substantive defect, the orchestrator halts with `blocked_reason: "validator_failed"`.
111
111
 
112
112
  ---
113
113
 
@@ -6,7 +6,7 @@ tools: [vscode/runCommand, vscode/extensions, execute/getTerminalOutput, execute
6
6
  handoffs:
7
7
  - label: Build minimal-audit atomic plan (preflight all clear)
8
8
  agent: atomic_planner
9
- prompt: "Generate a minimal-audit atomic plan for `${feature-folder}` using `${feature-folder}/issue.md` as the only requirements source (no spec/user-story/research). Use directive `DIRECTIVE: MINIMAL-AUDIT PLAN REQUIRED`. Target plan file path is `${plan-path}` and MUST be updated in place. Do NOT create additional `plan.*.md` siblings during drafting or preflight revision loops. The plan MUST include exactly 3 phases: Phase 0 baseline capture, Phase 1 placeholder for constrained small-path implementation work, Phase 2 final QC loop. Final-QC command tasks MUST be unconditional when present in the plan: do not add IN_SCOPE/OUT_OF_SCOPE branching and do not allow SKIPPED as a valid completion state for those tasks. Require validation-only preflight through `atomic_executor` and iterate until final `PREFLIGHT: ALL CLEAR` while preserving the same target path. Return `plan-path` and final preflight signal."
9
+ prompt: "Generate a minimal-audit atomic plan for `${feature-folder}` using `${feature-folder}/issue.md` as the only requirements source (no spec/user-story/research). Use directive `DIRECTIVE: MINIMAL-AUDIT PLAN REQUIRED`. Target plan file path is `${plan-path}` and MUST be updated in place. Do NOT create additional `plan.*.md` siblings during drafting or preflight revision loops. The plan MUST include exactly 3 phases: Phase 0 baseline capture, Phase 1 placeholder for constrained small-path implementation work, Phase 2 final QC loop. Final-QC command tasks MUST be unconditional when present in the plan: do not add IN_SCOPE/OUT_OF_SCOPE branching and do not allow SKIPPED as a valid completion state for those tasks. Require validation-only preflight through `atomic_executor` under the single-pass preflight rule (trivial defects fixed in place, at most one return to the planner) ending in `PREFLIGHT: ALL CLEAR` while preserving the same target path. Return `plan-path` and final preflight signal."
10
10
  send: true
11
11
  - label: Execute Phase 0 only
12
12
  agent: atomic_executor
@@ -38,7 +38,7 @@ handoffs:
38
38
  send: true
39
39
  - label: Build C# atomic plan (preflight all clear)
40
40
  agent: csharp-atomic-planning
41
- prompt: "You are csharp-atomic-planning.\n\nUse the prompt structure and requirements from `.github/prompts/generate-atomic-plan.prompt.md` as the canonical template.\nThe calling agent may provide a target plan path and full context package; use those exact paths/values.\n\nContext package:\n- objective + expected outcome\n- `${promotion-type}` and `${issue-num}` when available\n- `${feature-folder}`\n- `${feature-folder}/issue.md`\n- `${feature-folder}/spec.md`\n- `${feature-folder}/user-story.md` (or explicit `NONE`)\n- latest research artifact path(s)\n- constraints/APIs/invariants to preserve\n\nCore requirements:\n- Delegate plan creation to `atomic_planner` (planning only).\n- Require `atomic_planner` to run validation-only preflight through `atomic_executor` and iterate until final `PREFLIGHT: ALL CLEAR`.\n- Return the finalized plan path and final preflight signal; do not execute implementation."
41
+ prompt: "You are csharp-atomic-planning.\n\nUse the prompt structure and requirements from `.github/prompts/generate-atomic-plan.prompt.md` as the canonical template.\nThe calling agent may provide a target plan path and full context package; use those exact paths/values.\n\nContext package:\n- objective + expected outcome\n- `${promotion-type}` and `${issue-num}` when available\n- `${feature-folder}`\n- `${feature-folder}/issue.md`\n- `${feature-folder}/spec.md`\n- `${feature-folder}/user-story.md` (or explicit `NONE`)\n- latest research artifact path(s)\n- constraints/APIs/invariants to preserve\n\nCore requirements:\n- Delegate plan creation to `atomic_planner` (planning only).\n- Require `atomic_planner` to run validation-only preflight through `atomic_executor` under the single-pass preflight rule (trivial defects fixed in place, at most one return to the planner) ending in `PREFLIGHT: ALL CLEAR`.\n- Return the finalized plan path and final preflight signal; do not execute implementation."
42
42
  send: true
43
43
  - label: Execute approved C# atomic plan
44
44
  agent: csharp-atomic-executor
@@ -6,7 +6,7 @@ tools: [vscode, execute/testFailure, execute/getTerminalOutput, execute/killTerm
6
6
  handoffs:
7
7
  - label: Architecture + testability plan only (no edits)
8
8
  agent: csharp-atomic-planning
9
- prompt: "Create a plan ONLY (no implementation edits). Use `.github/prompts/generate-atomic-plan.prompt.md` as the planning contract and resolve it with concrete paths/inputs (`name`, `file`, `spec`, `user-story`, `research`) so there are no placeholders. Produce an executor-ready atomic plan with canonical `### Phase N — ...` headings, `- [ ] [P#-T#]` tasks, mandatory Phase 0 baseline capture, and mandatory final QA loop for all affected toolchains. Plan content must explicitly include: proposed class/module structure, minimal DI seams, MSTest scenario-level test strategy, Moq mock strategy, and exact files to change. After drafting, run the mandatory validation-only preflight loop through the C# planning chain and iterate until `PREFLIGHT: ALL CLEAR`, then return the finalized plan plus the final all-clear signal."
9
+ prompt: "Create a plan ONLY (no implementation edits). Use `.github/prompts/generate-atomic-plan.prompt.md` as the planning contract and resolve it with concrete paths/inputs (`name`, `file`, `spec`, `user-story`, `research`) so there are no placeholders. Produce an executor-ready atomic plan with canonical `### Phase N — ...` headings, `- [ ] [P#-T#]` tasks, mandatory Phase 0 baseline capture, and mandatory final QA loop for all affected toolchains. Plan content must explicitly include: proposed class/module structure, minimal DI seams, MSTest scenario-level test strategy, Moq mock strategy, and exact files to change. After drafting, run the mandatory single-pass validation-only preflight through the C# planning chain (trivial defects fixed in place, at most one return to the planner) ending in `PREFLIGHT: ALL CLEAR`, then return the finalized plan plus the final all-clear signal."
10
10
  send: true
11
11
  - label: Implement approved plan
12
12
  agent: csharp-atomic-executor
@@ -94,7 +94,7 @@ If any required item is missing in orchestrator handoff mode, STOP and request t
94
94
  When in **Orchestrator handoff mode**, this agent MUST run the following delegation chain and MUST NOT bypass it with direct implementation:
95
95
 
96
96
  1) Delegate to `csharp-atomic-planning` (handoff: **Architecture + testability plan only (no edits)**).
97
- 2) Require planner output to include final `PREFLIGHT: ALL CLEAR` from the preflight validation loop.
97
+ 2) Require planner output to include final `PREFLIGHT: ALL CLEAR` from single-pass preflight.
98
98
  3) Delegate plan execution to `csharp-atomic-executor` (handoff: **Implement approved plan**).
99
99
  4) Delegate final QA to `csharp-atomic-executor` (handoff: **Post-change QA gate (format + analyze + build + tests + coverage)**).
100
100
  5) Delegate post-implementation review to `feature_code_review_agent` (handoff: **Post-implementation feature review**).
@@ -205,7 +205,7 @@ The plan should include:
205
205
  - Exact files to change (must satisfy scope guardrails).
206
206
 
207
207
  Orchestrator handoff mode requirement:
208
- - Even if a draft plan is supplied, delegate to `csharp-atomic-planning` to normalize/validate the plan and run the mandatory preflight validation loop to `PREFLIGHT: ALL CLEAR` before any implementation delegation.
208
+ - Even if a draft plan is supplied, delegate to `csharp-atomic-planning` to normalize/validate the plan and run mandatory single-pass preflight to `PREFLIGHT: ALL CLEAR` before any implementation delegation.
209
209
 
210
210
  Orchestrator handoff mode hard stop:
211
211
  - In this mode, ignore implicit approval shortcuts for direct local execution.
@@ -6,7 +6,7 @@ tools: [vscode/runCommand, vscode/extensions, execute, read, agent, edit, search
6
6
  handoffs:
7
7
  - label: Build minimal-audit atomic plan (preflight all clear)
8
8
  agent: atomic_planner
9
- prompt: "Generate a minimal-audit atomic plan for `${feature-folder}` using `${feature-folder}/issue.md` as the only requirements source (no spec/user-story/research). Use directive `DIRECTIVE: MINIMAL-AUDIT PLAN REQUIRED`. Target plan file path is `${plan-path}` and MUST be updated in place. Do NOT create additional `plan.*.md` siblings during drafting or preflight revision loops. The plan MUST include exactly 3 phases: Phase 0 baseline capture, Phase 1 placeholder for constrained small-path implementation work, Phase 2 final QC loop. Final-QC command tasks MUST be unconditional when present in the plan: do not add IN_SCOPE/OUT_OF_SCOPE branching and do not allow SKIPPED as a valid completion state for those tasks. Require validation-only preflight through `atomic_executor` and iterate until final `PREFLIGHT: ALL CLEAR` while preserving the same target path. Return `plan-path` and final preflight signal."
9
+ prompt: "Generate a minimal-audit atomic plan for `${feature-folder}` using `${feature-folder}/issue.md` as the only requirements source (no spec/user-story/research). Use directive `DIRECTIVE: MINIMAL-AUDIT PLAN REQUIRED`. Target plan file path is `${plan-path}` and MUST be updated in place. Do NOT create additional `plan.*.md` siblings during drafting or preflight revision loops. The plan MUST include exactly 3 phases: Phase 0 baseline capture, Phase 1 placeholder for constrained small-path implementation work, Phase 2 final QC loop. Final-QC command tasks MUST be unconditional when present in the plan: do not add IN_SCOPE/OUT_OF_SCOPE branching and do not allow SKIPPED as a valid completion state for those tasks. Require single-pass validation-only preflight through `atomic_executor` (trivial defects fixed in place, at most one return to the planner) ending in `PREFLIGHT: ALL CLEAR` while preserving the same target path. Return `plan-path` and final preflight signal."
10
10
  send: true
11
11
  - label: Execute Phase 0 only
12
12
  agent: atomic_executor
@@ -38,7 +38,7 @@ handoffs:
38
38
  send: true
39
39
  - label: Build atomic plan (preflight all clear)
40
40
  agent: atomic_planner
41
- prompt: "You are atomic_planner.\n\nUse the prompt structure and requirements from `.github/prompts/generate-atomic-plan.prompt.md` as the canonical template.\nThe calling agent provides a REQUIRED target plan path `${plan-path}`; update this file in place and do NOT create additional `plan.*.md` siblings during drafting or preflight revision loops.\n\nContext package:\n- objective + expected outcome\n- `${promotion-type}` and `${issue-num}` when available\n- `${feature-folder}`\n- `${feature-folder}/issue.md`\n- `${feature-folder}/spec.md`\n- `${feature-folder}/user-story.md` (or explicit `NONE`)\n- latest research artifact path(s)\n- constraints/APIs/invariants to preserve\n\nCore requirements:\n- Generate a deterministic phased atomic plan (planning only).\n- Require validation-only preflight through `atomic_executor` and iterate until final `PREFLIGHT: ALL CLEAR` while preserving the same target path `${plan-path}`.\n- Plan MUST include explicit coverage-bearing baseline and final-QC testing tasks for each language in scope where policy requires coverage; coverage MUST NOT be left as UNVERIFIED for PASS outcomes.\n- Return the finalized plan path and final preflight signal; do not execute implementation."
41
+ prompt: "You are atomic_planner.\n\nUse the prompt structure and requirements from `.github/prompts/generate-atomic-plan.prompt.md` as the canonical template.\nThe calling agent provides a REQUIRED target plan path `${plan-path}`; update this file in place and do NOT create additional `plan.*.md` siblings during drafting or preflight revision loops.\n\nContext package:\n- objective + expected outcome\n- `${promotion-type}` and `${issue-num}` when available\n- `${feature-folder}`\n- `${feature-folder}/issue.md`\n- `${feature-folder}/spec.md`\n- `${feature-folder}/user-story.md` (or explicit `NONE`)\n- latest research artifact path(s)\n- constraints/APIs/invariants to preserve\n\nCore requirements:\n- Generate a deterministic phased atomic plan (planning only).\n- Require single-pass validation-only preflight through `atomic_executor` (trivial defects fixed in place, at most one return to the planner) ending in `PREFLIGHT: ALL CLEAR` while preserving the same target path `${plan-path}`.\n- Follow the design-level plan contract and include a `## Pre-Mortem` section.\n- Plan MUST include explicit coverage-bearing baseline and final-QC testing tasks for each language in scope where policy requires coverage; coverage MUST NOT be left as UNVERIFIED for PASS outcomes.\n- Return the finalized plan path and final preflight signal; do not execute implementation."
42
42
  send: true
43
43
  - label: Execute approved atomic plan
44
44
  agent: atomic_executor
@@ -88,6 +88,9 @@ Use these reusable skills to avoid duplicating shared operations:
88
88
  - `repo-automation-adapter`
89
89
  - `atomic-plan-contract`
90
90
  - `acceptance-criteria-tracking`
91
+ - `execution-environment`
92
+
93
+ Read `.github/skills/execution-environment/SKILL.md` first, before any delegation. It states the tool routes, command-text restrictions, batch budget, hook context, CI shape, contract tests, evidence rules, coverage and file-size gates, and test-isolation checks; delegation prompts reference it instead of restating them.
91
94
 
92
95
  # Non-negotiable mission behavior
93
96
 
@@ -378,9 +381,9 @@ Apply this exact loop after the first feature-review result and after every re-r
378
381
  - `REVIEW_STATUS: REMEDIATION_REQUIRED`
379
382
  - `REMEDIATION_INPUTS: <path>`
380
383
  - `REMEDIATION_PLAN: <path>`
381
- 2. Persist `${review-status}`, `${remediation-inputs-path}`, `${remediation-plan-path}`, and `${remediation-pass}` in the checkpoint.
382
- 3. Delegate handoff **Preflight remediation plan clearance** against `${remediation-plan-path}`.
383
- 4. If preflight returns `PREFLIGHT: REVISIONS REQUIRED`, delegate handoff **Revise remediation plan in place** and then repeat Step 3 against the same `${remediation-plan-path}` until the terminal signal is `PREFLIGHT: ALL CLEAR`.
384
+ 2. Persist `${review-status}`, `${remediation-inputs-path}`, `${remediation-plan-path}`, and `${remediation-pass}` in the checkpoint. Confirm that `${remediation-inputs-path}` carries exactly one line `Remediation-Mode: proportionate` or `Remediation-Mode: design`: proportionate when every autonomous finding can be fixed without changing a spec acceptance criterion, a public interface, or the file inventory beyond the branch diff plus tests and mirrors (CI-failure findings are normally proportionate), otherwise design.
385
+ 3. Delegate handoff **Preflight remediation plan clearance** against `${remediation-plan-path}`, with the preflight directive in the handoff prompt only. Preflight is single-pass: trivial defects are fixed in place. For `Remediation-Mode: proportionate`, the clearance and execution may run as one executor delegation that stops with `BLOCKED at preflight (before [P0-T1])` on a substantive defect; that converts the cycle to `Remediation-Mode: design`.
386
+ 4. If preflight returns `PREFLIGHT: REVISIONS REQUIRED`, delegate handoff **Revise remediation plan in place** once with the full `PREFLIGHT-DEFECT:` list and then run Step 3 once more against the same `${remediation-plan-path}`. If that confirming preflight still reports a substantive defect, record `blocked_preflight_iteration_limit` and stop; a plan returns to the planner at most once.
384
387
  5. Delegate handoff **Execute remediation plan** only after the exact preflight signal is `PREFLIGHT: ALL CLEAR`.
385
388
  6. Stage all files with `git add -A`.
386
389
  7. Do not continue unless staged changes now exist. If staging is empty, stop and record blocked state because remediation execution did not produce a commit-ready delta.