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
@@ -1,69 +1,56 @@
1
1
  # V2 Alpha Validation Report
2
2
 
3
- Release candidate `2.0.0-alpha.6.2` was validated on 2026-08-14 with Node.js 20.12.2 as a
4
- narrow backport from the `2.0.0-alpha.6.1` backport line, itself based on published
5
- `2.0.0-alpha.6`.
3
+ Release candidate `2.0.0-alpha.7` was validated on 2026-08-14 with Node.js 24.17.0.
6
4
 
7
- - `npm run typecheck`, `npm run build`, `npm test`, `npm run validate`, `npm run plugin:check`,
8
- `npm run smoke:downstream`, `npm run release:check`, and `npm run pack:check` passed in the
9
- sequential backport validation.
10
- - The final sequential full suite passed `89/89` on 2026-08-14.
11
- - The package test script runs test files sequentially; the unsupported
12
- `--test-force-exit` flag was removed.
13
- - Plan Risk Audit coverage includes the combined `plan-set --risk-audit-file` path, atomic
14
- rejection before Task/Plan acceptance, distinct planner/auditor identities, exact current
15
- Step-set equality, concrete failure modes, executable evidence binding, coupled
16
- migration/recovery rationale, blocking split/stop decisions, and adoption-aware
17
- remaining-scope bootstrap handling.
18
- - Strict high-risk Step Review coverage includes workflow-owned completion commits,
19
- `task step-review` routing, commit-bound reviewer attestation, and fail-closed rejection of
20
- stale, malformed, unverified, and wrong-commit review evidence.
21
- - Alpha.6.1 rescue coverage reproduces the production deadlock with an exact alpha.6
22
- dependency, stale Knowledge binding, pending strict review, claimed C1 posture, and both
23
- active and stale bound leases. The single rescue action preserves the original lease,
24
- exposes no plaintext token, completes review with the exact claimant/token, and fails closed
25
- for a wrong actor or token. Ordinary `task step-review` remains blocked by stale Knowledge.
26
- - Guarded remediation coverage includes the per-Step circuit breaker: two ordinary retries
27
- allowed, the third gated by a separate decision plus full independently audited corrective
28
- Plan, an explicit corrective run envelope, a hard stop after a third failed corrective
29
- review, and stop/redirection handling for `split-required` and `stop-escalate`. Knowledge
30
- rebind and reauthorization preserve this breaker posture.
31
- - Signal_v4 rescue coverage includes exact alpha.6 dependency/HEAD/Task/review-history
32
- matching, mutation-free preflight, active and stale bound leases without token disclosure,
33
- wrong actor/token ordering before heartbeat, scope-preserving decision plus full Plan apply,
34
- dirty/advanced checkout rejection, malformed/missing review evidence, and unrelated leases.
35
- - Milestone coverage includes human-only scope-change prepare/apply, journaled recovery of
36
- `state.json`, `plan.json`, and `scope-change-events.jsonl`, plus membership-integrity
37
- blocking for stale or contradictory Milestone/Task state, including reverse detection of a
38
- live linked Task missing from required/waived/cancelled membership.
39
- - `C1` coordination coverage includes the full prepared bundle, one-time and expiring claim
40
- token, Task/Plan/Knowledge/Milestone bindings, exact expected-next prompt, optional grant,
41
- target-only claim, claimant-only mutation, mandatory claim before Milestone Task start,
42
- lease-token binding, and terminal evidence-bound handback.
43
- - Adoption coverage includes sidecar-only `state adoption-prepare` and `state adoption-apply`,
44
- automatic posture initialization for fresh alpha.6 projects, preservation of terminal
45
- Milestones and Tasks, preservation of completed and skipped legacy Steps, and execution
46
- blocking until posture is present.
47
- - Compatibility checks passed for `protocolVersion: 1`, `STATE_SCHEMA_VERSION: 2`, unchanged
48
- canonical Task and Milestone shapes, and unchanged delegated transition allow-list.
49
- - Gateway handshake coverage includes the alpha.6 capabilities:
50
- `plan-risk-audit-sidecar-v1`, `step-strict-review-sidecar-v1`,
51
- `step-remediation-circuit-breaker-sidecar-v1`, `milestone-scope-change-sidecar-v1`,
52
- `milestone-membership-integrity-v1`, `task-c1-handoff-sidecar-v1`, and
53
- `alpha6-adoption-posture-v1`, `alpha6-c1-strict-review-rescue-v1`, and
54
- `alpha6-corrective-rescue-signal-v4`, plus strengthened contracts advertised as
55
- `semantic-plan-risk-audit-v2`, `guarded-remediation-hard-stop-v1`,
56
- `milestone-reverse-membership-integrity-v1`, and `task-c1-handoff-bundle-v2`.
57
- - npm dry-run packaging produced `codex-workflow-v2-2.0.0-alpha.6.2.tgz` with runtime, schemas,
58
- references, docs, and plugin source. Downstream installation and the packaged CLI handshake
59
- passed, and the install created none of `.codex`, `.tasks`, `.increments`, or
60
- `.memory-bank` in the temporary project.
61
- - Release checks require the dedicated `backport-alpha6` npm dist-tag, so publishing this
62
- version cannot move the alpha.7-owned `next` tag.
5
+ - TypeScript typecheck and build passed.
6
+ - The authoritative sequential suite passed `86/86` with `--test-concurrency=1`. An earlier
7
+ ordinary parallel run also passed its then-current `85/85` suite, but CLI subprocess
8
+ contention made one test take 165 seconds; the final sequential exit is the release evidence.
9
+ - `npm run pack:check`, `npm run smoke:downstream`, `npm run release:check`,
10
+ `npm run plugin:check`, and `git diff --check` passed. Packaging and downstream smoke used
11
+ an isolated temporary npm cache because the user cache contains pre-existing root-owned
12
+ entries.
13
+ - The repository-level `tools/tests/codex-workflow-regression.mjs` update/install regression
14
+ completed with `status: PASS`.
15
+ - Dry-run packaging produced `codex-workflow-v2-2.0.0-alpha.7.tgz` with 139 files; downstream
16
+ installation and packaged CLI handshake passed.
17
+
18
+ Alpha.7 regression coverage includes:
19
+
20
+ - pending strict Step Review outranks Knowledge Map reconcile/rebind after a knowledge-changing
21
+ completion commit; review succeeds against the exact historical approved binding even while
22
+ the current map is stale, and rebind remains mandatory before the next Step;
23
+ - read-only alpha.6 rescue-preflight rejects active leases and accepts only one exact pending
24
+ strict-review candidate on the clean recorded completion HEAD;
25
+ - seven linked Tasks can be materialized during initial Milestone assembly and classified by
26
+ one complete initial Plan without repeated scope-change approvals;
27
+ - one maximum-72-hour Milestone Autonomy Contract issues the existing Task/Milestone approval
28
+ permissions, permits Project Memory approval only inside an atomic content-only Task context
29
+ refresh, permits journaled membership-only evolution, requires reauthorization, and rejects
30
+ both standalone Project Memory approval and semantic scope drift; a later human semantic
31
+ change invalidates future uses of the autonomy grant;
32
+ - C1 Worker and corrective Auditor actors are deterministically derived while claim, lease,
33
+ handoff, and reviewer/auditor independence checks remain fail-closed;
34
+ - every newly recorded guarded Plan Risk Audit requires an exact proof obligation per failure
35
+ mode: hostile counterexample, expected safe result, and executable evidence command;
36
+ historical alpha.6 audits remain readable for recovery only;
37
+ - existing Milestone journal recovery, reverse-membership integrity, delegation, adoption,
38
+ Knowledge Map, graph, strict reviewer, Git ownership, and remediation hard-stop tests remain
39
+ green.
40
+
41
+ Compatibility claims verified:
42
+
43
+ - `protocolVersion: 1` and `STATE_SCHEMA_VERSION: 2` remain unchanged;
44
+ - canonical Task and Milestone schemas remain byte-identical;
45
+ - the generic delegated transition allow-list remains unchanged;
46
+ - new evidence is additive through `autonomy-contract-events.jsonl`, optional autonomous
47
+ fields on scope-change events, and optional proof obligations on Plan Risk Audit events;
48
+ - the gateway handshake advertises alpha.7 rescue, initial assembly, autonomy, derived actor,
49
+ corrective routing, and proof-obligation capabilities.
63
50
 
64
51
  Not claimed here:
65
52
 
66
- - no final release publish;
67
- - no final task audit beyond the recorded subtask evidence;
68
- - no new real-Codex isolation probe beyond the existing fail-closed strict-reviewer
69
- implementation and its automated coverage.
53
+ - no npm publication, Git tag, push, or downstream project mutation was performed;
54
+ - no manual rewrite of external Workflow state is part of the recovery design;
55
+ - the local package cannot cryptographically prove a real human identity or a physically
56
+ separate Codex task beyond the existing actor, process-isolation, sidecar, and lease evidence.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-workflow-v2",
3
- "version": "2.0.0-alpha.6.2",
3
+ "version": "2.0.0-alpha.7.1",
4
4
  "description": "Requirements-first Codex development workflow with local state and explicit Git ownership.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,7 +40,7 @@
40
40
  "clean": "node --eval \"import('node:fs').then(({rmSync}) => { rmSync('dist', {recursive:true, force:true}); rmSync('.test-dist', {recursive:true, force:true}); })\"",
41
41
  "build": "npm run clean && tsc -p tsconfig.build.json && node scripts/mark-cli-executable.mjs",
42
42
  "typecheck": "tsc -p tsconfig.json --noEmit",
43
- "test": "npm run build && tsc -p tsconfig.test.json && node --test --test-concurrency=1 .test-dist/tests/*.test.js",
43
+ "test": "npm run build && tsc -p tsconfig.test.json && node --test .test-dist/tests/*.test.js",
44
44
  "validate": "npm run typecheck && npm test",
45
45
  "pack:check": "npm run build && npm pack --dry-run",
46
46
  "smoke:downstream": "npm run build && node scripts/downstream-smoke.mjs",
@@ -40,8 +40,15 @@ Current capability set:
40
40
  - `milestone-reverse-membership-integrity-v1`
41
41
  - `task-c1-handoff-bundle-v2`
42
42
  - `alpha6-adoption-posture-v1`
43
-
44
- Protocol `1` and schema `2` remain valid only because alpha.6 is additive. The gateway must
43
+ - `alpha6-strict-review-rescue-v1`
44
+ - `milestone-initial-assembly-v1`
45
+ - `milestone-autonomy-contract-v1`
46
+ - `milestone-autonomous-membership-evolution-v1`
47
+ - `task-c1-derived-worker-actor-v1`
48
+ - `guarded-corrective-auditor-routing-v1`
49
+ - `plan-proof-obligations-v1`
50
+
51
+ Protocol `1` and schema `2` remain valid only because alpha.7 is additive. The gateway must
45
52
  not claim compatibility if canonical entity shapes or non-additive command semantics change.
46
53
 
47
54
  ## Alpha.6 adoption posture
@@ -86,7 +93,7 @@ workflow state manually; recovery remains coordinator-controlled.
86
93
 
87
94
  ## Plan Risk Audit and remediation breaker
88
95
 
89
- Before `task authorize`, every new alpha.6 Task requires:
96
+ Before `task authorize`, every new alpha.7 Task requires:
90
97
 
91
98
  ```text
92
99
  codex-workflow task plan-risk-audit --repo <git-root> \
@@ -94,7 +101,8 @@ codex-workflow task plan-risk-audit --repo <git-root> \
94
101
  ```
95
102
 
96
103
  The audit must classify every current Step exactly once, name distinct planner/auditor
97
- actors, and bind guarded failure modes to exact Step checks. Use `decision=approved` for an
104
+ actors, bind guarded failure modes to exact Step checks, and map each guarded failure mode to
105
+ one hostile counterexample, expected safe result, and exact executable evidence command. Use `decision=approved` for an
98
106
  unguarded Plan. Missing, stale, `split-required`, or `stop-escalate` evidence blocks
99
107
  authorization.
100
108
 
@@ -113,17 +121,23 @@ fourth run is prohibited; only split or stop may be recorded.
113
121
 
114
122
  ## Context refresh
115
123
 
124
+ Before `task plan-set`, compare exact Step `allowedWrites` and expected output paths with scanner
125
+ classifications. A planned new scanner-visible Knowledge file must be declared with
126
+ `knowledgeImpact: create` and an exact path/category `knowledgeTargets` entry. Wildcards,
127
+ directories, and inferred authority are not declarations; only Core may decide whether the final
128
+ diff is eligible for delegated refresh.
129
+
116
130
  Use `task context-refresh` only when the same `next` response exposes `contextRefresh` for the
117
131
  exact grant. Pass Task revision, map revision, delegate actor, and grant ID. The composite
118
- operation is restricted to content-hash-only drift and records the ordinary delegated map and
119
- Task authorization evidence. Any semantic map change remains on the normal visible path.
132
+ operation accepts content-hash-only drift and, under a Milestone Autonomy Grant, an exact
133
+ supporting-source addition predeclared by the current execution-authorized Task Plan. Core checks
134
+ the full fail-closed predicate; do not reconstruct it in the gateway. When `next` instead returns
135
+ `contextRefreshBlocked.unsafeDifferences`, keep the change on the normal visible Knowledge path.
120
136
 
121
137
  Before updating the installed package, run `update preflight`. Continue only for `safe=true`.
122
-
123
- Alpha.6.1 adds one compatibility exception before package update: an exact alpha.6 claimed-C1
124
- pending strict review with stale Knowledge may use external `update rescue-preflight` followed
125
- by its single `update rescue-review` action. The action must preserve the original lease and
126
- prove its bound actor/token; `locks repair` is forbidden before this review.
138
+ For an alpha.6 project trapped between a pending strict review and forbidden Knowledge rebind,
139
+ an exact external alpha.7 runner may run `update rescue-preflight`. Continue only for
140
+ `eligible=true` and only with the returned lock-repair and strict-review actions.
127
141
 
128
142
  ## C1 handoff
129
143
 
@@ -132,7 +146,7 @@ prove its bound actor/token; `locks repair` is forbidden before this review.
132
146
  ```text
133
147
  codex-workflow task handoff-prepare --repo <git-root> --id <TASK-ID> \
134
148
  --expected-revision <REVISION> --actor <CURRENT-ACTOR> \
135
- --target-actor <TARGET-ACTOR> --reason <TEXT> [--writer-token <TOKEN>] \
149
+ [--target-actor <TARGET-ACTOR>] --reason <TEXT> [--writer-token <TOKEN>] \
136
150
  [--delegation-grant <GRANT>] [--expires-at <ISO-TIMESTAMP>]
137
151
  codex-workflow task handoff-show --repo <git-root> --id <TASK-ID>
138
152
  codex-workflow task claim --repo <git-root> --id <TASK-ID> \
@@ -146,9 +160,31 @@ codex-workflow task handback-create --repo <git-root> --id <TASK-ID> \
146
160
  While a handoff is pending, `next` blocks the previous action behind `task claim`. While
147
161
  claimed, only the claimant may mutate the Task, and lease-bound mutations must present the
148
162
  bound writer token. Milestone-linked Tasks must be claimed before start, and handback is
149
- terminal and evidence-bound. No thread id is required or accepted as authority.
163
+ terminal and evidence-bound. When target actor is omitted, Core derives
164
+ `agent:worker:<task-id>`. No thread id is required or accepted as authority.
165
+
166
+ ## Milestone assembly, autonomy, and human gate
167
+
168
+ During initial planning, materialize every linked Task and then call `milestone plan-set` once
169
+ with the complete membership. Execution is blocked while reverse membership is incomplete.
170
+
171
+ After that Plan, one human may prepare and grant a maximum-72-hour Milestone Autonomy Contract:
172
+
173
+ ```text
174
+ codex-workflow milestone autonomy-prepare --repo <git-root> --id <MS-ID> \
175
+ --expected-revision <REVISION> --principal <HUMAN> --delegate <AGENT> --expires-at <ISO>
176
+ codex-workflow milestone autonomy-grant --repo <git-root> --id <MS-ID> \
177
+ --expected-revision <REVISION> --principal <HUMAN> --delegate <AGENT> --expires-at <ISO> \
178
+ --confirmation-code <MAC-CODE>
179
+ ```
150
180
 
151
- ## Milestone scope change and human gate
181
+ The contract issues a milestone-scoped grant for the existing Task/Milestone approval transitions
182
+ and Project Memory approval only inside an atomic Task context refresh for the same Milestone.
183
+ That composite path covers content-only drift plus exact Plan-bounded supporting-source additions;
184
+ it cannot approve Project Memory independently. `milestone autonomy-evolve --file
185
+ <plan.json>` is permitted only when outcome, success signal, acceptance, checks, discovery, and
186
+ base branch still match the contract. It journals agent actor plus contract evidence and requires
187
+ reauthorization afterward.
152
188
 
153
189
  After the initial empty planning posture, Milestone scope updates use:
154
190
 
@@ -160,7 +196,7 @@ codex-workflow milestone scope-change-apply --repo <git-root> \
160
196
  --confirmation-code <MSC-CODE> --file <plan.json>
161
197
  ```
162
198
 
163
- This path is human-only. Delegated approval never authorizes it.
199
+ This ordinary semantic-change path is human-only. Generic delegated approval never authorizes it.
164
200
 
165
201
  At `awaiting_final_acceptance`, `next` returns `requiredHumanGate` with kind
166
202
  `milestone_final_acceptance`, Milestone ID, revision, Plan/Result/evidence hashes, validated
@@ -188,8 +224,8 @@ as `--delegation-grant`. The resulting authorization event records the grant and
188
224
  For `milestone.final_accept`, also pass the current `MSA-*` code; the existing grant replaces
189
225
  the later-message requirement, not the state binding.
190
226
 
191
- Delegated approval does not cover adoption apply, Milestone scope change, or any other new
192
- human-only alpha.6 action.
227
+ Delegated approval does not cover adoption apply or the ordinary semantic Milestone scope-change
228
+ path. Membership-only evolution requires the separate Milestone Autonomy Contract.
193
229
 
194
230
  ## Graph Refresh Request
195
231
 
@@ -27,6 +27,11 @@ files, or MCP ADR storage as a fallback.
27
27
  6. Run `gateway handshake` before other actions. Stop on package, protocol, or
28
28
  state-schema incompatibility.
29
29
 
30
+ The sole exception is the alpha.7 `update rescue-preflight` compatibility profile. An exact
31
+ external alpha.7 runner may inspect a project still pinned to alpha.6 only when this read-only
32
+ command reports `eligible=true`. Execute only its returned stale-lock repair and strict-review
33
+ actions; do not use the external runner for any other transition or dependency mutation.
34
+
30
35
  If any step fails, report the concrete diagnostic. Do not load workflow
31
36
  semantics from this skill.
32
37
 
@@ -38,9 +43,19 @@ classifications, hashes, gaps, conflicts, and approval evidence.
38
43
 
39
44
  Do not create a memory directory or write project files during scan.
40
45
 
46
+ Before `task plan-set`, the Technical Planner compares every exact `allowedWrites` and expected
47
+ output path with the package scanner classifications. If the Plan will create a file that the
48
+ scanner will treat as Project Knowledge (for example a test or documentation source), declare
49
+ `knowledgeImpact: create` and one `knowledgeTargets` entry with that exact normalized path and
50
+ scanner category. Do not replace the path with a wildcard or directory, do not infer or assign
51
+ authority, and do not claim delegated-refresh eligibility; Core decides eligibility from the
52
+ resulting repository diff and current authorization state.
53
+
41
54
  When `next` exposes an exact delegated `contextRefresh`, use `task context-refresh` only for
42
- the returned Task/map revisions, actor, and grant. Never use it when the source set,
43
- classification, authority, gaps, or conflicts changed.
55
+ the returned Task/map revisions, actor, and grant. A source-set change is eligible only when
56
+ Core identifies it as a Plan-bounded supporting-source addition under the same Milestone
57
+ Autonomy Grant. Never infer eligibility from the Plan yourself; if Core returns
58
+ `contextRefreshBlocked.unsafeDifferences`, use the ordinary visible Knowledge Map flow.
44
59
 
45
60
  ## Product Or Workflow Graph Refresh
46
61
 
@@ -103,20 +118,29 @@ option is returned, follow the ordinary human-gate rule above. Knowledge Map app
103
118
  delegable only through an explicit project-scoped `project_memory.approve` permission. Scope
104
119
  changes, grant issuance, and grant expansion are never delegated by `delegated-approval-v1`.
105
120
 
121
+ For an entire Milestone, prefer one bounded `milestone autonomy-prepare` gate after the complete
122
+ initial membership Plan exists. Show principal, delegate, expiry, semantic-scope hash, policy
123
+ hash, and `MAC-*` code, then stop. A later exact approval permits `milestone autonomy-grant`.
124
+ The resulting grant covers the existing Task/Milestone approval transitions and the Project
125
+ Memory approval portion of an atomic Task context refresh for the same Milestone. Besides
126
+ content-only drift, Core may accept exact supporting-source additions predeclared by the current
127
+ execution-authorized Task Plan; unsafe differences remain blocked. The contract never permits
128
+ standalone Project Memory approval. It also permits `milestone autonomy-evolve`
129
+ only for membership changes; any change to outcome, success signal, acceptance, checks,
130
+ discovery, or base branch requires the ordinary human scope-change gate. Never self-renew or
131
+ replace the contract.
132
+
106
133
  After two failed Task reviews, follow `next.correctivePlanGate`: obtain a distinct read-only
107
134
  corrective Auditor result and pass it through `--corrective-audit-file`. Do not continue for
108
135
  replan, split, or stop decisions.
109
136
 
137
+ When `next` returns a derived C1 Worker or corrective Auditor actor, use that exact actor without
138
+ asking the user to name one. Derivation removes a routing pause; handoff claim, writer lease,
139
+ strict review, and auditor-independence checks remain mandatory.
140
+
110
141
  Before an npm package update, run the project-local `update preflight` and stop unless it
111
142
  returns `safe=true` with a clean checkout, no running Step, and no active writer lease.
112
143
 
113
- For a project still pinned exactly to `2.0.0-alpha.6` with one claimed-C1 pending strict review
114
- blocked by stale Project Knowledge, do not update the dependency and do not repair the lease.
115
- Resolve the exact external `2.0.0-alpha.6.1` runner, run its read-only `update rescue-preflight`,
116
- and continue only for `eligible=true` with the single returned `update rescue-review` action.
117
- Use the exact claimant and original bound writer token without printing the token. Stop on any
118
- binding mismatch or additional blocker.
119
-
120
144
  ## Stop Conditions
121
145
 
122
146
  - Dependency version is missing, ranged, or differs from the installed package.
@@ -6,14 +6,15 @@ to the task commit and Brief, Plan, and evidence hashes. Final acceptance is a s
6
6
  human event bound to Result, evidence, and commit. Locks expire only diagnostically;
7
7
  removing a stale lock is always an explicit repair operation.
8
8
 
9
- Alpha.6 keeps canonical entity JSON unchanged at `stateSchemaVersion: 2` and adds lifecycle
10
- evidence through sidecars. `protocolVersion: 1` remains valid only because the alpha.6
9
+ Alpha.7 keeps canonical entity JSON unchanged at `stateSchemaVersion: 2` and adds lifecycle
10
+ evidence through sidecars. `protocolVersion: 1` remains valid only because the alpha.7
11
11
  surface is additive and capability-advertised.
12
12
 
13
- Before execution authorization, every alpha.6 Task must have a current Plan Risk Audit bound
13
+ Before execution authorization, every alpha.7 Task must have a current Plan Risk Audit bound
14
14
  to the current Brief, Plan, Knowledge Map, and exact Step set. The audit is required even when
15
15
  all Steps are unguarded, must name distinct planner/auditor actors, and must bind guarded
16
- failure modes to exact Step checks. Missing, stale, inconsistent, `split-required`, or
16
+ failure modes to exact Step checks. Each newly recorded guarded failure mode also requires one
17
+ hostile counterexample, expected safe result, and exact evidence command. Missing, stale, inconsistent, `split-required`, or
17
18
  `stop-escalate` evidence blocks authorization.
18
19
 
19
20
  If the current Plan Risk Audit marks a Step for strict review, `task step-complete` still
@@ -36,11 +37,16 @@ bindings, supersedes execution authorization, and returns the Task to
36
37
  `awaiting_execution_authorization`. It cannot run while a Step is `in_progress` or while the
37
38
  Task is `blocked`; unrelated blocks must be resolved through their owning transition.
38
39
 
39
- For alpha.6 guarded remediation, two ordinary remediation attempts are allowed. A third
40
+ For guarded remediation, two ordinary remediation attempts are allowed. Corrective posture is
41
+ derived from the guarded Step, current Plan Risk Audit, remediation history, and
42
+ corrective-decision history rather than from `Task.status` alone, so the same gate survives
43
+ content-only Knowledge refresh, Task Knowledge rebind, and later reauthorization. A third
40
44
  ordinary retry is blocked until a current corrective decision exists for the same Step and
41
- Plan binding. `continue-fix` allows bounded continuation; `replan-required`,
42
- `split-required`, and `stop-escalate` stop ordinary execution. A failed third corrective
43
- attempt is a hard stop: no fourth run or new continue/replan decision is accepted.
45
+ Plan binding. `continue-fix` allows exactly the third corrective attempt; `replan-required`
46
+ requires an actual new Plan posture before execution; `split-required` and `stop-escalate`
47
+ stop ordinary execution. A failed third corrective attempt is a hard stop: `next` must
48
+ report the stop without throwing, no fourth run is allowed, and no new `continue-fix` or
49
+ `replan-required` decision is accepted.
44
50
 
45
51
  Milestone authorization is bound to its Plan and membership revision. Plan amendments
46
52
  supersede authorization. Milestone validation and acceptance are bound to the current base
@@ -55,10 +61,21 @@ but the acceptance command still requires the current `MSA-*` code so the use re
55
61
  to the validated revision, hashes, and HEAD. Grant issuance itself always remains a prior
56
62
  human turn boundary.
57
63
 
58
- After the initial empty planning posture, Milestone scope updates no longer use ordinary
59
- `milestone plan-set`. They must go through `milestone scope-change-prepare` and
60
- `milestone scope-change-apply`, which journal `state.json`, `plan.json`, and
61
- `scope-change-events.jsonl` together and remain human-only. Membership integrity is validated
64
+ During initial planning, all linked Tasks may be materialized before one complete
65
+ `milestone plan-set`; execution remains blocked until every reverse membership is classified.
66
+ After that boundary, semantic updates use human-only `milestone scope-change-prepare` and
67
+ `milestone scope-change-apply`. A human-confirmed, expiring Milestone Autonomy Contract may
68
+ use `milestone autonomy-evolve` only for membership changes while outcome, success signal,
69
+ acceptance, checks, discovery, and base branch remain fixed. It may also approve Project Memory
70
+ only within an atomic context refresh for a Task in that Milestone; standalone map approval
71
+ remains forbidden. In addition to content-only drift, that composite transition may accept a new
72
+ supporting source only when its exact normalized path and scanner category were declared by the
73
+ current execution-authorized Task Plan under `knowledgeImpact: create`. The Task must belong to
74
+ the grant's Milestone. Every added source must match the Plan, and removals, canonical additions,
75
+ wildcard or directory targets, existing source category/scope/authority changes, gaps, and
76
+ conflicts fail closed before any state write. `next` exposes the composite option only when the
77
+ full predicate passes and otherwise reports concrete unsafe differences. Both update paths journal
78
+ `state.json`, `plan.json`, and `scope-change-events.jsonl` together. Membership integrity is validated
62
79
  before scheduling, Task start, Milestone validation, scope change, and repository `next`.
63
80
  The same guard scans in reverse and blocks every live Task whose `milestoneId` is absent from
64
81
  the Milestone's required/waived/cancelled classification.
@@ -68,7 +85,8 @@ token and prompt bound to a stable handoff ID, revision, context hashes, Milesto
68
85
  delegate/grant, expected next action, and expiry. `task claim` validates those bindings and
69
86
  activates claimant-only mutation; terminal `task handback-create` returns result, evidence,
70
87
  review, knowledge, limitation, and recommended-next bindings. Milestone Tasks must be claimed
71
- before start. No part of this contract requires or proves a physically separate Codex thread.
88
+ before start. If no target is supplied, Core derives `agent:worker:<task-id>`. No part of this
89
+ contract requires or proves a physically separate Codex thread.
72
90
 
73
91
  Repository-level scheduling respects current Milestone membership. An unstarted linked Task
74
92
  is eligible only for an `active` Milestone with `required` disposition. Historical unstarted
@@ -12,7 +12,14 @@ Own state transitions, dispatch envelopes, evidence collection, and recovery gui
12
12
  request the user's explicit decision, and end the turn. Never call the acceptance command
13
13
  in the same turn that produced or displayed the gate.
14
14
  - Accept a Milestone only after a later user message explicitly approves that exact
15
- confirmation code. Do not infer approval from a request to validate, finish, or continue.
15
+ confirmation code, or through the exact active Milestone Autonomy Contract option. Do not
16
+ infer approval from a request to validate, finish, or continue.
17
+ - During initial Milestone planning, materialize the complete linked Task set and record one
18
+ full membership Plan. When a Milestone Autonomy Contract is active, evolve only membership;
19
+ any outcome, success-signal, acceptance, check, discovery, or base-branch change returns to
20
+ the human scope-change gate.
21
+ - Use the Milestone contract for Project Memory approval only through the exact atomic
22
+ content-only Task context-refresh route; never use it for standalone map approval.
16
23
  - Dispatch one Worker at a time for a concrete Step.
17
24
  - A Milestone coordinator creates one dedicated user-visible Codex Task chat for each required
18
25
  Task. The Milestone chat owns ordering, exact delegated approvals, merge observation,
@@ -22,6 +29,8 @@ Own state transitions, dispatch envelopes, evidence collection, and recovery gui
22
29
  - After a second failed independent Task review, require a separate corrective Plan Auditor
23
30
  and pass its evidence through `--corrective-audit-file`. Continue only for
24
31
  `decision=continue-fix`; replan/split/stop decisions return to the coordinator or user.
32
+ - Use the exact derived Worker and corrective Auditor actors returned by `next`; do not pause
33
+ for the user to invent routing identifiers.
25
34
  - Use `task context-refresh` only when `next.contextRefresh` offers the exact delegated,
26
35
  content-only option. Classification, authority, source-set, gap, or conflict changes still
27
36
  require the ordinary visible Knowledge Map flow.
@@ -10,6 +10,9 @@ Translate an approved Brief into an execution-ready Plan.
10
10
  restart/replay, crash recovery, or an external provider must include failure-specific checks
11
11
  in the original Steps: populated forward upgrades, deterministic races, restart/crash
12
12
  windows, and provider failure/default behavior as applicable.
13
+ - For every guarded failure mode, define one hostile counterexample, the expected safe result,
14
+ and the exact executable Step check that proves it. A happy-path check is not a proof
15
+ obligation for an adversarial or crash-window claim.
13
16
  - Split a Task when one acceptance slice would otherwise combine persistence migration,
14
17
  recovery orchestration, and executable composition. Do not use arbitrary line/file limits;
15
18
  split on independently verifiable failure boundaries.
@@ -43,16 +43,6 @@
43
43
  "stepId": { "type": "string", "pattern": "^STEP-[0-9]{3}(?:-[A-Z0-9-]+)?$" },
44
44
  "expectedRevision": { "type": "integer", "minimum": 1 },
45
45
  "writerToken": { "type": ["string", "null"] },
46
- "remediation": {
47
- "type": "object",
48
- "additionalProperties": false,
49
- "required": ["attemptOrdinal", "mode", "correctiveDecisionEventId"],
50
- "properties": {
51
- "attemptOrdinal": { "type": "integer", "minimum": 1, "maximum": 3 },
52
- "mode": { "enum": ["ordinary", "corrective"] },
53
- "correctiveDecisionEventId": { "type": ["string", "null"] }
54
- }
55
- },
56
46
  "knowledgeMap": {
57
47
  "type": "object",
58
48
  "additionalProperties": false,
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://codex-workflow.local/schemas/milestone-autonomy-event.schema.json",
4
+ "title": "Codex Workflow V2 Alpha.7 Milestone Autonomy Event",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "eventId",
9
+ "previousEventHash",
10
+ "recordedAt",
11
+ "eventHash",
12
+ "eventType",
13
+ "projectId",
14
+ "milestoneId",
15
+ "milestoneRevision",
16
+ "principal",
17
+ "delegate",
18
+ "issuedAt",
19
+ "expiresAt",
20
+ "semanticScopeHash",
21
+ "delegationGrantId",
22
+ "delegationPolicyHash"
23
+ ],
24
+ "properties": {
25
+ "eventId": { "type": "string", "pattern": "^MAC-[0-9A-HJKMNP-TV-Z]{26}$" },
26
+ "previousEventHash": { "$ref": "#/$defs/nullableHash64" },
27
+ "recordedAt": { "type": "string", "format": "date-time" },
28
+ "eventHash": { "$ref": "#/$defs/hash64" },
29
+ "eventType": { "const": "issued" },
30
+ "projectId": { "type": "string", "minLength": 1 },
31
+ "milestoneId": { "type": "string", "pattern": "^MS-[0-9A-HJKMNP-TV-Z]{26}$" },
32
+ "milestoneRevision": { "type": "integer", "minimum": 1 },
33
+ "principal": { "type": "string", "minLength": 1 },
34
+ "delegate": { "type": "string", "pattern": "^agent:.+" },
35
+ "issuedAt": { "type": "string", "format": "date-time" },
36
+ "expiresAt": { "type": "string", "format": "date-time" },
37
+ "semanticScopeHash": { "$ref": "#/$defs/hash64" },
38
+ "delegationGrantId": { "type": "string", "pattern": "^DGR-[0-9A-HJKMNP-TV-Z]{26}$" },
39
+ "delegationPolicyHash": { "$ref": "#/$defs/hash64" }
40
+ },
41
+ "$defs": {
42
+ "hash64": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
43
+ "nullableHash64": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$" }
44
+ }
45
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://codex-workflow.local/schemas/milestone-scope-change-event.schema.json",
4
- "title": "Codex Workflow V2 Alpha.6 Milestone Scope Change Event",
4
+ "title": "Codex Workflow V2 Alpha.7 Milestone Scope Change Event",
5
5
  "type": "object",
6
6
  "additionalProperties": false,
7
7
  "required": [
@@ -32,6 +32,8 @@
32
32
  "after": { "$ref": "#/$defs/scopeSnapshot" },
33
33
  "actor": { "type": "string", "minLength": 1 },
34
34
  "confirmationCodeBindingHash": { "$ref": "#/$defs/hash64" },
35
+ "authorizationMode": { "enum": ["human", "milestone-autonomy"] },
36
+ "autonomyContractEventHash": { "$ref": "#/$defs/nullableHash64" },
35
37
  "previousEventHash": { "$ref": "#/$defs/nullableHash64" },
36
38
  "recordedAt": { "type": "string", "format": "date-time" },
37
39
  "eventHash": { "$ref": "#/$defs/hash64" }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://codex-workflow.local/schemas/plan-risk-audit-event.schema.json",
4
- "title": "Codex Workflow V2 Alpha.6 Plan Risk Audit Event",
4
+ "title": "Codex Workflow V2 Alpha.7 Plan Risk Audit Event",
5
5
  "type": "object",
6
6
  "additionalProperties": false,
7
7
  "required": [
@@ -65,7 +65,11 @@
65
65
  },
66
66
  "reviewRequired": { "type": "boolean" },
67
67
  "failureModes": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
68
- "requiredEvidence": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } }
68
+ "requiredEvidence": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
69
+ "proofObligations": {
70
+ "type": "array",
71
+ "items": { "$ref": "#/$defs/proofObligation" }
72
+ }
69
73
  },
70
74
  "oneOf": [
71
75
  {
@@ -73,7 +77,8 @@
73
77
  "categories": { "maxItems": 0 },
74
78
  "reviewRequired": { "const": false },
75
79
  "failureModes": { "maxItems": 0 },
76
- "requiredEvidence": { "maxItems": 0 }
80
+ "requiredEvidence": { "maxItems": 0 },
81
+ "proofObligations": { "maxItems": 0 }
77
82
  }
78
83
  },
79
84
  {
@@ -81,10 +86,22 @@
81
86
  "categories": { "minItems": 1 },
82
87
  "reviewRequired": { "const": true },
83
88
  "failureModes": { "minItems": 1 },
84
- "requiredEvidence": { "minItems": 1 }
89
+ "requiredEvidence": { "minItems": 1 },
90
+ "proofObligations": { "minItems": 1 }
85
91
  }
86
92
  }
87
93
  ]
94
+ },
95
+ "proofObligation": {
96
+ "type": "object",
97
+ "additionalProperties": false,
98
+ "required": ["failureMode", "counterexample", "expectedResult", "evidence"],
99
+ "properties": {
100
+ "failureMode": { "type": "string", "minLength": 1 },
101
+ "counterexample": { "type": "string", "minLength": 1 },
102
+ "expectedResult": { "type": "string", "minLength": 1 },
103
+ "evidence": { "type": "string", "minLength": 1 }
104
+ }
88
105
  }
89
106
  }
90
107
  }