codex-workflow-v2 2.0.0-beta.1 → 2.0.0-beta.11

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 (187) hide show
  1. package/README.md +94 -12
  2. package/dist/src/alpha6/adoption.js +13 -3
  3. package/dist/src/alpha6/adoption.js.map +1 -1
  4. package/dist/src/alpha6/handoff.d.ts +26 -2
  5. package/dist/src/alpha6/handoff.js +277 -29
  6. package/dist/src/alpha6/handoff.js.map +1 -1
  7. package/dist/src/alpha6/mechanical-feasibility.d.ts +7 -0
  8. package/dist/src/alpha6/mechanical-feasibility.js +303 -0
  9. package/dist/src/alpha6/mechanical-feasibility.js.map +1 -0
  10. package/dist/src/alpha6/milestone.d.ts +37 -2
  11. package/dist/src/alpha6/milestone.js +472 -33
  12. package/dist/src/alpha6/milestone.js.map +1 -1
  13. package/dist/src/alpha6/plan-integrity.d.ts +14 -0
  14. package/dist/src/alpha6/plan-integrity.js +127 -0
  15. package/dist/src/alpha6/plan-integrity.js.map +1 -0
  16. package/dist/src/alpha6/plan-risk.d.ts +1 -0
  17. package/dist/src/alpha6/plan-risk.js +15 -7
  18. package/dist/src/alpha6/plan-risk.js.map +1 -1
  19. package/dist/src/alpha6/remediation.d.ts +2 -1
  20. package/dist/src/alpha6/remediation.js +186 -9
  21. package/dist/src/alpha6/remediation.js.map +1 -1
  22. package/dist/src/alpha6/review.d.ts +3 -0
  23. package/dist/src/alpha6/review.js +24 -0
  24. package/dist/src/alpha6/review.js.map +1 -1
  25. package/dist/src/cli.js +486 -46
  26. package/dist/src/cli.js.map +1 -1
  27. package/dist/src/contracts.d.ts +238 -6
  28. package/dist/src/contracts.js +1 -1
  29. package/dist/src/credential-output.d.ts +10 -0
  30. package/dist/src/credential-output.js +73 -0
  31. package/dist/src/credential-output.js.map +1 -0
  32. package/dist/src/dependency-provenance.d.ts +19 -0
  33. package/dist/src/dependency-provenance.js +185 -0
  34. package/dist/src/dependency-provenance.js.map +1 -0
  35. package/dist/src/errors.d.ts +1 -1
  36. package/dist/src/errors.js.map +1 -1
  37. package/dist/src/git.d.ts +1 -1
  38. package/dist/src/git.js +13 -5
  39. package/dist/src/git.js.map +1 -1
  40. package/dist/src/index.d.ts +2 -1
  41. package/dist/src/index.js +2 -1
  42. package/dist/src/index.js.map +1 -1
  43. package/dist/src/lifecycle/canonical-hash.d.ts +6 -0
  44. package/dist/src/lifecycle/canonical-hash.js +24 -0
  45. package/dist/src/lifecycle/canonical-hash.js.map +1 -0
  46. package/dist/src/lifecycle/catalog.d.ts +26 -0
  47. package/dist/src/lifecycle/catalog.js +208 -0
  48. package/dist/src/lifecycle/catalog.js.map +1 -0
  49. package/dist/src/lifecycle/compiler-inspection.d.ts +48 -0
  50. package/dist/src/lifecycle/compiler-inspection.js +29 -0
  51. package/dist/src/lifecycle/compiler-inspection.js.map +1 -0
  52. package/dist/src/lifecycle/core-static-readiness.d.ts +6 -0
  53. package/dist/src/lifecycle/core-static-readiness.js +130 -0
  54. package/dist/src/lifecycle/core-static-readiness.js.map +1 -0
  55. package/dist/src/lifecycle/corrective-replan-authority.d.ts +53 -0
  56. package/dist/src/lifecycle/corrective-replan-authority.js +139 -0
  57. package/dist/src/lifecycle/corrective-replan-authority.js.map +1 -0
  58. package/dist/src/lifecycle/corrective-replan-binding-manifest.d.ts +21 -0
  59. package/dist/src/lifecycle/corrective-replan-binding-manifest.js +35 -0
  60. package/dist/src/lifecycle/corrective-replan-binding-manifest.js.map +1 -0
  61. package/dist/src/lifecycle/corrective-replan-credential-core.d.ts +86 -0
  62. package/dist/src/lifecycle/corrective-replan-credential-core.js +563 -0
  63. package/dist/src/lifecycle/corrective-replan-credential-core.js.map +1 -0
  64. package/dist/src/lifecycle/corrective-replan-credential-schema.d.ts +17 -0
  65. package/dist/src/lifecycle/corrective-replan-credential-schema.js +44 -0
  66. package/dist/src/lifecycle/corrective-replan-credential-schema.js.map +1 -0
  67. package/dist/src/lifecycle/corrective-replan-credentials.d.ts +47 -0
  68. package/dist/src/lifecycle/corrective-replan-credentials.js +103 -0
  69. package/dist/src/lifecycle/corrective-replan-credentials.js.map +1 -0
  70. package/dist/src/lifecycle/corrective-replan.d.ts +64 -0
  71. package/dist/src/lifecycle/corrective-replan.js +553 -0
  72. package/dist/src/lifecycle/corrective-replan.js.map +1 -0
  73. package/dist/src/lifecycle/evaluator.d.ts +2 -0
  74. package/dist/src/lifecycle/evaluator.js +35 -0
  75. package/dist/src/lifecycle/evaluator.js.map +1 -0
  76. package/dist/src/lifecycle/fingerprint.d.ts +31 -0
  77. package/dist/src/lifecycle/fingerprint.js +388 -0
  78. package/dist/src/lifecycle/fingerprint.js.map +1 -0
  79. package/dist/src/lifecycle/immutable.d.ts +1 -0
  80. package/dist/src/lifecycle/immutable.js +10 -0
  81. package/dist/src/lifecycle/immutable.js.map +1 -0
  82. package/dist/src/lifecycle/implementation-table.d.ts +29 -0
  83. package/dist/src/lifecycle/implementation-table.js +87 -0
  84. package/dist/src/lifecycle/implementation-table.js.map +1 -0
  85. package/dist/src/lifecycle/index.d.ts +4 -0
  86. package/dist/src/lifecycle/index.js +5 -0
  87. package/dist/src/lifecycle/index.js.map +1 -0
  88. package/dist/src/lifecycle/schema-artifact.d.ts +12 -0
  89. package/dist/src/lifecycle/schema-artifact.js +214 -0
  90. package/dist/src/lifecycle/schema-artifact.js.map +1 -0
  91. package/dist/src/lifecycle/semantic-registry.d.ts +6 -0
  92. package/dist/src/lifecycle/semantic-registry.js +489 -0
  93. package/dist/src/lifecycle/semantic-registry.js.map +1 -0
  94. package/dist/src/lifecycle/types.d.ts +718 -0
  95. package/dist/src/lifecycle/types.js +4 -0
  96. package/dist/src/lifecycle/types.js.map +1 -0
  97. package/dist/src/observation.d.ts +20 -0
  98. package/dist/src/observation.js +171 -0
  99. package/dist/src/observation.js.map +1 -0
  100. package/dist/src/reviewer.d.ts +43 -1
  101. package/dist/src/reviewer.js +203 -50
  102. package/dist/src/reviewer.js.map +1 -1
  103. package/dist/src/state/corrective-replan-executor.d.ts +64 -0
  104. package/dist/src/state/corrective-replan-executor.js +608 -0
  105. package/dist/src/state/corrective-replan-executor.js.map +1 -0
  106. package/dist/src/state/corrective-replan-public-schema.d.ts +3 -0
  107. package/dist/src/state/corrective-replan-public-schema.js +43 -0
  108. package/dist/src/state/corrective-replan-public-schema.js.map +1 -0
  109. package/dist/src/state/corrective-replan-public.d.ts +95 -0
  110. package/dist/src/state/corrective-replan-public.js +665 -0
  111. package/dist/src/state/corrective-replan-public.js.map +1 -0
  112. package/dist/src/state/corrective-replan-transaction.d.ts +160 -0
  113. package/dist/src/state/corrective-replan-transaction.js +730 -0
  114. package/dist/src/state/corrective-replan-transaction.js.map +1 -0
  115. package/dist/src/state/corrective-yield-executor.d.ts +31 -0
  116. package/dist/src/state/corrective-yield-executor.js +236 -0
  117. package/dist/src/state/corrective-yield-executor.js.map +1 -0
  118. package/dist/src/state/corrective-yield-transaction.d.ts +97 -0
  119. package/dist/src/state/corrective-yield-transaction.js +591 -0
  120. package/dist/src/state/corrective-yield-transaction.js.map +1 -0
  121. package/dist/src/state/lock.d.ts +76 -3
  122. package/dist/src/state/lock.js +611 -30
  123. package/dist/src/state/lock.js.map +1 -1
  124. package/dist/src/state/store.d.ts +3 -0
  125. package/dist/src/state/store.js +65 -12
  126. package/dist/src/state/store.js.map +1 -1
  127. package/dist/src/transition-core.d.ts +67 -0
  128. package/dist/src/transition-core.js +318 -0
  129. package/dist/src/transition-core.js.map +1 -0
  130. package/dist/src/version.d.ts +1 -1
  131. package/dist/src/version.js +1 -1
  132. package/dist/src/version.js.map +1 -1
  133. package/dist/src/workflow.d.ts +88 -24
  134. package/dist/src/workflow.js +1647 -270
  135. package/dist/src/workflow.js.map +1 -1
  136. package/docs/autonomy-guardrails.md +61 -1
  137. package/docs/beta11-plan-integrity-recovery-brief.md +38 -0
  138. package/docs/beta2-initial-assembly-navigation-brief.md +616 -0
  139. package/docs/delegated-approval.md +26 -1
  140. package/docs/development-flow.md +63 -8
  141. package/docs/lifecycle/state-machine-stabilization.md +641 -0
  142. package/docs/pdf/README.md +24 -0
  143. package/docs/pdf/codex-workflow-v2-architecture-ru.pdf +0 -0
  144. package/docs/pdf/codex-workflow-v2-chat-only-guide-ru.pdf +0 -0
  145. package/docs/pdf/codex-workflow-v2-technical-reference-ru.pdf +0 -0
  146. package/docs/pdf/requirements.txt +1 -0
  147. package/docs/pdf/sources/codex-workflow-v2-architecture-ru.md +234 -0
  148. package/docs/pdf/sources/codex-workflow-v2-chat-only-guide-ru.md +334 -0
  149. package/docs/pdf/sources/codex-workflow-v2-technical-reference-ru.md +413 -0
  150. package/docs/problem-briefs/01-pre-implementation-integrity.md +478 -0
  151. package/docs/problem-briefs/02-minimal-step-integrity.md +411 -0
  152. package/docs/problem-briefs/03-minimal-agent-context-integrity.md +358 -0
  153. package/docs/problem-briefs/04-task-dependency-and-structural-replacement-integrity.md +566 -0
  154. package/docs/problem-briefs/BRIEF-TEMPLATE.md +56 -0
  155. package/docs/problem-briefs/README.md +120 -0
  156. package/docs/problem-briefs/evidence/p01-mechanical-feasibility-corpus.md +90 -0
  157. package/docs/problem-briefs/evidence/signal-v4-pre-m3-replay.md +246 -0
  158. package/docs/release.md +30 -6
  159. package/docs/split-required-recovery.md +19 -25
  160. package/docs/stable-release-defect-register.md +465 -3
  161. package/docs/updating-existing-project.md +59 -4
  162. package/docs/validation-report.md +124 -56
  163. package/package.json +9 -1
  164. package/plugins/codex-workflow-gateway/.codex-plugin/plugin.json +10 -3
  165. package/plugins/codex-workflow-gateway/references/protocol.md +92 -4
  166. package/plugins/codex-workflow-gateway/scripts/chat-registry.mjs +376 -0
  167. package/plugins/codex-workflow-gateway/skills/codex-workflow-gateway/SKILL.md +263 -4
  168. package/references/state-machine.md +13 -6
  169. package/roles/delivery-coordinator.md +39 -0
  170. package/schemas/adoption-posture-event.schema.json +1 -1
  171. package/schemas/authorization-event.schema.json +64 -1
  172. package/schemas/context-envelope.schema.json +1 -1
  173. package/schemas/corrective-decision-event.schema.json +48 -3
  174. package/schemas/corrective-replan-credentials.private.schema.json +98 -0
  175. package/schemas/corrective-replan-execution-event.private.schema.json +53 -0
  176. package/schemas/corrective-replan-public.schema.json +142 -0
  177. package/schemas/corrective-replan-task-transaction.private.schema.json +151 -0
  178. package/schemas/corrective-yield-task-transaction.private.schema.json +98 -0
  179. package/schemas/milestone-scope-change-event.schema.json +6 -1
  180. package/schemas/milestone.schema.json +6 -1
  181. package/schemas/remediation-event.schema.json +11 -1
  182. package/schemas/task-handoff-event.schema.json +19 -3
  183. package/schemas/task.schema.json +24 -1
  184. package/schemas/transition-definition.schema.json +2609 -0
  185. package/schemas/transition-payloads.schema.json +140 -0
  186. package/scripts/generate-pdf-docs.py +512 -0
  187. package/scripts/run-pdf-docs.mjs +62 -0
@@ -0,0 +1,478 @@
1
+ ---
2
+ brief_id: WF2-P01
3
+ problem: "Mechanically infeasible Task Plans can reach execution authorization"
4
+ status: approved
5
+ owner: null
6
+ created_at: 2026-08-23
7
+ approved_at: 2026-08-24
8
+ implemented_at: null
9
+ revision: 5
10
+ ---
11
+
12
+ # Brief — P01-A Bounded Mechanical Plan Feasibility
13
+
14
+ ## 0. Evidence and scope
15
+
16
+ The bounded mechanical problem is **confirmed**. The broader claim that bad Briefs or semantic
17
+ decomposition are a primary cause of repeated fix/review cycles is only partially supported and is
18
+ not part of P01-A.
19
+
20
+ Confirmed baseline behavior at the pinned pre-candidate revision:
21
+
22
+ - Task Plan validation checks shape, requirement coverage, Step identifiers, non-empty declared
23
+ checks and outputs, write declarations, and Step dependency cycles.
24
+ - It does not generally prove that a literal npm script or an exact repository path referenced by a
25
+ supported Plan form exists at the planning base.
26
+ - Task execution authorization does not contain a mechanical-feasibility result.
27
+ - `TaskState.baseCommit` is `null` until `task start`; therefore it cannot bind a pre-authorization
28
+ verdict.
29
+ - Current corrective authority already exposes `continue-fix`, `replan-required`,
30
+ `split-required`, and `stop-escalate`. It has no `implementation-defect`, `plan-defect`,
31
+ `brief-decomposition-defect`, or `reslice-plan` decision.
32
+
33
+ The P01-A candidate on `codex/p04-task-dependencies` now adds the bounded evaluator and event
34
+ binding described below. These baseline gaps are retained here as problem evidence, not as claims
35
+ about the candidate implementation. The brief remains `approved` until the combined P04-A/P01-A
36
+ candidate is merged/installed and implementation acceptance is recorded.
37
+
38
+ The Signal pre-M3 replay additionally showed that a narrow check can pass while a project-reference
39
+ build or architecture check fails. That supports earlier verification, but does not make semantic
40
+ Brief/decomposition admission mechanically decidable. See
41
+ [the replay journal](evidence/signal-v4-pre-m3-replay.md#obs-012--a-narrow-task-check-can-pass-while-the-project-reference-build-or-architecture-contract-fails).
42
+
43
+ P01-A implements only:
44
+
45
+ ```text
46
+ current Task Plan
47
+ -> deterministic supported analyzers
48
+ -> evidence bound to the planning-base HEAD
49
+ -> authorization guard and exact diagnostics
50
+ ```
51
+
52
+ Discovery materialization admission, semantic ownership/output mapping, causal defect taxonomy, and
53
+ return from Task execution to decomposition authority are deferred to P01-B or another brief.
54
+
55
+ ## 1. Problem
56
+
57
+ Workflow can authorize a Plan when current repository state and the Plan's own bounded write
58
+ contract already prove that a supported command or exact output target cannot exist when needed.
59
+ The failure is then discovered only after implementation starts.
60
+
61
+ P01-A prevents only **proven mechanical contradictions**. It does not claim that a mechanically
62
+ clear Plan is semantically sufficient or will produce correct code.
63
+
64
+ ## 2. Required invariants
65
+
66
+ ### INV-1 — Proven mechanical contradiction blocks authorization
67
+
68
+ An execution authorization cannot be issued when a versioned supported analyzer proves that the
69
+ current Plan cannot satisfy its own command/path precondition within the allowed prior work.
70
+
71
+ ### INV-2 — Unknown is not a negative verdict
72
+
73
+ Unsupported command syntax, natural-language ambiguity, or a path that a permitted Step may create
74
+ is reported as `unverified`. Core must not convert it into either feasibility proof or mechanical
75
+ failure.
76
+
77
+ ### INV-3 — The verdict binds to the exact evaluation source
78
+
79
+ Before Task start, the authoritative source binding is:
80
+
81
+ ```text
82
+ baseBranch
83
+ evaluatedHead = rev-parse(baseBranch)
84
+ ```
85
+
86
+ `Task.baseCommit` is not used at that phase because current Core assigns it only during
87
+ `task start`. Start requires the selected base commit to equal the authorized `evaluatedHead`.
88
+
89
+ For a corrective Plan after Task start, evaluation uses the current committed Task workspace/branch
90
+ HEAD together with the recorded `baseCommit`. It does not switch back to the moving base branch.
91
+
92
+ ### INV-4 — Relevant change invalidates the verdict
93
+
94
+ A changed Brief hash, Plan hash, selected pre-execution source, analyzer-set version, or other Task
95
+ field consumed by an analyzer requires reevaluation and fresh execution authorization. An unrelated
96
+ Task revision alone is not a freshness signal. A predecessor merge that advances the Task base
97
+ branch before start invalidates an older result. After start, unrelated base-branch movement and
98
+ ordinary Workflow-owned Step commits do not invalidate a verdict whose evaluated commit remains in
99
+ the authorized Task history.
100
+
101
+ ### INV-5 — Existing decisions remain canonical
102
+
103
+ P01-A does not add corrective-decision values. A pre-authorization contradiction rejects
104
+ authorization and routes to Plan replacement. The same contradiction discovered after execution
105
+ uses existing `replan-required`. Unknown classification uses `stop-escalate`; ordinary code defects
106
+ remain on the existing `continue-fix` route.
107
+
108
+ ### INV-6 — Analysis is bounded and read-only
109
+
110
+ The preflight never executes arbitrary Plan commands, starts infrastructure, calls providers,
111
+ applies migrations, or mutates the checkout.
112
+
113
+ ### INV-7 — Authorization and evidence are one authority change
114
+
115
+ A successful execution authorization stores the exact feasibility payload in the appended
116
+ authorization event. There is no independent feasibility credential or sidecar lifecycle that can
117
+ drift from Task state.
118
+
119
+ ## 3. P01-A solution
120
+
121
+ ### A. Boundary
122
+
123
+ The evaluator runs against the current Plan before `task authorize`. Repository `next` may expose
124
+ the same deterministic report for diagnostics. The mutating authorization path must recompute or
125
+ verify the report against fresh state; it cannot trust an older `next` response.
126
+
127
+ No new user-visible lifecycle stage is introduced.
128
+
129
+ ### B. Initial supported analyzer set
130
+
131
+ The first implementation supports only explicitly documented grammars:
132
+
133
+ 1. **Literal root npm script** — a check exactly matching the supported `npm run <literal-name>`
134
+ grammar refers to a script present in the root `package.json` at `evaluatedHead`.
135
+ 2. **Provably impossible npm script** — if the script is absent and neither the current Step nor a
136
+ completed/declared predecessor before that check may write the root `package.json`, the Plan is
137
+ blocked. Permission to write the manifest makes the result `unverified`, not automatically
138
+ feasible, unless a future structured contract explicitly declares the script creation.
139
+ 3. **Exact-path output** — an `expectedOutputs[]` entry recognized by an exact documented
140
+ repository-relative-path grammar is either present at `evaluatedHead` or writable by the
141
+ responsible Step. An absent path outside that Step's `allowedWrites` is blocked.
142
+ 4. **Exact-path predecessor** — a missing exact path may be treated as available to a consumer only
143
+ when a declared predecessor owns that exact output path and is allowed to write it. Prose,
144
+ directory overlap, or ordinal is insufficient.
145
+
146
+ All other command forms and semantic claims are `unverified`. Adding an analyzer later requires a
147
+ new stable analyzer ID/version and regression fixtures; it must not silently change an existing
148
+ analyzer's meaning.
149
+
150
+ The revision-4 frozen grammar is exact:
151
+
152
+ ```text
153
+ wf2.root-npm-script@1
154
+ raw check = ^npm run ([A-Za-z0-9][A-Za-z0-9:_-]*)$
155
+
156
+ wf2.exact-output-path@1
157
+ raw expected output = path:<repository-relative POSIX path>
158
+
159
+ wf2.exact-predecessor-path@1
160
+ same exact path + transitive declared Step dependency + predecessor write permission
161
+ ```
162
+
163
+ The structured path contains no empty, `.` or `..` segment or glob token; every segment matches
164
+ `[A-Za-z0-9._-]+`. Bare path-like prose is not recognized. `npm test`, arguments, flags, quoting,
165
+ environment prefixes, shell operators, alternate package managers, and surrounding whitespace are
166
+ not recognized. The evaluator reuses the current `allowedWrites` matcher only after an exact
167
+ structured path has been decoded; it never infers a path from prose.
168
+
169
+ Analyzer order is the fixed order above. Findings are canonicalized by Step ID, analyzer ID, raw
170
+ subject, and result. The analyzer-set hash is SHA-256 over canonical JSON containing the exact
171
+ analyzer IDs and versions.
172
+
173
+ P01-A does not attempt to map every acceptance item to behavioral proof. That requires the
174
+ structured evidence relation and semantic authority owned by P02/P01-B.
175
+
176
+ ### C. Exact evidence contract
177
+
178
+ Extend the existing execution `AuthorizationEvent` with an optional payload equivalent to:
179
+
180
+ ```text
181
+ MechanicalFeasibilityEvidence {
182
+ schemaVersion
183
+ taskId
184
+ evaluatedTaskRevision
185
+ briefHash
186
+ planHash
187
+ sourceKind: pre-start-base | corrective-task-workspace
188
+ sourceBranch
189
+ evaluatedHead
190
+ baseCommit?
191
+ analyzerSetHash
192
+ analyzers[] {
193
+ analyzerId
194
+ analyzerVersion
195
+ }
196
+ findings[] {
197
+ analyzerId
198
+ result: pass | blocked | unverified
199
+ stepId
200
+ subject
201
+ evidence
202
+ reasonCode
203
+ }
204
+ decision: clear | blocked
205
+ }
206
+ ```
207
+
208
+ `clear` means only “no supported analyzer proved infeasibility”; it is not a semantic feasibility
209
+ claim. The canonical payload hash is stored in the event's existing `evidenceHash`, and
210
+ `evaluatedHead` is stored in its existing `headCommit`. The event, payload, hash, and transition to
211
+ `ready` are written atomically with Task state.
212
+
213
+ The payload is optional in the persisted TypeScript/JSON contract only for execution
214
+ authorizations written before P01-A. Every new authorization writes it. Existing already-ready or
215
+ in-progress legacy Tasks retain the earlier Brief/Plan hash freshness rule because Core has no safe
216
+ transition that can retroactively move them back through authorization without inventing human
217
+ authority. Their bounded residual risk remains covered by beta.11 Plan-integrity recovery. Any
218
+ new Plan, Knowledge rebind/context refresh, or corrective authorization writes current P01-A
219
+ evidence.
220
+
221
+ Blocked authorization writes no approved event. Its error and `next` diagnostics return the same
222
+ bounded findings without inventing a durable approval.
223
+
224
+ ### D. Freshness
225
+
226
+ Core selects the source for each new evaluation deterministically:
227
+
228
+ ```text
229
+ Task.baseCommit is null
230
+ -> sourceKind = pre-start-base
231
+ -> sourceBranch = Task.baseBranch
232
+
233
+ Task.baseCommit is present
234
+ -> sourceKind = corrective-task-workspace
235
+ -> sourceBranch = Task.taskBranch/current owned workspace branch
236
+ -> include recorded baseCommit
237
+ ```
238
+
239
+ During the mutating authorization transition, Core builds the payload from fresh values:
240
+
241
+ ```text
242
+ current briefHash / planHash
243
+ current selected source kind / branch / HEAD / baseCommit
244
+ current analyzerSetHash
245
+ current values of any other Task fields consumed by a supported analyzer
246
+ ```
247
+
248
+ Those values become the approved event binding only if the decision is `clear` and the Task write
249
+ commits. Later direct entries compare current authority with that stored binding according to the
250
+ phase rules below.
251
+
252
+ `evaluatedTaskRevision` is retained for audit and diagnostics; it is not compared blindly with the
253
+ current revision because unrelated Task transitions must not invalidate mechanical evidence.
254
+
255
+ Direct-entry freshness then depends on phase:
256
+
257
+ ```text
258
+ before task start
259
+ -> current baseBranch HEAD must equal evaluatedHead
260
+
261
+ after task start, for a pre-start-base event
262
+ -> Task.baseCommit must equal evaluatedHead
263
+ -> evaluatedHead must remain an ancestor of current Task HEAD
264
+
265
+ after task start, for a corrective-task-workspace event
266
+ -> recorded baseCommit must still match
267
+ -> evaluatedHead must remain an ancestor of current Task HEAD
268
+ ```
269
+
270
+ A pre-start `task start` cannot authorize one commit and branch from another. Successful start seals
271
+ that binding as `Task.baseCommit`; the event does not become stale merely because the phase changes.
272
+ Workflow-owned Step commits may advance Task HEAD while preserving ancestry. A Plan replacement,
273
+ history rewrite that removes `evaluatedHead`, explicit source rebinding, or mismatched `baseCommit`
274
+ requires reevaluation and fresh authorization. P04-A supplies predecessor dependency authority;
275
+ P01-A observes its effect on the pre-start base HEAD rather than duplicating the dependency graph.
276
+
277
+ ### E. Routing
278
+
279
+ Before execution:
280
+
281
+ ```text
282
+ blocked mechanical finding
283
+ -> reject task authorization
284
+ -> retain/supersede Plan according to current Plan update rules
285
+ -> return exact task plan-set/corrective-replan route
286
+ ```
287
+
288
+ After execution has started:
289
+
290
+ ```text
291
+ proven mechanical Plan contradiction
292
+ -> existing replan-required decision
293
+ -> current corrective-replan path
294
+ -> rerun P01-A
295
+ -> fresh authorization
296
+ ```
297
+
298
+ P01-A does not introduce causal labels into the corrective-decision union. A stable reason code may
299
+ identify `mechanical-plan-infeasibility` inside evidence, but authority remains
300
+ `replan-required`. If the repair would change Task scope or decomposition, P01-A stops; it does not
301
+ silently map the condition to `split-required` because that decision has terminal replacement
302
+ semantics.
303
+
304
+ ### F. Diagnostics
305
+
306
+ `next` and authorization failures expose, without credentials:
307
+
308
+ ```text
309
+ analyzer ID/version
310
+ binding HEAD and Plan hash
311
+ Step and subject
312
+ pass / blocked / unverified
313
+ concrete repository or Plan evidence
314
+ required existing route
315
+ ```
316
+
317
+ Unsupported syntax must be distinguishable from a proved missing prerequisite.
318
+
319
+ ## 4. Validation
320
+
321
+ ### 4.1 Contract and freshness tests
322
+
323
+ - exact supported npm script at the evaluated HEAD is clear;
324
+ - missing script outside all responsible manifest write bounds blocks;
325
+ - missing script with a permitted manifest-writing Step is `unverified`, not pass;
326
+ - absent exact output path outside `allowedWrites` blocks;
327
+ - exact predecessor-owned path is accepted only with a declared dependency and exact write/output
328
+ match;
329
+ - prose output and unsupported commands remain `unverified`;
330
+ - analyzer IDs, versions, ordering, canonical payload, and hash are deterministic;
331
+ - Plan, Brief, pre-start source HEAD, source ancestry/baseCommit, analyzer-set, or another
332
+ analyzer-consumed field change invalidates the event;
333
+ - an unrelated Task revision does not invalidate the event;
334
+ - a P04 predecessor merge before start invalidates authorization through base-HEAD drift;
335
+ - unrelated base-branch movement and ordinary descendant Step commits after start do not invalidate
336
+ the event;
337
+ - a history rewrite that removes `evaluatedHead` from Task ancestry fails closed;
338
+ - evidence payload, event hash, and Task `ready` transition cannot partially commit.
339
+
340
+ ### 4.2 Routing tests
341
+
342
+ - a pre-authorization block returns to current Plan replacement without consuming an implementation
343
+ attempt;
344
+ - a late proved Plan contradiction uses `replan-required`;
345
+ - an ordinary implementation defect remains `continue-fix`;
346
+ - a scope/decomposition ambiguity does not get mislabeled as `split-required` by P01-A;
347
+ - unknown classification returns `stop-escalate` where current policy requires a decision.
348
+
349
+ ### 4.3 Synthetic E2E
350
+
351
+ 1. Reject a missing npm script that no responsible Step may create before implementation starts.
352
+ 2. Report `unverified`, without a false pass, when the current Plan permits a predecessor to edit
353
+ the manifest but does not structurally declare script creation.
354
+ 3. Authorize a valid low-risk Plan without an extra semantic agent review.
355
+ 4. Advance the base branch after pre-start authorization and prove that claim/start is rejected
356
+ until fresh evaluation and authorization.
357
+ 5. Advance the base branch and add an authorized descendant Step commit after Task start; neither
358
+ makes the event falsely stale.
359
+ 6. Rewrite Task history so that `evaluatedHead` is no longer an ancestor and prove execution fails
360
+ closed.
361
+ 7. Discover a genuine mechanical contradiction after execution and route through current
362
+ corrective replan.
363
+
364
+ ### 4.4 Replay controls
365
+
366
+ Before fail-closed enforcement, evaluate a version-pinned corpus containing:
367
+
368
+ - successful single- and multi-Step Plans;
369
+ - ordinary implementation remediations;
370
+ - known missing-script/path contradictions;
371
+ - unsupported command forms.
372
+
373
+ Record earliest detection, finding classification, false blockers, and transitions avoided.
374
+ Unverified findings are measured separately and are not counted as passes.
375
+
376
+ Revision-4 replay evidence is recorded in
377
+ [the P01-A corpus journal](evidence/p01-mechanical-feasibility-corpus.md). The pinned corpus produced
378
+ three exact supported contradictions, zero false blockers among successful controls, and preserved
379
+ unsupported shell/prose and semantic coverage claims as `unverified`.
380
+
381
+ ## 5. Design approval gate
382
+
383
+ P01-A is recommended after P04-A. It may move from `hypothesis` to `approved` only when:
384
+
385
+ 1. The supported command/path grammars and canonicalization fixtures are explicit.
386
+ 2. Each analyzer has a stable ID/version and cannot execute the Plan.
387
+ 3. The authorization payload, hash reuse, atomic write, and diagnostics are accepted as the exact
388
+ evidence contract.
389
+ 4. Freshness uses exact base-branch HEAD before start and source ancestry plus `baseCommit` after
390
+ start, without invalidating ordinary descendant Step commits.
391
+ 5. Existing corrective decisions and transitions cover every P01-A route without a new decision
392
+ enum.
393
+ 6. Corpus replay shows that proven blockers are real contradictions and unsupported cases remain
394
+ unverified.
395
+
396
+ ## 6. Implementation acceptance
397
+
398
+ P01-A may move from `approved` to `implemented` only when:
399
+
400
+ 1. Every declared contract, freshness, routing, E2E, and atomicity test passes.
401
+ 2. Proven supported contradictions block authorization and direct execution entry points.
402
+ 3. Selected source or Plan authority drift requires fresh evaluation and authorization without
403
+ treating unrelated post-start base movement or descendant Step commits as stale.
404
+ 4. Low-risk valid Plans gain no mandatory semantic review or lifecycle stage.
405
+ 5. Unsupported analysis never becomes an invented pass or failure.
406
+ 6. Current correction/replan behavior remains compatible for ordinary implementation defects.
407
+ 7. No new credential, feasibility sidecar lifecycle, Contract Registry, Context Graph, or
408
+ decomposition state machine is introduced.
409
+
410
+ ## 7. Dependencies and conflicts
411
+
412
+ - P04-A should land first so predecessor satisfaction and the base-HEAD invalidation scenario are
413
+ canonical.
414
+ - P02 owns output-to-verification semantics and Step usefulness; P01-A does not infer them.
415
+ - P03 may project the current feasibility binding but cannot recompute or approve it.
416
+ - P05/P04-B owns replacement after `split-required`.
417
+ - P01-A must not repurpose `split-required` as a generic decomposition label.
418
+
419
+ ## 8. Deferred P01-B questions
420
+
421
+ P01-A intentionally leaves these unresolved:
422
+
423
+ - What durable authority represents Task boundary, ownership, prerequisite, and verification
424
+ allocation before materialization?
425
+ - How is semantic acceptance-to-evidence mapping represented without duplicating P02?
426
+ - Does decomposition repair mutate Discovery, materialize replacement Tasks, or require a distinct
427
+ transition?
428
+ - Is a causal defect class metadata on existing decisions, or is a new decision model actually
429
+ necessary?
430
+ - How are implementation-attempt counters distinguished from Plan/decomposition repair?
431
+
432
+ P01-B remains `NO-GO` until those questions have concrete contracts and fresh replay evidence.
433
+
434
+ ## 9. Non-goals
435
+
436
+ - Discovery/decomposition semantic admission;
437
+ - semantic proof that checks establish behavior;
438
+ - Step usefulness and reslicing;
439
+ - Task dependency storage or scheduling;
440
+ - structural replacement topology;
441
+ - executing arbitrary Plan commands;
442
+ - requiring the full repository suite for every Step;
443
+ - proving future implementation correctness.
444
+
445
+ ## 10. Decision log
446
+
447
+ - 2026-08-23 — Revision 1 created as `hypothesis`.
448
+ - 2026-08-24 — Revision 2 narrowed arbitrary pre-execution validation to supported deterministic
449
+ analyzers and recorded Signal replay evidence.
450
+ - 2026-08-24 — Revision 3 split the implementable P01-A mechanical boundary from deferred P01-B
451
+ semantic decomposition work.
452
+ - 2026-08-24 — Feasibility binding changed from unavailable pre-start `Task.baseCommit` to an exact
453
+ phase-aware source: `baseBranch` HEAD before start and Task-workspace HEAD plus `baseCommit` after
454
+ start. Post-start freshness uses commit ancestry, so predecessor/base drift invalidates pre-start
455
+ authorization without treating authorized Step commits as stale.
456
+ - 2026-08-24 — Mechanical evidence was placed inside the existing execution authorization event;
457
+ new corrective decision values and a separate evidence lifecycle were rejected.
458
+ - 2026-08-24 — P01-A designated `GO after P04-A`; P01-B remains `NO-GO`.
459
+ - 2026-08-24 — Revision 4 froze three analyzer IDs/versions, exact literal npm and `path:`
460
+ grammars, canonical ordering/hash rules, and the conservative unsupported boundary.
461
+ - 2026-08-24 — The version-pinned corpus replay found three real supported contradictions, zero
462
+ false blockers among successful controls, and kept unsupported shell/prose and Signal semantic
463
+ coverage claims `unverified`.
464
+ - 2026-08-24 — Design review accepted the existing execution authorization event as the sole
465
+ feasibility authority, phase-aware HEAD/ancestry freshness, current corrective decisions, and
466
+ atomic Task-state write. Status moved from `hypothesis` to `approved`; implementation has not
467
+ started at this decision boundary.
468
+ - 2026-08-24 — Revision 5 records the combined-branch implementation candidate: three read-only
469
+ analyzers, deterministic evidence/hash binding, pre-lease claim and execution-entry freshness,
470
+ `next` diagnostics, and legacy beta.11 compatibility. The document remains `approved` pending
471
+ merge/install and final implementation acceptance.
472
+ - 2026-08-24 — Candidate validation passed typecheck, plugin/schema validation, 12/12 focused
473
+ P01-A tests, 4/4 beta.11 late-recovery compatibility tests, and the full combined 318/318 suite.
474
+ This is review/merge evidence, not an `implemented` status change.
475
+ - 2026-08-24 — Final source review closed a start-time TOCTOU window by comparing the authorized
476
+ base commit again inside local branch creation before Git mutation. The new negative witness and
477
+ the complete affected P01/P04/Task lifecycle selection passed 13/13 and 84/84 respectively;
478
+ the exact final candidate then passed the full 319/319 suite.