@danmoisan/drm-copilot-mcp 1.1.16 → 1.1.18

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 (105) hide show
  1. package/out/mcp-server.js +1139 -133
  2. package/package.json +4 -3
  3. package/resources/claude-customizations/.claude/agents/feature-review.md +10 -1
  4. package/resources/claude-customizations/.claude/agents/orchestrator.md +16 -3
  5. package/resources/claude-customizations/.claude/agents/parallel-orchestrator.md +18 -6
  6. package/resources/claude-customizations/.claude/agents/python-typed-engineer.md +3 -3
  7. package/resources/claude-customizations/.claude/hooks/{enforce-powershell-batch-budget-route.ps1 → enforce-batch-budget-route.ps1} +12 -10
  8. package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate-resolution.ps1 +221 -0
  9. package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate.ps1 +42 -66
  10. package/resources/claude-customizations/.claude/hooks/enforce-epic-wave-barrier.ps1 +58 -10
  11. package/resources/claude-customizations/.claude/hooks/enforce-epic-worktree-removal-gate-resolution.ps1 +144 -0
  12. package/resources/claude-customizations/.claude/hooks/enforce-epic-worktree-removal-gate.ps1 +36 -47
  13. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate-epic-scope.ps1 +179 -27
  14. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate.ps1 +21 -38
  15. package/resources/claude-customizations/.claude/hooks/enforce-parallel-abandon-gate.ps1 +4 -4
  16. package/resources/claude-customizations/.claude/hooks/enforce-parallel-cohort-barrier.ps1 +58 -10
  17. package/resources/claude-customizations/.claude/hooks/enforce-parallel-drift-gate.ps1 +59 -9
  18. package/resources/claude-customizations/.claude/hooks/enforce-parallel-worktree-removal-gate.ps1 +114 -37
  19. package/resources/claude-customizations/.claude/hooks/enforce-powershell-batch-budget.ps1 +3 -3
  20. package/resources/claude-customizations/.claude/hooks/enforce-python-batch-budget.ps1 +99 -64
  21. package/resources/claude-customizations/.claude/lib/bash/abandon-parallel-item.sh +176 -0
  22. package/resources/claude-customizations/.claude/lib/bash/parallel-lane-assertion.sh +4 -2
  23. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusConflict.psm1 +193 -14
  24. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusGlob.psm1 +51 -28
  25. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusScheduling.psm1 +5 -8
  26. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorState.psm1 +6 -13
  27. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateIssueAdoption.psm1 +375 -0
  28. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateReceipts.psm1 +22 -15
  29. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateRemediationAccounting.psm1 +337 -0
  30. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateRoutingContract.psm1 +9 -1
  31. package/resources/claude-customizations/.claude/lib/parallel-drift/Invoke-ParallelDriftDetection.ps1 +336 -0
  32. package/resources/claude-customizations/.claude/lib/parallel-drift/ParallelDrift.psm1 +467 -0
  33. package/resources/claude-customizations/.claude/lib/parallel-drift/ParallelDriftHalt.psm1 +388 -0
  34. package/resources/claude-customizations/.claude/lib/worktree-resolution/EpicScopeResolution.psm1 +53 -32
  35. package/resources/claude-customizations/.claude/lib/worktree-resolution/WorktreeItemResolution.psm1 +19 -4
  36. package/resources/claude-customizations/.claude/lib/worktree-resolution/WorktreeRunResolution.psm1 +497 -0
  37. package/resources/claude-customizations/.claude/rules/orchestrator-state.md +119 -3
  38. package/resources/claude-customizations/.claude/rules/parallel-orchestration.md +21 -0
  39. package/resources/claude-customizations/.claude/rules/quality-tiers.md +1 -1
  40. package/resources/claude-customizations/.claude/skills/acceptance-criteria-tracking/SKILL.md +8 -0
  41. package/resources/claude-customizations/.claude/skills/atomic-plan-contract/SKILL.md +2 -0
  42. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/SKILL.md +11 -3
  43. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/scripts/cleanup-worktrees.sh +11 -2
  44. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/scripts/cleanup_worktrees_enumerate_lib.sh +169 -5
  45. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/scripts/cleanup_worktrees_preserve_lib.sh +1 -1
  46. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/scripts/cleanup_worktrees_report_records_lib.sh +6 -43
  47. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/scripts/cleanup_worktrees_scan_helper.sh +4 -15
  48. package/resources/claude-customizations/.claude/skills/epic-orchestrate/SKILL.md +15 -6
  49. package/resources/claude-customizations/.claude/skills/evidence-and-timestamp-conventions/SKILL.md +4 -0
  50. package/resources/claude-customizations/.claude/skills/feature-promotion-lifecycle/SKILL.md +10 -0
  51. package/resources/claude-customizations/.claude/skills/feature-review-workflow/SKILL.md +3 -1
  52. package/resources/claude-customizations/.claude/skills/invoke-csharp-engineer/SKILL.md +4 -0
  53. package/resources/claude-customizations/.claude/skills/invoke-powershell-engineer/SKILL.md +4 -0
  54. package/resources/claude-customizations/.claude/skills/invoke-python-engineer/SKILL.md +6 -3
  55. package/resources/claude-customizations/.claude/skills/orchestrate/SKILL.md +33 -13
  56. package/resources/claude-customizations/.claude/skills/parallel-orchestrate/SKILL.md +50 -21
  57. package/resources/claude-customizations/.claude/skills/parallel-remove/SKILL.md +10 -10
  58. package/resources/claude-customizations/.claude/skills/python-change-budget-router/SKILL.md +11 -35
  59. package/resources/claude-customizations/.claude/skills/remediation-handoff-atomic-planner/SKILL.md +5 -1
  60. package/resources/claude-customizations/pack-manifests/core.json +10 -0
  61. package/resources/claude-customizations/pack-manifests/powershell.json +0 -1
  62. package/resources/codex-and-agents-customizations/.agents/skills/acceptance-criteria-tracking/SKILL.md +8 -0
  63. package/resources/codex-and-agents-customizations/.agents/skills/epic-orchestrate/SKILL.md +5 -3
  64. package/resources/codex-and-agents-customizations/.agents/skills/evidence-and-timestamp-conventions/SKILL.md +4 -0
  65. package/resources/codex-and-agents-customizations/.agents/skills/feature-promotion-lifecycle/SKILL.md +1 -1
  66. package/resources/codex-and-agents-customizations/.agents/skills/feature-review/SKILL.md +30 -6
  67. package/resources/codex-and-agents-customizations/.agents/skills/feature-review-workflow/SKILL.md +3 -1
  68. package/resources/codex-and-agents-customizations/.agents/skills/invoke-powershell-engineer/SKILL.md +0 -1
  69. package/resources/codex-and-agents-customizations/.agents/skills/invoke-python-engineer/SKILL.md +2 -3
  70. package/resources/codex-and-agents-customizations/.agents/skills/orchestrate/SKILL.md +30 -7
  71. package/resources/codex-and-agents-customizations/.agents/skills/orchestrator-state/SKILL.md +41 -2
  72. package/resources/codex-and-agents-customizations/.agents/skills/orchestrator-workflow/SKILL.md +18 -3
  73. package/resources/codex-and-agents-customizations/.agents/skills/python-change-budget-router/SKILL.md +10 -34
  74. package/resources/codex-and-agents-customizations/.agents/skills/quality-tiers/SKILL.md +1 -1
  75. package/resources/codex-and-agents-customizations/.agents/skills/remediation-handoff-atomic-planner/SKILL.md +2 -0
  76. package/resources/codex-and-agents-customizations/.codex/agents/feature-reviewer-c1.toml +1 -0
  77. package/resources/codex-and-agents-customizations/.codex/agents/feature-reviewer-c2.toml +1 -0
  78. package/resources/codex-and-agents-customizations/.codex/agents/feature-reviewer-c3-elevated.toml +1 -0
  79. package/resources/codex-and-agents-customizations/.codex/agents/feature-reviewer-c3.toml +1 -0
  80. package/resources/codex-and-agents-customizations/.codex/agents/feature-reviewer-c4.toml +1 -0
  81. package/resources/codex-and-agents-customizations/.codex/agents/feature-reviewer.toml +1 -0
  82. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c1.toml +1 -1
  83. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c2.toml +1 -1
  84. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c3-elevated.toml +1 -1
  85. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c3.toml +1 -1
  86. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c4.toml +1 -1
  87. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator.toml +1 -1
  88. package/resources/codex-and-agents-customizations/.codex/agents/python-orchestrator.toml +2 -2
  89. package/resources/codex-and-agents-customizations/.codex/agents/python-typed-engineer-c1.toml +3 -3
  90. package/resources/codex-and-agents-customizations/.codex/agents/python-typed-engineer-c2.toml +3 -3
  91. package/resources/codex-and-agents-customizations/.codex/agents/python-typed-engineer-c3-elevated.toml +3 -3
  92. package/resources/codex-and-agents-customizations/.codex/agents/python-typed-engineer-c3.toml +3 -3
  93. package/resources/codex-and-agents-customizations/.codex/agents/python-typed-engineer-c4.toml +3 -3
  94. package/resources/codex-and-agents-customizations/.codex/agents/python-typed-engineer.toml +3 -3
  95. package/resources/codex-and-agents-customizations/.codex/config.toml +1 -1
  96. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-batch-budget-route.ps1 +139 -0
  97. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-powershell-batch-budget.ps1 +4 -124
  98. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-python-batch-budget.ps1 +169 -79
  99. package/resources/codex-and-agents-customizations/pack-manifests/core.json +1 -0
  100. package/resources/customizations/.github/agents/python-orchestrator.agent.md +4 -4
  101. package/resources/customizations/.github/agents/python-typed-engineer.agent.md +7 -8
  102. package/resources/customizations/.github/prompts/orchestrate-python-work.prompt.md +3 -3
  103. package/resources/customizations/.github/skills/acceptance-criteria-tracking/SKILL.md +8 -0
  104. package/resources/customizations/.github/skills/evidence-and-timestamp-conventions/SKILL.md +4 -0
  105. package/resources/powershell/PoshQC/settings/pester.runsettings.psd1 +16 -1
@@ -22,14 +22,17 @@
22
22
  ".claude/agents/staged-review.md",
23
23
  ".claude/agents/status-updater.md",
24
24
  ".claude/agents/task-researcher.md",
25
+ ".claude/hooks/enforce-batch-budget-route.ps1",
25
26
  ".claude/hooks/enforce-checkpoint-monotonic.ps1",
26
27
  ".claude/hooks/enforce-completion-consistency.ps1",
27
28
  ".claude/hooks/enforce-discovery-artifact-gate.ps1",
28
29
  ".claude/hooks/enforce-epic-invocation-origin.ps1",
29
30
  ".claude/hooks/enforce-epic-merge-gate.ps1",
30
31
  ".claude/hooks/enforce-epic-merge-gate-authorization.ps1",
32
+ ".claude/hooks/enforce-epic-merge-gate-resolution.ps1",
31
33
  ".claude/hooks/enforce-epic-wave-barrier.ps1",
32
34
  ".claude/hooks/enforce-epic-worktree-removal-gate.ps1",
35
+ ".claude/hooks/enforce-epic-worktree-removal-gate-resolution.ps1",
33
36
  ".claude/hooks/enforce-evidence-locations.ps1",
34
37
  ".claude/hooks/enforce-feature-folder-order.ps1",
35
38
  ".claude/hooks/enforce-model-routing-receipt.ps1",
@@ -133,12 +136,14 @@
133
136
  ".claude/lib/orchestrator-state/OrchestratorStateCompletion.psm1",
134
137
  ".claude/lib/orchestrator-state/OrchestratorStateCheckpointValue.psm1",
135
138
  ".claude/lib/orchestrator-state/OrchestratorStateReceipts.psm1",
139
+ ".claude/lib/orchestrator-state/OrchestratorStateRemediationAccounting.psm1",
136
140
  ".claude/lib/orchestrator-state/OrchestratorStateModelReceipts.psm1",
137
141
  ".claude/lib/orchestrator-state/OrchestratorStateCodexModelReceipts.psm1",
138
142
  ".claude/lib/orchestrator-state/OrchestratorStateCodexTopologyReceipts.psm1",
139
143
  ".claude/lib/orchestrator-state/OrchestratorStateRoutingMatrix.psm1",
140
144
  ".claude/lib/orchestrator-state/OrchestratorStateCompletionChecks.psm1",
141
145
  ".claude/lib/orchestrator-state/OrchestratorStateRoutingContract.psm1",
146
+ ".claude/lib/orchestrator-state/OrchestratorStateIssueAdoption.psm1",
142
147
  ".claude/lib/orchestrator-state/OrchestratorStateUnconditional.psm1",
143
148
  ".claude/lib/discovery-validation/DiscoveryValidation.psm1",
144
149
  ".claude/lib/codex-routing/CodexDeployment.psm1",
@@ -158,8 +163,12 @@
158
163
  ".claude/lib/project-file-merge/ProjectFileMerge.psm1",
159
164
  ".claude/lib/project-file-merge/Resolve-MergeableConflict.ps1",
160
165
  ".claude/lib/ci-gate/Invoke-CiGateParser.ps1",
166
+ ".claude/lib/parallel-drift/ParallelDriftHalt.psm1",
167
+ ".claude/lib/parallel-drift/ParallelDrift.psm1",
168
+ ".claude/lib/parallel-drift/Invoke-ParallelDriftDetection.ps1",
161
169
  ".claude/rules/parallel-orchestration.md",
162
170
  ".claude/rules/shell.md",
171
+ ".claude/lib/bash/abandon-parallel-item.sh",
163
172
  ".claude/lib/bash/compute-cohorts.sh",
164
173
  ".claude/lib/bash/compute-concurrency-batches.sh",
165
174
  ".claude/lib/bash/parallel-cohorts.sh",
@@ -185,6 +194,7 @@
185
194
  ".claude/lib/worktree-resolution/WorktreeItemResolution.psm1",
186
195
  ".claude/lib/worktree-resolution/EpicScopeResolution.psm1",
187
196
  ".claude/lib/worktree-resolution/EpicScopeReadiness.psm1",
197
+ ".claude/lib/worktree-resolution/WorktreeRunResolution.psm1",
188
198
  ".claude/skills/mermaid-diagram/references/flowchart.md",
189
199
  ".claude/skills/mermaid-diagram/references/sequence.md",
190
200
  ".claude/skills/mermaid-diagram/references/class.md",
@@ -6,7 +6,6 @@
6
6
  ".claude/agents/powershell-typed-engineer.md",
7
7
  ".claude/hooks/check-powershell-test-purity.ps1",
8
8
  ".claude/hooks/enforce-powershell-batch-budget.ps1",
9
- ".claude/hooks/enforce-powershell-batch-budget-route.ps1",
10
9
  ".claude/skills/invoke-powershell-engineer/SKILL.md",
11
10
  ".claude/skills/powershell-change-budget-router/SKILL.md",
12
11
  ".claude/skills/powershell-orchestration-state-machine/SKILL.md",
@@ -68,6 +68,14 @@ During plan execution, after completing a task whose work satisfies an acceptanc
68
68
 
69
69
  Timing: Check off AC items as soon as the corresponding plan task passes verification — do not defer all AC updates to the end of plan execution.
70
70
 
71
+ ### CI-Dependent Criteria
72
+
73
+ A CI-dependent criterion is one whose verification requires the result of CI on the PR head. It cannot be verified before the pull request exists, so it stays unchecked and is listed as pending-CI in the AC verification artifact until CI has run.
74
+
75
+ - Owner: the item's own orchestrator run owns the check-off and performs it at S9; this is the one case in which an orchestrator run checks off AC. A parent or coordinating session never commits the check-off from its own root.
76
+ - Timing: after the CI green gate (S9) records `ci_gate.conclusion` as `success`, and before the run reports DONE.
77
+ - Push and re-verify: the check-off is committed in the item's own worktree and pushed to the PR branch, and the CI green gate is re-run against the new head SHA so that `ci_gate.head_sha` equals the final PR head before DONE.
78
+
71
79
  ### When Reviewers Check Off AC
72
80
 
73
81
  During feature review (feature-audit phase):
@@ -112,9 +112,11 @@ authoritative backstop.
112
112
 
113
113
  Each child owns its implementation, review, PR, CI-green gate, and merge into the integration
114
114
  branch. A merge conflict enters that child's existing remediation loop with a blocking
115
- `remediation-inputs.<timestamp>.md`. After three unresolved passes, record
116
- `blocked_conflict_loop_limit` and stop that edge. The epic agent must not resolve child conflicts
117
- locally.
115
+ `remediation-inputs.<timestamp>.md`. Conflict cycles share the child's attempt count,
116
+ `remediation_loop.completed_attempts`. The active cycle number is `completed_attempts + 1`, and a
117
+ cycle without an applied candidate consumes no number. After three completed attempts without a
118
+ `PASS` review, record `blocked_conflict_loop_limit` and stop that edge. The epic agent must not
119
+ resolve child conflicts locally.
118
120
 
119
121
  ## Worktree Cleanup
120
122
 
@@ -48,6 +48,8 @@ Use this skill when:
48
48
  Use `yyyy-MM-ddTHH-mm` for all audit, remediation, and evidence artifacts.
49
49
  Example: `2026-02-06T14-30`.
50
50
 
51
+ The `Timestamp` value is local time read from the host system clock when the recorded command runs (for example `Get-Date -Format yyyy-MM-ddTHH-mm`); the agent never composes or estimates it.
52
+
51
53
  ## Canonical Evidence Locations
52
54
 
53
55
  - Baseline evidence: `evidence/baseline/`
@@ -112,6 +114,8 @@ When evidence artifacts are used for automated checking or plan reconciliation,
112
114
  - `Command: <exact command>`
113
115
  - `EXIT_CODE: <int>`
114
116
 
117
+ The first occurrence of `Timestamp`, `Command`, `EXIT_CODE`, and `ExpectedExitCode` forms the record in both the Python and the TypeScript parser; later occurrences, including empty later values, are ignored. An artifact that records several gates therefore reports its first gate.
118
+
115
119
  One optional field may also be declared:
116
120
  - `ExpectedExitCode: <int>` — the exit code the gate is expected to produce.
117
121
 
@@ -83,7 +83,7 @@ Lifecycle guardrails:
83
83
 
84
84
  4) Create the potential entry through `mcp__drm-copilot__new_potential_entry` or `mcp__drm-copilot__new_potential_bug_entry`.
85
85
 
86
- 5) Promote the potential document through `mcp__drm-copilot__potential_to_issue` with the selected `${work-mode}` and capture the numeric `${issue-num}`.
86
+ 5) Promote the potential document through `mcp__drm-copilot__potential_to_issue` with the selected `${work-mode}` and capture the numeric `${issue-num}`. When the issue already exists, do not call `potential_to_issue`; verify the issue read-only and record `issue_adoption` with the existing number as `${issue-num}`.
87
87
 
88
88
  6) Rename the branch to the final branch:
89
89
  - `${final-branch}`
@@ -34,11 +34,11 @@ Write timestamped artifacts into the active feature folder:
34
34
  - `policy-audit.<timestamp>.md`
35
35
  - `code-review.<timestamp>.md`
36
36
  - `feature-audit.<timestamp>.md`
37
- - `remediation-inputs.<timestamp>.md` when remediation is required
38
- - `remediation-plan.<timestamp>.md` when remediation is required
37
+ - `remediation-inputs.<timestamp>.md` for every review with at least one blocking finding, including `HALT_NON_REMEDIABLE` and `AWAITING_CI` reviews
38
+ - `remediation-plan.<timestamp>.md` only when the verdict is `REMEDIATION_REQUIRED`
39
39
 
40
40
  The final review report MUST end with these exact single-line fields:
41
- - `REVIEW_STATUS: PASS` or `REVIEW_STATUS: REMEDIATION_REQUIRED`
41
+ - `REVIEW_STATUS: PASS`, `REVIEW_STATUS: REMEDIATION_REQUIRED`, `REVIEW_STATUS: HALT_NON_REMEDIABLE`, or `REVIEW_STATUS: AWAITING_CI`
42
42
  - `FEATURE_FOLDER: <path>`
43
43
  - `POLICY_AUDIT: <path>`
44
44
  - `CODE_REVIEW: <path>`
@@ -46,6 +46,28 @@ The final review report MUST end with these exact single-line fields:
46
46
  - `REMEDIATION_INPUTS: <path-or-NONE>`
47
47
  - `REMEDIATION_PLAN: <path-or-NONE>`
48
48
 
49
+ `HALT_NON_REMEDIABLE` and `AWAITING_CI` require `REMEDIATION_PLAN: NONE`.
50
+
51
+ ### Remediability Contract
52
+
53
+ Every blocking finding receives exactly one remediability class (exact, case-sensitive):
54
+ - `autonomous`: repository remediation can resolve the finding without a human decision. This is the default when a finding block carries no remediability line.
55
+ - `external_dependency`: a system, service, runtime, or published artifact outside the repository is unavailable or mismatched.
56
+ - `policy_hold`: proceeding requires a policy decision, exception, or authorization the orchestrator may not grant.
57
+ - `awaiting_ci`: the finding resolves when a CI result that has not completed becomes available.
58
+ - `human_decision_required`: a human must choose between alternatives or approve a direction.
59
+
60
+ A published MCP runtime that lags the repository contract is classified `external_dependency`.
61
+
62
+ The verdict follows from the classes of all blocking findings: no blocking findings is `PASS`; at least one `autonomous` finding is `REMEDIATION_REQUIRED`; otherwise at least one `external_dependency`, `policy_hold`, or `human_decision_required` finding is `HALT_NON_REMEDIABLE`; otherwise every finding is `awaiting_ci` and the verdict is `AWAITING_CI`.
63
+
64
+ The remediation inputs file carries these line formats:
65
+ - one line `Review-Verdict: <VERDICT>` for the review,
66
+ - inside each blocking finding block, one line `Remediability: <class>`,
67
+ - inside each blocking finding block, one line `Remediability-Evidence: <text>` stating why the class applies.
68
+
69
+ These lines, including the evidence text, never contain the substrings the orchestrator counts when it counts blocking findings, so their presence does not change the blocking count.
70
+
49
71
  Each required review artifact MUST pass the matching validator command before review can be reported as complete:
50
72
  - the `validate_orchestration_artifacts` MCP tool with `artifact_type: "policy-audit"` and `artifact_path: <path>`
51
73
  - the `validate_orchestration_artifacts` MCP tool with `artifact_type: "code-review"` and `artifact_path: <path>`
@@ -63,10 +85,12 @@ Each required review artifact MUST pass the matching validator command before re
63
85
  5. Create the policy audit, code review, and feature audit.
64
86
  - validate each artifact immediately after writing it
65
87
  6. Check off passing acceptance criteria in the authoritative requirement sources per `acceptance-criteria-tracking`.
66
- 7. If remediation is required, create remediation inputs first and then hand off plan creation using `remediation-handoff-atomic-planner`.
88
+ 7. Classify every blocking finding per the Remediability Contract. Remediation is required only when at least one blocking finding is `autonomous`. If remediation is required, create remediation inputs first and then hand off plan creation using `remediation-handoff-atomic-planner`. When every blocking finding is non-remediable, write the remediation inputs, report `HALT_NON_REMEDIABLE` or `AWAITING_CI` with `REMEDIATION_PLAN: NONE`, create no remediation plan target, and do not hand off to `atomic-planner`.
67
89
  8. In the final report:
68
- - set `REVIEW_STATUS: PASS` only when no remediation artifact is required,
69
- - set `REVIEW_STATUS: REMEDIATION_REQUIRED` when remediation inputs or a remediation plan were required,
90
+ - set `REVIEW_STATUS: PASS` only when no blocking finding exists,
91
+ - set `REVIEW_STATUS: REMEDIATION_REQUIRED` when at least one blocking finding is `autonomous`,
92
+ - set `REVIEW_STATUS: HALT_NON_REMEDIABLE` when no blocking finding is `autonomous` and at least one is `external_dependency`, `policy_hold`, or `human_decision_required`,
93
+ - set `REVIEW_STATUS: AWAITING_CI` when every blocking finding is `awaiting_ci`,
70
94
  - include every required artifact-path field exactly once.
71
95
 
72
96
  ### Enforced Remediation Handoff Contract
@@ -136,6 +136,8 @@ Always apply:
136
136
  - required acceptance criteria are FAIL or PARTIAL
137
137
  - coverage regression below policy threshold (< 80% repo-wide per language, < 80% or regression for modified files, or < 90% for new files)
138
138
  - coverage artifact absent for any language that has changed files
139
+ - Classify each blocking finding before triggering remediation: every blocking finding receives one `Remediability` class (`autonomous`, `external_dependency`, `policy_hold`, `awaiting_ci`, or `human_decision_required`; `autonomous` when no class is stated).
140
+ - Trigger remediation only for `autonomous` findings. When no blocking finding is `autonomous`, write the remediation inputs, report `HALT_NON_REMEDIABLE` (at least one `external_dependency`, `policy_hold`, or `human_decision_required` finding) or `AWAITING_CI` (every finding `awaiting_ci`) with `REMEDIATION_PLAN: NONE`, create no remediation plan target, and do not hand off to `atomic-planner`.
139
141
  - Create `remediation-inputs.<timestamp>.md` first.
140
142
  - Create the target remediation plan file from the canonical plan template.
141
143
  - Hand off plan creation through `remediation-handoff-atomic-planner`.
@@ -145,7 +147,7 @@ Always apply:
145
147
  - Verify every reported artifact exists on disk before reporting completion.
146
148
  - Report artifact paths and a concise go/no-go recommendation for PR readiness.
147
149
  - End the final report with these exact single-line fields:
148
- - `REVIEW_STATUS: PASS` or `REVIEW_STATUS: REMEDIATION_REQUIRED`
150
+ - `REVIEW_STATUS: PASS`, `REVIEW_STATUS: REMEDIATION_REQUIRED`, `REVIEW_STATUS: HALT_NON_REMEDIABLE`, or `REVIEW_STATUS: AWAITING_CI`
149
151
  - `FEATURE_FOLDER: <path>`
150
152
  - `POLICY_AUDIT: <path>`
151
153
  - `CODE_REVIEW: <path>`
@@ -23,7 +23,6 @@ If the estimated scope exceeds the direct-mode budget, this skill defers to the
23
23
  - Files or entrypoints in scope (exact script or module paths and corresponding `*.Tests.ps1` paths).
24
24
  - Constraints, including public function or module contracts that must be preserved.
25
25
  - Optional approved plan. If none is supplied, the worker delegates plan authoring to `atomic_planner` before any edits.
26
- - Optional budget override in the form `budget: prod=<N>, test=<M>` subject to repo policy compliance.
27
26
 
28
27
  ## Output Paths
29
28
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: invoke-python-engineer
3
- description: Invoke the python-typed-engineer worker to design, implement, and verify Python changes within typed repository boundaries. Applies Black, Ruff, Pyright, and Pytest with a three-production plus three-test per-batch budget and zero-regression quality gates.
3
+ description: Invoke the python-typed-engineer worker to design, implement, and verify Python changes within typed repository boundaries. Applies Black, Ruff, Pyright, and Pytest with a 1-3 production-file direct-mode budget, routing to the orchestrated large path above it, and zero-regression quality gates.
4
4
  ---
5
5
 
6
6
  # Implement Python Skill
@@ -15,7 +15,7 @@ Use this skill when:
15
15
  - Estimated scope fits the small path (1-3 production files plus corresponding tests).
16
16
  - The toolchain (Black, Ruff, Pyright, Pytest) can be run in the current environment, or the user has explicitly authorized an unverified plan-only response.
17
17
 
18
- If the estimated scope exceeds the small-path budget, this skill defers to the orchestrated flow via `python-change-budget-router` instead of proceeding directly.
18
+ If the estimated scope is more than 3 production files, this skill defers to the orchestrated large path (`.codex/prompts/orchestrate-work.md`) via `python-change-budget-router` instead of proceeding directly. The large path has no production-file cap, and test files are not counted toward the routing threshold.
19
19
 
20
20
  ## Inputs
21
21
 
@@ -23,7 +23,6 @@ If the estimated scope exceeds the small-path budget, this skill defers to the o
23
23
  - Files or entrypoints in scope.
24
24
  - Constraints, including public APIs that must be preserved.
25
25
  - Optional approved plan. If none is supplied, the worker delegates plan authoring to `atomic_planner` before any edits.
26
- - Optional budget override in the form `budget: prod=<N>, test=<M>` subject to repo policy compliance.
27
26
 
28
27
  ## Output Paths
29
28
 
@@ -128,6 +128,11 @@ route.
128
128
  `not-applicable`, and `blocked_reason: "none"`.
129
129
  - Do not edit production code, execute the plan, author or edit a PR, run feature review, monitor
130
130
  CI, set `next_step: "complete"`, record `S12_complete`, or claim feature completion.
131
+ - Premise-falsified halt: use `blocked_reason: "premise_falsified"` when every delegation and
132
+ validator succeeded but evidence gathered during execution falsified the plan's premise. Still
133
+ record the evidence path in free-form checkpoint keys; `blocked_reason` carries only the
134
+ classification. The preparation terminal checkpoint above still sets `blocked_reason: "none"`.
135
+ The full `blocked_reason` vocabulary and its partition are in `.claude/rules/orchestrator-state.md`.
131
136
 
132
137
  Only the literal JSON Boolean `false` in the route configuration disables the CI requirement.
133
138
  Missing, malformed, string-valued, or unknown route data fails closed. The preparation mutation
@@ -290,10 +295,12 @@ skill use. The checkpoint must include:
290
295
  - `required_mcp_tools`: exactly the selected route's `required_mcp_tools`
291
296
  - `delegation_receipts`: one receipt for each required agent
292
297
  - `skill_receipts`: one required receipt for each required skill, with evidence
293
- - `mcp_call_receipts`: one successful receipt for each required MCP tool
298
+ - `mcp_call_receipts`: one successful receipt for each required MCP tool unless a valid `issue_adoption` record waives it
294
299
  - `local_execution_overrides`: an empty list at completion
295
300
  - `delegation_bypasses`: an empty list at completion
296
301
  - `lifecycle_operations`: any lifecycle operation must record `surface: "mcp"`
302
+ - `ci_gate`: the CI result object defined in `## CI Green Gate`, with keys `conclusion`, `head_sha`, and `verified_at`
303
+ - `pr_gate`: the pull-request object defined in `## CI Green Gate`, with keys `pr_number`, `pr_url`, `head_branch`, and `head_sha`
297
304
 
298
305
  If any required handoff, skill receipt, MCP receipt, or empty bypass list is
299
306
  missing, `validate_orchestration_artifacts --require-complete` fails and the
@@ -405,22 +412,32 @@ The review subagent compares against a base branch; uncommitted changes are invi
405
412
  After each `feature-reviewer` delegation returns:
406
413
 
407
414
  1. Read the exact terminal status lines from the review result.
408
- 2. If the result does not include `REVIEW_STATUS: PASS` or `REVIEW_STATUS: REMEDIATION_REQUIRED`, stop and record blocked state.
409
- 3. If the result is `REVIEW_STATUS: PASS`, advance to the PR creation gate.
410
- 4. If the result is `REVIEW_STATUS: REMEDIATION_REQUIRED`, require both `REMEDIATION_INPUTS: <path>` and `REMEDIATION_PLAN: <path>` and then enter the remediation loop.
415
+ 2. If the result does not include `REVIEW_STATUS: PASS`, `REVIEW_STATUS: REMEDIATION_REQUIRED`, `REVIEW_STATUS: HALT_NON_REMEDIABLE`, or `REVIEW_STATUS: AWAITING_CI`, stop and record blocked state.
416
+ 3. When the remediation inputs carry a `Review-Verdict:` line, recompute the verdict from the finding classes (a blocking finding block without a remediability line counts as `autonomous`). A mismatch between the declared and recomputed verdicts is a reviewer contract error: record it under `artifact_errors`, re-request the review once, and halt with `blocked_reason: "delegate_contract_incomplete"` if it persists.
417
+ 4. Append a `remediation_loop.review_outcomes[]` entry (`verdict` plus one `findings[]` object with `remediability` per blocking finding) for every review, including `PASS`.
418
+ 5. If the result is `REVIEW_STATUS: PASS`, advance to the PR creation gate.
419
+ 6. If the result is `REVIEW_STATUS: REMEDIATION_REQUIRED`, require both `REMEDIATION_INPUTS: <path>` and `REMEDIATION_PLAN: <path>` and then enter the remediation loop with the plan scoped to the `autonomous` findings; non-remediable findings carry forward unchanged.
420
+ 7. If the result is `REVIEW_STATUS: HALT_NON_REMEDIABLE`, require `REMEDIATION_PLAN: NONE` and halt: set `blocked_reason` to the highest-precedence halt class present, append one `human_interaction.requirements[]` entry with `response: "halt"` for each halt class present (`external_dependency`, `policy_hold`, `human_decision_required`) describing the human action needed, leave `remediation_loop.completed_attempts` unchanged, write no cycle, create no remediation plan, and stop. The precedence is:
421
+
422
+ Halt precedence: human_decision_required > policy_hold > external_dependency
423
+
424
+ 8. If the result is `REVIEW_STATUS: AWAITING_CI`, require `REMEDIATION_PLAN: NONE` and wait: set `blocked_reason: "awaiting_ci"`, set `next_step` to the step that re-checks (`S7_feature_review` for a review-time wait, `S9_ci_green` for a CI poll timeout), record no `human_interaction.requirements[]` entry for the wait, write no cycle, and create no remediation plan. Poll within the existing bounded CI interval and timeout; when the bound is exhausted, persist and stop. On resume, set `blocked_reason: "none"` and re-run the named step. For a review-time wait, the awaited workflow is named in the finding's `Remediability-Evidence:` line.
425
+ 9. A CI Green Gate poll timeout is recorded as a finding with `Remediability: awaiting_ci` and follows the wait path; a failed required check stays `autonomous` and enters the remediation loop.
411
426
 
412
427
  ## Remediation Loop (R1–R5)
413
428
 
414
- A bounded loop consisting of five steps. The loop variable `remediation_pass` starts at 1 and increments at R5 before returning to R1.
429
+ A bounded loop consisting of five steps. The attempt count is `remediation_loop.completed_attempts`, and `remediation_pass` equals `remediation_loop.completed_attempts`. The active cycle number is `completed_attempts + 1`; `remediation_loop.current_cycle` is a record position in `cycles[]`, not a count. A halt or wait verdict never opens a cycle, and every cycle opened from a review records `opened_by_review`, the zero-based index of that `review_outcomes[]` entry.
430
+
431
+ Cycle accounting: a remediation attempt is complete when R3 execution finished (`execution_status: "complete"`) and the pre-R4 commit recorded a non-empty change set; only then set `candidate_applied: true` on that cycle and increment `completed_attempts`. A cycle that ends without a candidate (execution not started, execution failed, or an empty staged change set) records `candidate_applied: false` and consumes no number. It is followed by at most one re-plan under the same number when the executor output identifies an autonomous plan defect; otherwise reclassify the blocker (typically `external_dependency`) and halt. Two consecutive no-candidate cycles halt with `step6_status: "blocked_remediation_loop_limit"`.
415
432
 
416
433
  - **R1 — Remediation plan of record:** Use the exact `REMEDIATION_PLAN: <path>` returned by the review as the starting plan of record for the loop.
417
434
  - **R2 — Preflight clearance:** Delegate to `atomic-executor` for precondition validation only (no implementation). If the executor does not return `PREFLIGHT: ALL CLEAR`, return to R1 by re-delegating to `atomic-planner` against the same remediation-plan path with the required-changes output from the executor. Only after `PREFLIGHT: ALL CLEAR` may the orchestrator advance to R3.
418
435
  - **R3 — Remediation execution:** Delegate to `atomic-executor` with full execution authorization. Each task's toolchain loop (format → lint → type-check → test) is mandatory; no skipping.
419
436
  - **Pre-R4 commit:** Stage all changes (`git add -A`), run MCP tool `collect_commit_context`, delegate to `commit_steward` using the resulting artifact, and commit with the generated message. Advance to R4 only after a successful commit.
420
437
  - **R4 — Re-audit:** Refresh PR context via MCP tool `collect_pr_context`, then delegate to `feature-reviewer` with the same inputs as the original review (resolved base branch, feature folder, refreshed PR context artifacts, acceptance-criteria source). No scope narrowing. The canonical issue number line must be included.
421
- - **R5 — Loop-exit decision:** If the re-audit returns `REVIEW_STATUS: PASS`, exit the loop and advance to the PR creation gate. Otherwise, record `remediation_pass` increment in the checkpoint and return to R1.
438
+ - **R5 — Loop-exit decision:** Evaluate the re-audit per Post-Review Outcome Evaluation. If it returns `REVIEW_STATUS: PASS`, exit the loop and advance to the PR creation gate. If it returns `REVIEW_STATUS: HALT_NON_REMEDIABLE` or `REVIEW_STATUS: AWAITING_CI`, follow the halt or wait branch instead of opening the next cycle. Otherwise, record the cycle's `candidate_applied` value and the resulting `completed_attempts` in the checkpoint and return to R1.
422
439
 
423
- **Termination guard:** If `remediation_pass` reaches 3 without resolution, the orchestrator records `step6_status: "blocked_remediation_loop_limit"` in the checkpoint and halts. No further automation is attempted.
440
+ **Termination guard:** Halt after three completed attempts: when `remediation_loop.completed_attempts` equals 3 and the latest verdict is not `PASS`, the orchestrator records `step6_status: "blocked_remediation_loop_limit"` in the checkpoint and halts. No further automation is attempted.
424
441
 
425
442
  ## Issue Number Consistency
426
443
 
@@ -440,6 +457,12 @@ and required GitHub checks through `gh`. The checkpoint must record the checked
440
457
  head SHA and CI result. DONE is blocked unless the required checks pass for the
441
458
  current PR head SHA.
442
459
 
460
+ The checkpoint records the CI result in a top-level `ci_gate` object with the required keys `conclusion`, `head_sha`, and `verified_at`. `conclusion` is one of `success`, `failure`, or `pending`; `head_sha` is the PR head SHA the required checks were observed against; `verified_at` is the ISO-8601 time at which this gate (S9) recorded the result. DONE requires `ci_gate.conclusion` equal to `success` and `ci_gate.head_sha` equal to the current PR head SHA. The key set is defined by `CI_GATE_KEYS` in `scripts/dev_tools/validate_orchestrator_state.py`, and the TypeScript MCP validator used by the Codex runtime requires the same keys.
461
+
462
+ The checkpoint records the pull request in a top-level `pr_gate` object with the keys `pr_number`, `pr_url`, `head_branch`, and `head_sha`. The key set is defined by `PR_GATE_KEYS` in `scripts/dev_tools/_orchestrator_state_routing.py`.
463
+
464
+ CI-dependent acceptance criteria are criteria whose verification requires the result of CI on the PR head. The item's own orchestrator run owns their check-off. After `ci_gate.conclusion` is `success`, check off each CI-dependent criterion in the item's own worktree, commit, push to the PR branch, and re-run this gate against the new head SHA, so that `ci_gate.head_sha` equals the final PR head before DONE. A failed re-run enters the Remediation Loop (R1–R5) as a blocking finding; the shared `remediation_loop.completed_attempts` count and its halt after three completed attempts are unchanged. A parent or coordinating session never commits these check-offs from its own root.
465
+
443
466
  ## PR Creation Gate
444
467
 
445
468
  The orchestrator must not create a PR, push a branch for PR purposes, or report work complete until all four conditions are simultaneously true:
@@ -9,7 +9,7 @@ Source: legacy Claude rule `orchestrator-state`.
9
9
 
10
10
  # Orchestrator-State Remediation-Cycle and Human-Interaction Invariants
11
11
 
12
- This rule governs remediation-cycle records and the optional `human_interaction` block in the orchestrator-state checkpoint at `artifacts/orchestration/orchestrator-state.json`. It documents three invariants that must hold for each remediation cycle, plus three invariants for the `human_interaction` block, so that resume and review workflows do not depend on a structurally invalid checkpoint.
12
+ This rule governs remediation-cycle records and the optional `human_interaction` block in the orchestrator-state checkpoint at `artifacts/orchestration/orchestrator-state.json`. It documents the invariants that must hold for each remediation cycle and for the remediation-loop review outcomes and attempt count, plus three invariants for the `human_interaction` block, so that resume and review workflows do not depend on a structurally invalid checkpoint.
13
13
 
14
14
  ## Foreign Schema Warning (do not copy verbatim)
15
15
 
@@ -60,7 +60,7 @@ completion authority.
60
60
 
61
61
  ## Scope and Backward Compatibility
62
62
 
63
- These invariants apply only when the checkpoint contains a top-level `remediation_loop` with a `cycles` array. A checkpoint with no `remediation_loop` (the existing step-based checkpoint shape) is unaffected: it validates exactly as before and produces no new errors. The invariants are additive.
63
+ These invariants apply only when the checkpoint contains a top-level `remediation_loop`; the per-cycle invariants apply when it has a `cycles` array, and the review-outcome and attempt-count invariants apply when their keys are present. A checkpoint with no `remediation_loop` (the existing step-based checkpoint shape) is unaffected: it validates exactly as before and produces no new errors. The invariants are additive.
64
64
 
65
65
  ## Invariants (per remediation cycle)
66
66
 
@@ -70,6 +70,45 @@ These invariants apply only when the checkpoint contains a top-level `remediatio
70
70
 
71
71
  3. **Exit gate requires zero blocking findings.** When a cycle's `exit_condition_met == true`, its `blocking_count` must be `0`. A non-zero `blocking_count` with `exit_condition_met == true` is a malformed cycle (the exit gate was marked satisfied while blocking findings remained).
72
72
 
73
+ 4. **`candidate_applied` is a boolean (R5).** When a cycle object carries `candidate_applied`, its value must be a JSON boolean, and any other value is a malformed cycle.
74
+
75
+ 5. **A completed attempt requires completed execution (R6).** A cycle whose `candidate_applied == true` must have `execution_status == "complete"`, and `candidate_applied == true` with any other execution status is a malformed cycle.
76
+
77
+ 6. **`opened_by_review` references a remediation review (R11).** When a cycle object carries `opened_by_review`, its value must be a non-negative integer (not a boolean) that indexes an object entry of the `remediation_loop.review_outcomes` list whose `verdict` is `REMEDIATION_REQUIRED`, and a value that is not such an integer, is out of range, or references an outcome with any other verdict is a malformed cycle.
78
+
79
+ 7. **`completed_attempts` counts completed attempts (R7).** When `remediation_loop.completed_attempts` is present, it must be a non-negative integer (not a boolean) equal to the number of object cycles whose `candidate_applied` is `true` (zero when `cycles` is absent or not a list), and any other value is a malformed loop.
80
+
81
+ ## Invariants (remediation_loop.review_outcomes)
82
+
83
+ These invariants apply only when `remediation_loop` contains a `review_outcomes` key. The orchestrator appends one entry per review, including a `PASS` review, in the shape `{"verdict": <verdict>, "findings": [{"remediability": <class>}, ...]}`, where `findings` lists the review's blocking findings only. A halt or wait verdict records no remediation cycle.
84
+
85
+ Review verdicts (exact, case-sensitive):
86
+
87
+ | Verdict | Condition over the classes of the review's blocking findings |
88
+ |---|---|
89
+ | `PASS` | No blocking findings. |
90
+ | `REMEDIATION_REQUIRED` | At least one `autonomous` finding. |
91
+ | `HALT_NON_REMEDIABLE` | No `autonomous` finding, and at least one `external_dependency`, `policy_hold`, or `human_decision_required` finding. |
92
+ | `AWAITING_CI` | At least one finding, and every finding is `awaiting_ci`. |
93
+
94
+ Remediability classes (exact, case-sensitive) and the `blocked_reason` member (#523) that a halt or wait records for each class:
95
+
96
+ | Class | Meaning | `blocked_reason` member |
97
+ |---|---|---|
98
+ | `autonomous` | Repository remediation can resolve the finding without a human decision. | none (remediation loop) |
99
+ | `external_dependency` | A system, service, runtime, or published artifact outside the repository is unavailable or mismatched. | `external_dependency` |
100
+ | `policy_hold` | Proceeding requires a policy decision, exception, or authorization that the orchestrator may not grant. | `policy_hold` |
101
+ | `awaiting_ci` | The finding resolves when a CI result that has not completed becomes available. | `awaiting_ci` |
102
+ | `human_decision_required` | A human must choose between alternatives or approve a direction. | `human_decision_required` |
103
+
104
+ Derivation order. The verdict is a pure function of the findings' classes, evaluated in this order: no findings yields `PASS`; any `autonomous` finding yields `REMEDIATION_REQUIRED`; any `external_dependency`, `policy_hold`, or `human_decision_required` finding yields `HALT_NON_REMEDIABLE`; otherwise the verdict is `AWAITING_CI`.
105
+
106
+ 1. **`review_outcomes` is a list of objects (R8).** `review_outcomes` must be a list, and each entry must be an object. A non-list value or a non-object entry is malformed.
107
+
108
+ 2. **Verdict and class membership (R9).** Each outcome's `verdict` must be a string among the four verdicts, its `findings` must be a list (a missing key is not a list), and each finding must be an object whose `remediability` is a string among the five classes. Comparisons are case-sensitive, so a case variant such as `Pass` or `Autonomous` is malformed.
109
+
110
+ 3. **Verdict matches its findings (R10).** When an outcome passes the membership checks, its `verdict` must equal the verdict that the derivation order yields for its findings' classes. A mismatch is a malformed outcome.
111
+
73
112
  ## Human-Interaction Scope and Backward Compatibility
74
113
 
75
114
  These invariants apply only when the checkpoint contains a top-level `human_interaction` block. A checkpoint with no `human_interaction` key (the existing checkpoint shape) is unaffected: it validates exactly as before and produces no new errors. The invariants are additive and support the autonomous-execution mandate documented in `.agents/skills/orchestrate/SKILL.md`.
@@ -157,6 +157,13 @@ Blocked-reason enum:
157
157
  - `commit_context_missing`
158
158
  - `no_staged_changes`
159
159
  - `pre_implementation_gate_violation`
160
+ - `premise_falsified` — Every delegation and validator succeeded, but evidence gathered during execution falsified the premise on which the plan was built, so continuing would implement an invalid plan.
161
+ - `external_dependency` — The run cannot proceed because a system, service, runtime, or artifact outside the repository's control is unavailable or mismatched, and no in-repository remediation can resolve it.
162
+ - `policy_hold` — The run is stopped because proceeding requires a policy decision, exception, or authorization that the orchestrator is not permitted to grant autonomously.
163
+ - `awaiting_ci` — The run is waiting for a CI result that has not yet completed, and no remediation is warranted until that result is available.
164
+ - `human_decision_required` — The run requires a human to choose between alternatives or approve a direction before it can continue.
165
+
166
+ Blocked-reason partition: `none` (or JSON `null`) means the run is not blocked. The six validator-enforced members `spawn_agent_unavailable`, `delegation_launch_failed`, `delegate_no_receipt`, `delegate_contract_incomplete`, `validator_failed`, and `user_requested_stop` form the mechanical partition. The five members `premise_falsified`, `external_dependency`, `policy_hold`, `awaiting_ci`, and `human_decision_required` form the non-mechanical partition. The full vocabulary is published in `.claude/rules/orchestrator-state.md`.
160
167
 
161
168
  Pre-implementation violation schema:
162
169
  - `pre-implementation-violation` MUST be either `null` or an object with:
@@ -198,7 +205,8 @@ Completion-state invariants:
198
205
  - every required skill MUST have a matching required `skill_receipts[].skill`
199
206
  with non-empty evidence.
200
207
  - every required MCP tool MUST have a successful `mcp_call_receipts[].tool`
201
- receipt with non-empty evidence.
208
+ receipt with non-empty evidence, unless a valid `issue_adoption` record
209
+ waives the tool.
202
210
  - `local_execution_overrides` and `delegation_bypasses` MUST be empty lists at
203
211
  completion.
204
212
  - every recorded `lifecycle_operations[]` item MUST use `surface: "mcp"`.
@@ -228,6 +236,8 @@ Do not advance on summaries alone when an exact result signal is required.
228
236
  - feature review result:
229
237
  - `REVIEW_STATUS: PASS`
230
238
  - `REVIEW_STATUS: REMEDIATION_REQUIRED`
239
+ - `REVIEW_STATUS: HALT_NON_REMEDIABLE`
240
+ - `REVIEW_STATUS: AWAITING_CI`
231
241
  - `FEATURE_FOLDER: <path>`
232
242
  - `POLICY_AUDIT: <path>`
233
243
  - `CODE_REVIEW: <path>`
@@ -382,18 +392,23 @@ Required behavior:
382
392
 
383
393
  Apply this loop after any required review returns `REVIEW_STATUS: REMEDIATION_REQUIRED`.
384
394
 
395
+ Attempt accounting: `remediation-pass` equals `remediation_loop.completed_attempts`, the number of cycles whose `candidate_applied` is `true`. A cycle records `candidate_applied: true` only when remediation execution completed and the remediation commit recorded a non-empty change set. The active cycle number is `completed_attempts + 1`, and a cycle without a candidate consumes no number. Cap: halt after three completed attempts, that is, when `completed_attempts` equals 3 and the latest review is not `REVIEW_STATUS: PASS`, with `step6_status: "blocked_remediation_loop_limit"`.
396
+
397
+ Halt and wait branches: a review that returns `REVIEW_STATUS: HALT_NON_REMEDIABLE` or `REVIEW_STATUS: AWAITING_CI` never enters or continues this loop and opens no cycle. On `HALT_NON_REMEDIABLE`, set `blocked_reason` to the highest-precedence halt class present (`human_decision_required`, then `policy_hold`, then `external_dependency`), append one `human_interaction.requirements[]` entry with `response: "halt"` per halt class present, and stop. On `AWAITING_CI`, set `blocked_reason: "awaiting_ci"`, set `next_step` to the step that re-checks, persist, and stop; on resume, set `blocked_reason: "none"` and re-run that step.
398
+
385
399
  1. Persist `review-status`, `remediation-inputs-path`, `remediation-plan-path`, and `remediation-pass` in the checkpoint.
386
400
  2. Delegate `atomic-executor` in validation-only mode against the exact `remediation-plan-path`.
387
401
  3. If the executor returns `PREFLIGHT: REVISIONS REQUIRED`, delegate `atomic-planner` to update the same `remediation-plan-path` in place and then repeat preflight clearance.
388
402
  4. Only after `PREFLIGHT: ALL CLEAR`, delegate `atomic-executor` to execute the remediation plan exactly as written.
389
403
  5. Stage all files with `git add -A`.
390
404
  6. If staging is empty after execution, set `blocked_reason` to `no_staged_changes` and stop.
405
+ - Record `candidate_applied: false` for that cycle; it consumes no attempt number.
391
406
  7. Use `repo-automation-adapter` to run MCP tool `collect_commit_context`, capture the returned on-disk artifact path as `commit-context-path`, and stop with `blocked_reason: commit_context_missing` if that path is unavailable.
392
407
  8. Delegate `commit-steward` using `commit-context-path` as the authoritative staged-change input.
393
408
  9. Commit the staged work with the exact message returned by `commit-steward`.
394
409
  10. Use `repo-automation-adapter` to refresh PR-context artifacts through MCP tool `collect_pr_context` with the resolved base branch.
395
410
  11. Delegate `feature-reviewer` again with the refreshed PR context.
396
- 12. If the new review still returns `REVIEW_STATUS: REMEDIATION_REQUIRED`, increment `remediation-pass` and repeat the loop. Exit only when the latest review returns `REVIEW_STATUS: PASS`.
411
+ 12. Record `candidate_applied: true` for the cycle and set `remediation_loop.completed_attempts` and `remediation-pass` to the new count. If the new review still returns `REVIEW_STATUS: REMEDIATION_REQUIRED`, repeat the loop under the cap. Exit only when the latest review returns `REVIEW_STATUS: PASS`, or follow the halt or wait branch.
397
412
 
398
413
  ## Completion Gates
399
414
 
@@ -404,7 +419,7 @@ Do not claim mission completion until all of the following are true:
404
419
  - small-path implementation has a receipt from the exact language-specific generated
405
420
  typed-engineer deployment profile
406
421
  - all required skills have `skill_receipts` with evidence
407
- - all required MCP tools have successful `mcp_call_receipts`
422
+ - all required MCP tools have successful `mcp_call_receipts`, unless a valid `issue_adoption` record waives the tool
408
423
  - no local execution override or delegation bypass is recorded
409
424
  - the checkpoint is updated with the final state
410
425
  - the canonical checkpoint path was used without sidecar replacement or backup substitution
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: python-change-budget-router
3
- description: Budget-first routing and batch-scope contract for Python work. Estimate production-file scope, choose small vs large path, enforce the 3 production + 3 test per-batch cap, and halt the agent for scope expansion approval when the estimate exceeds the budget.
3
+ description: Budget-first routing contract for Python work. Estimate production-file scope, choose small vs large path, and route direct-mode work of more than 3 production files to the orchestrated large path.
4
4
  ---
5
5
 
6
6
  # Python Change Budget Router
7
7
 
8
- Canonical guidance for deciding whether Python work stays on the small path (`python-typed-engineer` direct mode) or escalates to the full orchestration workflow, and for enforcing per-batch change budgets during execution.
8
+ Canonical guidance for deciding whether Python work stays on the small path (`python-typed-engineer` direct mode) or escalates to the orchestrated large path through `.codex/prompts/orchestrate-work.md`.
9
9
 
10
10
  ## When to Use This Skill
11
11
 
@@ -14,46 +14,23 @@ Use this skill when:
14
14
  - Intake starts from a natural-language Python request.
15
15
  - An agent must decide the execution path before planning or implementation.
16
16
  - A direct-mode route must reject over-budget requests and switch to orchestrated flow.
17
- - An executor must confirm a batch fits within the 3 production + 3 test file cap before editing.
18
17
 
19
18
  ## Canonical Routing Rules
20
19
 
21
20
  1. Estimate rough change budget first based on likely **production Python files** touched.
22
21
  2. Route:
23
22
  - `1-3` production files (plus corresponding tests) → **small path** (`python-typed-engineer` direct mode).
24
- - `>3` production files → **large path** (orchestration workflow with promotion, research, spec, planning, execution, and review).
25
-
26
- ## Per-Batch Change Budget (Hard Gate)
27
-
28
- During Phase C execution:
29
-
30
- - A single batch may change at most **3 production files** and **3 test files**.
31
- - The default cap applies unless the user supplies an override of the form `budget: prod=<N>, test=<M>` in the initiating prompt.
32
- - A user override may be honored only if it complies with repo policy and approved scope. If the requested scope exceeds 3 production files overall, stop before execution and seek explicit approval.
33
- - If an override is requested, confirm compliance with repo policy before entering Phase C.
34
-
35
- ## Scope Expansion Protocol
36
-
37
- When in-scope work is required beyond 3 production files, stop and return:
38
-
39
- - a one-paragraph justification for the additional files,
40
- - the exact additional file paths,
41
- - the smallest alternative that avoids expanding scope,
42
-
43
- and wait for explicit user approval before proceeding.
44
-
45
- Allowed minimal-seam exceptions (still within the 3-file cap) are:
46
-
47
- - introducing a minimal seam for testability (I/O boundary isolation, dependency injection),
48
- - typing changes required for Pyright cleanliness in the slice,
49
- - updating the smallest set of call sites needed to preserve a stable public API.
23
+ - More than 3 production files → **large path** (`.codex/prompts/orchestrate-work.md`). The large path has no production-file cap.
24
+ 3. Test files are not counted toward the routing threshold.
50
25
 
51
26
  ## Direct-Mode Rejection Rule
52
27
 
53
- If `python-typed-engineer` is invoked directly and estimated scope is `>3` production files:
28
+ If `python-typed-engineer` is invoked directly and the estimated scope, or the scope discovered during implementation, is more than 3 production files:
54
29
 
55
- - Stop before implementation.
56
- - Return an explicit routing instruction to invoke the orchestrated workflow.
30
+ - Stop before editing the 4th production file.
31
+ - Report the production files already changed and the production files still required.
32
+ - Return an explicit routing instruction to invoke `.codex/prompts/orchestrate-work.md`.
33
+ - Do not request an exception to the threshold; routing is the only path past it.
57
34
 
58
35
  ## Orchestrated Small-Path Requirements
59
36
 
@@ -75,5 +52,4 @@ Record in the agent response or logs:
75
52
 
76
53
  - estimated production file count,
77
54
  - chosen path (`small` or `large`),
78
- - rationale summary (1-3 bullets),
79
- - any requested budget override and its approval state.
55
+ - rationale summary (1-3 bullets).
@@ -9,7 +9,7 @@ Source: legacy Claude rule `quality-tiers`.
9
9
 
10
10
  # Module Rigor Tiers
11
11
 
12
- This rule defines the T1–T4 module rigor tier system used by all CI gates in this repository. The tier system source of truth is `docs/ci.research.md` section 1; the file `quality-tiers.yml` at the repository root maps every project to a tier. Adding a project without a tier classification fails CI.
12
+ This rule defines the T1–T4 module rigor tier system used by all CI gates in this repository. The tier definitions and gate matrix in this document are the tier system's source of truth; the file `quality-tiers.yml` at the repository root maps every project to a tier. Adding a project without a tier classification fails CI.
13
13
 
14
14
  ## Tiers
15
15
 
@@ -20,6 +20,8 @@ Trigger remediation when any of these are true:
20
20
  - Toolchain checks fail.
21
21
  - Acceptance criteria are not met.
22
22
 
23
+ Remediation triggers only on blocking findings classified `autonomous`. Each blocking finding carries one remediability class (`autonomous`, `external_dependency`, `policy_hold`, `awaiting_ci`, or `human_decision_required`). Non-remediable findings halt (`HALT_NON_REMEDIABLE`) or wait (`AWAITING_CI`): they receive remediation inputs but no remediation plan target and no `atomic_planner` handoff.
24
+
23
25
  ## Required Remediation Inputs
24
26
 
25
27
  Create `remediation/<timestamp>/remediation-inputs.md` (one timestamped `remediation/` folder per cycle; reaudit artifacts from a triggering or exit review live under the sibling `audit/<timestamp>/` folder, per the canonical pattern documented in the Claude-side `remediation-handoff-atomic-planner` skill) with:
@@ -46,6 +46,7 @@ Review constraints:
46
46
 
47
47
  Acceptance and remediation rules:
48
48
  - Trigger remediation if policy audit has FAIL or meaningful PARTIAL findings, toolchain checks fail, blockers exist in code review, or required acceptance criteria are not fully met.
49
+ - When every blocking finding is non-remediable (remediability external_dependency, policy_hold, awaiting_ci, or human_decision_required, with no autonomous finding), report REVIEW_STATUS: HALT_NON_REMEDIABLE or REVIEW_STATUS: AWAITING_CI with REMEDIATION_PLAN: NONE, create no remediation plan target, and do not delegate to atomic-planner.
49
50
  - When remediation is triggered, generate remediation-inputs first.
50
51
  - Then automatically delegate remediation planning to the atomic-planner agent; do not leave remediation as a manual follow-up.
51
52
  - Create the remediation plan target file on disk before the planning handoff.
@@ -46,6 +46,7 @@ Review constraints:
46
46
 
47
47
  Acceptance and remediation rules:
48
48
  - Trigger remediation if policy audit has FAIL or meaningful PARTIAL findings, toolchain checks fail, blockers exist in code review, or required acceptance criteria are not fully met.
49
+ - When every blocking finding is non-remediable (remediability external_dependency, policy_hold, awaiting_ci, or human_decision_required, with no autonomous finding), report REVIEW_STATUS: HALT_NON_REMEDIABLE or REVIEW_STATUS: AWAITING_CI with REMEDIATION_PLAN: NONE, create no remediation plan target, and do not delegate to atomic-planner.
49
50
  - When remediation is triggered, generate remediation-inputs first.
50
51
  - Then automatically delegate remediation planning to the atomic-planner agent; do not leave remediation as a manual follow-up.
51
52
  - Create the remediation plan target file on disk before the planning handoff.
@@ -46,6 +46,7 @@ Review constraints:
46
46
 
47
47
  Acceptance and remediation rules:
48
48
  - Trigger remediation if policy audit has FAIL or meaningful PARTIAL findings, toolchain checks fail, blockers exist in code review, or required acceptance criteria are not fully met.
49
+ - When every blocking finding is non-remediable (remediability external_dependency, policy_hold, awaiting_ci, or human_decision_required, with no autonomous finding), report REVIEW_STATUS: HALT_NON_REMEDIABLE or REVIEW_STATUS: AWAITING_CI with REMEDIATION_PLAN: NONE, create no remediation plan target, and do not delegate to atomic-planner.
49
50
  - When remediation is triggered, generate remediation-inputs first.
50
51
  - Then automatically delegate remediation planning to the atomic-planner agent; do not leave remediation as a manual follow-up.
51
52
  - Create the remediation plan target file on disk before the planning handoff.
@@ -46,6 +46,7 @@ Review constraints:
46
46
 
47
47
  Acceptance and remediation rules:
48
48
  - Trigger remediation if policy audit has FAIL or meaningful PARTIAL findings, toolchain checks fail, blockers exist in code review, or required acceptance criteria are not fully met.
49
+ - When every blocking finding is non-remediable (remediability external_dependency, policy_hold, awaiting_ci, or human_decision_required, with no autonomous finding), report REVIEW_STATUS: HALT_NON_REMEDIABLE or REVIEW_STATUS: AWAITING_CI with REMEDIATION_PLAN: NONE, create no remediation plan target, and do not delegate to atomic-planner.
49
50
  - When remediation is triggered, generate remediation-inputs first.
50
51
  - Then automatically delegate remediation planning to the atomic-planner agent; do not leave remediation as a manual follow-up.
51
52
  - Create the remediation plan target file on disk before the planning handoff.