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
@@ -28,6 +28,16 @@ uses a bootstrap audit over the preserved non-`completed`, non-`skipped` Steps o
28
28
  The audit names a Plan author and independent auditor, binds each guarded failure mode to
29
29
  exact executable evidence, and blocks authorization on `split-required` or `stop-escalate`.
30
30
 
31
+ P01-A adds a second, bounded admission check without adding a lifecycle stage. Before
32
+ `task authorize`, Core reads the selected committed source and recognizes only three versioned
33
+ mechanical forms: an exact root `npm run <literal-script>`, an exact structured
34
+ `path:<repository-relative POSIX path>` output, and that same path supplied by an exact transitive
35
+ Step predecessor with write authority. A proved contradiction returns to `task plan-set` without
36
+ writing an approval. Unsupported commands, prose, or ambiguous future creation remain
37
+ `unverified`, not pass or failure. A clear payload is stored inside the execution authorization,
38
+ bound to the Brief, Plan, analyzer inputs/set, selected HEAD, and phase-aware base/Task branch.
39
+ Freshness is checked before claim lease acquisition, Task start, and direct execution entry.
40
+
31
41
  Local execution creates `codex/task-<id>-<slug>` from a clean base only after authorization.
32
42
  An externally owned checkout must already use a dedicated non-base branch. The core never
33
43
  creates or removes external worktrees. Each Step declares allowed writes, dependencies, and
@@ -40,6 +50,11 @@ failed checks, or any manual/unrecorded Worker commit block completion.
40
50
  If the current Plan Risk Audit marks the Step for strict review, the atomic commit is still
41
51
  created by core, but the Step remains non-terminal and `next` routes to `task step-review`
42
52
  until commit-bound strict review and reviewer attestation pass.
53
+ Use the exact claimant or required actor from `next` as `--actor`; the independent reviewer
54
+ runs inside Core and is not supplied as the CLI actor.
55
+ When `next` includes `gitMutationPolicy`, obtain bounded permission for that exact Git-writing
56
+ transition before the first call instead of probing and retrying after a `.git/index.lock`
57
+ failure. For `task start`, this applies only when invoking `--workspace-owner local`.
43
58
 
44
59
  After a Step changes approved project knowledge, the Delivery Coordinator reconciles and
45
60
  reapproves the Project Knowledge Map, then runs `task knowledge-rebind` between Steps. The
@@ -58,7 +73,9 @@ additions under Milestone autonomy; every unsafe source-set, category, scope, au
58
73
  conflict change is rejected.
59
74
 
60
75
  Submission requires a clean, auditable Task history and records evidence for the exact
61
- Task head. `task review-launch` starts a separate read-only reviewer. A passing fresh review
76
+ Task head. `task review-launch` starts a separate read-only reviewer and atomically records its
77
+ result. If C1 handoff is active, keep `--actor` equal to the current claimant or required actor
78
+ from `next`; the reviewer identity remains internal to the compound route. A passing fresh review
62
79
  permits Result creation. Human final acceptance binds Brief, Plan, Result, evidence, and
63
80
  the accepted head. Base advancement forces synchronization, checks, review, and acceptance
64
81
  to be repeated before merge.
@@ -73,6 +90,14 @@ For guarded remediation, a third ordinary retry is blocked until a current
73
90
  `task corrective-decision` exists for the same Step and Plan binding. If that corrective
74
91
  attempt fails review, the third failure is a hard stop and no fourth run is permitted.
75
92
 
93
+ One bounded exception avoids a deliberately repeated failure for an older authorization without
94
+ P01-A evidence or a contradiction that becomes observable only after execution starts. If the first guarded check failure
95
+ is caused by an absent root npm script that the Step cannot add because `package.json` is outside
96
+ its `allowedWrites`, fresh `next` advertises `task plan-integrity-recover`. The command records only
97
+ the exact evidence-bound early `replan-required` posture; it never edits source, Plan, or Git.
98
+ Continue through the advertised corrective yield and corrective replan rather than calling
99
+ `task run` again.
100
+
76
101
  Execution authorization and final acceptance use the human path by default. If the user has
77
102
  previously issued an active delegation grant for the exact transition and scope, the named
78
103
  delegate may perform that transition with `--delegation-grant`. The event keeps the delegate
@@ -88,7 +113,10 @@ Discovery -> Milestone planning -> execution authorization -> active
88
113
  -> final acceptance -> accepted
89
114
  ```
90
115
 
91
- A Milestone Plan records outcome, success signal, acceptance, checks, and Task membership.
116
+ A Milestone Plan records outcome, success signal, acceptance, checks, Task membership, and the
117
+ canonical Task dependency DAG. Every membership explicitly supplies `dependsOnTaskIds`, including
118
+ `[]`. A required consumer may depend only on required members of the same Milestone; duplicate,
119
+ self, dangling, external, non-required-provider, and cyclic edges are rejected before commit.
92
120
  Membership is `required`, `waived`, or `cancelled`; non-required entries require a reason.
93
121
  Changing the Plan increments the membership revision, supersedes execution authorization,
94
122
  and prevents new linked Tasks from starting. A Task that has started cannot be removed;
@@ -97,24 +125,33 @@ may finish while an amendment awaits authorization.
97
125
 
98
126
  During initial planning, all linked Tasks may be materialized before one complete
99
127
  `milestone plan-set`; no execution is available until the Plan classifies every reverse
100
- membership. After that boundary, semantic changes use human-only
128
+ membership. Repository `next` returns `milestone initial-assembly` both before Task 1 and between
129
+ linked Tasks. Its `linked-task-assembly` option explicitly permits `discovery start` and
130
+ `discovery materialize`; after the first linked Task exists, its closing option permits one
131
+ complete `milestone plan-set`. A failed
132
+ `status` or `next` is not permission to call the closing command directly. After that boundary,
133
+ semantic changes use human-only
101
134
  `milestone scope-change-prepare` and `milestone scope-change-apply`. A previously issued
102
135
  Milestone Autonomy Contract may instead use `milestone autonomy-evolve` for membership-only
103
136
  changes while the outcome, success signal, acceptance, checks, discovery, and base branch
104
137
  remain unchanged. The same contract may complete an atomic content-only Task context refresh
105
138
  without a new human gate, but cannot approve Project Memory independently. Both paths retain
106
- journaled recovery across `state.json`, `plan.json`, and `scope-change-events.jsonl`.
139
+ journaled recovery across `state.json`, `plan.json`, and `scope-change-events.jsonl`. The initial
140
+ Plan uses the same recovery machinery for its exact two-file `state.json` + `plan.json` commit and
141
+ does not manufacture a scope-change event.
107
142
 
108
143
  A Milestone has no integration branch. Validation requires all required Tasks to be
109
144
  `merged`, checks the current clean base branch, and writes evidence plus Result. Final
110
145
  acceptance binds those artifacts to the unchanged base HEAD. Cancellation records a reason
111
146
  and never changes Task state or reverts merged commits.
112
147
 
113
- Repository-level `next` considers Milestone membership before it dispatches a Task. An
114
- unstarted linked Task is actionable only while its Milestone is `active` and its current
115
- membership is `required`. Unstarted `waived`/`cancelled` memberships and Tasks belonging to
148
+ Repository-level `next` considers Milestone membership and dependencies before it dispatches a
149
+ Task. A linked Task is actionable only while its Milestone is `active`, its current membership is
150
+ `required`, and every declared required predecessor is `merged`. Handoff prepare, claim before
151
+ lease acquisition, and Task start use the same predicate. Unstarted `waived`/`cancelled`
152
+ memberships and Tasks belonging to
116
153
  an accepted/cancelled Milestone are historical records, not work. A Task that already owns
117
- a workspace remains actionable while its non-terminal Milestone permits it to finish.
154
+ a workspace does not bypass an unsatisfied Milestone predecessor.
118
155
 
119
156
  After successful Milestone validation, `next` emits `requiredHumanGate` containing the
120
157
  Milestone revision, Plan/Result/evidence hashes, validated base HEAD, and a deterministic
@@ -128,11 +165,29 @@ With an eligible `milestone.final_accept` grant, `next` additionally returns
128
165
  `delegatedApprovalOptions`. The delegate may then use the current `MSA-*` code in the same
129
166
  turn because the earlier grant-issuance turn is the controlling user decision. Without such
130
167
  an option, the ordinary later-message human gate remains mandatory.
168
+ Pass `--delegation-grant` only when the same `next` response exposes an exact eligible
169
+ `delegatedApprovalOptions` entry for that transition. Ordinary C1 handoff, claim, run,
170
+ step-complete, step-review, merge, and sync-base do not consume a Milestone approval grant.
131
171
 
132
172
  The Milestone coordinator keeps implementation out of its long-lived context: every required
133
173
  Task runs in a dedicated user-visible Task chat. The Milestone chat owns ordering, exact
134
174
  delegated transitions, merge observation, cross-Task validation, and final acceptance.
135
175
 
176
+ The coordinator creates that chat as a new standalone Codex task, never as a fork/handoff of its
177
+ own thread, and sends only a fresh TaskContextPacket for the exact Task. It creates or reuses the
178
+ chat just before dispatch, not as an empty membership placeholder. The project registry allocates
179
+ one monotonic `#NNN` and builds `#NNN · M<NN> · Coord · <Milestone title> · <MS-ID>` or
180
+ `#NNN · M<NN>/T<NN> · Task · <Task title> · <TASK-ID>`; the Task ordinal still comes from approved
181
+ membership order. Exact readback and registry-owned fallback are mandatory.
182
+
183
+ Dispatch is followed by an explicit coordinator supervision loop. The Milestone chat waits on the
184
+ one currently routed Task chat with bounded `wait_threads` calls, reads it when it completes or
185
+ needs attention, and then verifies repository `status -> next`. A recoverable non-human boundary is
186
+ returned to the same chat with `send_message_to_thread`; only a genuine user/semantic gate or
187
+ unrecoverable blocker ends the coordinator turn. The next Task chat is created only after Core
188
+ confirms that the prior required Task is terminal and merged. Task completion does not implicitly
189
+ wake a coordinator that has already ended its turn.
190
+
136
191
  ## Responsibility boundaries
137
192
 
138
193
  | Participant | Responsible for | Cannot decide |