codex-workflow-v2 2.0.0-alpha.6.2 → 2.0.0-alpha.7.1

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 (48) hide show
  1. package/README.md +43 -71
  2. package/dist/src/alpha6/handoff.d.ts +1 -0
  3. package/dist/src/alpha6/handoff.js +6 -0
  4. package/dist/src/alpha6/handoff.js.map +1 -1
  5. package/dist/src/alpha6/milestone.d.ts +3 -0
  6. package/dist/src/alpha6/milestone.js +57 -3
  7. package/dist/src/alpha6/milestone.js.map +1 -1
  8. package/dist/src/alpha6/plan-risk.js +61 -0
  9. package/dist/src/alpha6/plan-risk.js.map +1 -1
  10. package/dist/src/alpha6/remediation.d.ts +4 -20
  11. package/dist/src/alpha6/remediation.js +73 -150
  12. package/dist/src/alpha6/remediation.js.map +1 -1
  13. package/dist/src/alpha7/autonomy.d.ts +61 -0
  14. package/dist/src/alpha7/autonomy.js +256 -0
  15. package/dist/src/alpha7/autonomy.js.map +1 -0
  16. package/dist/src/cli.js +23 -16
  17. package/dist/src/cli.js.map +1 -1
  18. package/dist/src/contracts.d.ts +11 -6
  19. package/dist/src/index.d.ts +3 -0
  20. package/dist/src/index.js +3 -0
  21. package/dist/src/index.js.map +1 -1
  22. package/dist/src/state/lock.d.ts +1 -3
  23. package/dist/src/state/lock.js +2 -5
  24. package/dist/src/state/lock.js.map +1 -1
  25. package/dist/src/version.d.ts +1 -1
  26. package/dist/src/version.js +1 -1
  27. package/dist/src/workflow.d.ts +21 -65
  28. package/dist/src/workflow.js +548 -657
  29. package/dist/src/workflow.js.map +1 -1
  30. package/docs/alpha7.1-implementation-brief.md +268 -0
  31. package/docs/autonomy-guardrails.md +56 -20
  32. package/docs/decisions.md +16 -4
  33. package/docs/delegated-approval.md +12 -5
  34. package/docs/development-flow.md +12 -7
  35. package/docs/release.md +4 -6
  36. package/docs/updating-existing-project.md +9 -39
  37. package/docs/validation-report.md +50 -63
  38. package/package.json +2 -2
  39. package/plugins/codex-workflow-gateway/references/protocol.md +53 -17
  40. package/plugins/codex-workflow-gateway/skills/codex-workflow-gateway/SKILL.md +33 -9
  41. package/references/state-machine.md +31 -13
  42. package/roles/delivery-coordinator.md +10 -1
  43. package/roles/technical-planner.md +3 -0
  44. package/schemas/context-envelope.schema.json +0 -10
  45. package/schemas/milestone-autonomy-event.schema.json +45 -0
  46. package/schemas/milestone-scope-change-event.schema.json +3 -1
  47. package/schemas/plan-risk-audit-event.schema.json +21 -4
  48. package/schemas/corrective-plan-audit-record.schema.json +0 -47
@@ -0,0 +1,268 @@
1
+ # codex-workflow-v2 2.0.0-alpha.7.1 implementation brief
2
+
3
+ ## Status and authority
4
+
5
+ This document is the single source of truth for the local `2.0.0-alpha.7.1`
6
+ release candidate. It was authorized in the current Codex task on 2026-08-14.
7
+ Workflow V2 must not be used to organize or authorize this development work.
8
+
9
+ The candidate is based on the published tag `v2.0.0-alpha.7` at commit
10
+ `b7ce0b5e14791e8177c104a2344dfb46f459696f` and is developed in the standalone
11
+ repository `/Users/home-pc/htdocs/codex-workflow-v2` on the isolated branch
12
+ `codex/workflow-v2-alpha7-1`.
13
+
14
+ No tag, push, or npm publication is authorized. The `signal_v4` repository,
15
+ its external Workflow state, and its Milestone 3 state are read-only evidence
16
+ and must not be changed.
17
+
18
+ ## Problem statement
19
+
20
+ Alpha.7 adds a bounded Milestone autonomy contract, but its guarded remediation
21
+ state machine is not internally consistent after a strict Step review failure
22
+ causes Project Knowledge refresh, Task Knowledge rebind, and delegated
23
+ reauthorization.
24
+
25
+ The production-shaped failure is:
26
+
27
+ 1. A guarded Step fails two strict reviews and records two ordinary remediation
28
+ events.
29
+ 2. The Step's commits make Project Knowledge stale.
30
+ 3. Project Knowledge is reconciled and approved, then the Task Plan is rebound
31
+ and reauthorized under a new Plan hash.
32
+ 4. The Task remains runnable and the failed Step remains the remediation target,
33
+ but `next` no longer advertises `task corrective-decision` because the gate is
34
+ derived only for `needs_fix`.
35
+ 5. `recordStepCorrectiveDecision` also accepts only `needs_fix` or a narrowly
36
+ defined `blocked` unverified-review posture, so the advertised and executable
37
+ transitions can diverge.
38
+
39
+ This creates a lifecycle deadlock and previously encouraged signal-specific
40
+ rescue patches. Alpha.7.1 must fix the generic transition semantics. It must not
41
+ hard-code repository names, Task IDs, Step IDs, revisions, commits, Plan hashes,
42
+ or package-upgrade rescue identities.
43
+
44
+ The real-agent E2E exposed a second autonomy deadlock. A normal Task that adds a
45
+ new test can cause the repository scanner to add that file as a supporting
46
+ Knowledge source. The Milestone autonomy contract currently permits only
47
+ content-hash-only atomic refresh, so the new source forces another human approval
48
+ even when its exact path, category, authority, and reason were declared in the
49
+ authorized Task Plan. Alpha.7.1 must distinguish such Plan-bounded supporting
50
+ source additions from unplanned source-set or authority changes.
51
+
52
+ ## User outcomes
53
+
54
+ 1. A Milestone coordinator can execute a bounded Milestone autonomously without
55
+ asking for repeated human approvals covered by the Milestone autonomy
56
+ contract.
57
+ 2. A guarded Step gets at most two ordinary remediation attempts, then exactly
58
+ one independently audited corrective attempt when `continue-fix` is chosen.
59
+ 3. Project Knowledge refresh, Task Knowledge rebind, and delegated
60
+ reauthorization preserve the remediation posture rather than losing or
61
+ bypassing it.
62
+ 4. `next` always recommends a transition that the corresponding command can
63
+ execute from the same immutable state, subject only to the evidence explicitly
64
+ named by that recommendation.
65
+ 5. A third failed guarded remediation reaches a hard stop. Only split or stop
66
+ escalation is permitted; a fourth run is impossible.
67
+ 6. Discovery quality is checked, but ordinary human incompleteness and
68
+ non-blocking unknowns do not require the user to pre-plan agent behavior.
69
+ 7. A Task may add a supporting Knowledge source declared by its already
70
+ authorized Plan without creating another human gate; undeclared additions,
71
+ canonical-source additions, removals, authority/category changes, gaps, and
72
+ conflicts still fail closed.
73
+
74
+ ## Required state-machine semantics
75
+
76
+ ### R1 — generic corrective posture
77
+
78
+ Derive the corrective posture from the current guarded Step, current Plan Risk
79
+ Audit, remediation history, and corrective-decision history. Do not infer it
80
+ solely from `Task.status`.
81
+
82
+ The derivation must work when the same failed guarded Step is represented in any
83
+ legitimate post-failure/post-refresh status produced by the Workflow, including
84
+ `needs_fix`, post-rebind `ready`, post-authorization `ready`, and the existing
85
+ blocked/unverified strict-review retry posture.
86
+
87
+ ### R2 — `next`/command consistency
88
+
89
+ If a guarded Step has two failed remediation events and no decision for attempt
90
+ 3, `next` must advertise `task corrective-decision` before `task run` regardless
91
+ of a content-only Knowledge refresh, Plan rebind, or delegated reauthorization.
92
+
93
+ When `next` advertises `task corrective-decision`,
94
+ `recordStepCorrectiveDecision` must accept the same Task/Step state with the
95
+ recommended revision, Plan Risk Audit, actor/lease posture, and independent
96
+ auditor evidence.
97
+
98
+ ### R3 — Plan rebind continuity
99
+
100
+ Knowledge rebind may create a new Plan hash. Historical remediation events remain
101
+ immutable. A corrective decision is bound to the current Plan hash and the exact
102
+ covered remediation event IDs. Rebind must not reset attempt counts or permit a
103
+ third ordinary attempt.
104
+
105
+ ### R4 — bounded recovery
106
+
107
+ - Attempts 1 and 2 are ordinary.
108
+ - Attempt 3 requires an independent corrective decision.
109
+ - `continue-fix` enables exactly the third corrective attempt.
110
+ - `replan-required` requires an actual new Plan posture before execution.
111
+ - `split-required` and `stop-escalate` block execution.
112
+ - After a third failed remediation event, `next` must expose a stable hard-stop
113
+ action and must not throw while merely reporting status.
114
+ - A fourth `task run` and a fourth `continue-fix` decision are prohibited.
115
+
116
+ ### R5 — priority ordering
117
+
118
+ Pending strict review for an already recorded completion commit outranks
119
+ Knowledge refresh. After that review is terminal, required Project Knowledge
120
+ refresh and Task Knowledge rebind remain mandatory. Once current knowledge and
121
+ authorization are restored, an outstanding corrective decision outranks another
122
+ run. C1 claim/handoff constraints remain authoritative and must not be bypassed.
123
+
124
+ ### R6 — Milestone autonomy
125
+
126
+ The alpha.7 Milestone autonomy contract remains bounded by its immutable semantic
127
+ scope, delegate, expiry, policy hash, and allowed transitions. It may cover
128
+ Milestone execution/final acceptance, Task execution/final acceptance, and
129
+ content-only Project Knowledge approval. Semantic scope changes still require
130
+ new human authority. Alpha.7.1 must not broaden these permissions.
131
+
132
+ ### R7 — Plan-bounded supporting-source refresh
133
+
134
+ The user explicitly authorized this bounded delegated-approval expansion in the
135
+ current Codex task after the real-agent E2E exposed the supporting-source
136
+ deadlock. The authorization is limited to the complete fail-closed predicate
137
+ below.
138
+
139
+ The atomic delegated `task context-refresh` transition may accept a newly
140
+ discovered Knowledge source only when all of the following are true:
141
+
142
+ - the active Task belongs to the Milestone named by the autonomy grant;
143
+ - the current authorized Task Plan declares `knowledgeImpact: create` and an
144
+ exact `knowledgeTargets` entry for the new path and category;
145
+ - the scanner classifies that exact path and category as `supporting`;
146
+ - no previously approved source is removed;
147
+ - no existing source changes category or authority;
148
+ - no unplanned source is added;
149
+ - gaps and conflicts are unchanged and no new conflict exists.
150
+
151
+ The transition remains atomic: reconcile, approve the exact safe candidate,
152
+ rebind Task Knowledge, and supersede execution authorization together. It must
153
+ not permit standalone Project Memory approval, canonical-source creation,
154
+ wildcard/directory targets, or mutation beyond the Task's current Plan and the
155
+ existing Milestone autonomy policy. `next` must expose this delegated refresh
156
+ only when the complete predicate is satisfied and otherwise report the concrete
157
+ unsafe differences.
158
+
159
+ ## Required tests
160
+
161
+ ### Deterministic replay (release-blocking)
162
+
163
+ Add a production-shaped regression using opaque, non-hard-coded Step IDs. It must
164
+ replay the complete sequence:
165
+
166
+ 1. Milestone autonomy and delegated Task authorization.
167
+ 2. Guarded Step completion and strict-review failure 1.
168
+ 3. Ordinary remediation, completion, and strict-review failure 2.
169
+ 4. Project Knowledge staleness, content-only reconcile/approval, Task Knowledge
170
+ rebind, refreshed Plan Risk Audit, and delegated reauthorization.
171
+ 5. `next -> task corrective-decision` and successful recording by an auditor
172
+ distinct from the latest strict reviewer.
173
+ 6. Corrective attempt 3 and successful strict review, followed by Task completion.
174
+ 7. A sibling replay where attempt 3 fails and proves stable hard-stop reporting,
175
+ rejection of a fourth run, and rejection of `continue-fix` for attempt 4.
176
+
177
+ The replay must assert state, sidecar bindings, attempt ordinals, Plan hashes,
178
+ returned actions, and absence of repository-specific rescue logic.
179
+
180
+ Add a sibling deterministic replay for R7. It must prove that one exact
181
+ Plan-declared supporting test source can be accepted through atomic delegated
182
+ context refresh, while an undeclared source, a canonical addition, a removal,
183
+ and an authority/category change remain ineligible and cannot mutate state.
184
+
185
+ ### Existing suites (release-blocking)
186
+
187
+ `npm run validate`, `npm run release:check`, `npm run pack:check`,
188
+ `npm run smoke:downstream`, and `npm run plugin:check` must pass sequentially
189
+ under the repository's supported Node version. Parallel build/clean scripts are
190
+ not valid evidence because they race on shared output directories.
191
+
192
+ ### Real-agent isolated E2E (release-blocking)
193
+
194
+ Create `test-runs/2.0.0-alpha.7.1/project` as a disposable repository inside the
195
+ standalone project. Use the sibling `codex-home`, `workflow-state`, `plugin-root`,
196
+ `npm-cache`, and `evidence` directories for complete isolation. Install the
197
+ candidate from a local `npm pack` tarball, not the public registry. The globally
198
+ installed Codex Workflow plugin remains disabled; the real agent loads only the
199
+ candidate gateway from the isolated plugin root.
200
+
201
+ Run a real Delegate agent through:
202
+
203
+ `initial Discovery -> Milestone -> bounded Milestone autonomy -> Tasks -> strict
204
+ review/remediation and Knowledge refresh -> merge/handback -> Milestone validate
205
+ -> delegated final accept`.
206
+
207
+ The Milestone must be small enough to finish but contain at least three Tasks:
208
+
209
+ 1. A bounded safe-contract implementation Task that adds a Plan-declared
210
+ supporting test source and exercises the R7 atomic refresh path.
211
+ 2. A guarded persistence/documentation Task that causes content drift and two
212
+ deterministic strict-review failures before a bounded corrective success,
213
+ exercising reconcile, rebind, and reauthorization.
214
+ 3. A composition/acceptance Task that closes the Milestone.
215
+
216
+ The initial Discovery prompt should imitate a real product-owner request: desired
217
+ outcome, examples and constraints are present, while implementation details,
218
+ exact Step decomposition, retry mechanics, and some non-blocking design choices
219
+ are deliberately omitted. The agent must discover and resolve what it can,
220
+ record non-blocking unknowns honestly, and proceed without asking the user to
221
+ predict its implementation behavior. The signal_v4 M3 Discovery may be used as
222
+ read-only style evidence, but its domain and identifiers must not be copied into
223
+ the candidate logic.
224
+
225
+ E2E acceptance requires the Milestone to reach final acceptance, all Tasks to be
226
+ terminal, repository state clean, no active or stale writer leases, no action
227
+ requiring human approval inside the granted semantic scope, and an evidence log
228
+ that identifies every command/action and final entity status without secrets.
229
+ The run must include at least one new supporting test source admitted through the
230
+ R7 atomic delegated context-refresh path; manually approving that source is not
231
+ acceptable passing evidence.
232
+
233
+ ## Ownership and integration
234
+
235
+ - Main coordinator: owns this Brief, integration, local tarball, isolated E2E,
236
+ final evidence, and all decisions that cross file ownership.
237
+ - State-machine implementer: owns production changes in `src/` and directly
238
+ related contracts/reference documentation. Must not edit E2E evidence.
239
+ - E2E/test owner: owns deterministic regression tests, fixtures, and isolated E2E
240
+ harness documentation/scripts. Must not change production semantics without a
241
+ written finding to the coordinator.
242
+ - Independent auditor: starts only after implementation and E2E evidence are
243
+ complete; reviews Brief-to-diff traceability, test validity, release artifacts,
244
+ and residual risks without editing implementation files.
245
+
246
+ All contributors share the worktree, must preserve concurrent edits, and must not
247
+ revert changes they did not create.
248
+
249
+ ## Stop-loss and release gate
250
+
251
+ All local iterations retain version `2.0.0-alpha.7.1`; individual failures do not
252
+ create alpha.7.2/alpha.7.3 versions. No publication occurs until deterministic
253
+ replay, the real-agent Milestone, and independent audit all pass.
254
+
255
+ If real-agent execution cannot be completed because Codex cannot be launched with
256
+ the required isolation or cannot exercise a deterministic failure seam, that is
257
+ a release blocker, not permission to substitute a mocked test.
258
+
259
+ ## Deliverables
260
+
261
+ 1. This Brief.
262
+ 2. Generic source diff and reference documentation.
263
+ 3. Deterministic replay and all package validation evidence.
264
+ 4. Local alpha.7.1 tarball identity and downstream installation evidence.
265
+ 5. Real-agent E2E evidence through Milestone final acceptance.
266
+ 6. Independent audit with every finding resolved or explicitly accepted by the
267
+ user.
268
+ 7. Remaining risks and a release recommendation. No tag, push, or publish.
@@ -1,11 +1,11 @@
1
1
  # Autonomous Development Guardrails
2
2
 
3
3
  These rules keep delegated execution autonomous without turning approval into a rubber stamp.
4
- Alpha.6 adds no persistent canonical state fields and keeps `stateSchemaVersion: 2`.
4
+ Alpha.7 adds no persistent canonical entity fields and keeps `stateSchemaVersion: 2`.
5
5
 
6
6
  ## Plan Risk Audit
7
7
 
8
- Before execution authorization, every alpha.6 Task needs a current Plan Risk Audit sidecar
8
+ Before execution authorization, every alpha.7 Task needs a current Plan Risk Audit sidecar
9
9
  bound to the current Brief, Plan, and approved Knowledge Map. This is mandatory even when all
10
10
  Steps are unguarded and the decision is `approved`.
11
11
 
@@ -15,6 +15,8 @@ The payload must classify every current Step exactly once and declare:
15
15
  - `decision`: `approved`, `approved-with-rationale`, `split-required`, or `stop-escalate`
16
16
  - per-Step guarded categories, concrete `failureModes`, and `reviewRequired`
17
17
  - `requiredEvidence` entries that exactly match executable checks in that Step
18
+ - one proof obligation per guarded failure mode, with a hostile counterexample, expected safe
19
+ result, and evidence that exactly matches `requiredEvidence`
18
20
  - `splitRationale` when migration is intentionally coupled to recovery or runtime composition
19
21
 
20
22
  The workflow rejects omitted Steps, extra Steps, duplicate classifications, stale bindings,
@@ -70,15 +72,21 @@ path. The Auditor must differ from the failed-review author and cover every late
70
72
  `replan-required`, `split-required`, and `stop-escalate` are stop decisions: Core does not
71
73
  start another implementation loop.
72
74
 
73
- For alpha.6 guarded Steps, remediation attempts are also tracked in
75
+ For guarded Steps, remediation attempts are also tracked in
74
76
  `remediation-events.jsonl`. Two ordinary remediation attempts are allowed. A third ordinary
75
77
  retry is blocked until `task corrective-decision` records a current corrective decision in
76
- `corrective-decisions.jsonl`. `continue-fix` allows bounded continuation; the other decisions
77
- stop or redirect ordinary execution. If that third, corrective remediation review also fails,
78
- Core enters a hard stop: a fourth run and another `continue-fix`/`replan-required` decision are
79
- rejected. Only `split-required` or `stop-escalate` may be recorded.
80
-
81
- ## Content-only context refresh
78
+ `corrective-decisions.jsonl`. The corrective gate is derived from the guarded Step, current
79
+ Plan Risk Audit, remediation history, and corrective-decision history, so it remains visible
80
+ after content-only context refresh, Task Knowledge rebind, and reauthorization. `continue-fix`
81
+ allows bounded continuation; `replan-required` requires an actual new Plan posture before
82
+ execution; the other decisions stop or redirect ordinary execution. If that third, corrective
83
+ remediation review also fails, Core enters a hard stop: `next` must report the stop without
84
+ throwing, a fourth run and another `continue-fix`/`replan-required` decision are rejected,
85
+ and only `split-required` or `stop-escalate` may be recorded. At the corrective boundary,
86
+ `next` derives a distinct `agent:corrective-auditor:<task-id>` actor; selecting that actor is
87
+ not a human approval, while auditor independence remains mandatory.
88
+
89
+ ## Atomic context refresh
82
90
 
83
91
  When `next.contextRefresh` offers an exact option, a project-scoped delegate may run one
84
92
  composite transition:
@@ -92,10 +100,20 @@ task context-refresh
92
100
  ```
93
101
 
94
102
  The command requires the exact Task and Knowledge Map revisions, delegate actor, and grant.
95
- Core validates both grant transitions before the first write. It is allowed only when an
96
- already approved source set has content-hash drift and its category, scope, authority, gaps,
97
- and conflicts are unchanged. New or removed sources and any classification/authority change
98
- stop on the ordinary visible Knowledge Map flow.
103
+ Core validates both grant transitions and the complete Knowledge diff before the first write.
104
+ The existing content-only path remains limited to an already approved source set whose category,
105
+ scope, authority, gaps, and conflicts are unchanged.
106
+
107
+ A Milestone Autonomy Grant may additionally admit a new supporting source when the current,
108
+ already execution-authorized Task Plan declares `knowledgeImpact: create` and the source's exact
109
+ normalized file path and scanner category in `knowledgeTargets`. Every added source must match;
110
+ wildcards and directory-like targets are not authority. The Task must belong to that exact
111
+ Milestone and the delegate and grant must still satisfy the immutable autonomy contract. Removed
112
+ sources, canonical additions, unplanned additions, changes to existing category/scope/authority
113
+ or classification identity, changed gaps, and changed or non-empty conflicts fail closed before
114
+ state is written. `next.contextRefresh.addedSources` exposes the exact eligible additions, while
115
+ `next.contextRefreshBlocked.unsafeDifferences` reports the concrete mismatches.
116
+ Standalone Project Memory approval is never enabled by this path.
99
117
 
100
118
  ## Chat ownership
101
119
 
@@ -113,7 +131,13 @@ An expired lease is also a blocker until the ordinary explicit stale-lock repair
113
131
  The command is read-only and reports every blocker. It does not install a package or migrate
114
132
  state. When `stateSchemaVersion` remains `2`, the external project state is reused unchanged.
115
133
  Existing schema 2 projects then use `state adoption-prepare` and `state adoption-apply`; they
116
- do not use `state migrate` for alpha.6 adoption.
134
+ do not use `state migrate` for schema-2 adoption.
135
+
136
+ Alpha.7 also exposes `update rescue-preflight` for one narrow alpha.6 deadlock: a pending strict
137
+ review whose completion commit changed canonical knowledge while Knowledge rebind is forbidden
138
+ by the still-in-progress Step. Eligibility requires an exact alpha.6 dependency, one pending
139
+ review, exact clean completion HEAD, valid history, and no active lease. The command is read-only
140
+ and returns only stale-lock repair plus strict-review actions.
117
141
 
118
142
  ## Milestone closure
119
143
 
@@ -123,15 +147,27 @@ compare Result, evidence, Plan hash, and validated HEAD. A delegate may accept o
123
147
  exact `milestone.final_accept` option, must remain the recorded actor, and must pass the
124
148
  current `MSA-*` code. Without that option the ordinary later-message human gate applies.
125
149
 
126
- ## Human-only Milestone scope change and C1 handoff
150
+ ## Bounded Milestone autonomy and C1 handoff
151
+
152
+ Initial assembly may materialize every linked Task before one complete `milestone plan-set`;
153
+ the Milestone cannot execute until all reverse memberships are classified. Ordinary semantic
154
+ scope change remains explicit and human-only through `milestone scope-change-prepare` and
155
+ `milestone scope-change-apply`.
127
156
 
128
- Milestone scope change beyond the initial empty planning posture is explicit and human-only:
129
- use `milestone scope-change-prepare` and `milestone scope-change-apply`. The change is
130
- journaled across `state.json`, `plan.json`, and `scope-change-events.jsonl`, and delegated
131
- approval never authorizes it.
157
+ After the initial Plan, one human may approve a time-bound (maximum 72 hours) Milestone
158
+ Autonomy Contract. It creates a milestone-scoped grant for Task/Milestone execution and final
159
+ acceptance plus Project Memory approval only inside an atomic Task context refresh for the same
160
+ Milestone. That refresh covers content-only drift and the exact Plan-bounded supporting-source
161
+ addition described above. Standalone Project Memory approval remains forbidden. The contract binds
162
+ the immutable outcome, success signal, acceptance, checks, discovery, and base branch.
163
+ `milestone autonomy-evolve` may only alter Task memberships; it records the
164
+ agent actor plus the autonomy-contract event hash in the journaled scope-change sidecar and
165
+ supersedes execution authorization. Any semantic drift, expiry, revocation, actor mismatch,
166
+ or contract hash mismatch fails closed.
132
167
 
133
168
  `C1` handoff uses `task handoff-prepare`, `task claim --claim-token ...`, and terminal
134
- `task handback-create`. Preparation returns a one-time token and prompt bound to a stable
169
+ `task handback-create`. When target actor is omitted, Core derives
170
+ `agent:worker:<task-id>`. Preparation returns a one-time token and prompt bound to a stable
135
171
  `handoffId`, revision, Brief/Plan/Knowledge hashes, Milestone and Task display numbers,
136
172
  expected next action, delegate/grant, creation time, and expiry. Only the claim-token hash is
137
173
  stored; `task handoff-show` cannot recover it. Claim fails closed on expiry, actor, token,
package/docs/decisions.md CHANGED
@@ -80,7 +80,19 @@ This document closes the requirement gaps identified during the V2 design review
80
80
  15. **Safe update preflight.** Dependency updates begin with a read-only preflight requiring
81
81
  a clean checkout, no running Step, and no active writer lease. It does not install,
82
82
  migrate, or mutate project state.
83
- 16. **Claimed-C1 rescue is one guarded transition.** The alpha.6.1 backport may bypass only
84
- the stale Knowledge binding that blocks one exact pending strict review. It requires the
85
- original claimant actor and writer token, preserves the lease, rechecks clean completion
86
- HEAD and C1 bindings, and never composes stale-lock repair with review.
83
+ 16. **Strict-review recovery precedes Knowledge rebind.** A pending strict review is bound to
84
+ its immutable completion commit, Plan, and historical knowledge binding. It therefore
85
+ runs before a current-map rebind; the rebind remains mandatory before the next Step. A
86
+ read-only alpha.6 rescue profile exposes only this exact recovery shape.
87
+ 17. **Bounded Milestone autonomy.** Initial linked Tasks may be assembled before one complete
88
+ membership Plan. One human-confirmed, expiring Milestone contract may then authorize the
89
+ existing Task/Milestone approval transitions, guarded content-only Task context refresh,
90
+ and membership-only evolution. Standalone Project Memory approval remains forbidden.
91
+ Outcome, success signal, acceptance, checks, discovery, and base branch remain immutable;
92
+ semantic change stays human-only.
93
+ 18. **Planning proof obligations.** Every newly recorded guarded audit maps each failure mode
94
+ to one hostile counterexample, expected safe result, and exact executable Step check.
95
+ Historical alpha.6 audit events remain readable only to preserve safe lifecycle recovery.
96
+ 19. **Derived independent actors.** Core derives stable Task Worker and corrective Auditor
97
+ actors from Task identity. This removes name-selection pauses without weakening C1 claim,
98
+ lease, or auditor-independence checks.
@@ -52,12 +52,19 @@ delegation.transition
52
52
  acceptance still requires the current `MSA-*` code, preserving the revision/hash/HEAD binding;
53
53
  the pre-issued grant replaces only the later human-message requirement.
54
54
 
55
- Alpha.6 does not widen this allow-list. Delegated approval does not authorize:
55
+ Alpha.7 does not widen the generic delegation allow-list. Generic delegated approval does not authorize:
56
56
 
57
57
  - `state adoption-apply`
58
58
  - `milestone scope-change-prepare`
59
59
  - `milestone scope-change-apply`
60
- - any replacement human gate for Milestone membership repair or scope decisions
60
+ - semantic Milestone scope changes
61
+
62
+ A separate `milestone autonomy-prepare` / `milestone autonomy-grant` contract issues one
63
+ milestone-scoped grant over the existing Task/Milestone approval transitions, adds
64
+ membership-only evolution authority, and permits Project Memory approval only as the guarded
65
+ half of an atomic content-only Task context refresh in that Milestone. Standalone Project Memory
66
+ approval remains project-scoped. The contract does not add a generic delegation transition:
67
+ outcome, success signal, acceptance, checks, discovery, and base branch remain immutable.
61
68
 
62
69
  ## Starting a delegate chat
63
70
 
@@ -81,9 +88,9 @@ scope changes are not approval transitions: the delegate stops and asks the user
81
88
  Independent Reviewer roles may implement or review work, but the coordinating delegate alone
82
89
  uses the grant and passes `--delegation-grant` to the Core transition.
83
90
 
84
- This matters more in alpha.6 because Milestone scope changes are explicitly journaled,
85
- human-only lifecycle actions. A delegate may continue ordinary Milestone execution only inside
86
- the already approved scope.
91
+ Ordinary semantic Milestone scope changes remain journaled, human-only lifecycle actions. A
92
+ contract delegate may evolve only the membership graph inside the cryptographically bound
93
+ semantic scope.
87
94
 
88
95
  ### Milestone delegate prompt
89
96
 
@@ -21,9 +21,9 @@ Materialization requires an observable outcome, scope, acceptance criteria, and
21
21
  blocking unknowns. No Task identifier or branch exists before this gate. Task authorization
22
22
  is hash-bound to Brief and Plan. Later Plan changes supersede it.
23
23
 
24
- In alpha.6, execution authorization also requires a current Plan Risk Audit bound to the same
24
+ In alpha.7, execution authorization also requires a current Plan Risk Audit bound to the same
25
25
  Brief, Plan, Knowledge Map, and exact Step set. For existing schema 2 projects upgraded into
26
- alpha.6, execution additionally requires adoption posture first; remaining legacy scope then
26
+ alpha.7, execution additionally requires adoption posture first; remaining legacy scope then
27
27
  uses a bootstrap audit over the preserved non-`completed`, non-`skipped` Steps only.
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`.
@@ -67,7 +67,7 @@ replay, and crash claims include restart/crash-window evidence; provider work in
67
67
  failure injection and hidden-default verification. After two failed independent reviews,
68
68
  another Plan requires a distinct corrective Auditor and `--corrective-audit-file`. Only a
69
69
  `continue-fix` audit may continue; replan, split, and stop decisions return to coordination.
70
- For guarded alpha.6 remediation, a third ordinary retry is blocked until a current
70
+ For guarded remediation, a third ordinary retry is blocked until a current
71
71
  `task corrective-decision` exists for the same Step and Plan binding. If that corrective
72
72
  attempt fails review, the third failure is a hard stop and no fourth run is permitted.
73
73
 
@@ -93,10 +93,15 @@ and prevents new linked Tasks from starting. A Task that has started cannot be r
93
93
  it can be retained as waived/cancelled with history and reason. Tasks already in progress
94
94
  may finish while an amendment awaits authorization.
95
95
 
96
- After the initial empty planning posture, alpha.6 does not use ordinary `milestone plan-set`
97
- for scope changes. It uses human-only `milestone scope-change-prepare` and
98
- `milestone scope-change-apply`, with journaled recovery across `state.json`, `plan.json`, and
99
- `scope-change-events.jsonl`.
96
+ During initial planning, all linked Tasks may be materialized before one complete
97
+ `milestone plan-set`; no execution is available until the Plan classifies every reverse
98
+ membership. After that boundary, semantic changes use human-only
99
+ `milestone scope-change-prepare` and `milestone scope-change-apply`. A previously issued
100
+ Milestone Autonomy Contract may instead use `milestone autonomy-evolve` for membership-only
101
+ changes while the outcome, success signal, acceptance, checks, discovery, and base branch
102
+ remain unchanged. The same contract may complete an atomic content-only Task context refresh
103
+ without a new human gate, but cannot approve Project Memory independently. Both paths retain
104
+ journaled recovery across `state.json`, `plan.json`, and `scope-change-events.jsonl`.
100
105
 
101
106
  A Milestone has no integration branch. Validation requires all required Tasks to be
102
107
  `merged`, checks the current clean base branch, and writes evidence plus Result. Final
package/docs/release.md CHANGED
@@ -20,18 +20,16 @@ The downstream smoke packs the actual tarball, installs it into an empty tempora
20
20
  runs the packaged CLI handshake, and proves installation created none of `.codex`, `.tasks`,
21
21
  `.increments`, or `.memory-bank` in that project.
22
22
 
23
- For alpha.6, the release gate also relies on `npm run release:check` to fail if:
23
+ For alpha.7, the release gate also relies on `npm run release:check` to fail if:
24
24
 
25
25
  - canonical entity schema 2 shapes drift;
26
26
  - protocol 1 compatibility is no longer additive;
27
27
  - the delegated transition allow-list expands;
28
- - alpha.6 adoption is presented as `state migrate` instead of posture sidecars.
28
+ - schema-2 adoption is presented as `state migrate` instead of posture sidecars;
29
+ - alpha.7 rescue, Milestone autonomy (including guarded content refresh), derived actor, or
30
+ proof-obligation capabilities and schemas are absent from the packaged surface.
29
31
 
30
32
  Tag releases as `v<package-version>`. The tag workflow verifies the tag/package match and
31
33
  uses npm trusted publishing with public access. For a public GitHub repository and public
32
34
  package, npm trusted publishing generates provenance automatically. Publishing is never
33
35
  performed by local validation commands.
34
-
35
- The `2.0.0-alpha.6.x` backport line publishes with the dedicated `backport-alpha6`
36
- dist-tag (or by exact version). It must never move npm's `next` tag, which remains owned by
37
- the alpha.7 line.
@@ -22,45 +22,15 @@ state schema. Совпадение `stateSchemaVersion` до и после об
22
22
  нужна. Для alpha.6 при `stateSchemaVersion: 2` применяется не migration, а sidecar-only
23
23
  adoption posture.
24
24
 
25
- ## Исключение: claimed C1 strict-review deadlock в alpha.6
26
-
27
- Не обновляйте dependency, если alpha.6 Task уже имеет `in_progress` Step с completion evidence,
28
- pending strict review и stale Knowledge binding. Для такого состояния используйте внешний
29
- точный runner `2.0.0-alpha.6.1`; сам проект до завершения recovery остаётся закреплён на
30
- `2.0.0-alpha.6`.
31
-
32
- Сначала выполните только `update rescue-preflight`. Продолжать разрешено исключительно при
33
- `eligible=true` и одной exact action `update rescue-review`. Передайте returned Task ID, Step
34
- ID, revision, claimant actor и исходный bound writer token. Не выводите token в чат и не
35
- передавайте другому actor.
36
-
37
- Recovery не требует и не допускает предварительный `locks repair`: alpha.6.1 проверяет token
38
- сразу против существующего lease и C1 hash, затем сохраняет и heartbeat'ит тот же lease в
39
- единственной guarded review-команде. Active и stale lease допустимы только при exact binding.
40
- Неверный actor/token, dirty checkout, advanced HEAD, второй pending review
41
- или посторонний lease блокируют переход без изменения Task state.
42
-
43
- После successful review следуйте обычному `next`: reconcile/approve Knowledge Map, выполните
44
- knowledge rebind, свежую authorization и завершите Task. Только на безопасной lifecycle-границе
45
- запускайте обычное обновление dependency и gateway.
46
-
47
- ## Исключение: signal_v4 после двух failed review в alpha.6
48
-
49
- Если точный alpha.6 state уже дошёл до Task revision 14/status `ready`, `STEP-001` имеет два
50
- distinct verified strict-review failure, remediation `attemptCount=2`, а corrective decision
51
- отсутствует, используйте только внешний runner `2.0.0-alpha.6.2`. Dependency проекта при этом
52
- остаётся точно `2.0.0-alpha.6`.
53
-
54
- Сначала выполните mutation-free `update corrective-rescue-preflight`. Он требует clean checkout
55
- на exact HEAD `5c63798cc7b8fbb5e1c8b26ebf93876bc642295a`, неизменные Brief/Plan/Milestone bindings,
56
- claimed C1 и ровно один token-bound lease. Stale lease допустим только при точном совпадении
57
- claimant/token binding; plaintext token команда не возвращает.
58
-
59
- При `eligible=true` команда `update corrective-rescue-apply` принимает исходный actor/token,
60
- полный corrective Plan, independent `continue-fix` decision audit и отдельный independent Plan
61
- audit. Она использует канонические переходы, heartbeat'ит существующий lease только после
62
- проверки actor/token и не удаляет его. Нельзя вручную редактировать state, Brief, Step 2,
63
- requirements/acceptance или Milestone scope.
25
+ ### Исключение для lifecycle-дедлока alpha.6
26
+
27
+ Обычный `update preflight` намеренно блокирует обновление при `in_progress` Step. Если alpha.6
28
+ завис между completion commit, обязательным strict review и запрещённым Knowledge rebind,
29
+ используйте внешний точный runner alpha.7 только для `update rescue-preflight`. Продолжать
30
+ можно лишь при `eligible=true`; допустимы только перечисленные им `locks repair` и
31
+ `task step-review`. Этот путь не меняет dependency и не разрешает другие команды alpha.7.
32
+ После terminal review выполните обычный Knowledge reconcile/rebind, доведите Task до безопасной
33
+ границы и только затем обновляйте package/lock обычным способом.
64
34
 
65
35
  ## 1. Подготовьте отдельный чат обновления
66
36