codex-workflow-v2 2.0.0-alpha.4 → 2.0.0-alpha.7

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 (82) hide show
  1. package/README.md +114 -10
  2. package/dist/src/alpha6/adoption.d.ts +55 -0
  3. package/dist/src/alpha6/adoption.js +920 -0
  4. package/dist/src/alpha6/adoption.js.map +1 -0
  5. package/dist/src/alpha6/handoff.d.ts +40 -0
  6. package/dist/src/alpha6/handoff.js +981 -0
  7. package/dist/src/alpha6/handoff.js.map +1 -0
  8. package/dist/src/alpha6/journal.d.ts +30 -0
  9. package/dist/src/alpha6/journal.js +369 -0
  10. package/dist/src/alpha6/journal.js.map +1 -0
  11. package/dist/src/alpha6/milestone.d.ts +52 -0
  12. package/dist/src/alpha6/milestone.js +1103 -0
  13. package/dist/src/alpha6/milestone.js.map +1 -0
  14. package/dist/src/alpha6/plan-risk.d.ts +32 -0
  15. package/dist/src/alpha6/plan-risk.js +908 -0
  16. package/dist/src/alpha6/plan-risk.js.map +1 -0
  17. package/dist/src/alpha6/remediation.d.ts +21 -0
  18. package/dist/src/alpha6/remediation.js +754 -0
  19. package/dist/src/alpha6/remediation.js.map +1 -0
  20. package/dist/src/alpha6/review.d.ts +46 -0
  21. package/dist/src/alpha6/review.js +785 -0
  22. package/dist/src/alpha6/review.js.map +1 -0
  23. package/dist/src/alpha6/store-sidecars.d.ts +35 -0
  24. package/dist/src/alpha6/store-sidecars.js +281 -0
  25. package/dist/src/alpha6/store-sidecars.js.map +1 -0
  26. package/dist/src/alpha7/autonomy.d.ts +61 -0
  27. package/dist/src/alpha7/autonomy.js +256 -0
  28. package/dist/src/alpha7/autonomy.js.map +1 -0
  29. package/dist/src/cli.js +109 -19
  30. package/dist/src/cli.js.map +1 -1
  31. package/dist/src/contracts.d.ts +268 -0
  32. package/dist/src/git.js +2 -1
  33. package/dist/src/git.js.map +1 -1
  34. package/dist/src/index.d.ts +5 -0
  35. package/dist/src/index.js +3 -0
  36. package/dist/src/index.js.map +1 -1
  37. package/dist/src/reviewer.d.ts +6 -1
  38. package/dist/src/reviewer.js +145 -32
  39. package/dist/src/reviewer.js.map +1 -1
  40. package/dist/src/state/lock.d.ts +1 -0
  41. package/dist/src/state/lock.js +7 -1
  42. package/dist/src/state/lock.js.map +1 -1
  43. package/dist/src/state/store.d.ts +39 -1
  44. package/dist/src/state/store.js +127 -1
  45. package/dist/src/state/store.js.map +1 -1
  46. package/dist/src/version.d.ts +1 -1
  47. package/dist/src/version.js +1 -1
  48. package/dist/src/workflow.d.ts +113 -8
  49. package/dist/src/workflow.js +1635 -78
  50. package/dist/src/workflow.js.map +1 -1
  51. package/docs/autonomy-guardrails.md +164 -0
  52. package/docs/decisions.md +39 -0
  53. package/docs/delegated-approval.md +37 -5
  54. package/docs/development-flow.md +45 -1
  55. package/docs/pdf/codex-workflow-v2-architecture-ru.pdf +155 -136
  56. package/docs/pdf/codex-workflow-v2-chat-only-guide-ru.pdf +236 -223
  57. package/docs/pdf/codex-workflow-v2-technical-reference-ru.pdf +225 -206
  58. package/docs/project-memory.md +7 -0
  59. package/docs/release.md +9 -0
  60. package/docs/updating-existing-project.md +63 -5
  61. package/docs/validation-report.md +52 -34
  62. package/package.json +1 -1
  63. package/plugins/codex-workflow-gateway/references/protocol.md +182 -6
  64. package/plugins/codex-workflow-gateway/skills/codex-workflow-gateway/SKILL.md +35 -1
  65. package/references/git-policy.md +5 -2
  66. package/references/state-machine.md +43 -0
  67. package/references/validation-and-review.md +28 -1
  68. package/roles/delivery-coordinator.md +21 -1
  69. package/roles/independent-reviewer.md +3 -0
  70. package/roles/technical-planner.md +10 -0
  71. package/roles/worker.md +4 -0
  72. package/schemas/adoption-posture-event.schema.json +129 -0
  73. package/schemas/corrective-decision-event.schema.json +55 -0
  74. package/schemas/corrective-plan-audit.schema.json +20 -0
  75. package/schemas/milestone-autonomy-event.schema.json +45 -0
  76. package/schemas/milestone-scope-change-event.schema.json +70 -0
  77. package/schemas/milestone-transaction-journal.schema.json +95 -0
  78. package/schemas/plan-risk-audit-event.schema.json +107 -0
  79. package/schemas/remediation-event.schema.json +53 -0
  80. package/schemas/reviewer-attestation-event.schema.json +49 -0
  81. package/schemas/step-review-event.schema.json +74 -0
  82. package/schemas/task-handoff-event.schema.json +116 -0
@@ -0,0 +1,164 @@
1
+ # Autonomous Development Guardrails
2
+
3
+ These rules keep delegated execution autonomous without turning approval into a rubber stamp.
4
+ Alpha.7 adds no persistent canonical entity fields and keeps `stateSchemaVersion: 2`.
5
+
6
+ ## Plan Risk Audit
7
+
8
+ Before execution authorization, every alpha.7 Task needs a current Plan Risk Audit sidecar
9
+ bound to the current Brief, Plan, and approved Knowledge Map. This is mandatory even when all
10
+ Steps are unguarded and the decision is `approved`.
11
+
12
+ The payload must classify every current Step exactly once and declare:
13
+
14
+ - `planner` and a distinct `auditor`
15
+ - `decision`: `approved`, `approved-with-rationale`, `split-required`, or `stop-escalate`
16
+ - per-Step guarded categories, concrete `failureModes`, and `reviewRequired`
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`
20
+ - `splitRationale` when migration is intentionally coupled to recovery or runtime composition
21
+
22
+ The workflow rejects omitted Steps, extra Steps, duplicate classifications, stale bindings,
23
+ and self-contradictory classifications. `split-required` and `stop-escalate` block execution
24
+ authorization. The sidecar, not informal Plan prose, is
25
+ the source of truth for which Steps require strict review.
26
+
27
+ Guarded categories cover:
28
+
29
+ - forward database or state migrations;
30
+ - concurrent ownership, queues, cursors, compare-and-swap, or locking;
31
+ - restart, replay, recovery, or crash windows;
32
+ - external provider lifecycle, hidden retries, defaults, timeouts, or error mapping;
33
+ - runtime composition boundaries, security boundaries, auth/secrets, and irreversible execution.
34
+
35
+ The original Plan must contain the corresponding failure evidence. A migration needs a
36
+ populated forward-upgrade scenario, not only a clean bootstrap. Concurrent state needs
37
+ deterministic race tests. Recovery needs restart and crash-window evidence. Provider work
38
+ needs failure injection and verification of provider defaults. When persistence migration,
39
+ recovery orchestration, and executable composition form independently verifiable failure
40
+ boundaries, they are separate Tasks rather than one oversized Task.
41
+
42
+ For adopted legacy Tasks, the bootstrap audit covers only the remaining non-`completed` and
43
+ non-`skipped` Steps recorded at the adoption boundary.
44
+
45
+ ## Strict Step Review
46
+
47
+ If the current Plan Risk Audit marks a Step for strict review, `task step-complete` still
48
+ creates the workflow-owned commit, but the Step stays non-terminal and `next` routes to
49
+ `task step-review`. Canonical completion is recorded only after the strict review and the
50
+ reviewer attestation both bind to that exact completion commit.
51
+
52
+ Invalid or stale review sidecars fail closed. The workflow blocks downstream acceptance and
53
+ normal continuation when review evidence is malformed, unverified, or commit-mismatched.
54
+
55
+ ## Repeated failed review and remediation breaker
56
+
57
+ The first failed independent review returns the Task to `needs_fix` and requires a changed or
58
+ new remediation Step. After two distinct failed-review attempts, `next` returns
59
+ `task plan-set with independent corrective audit`. Another Plan requires a JSON audit:
60
+
61
+ ```json
62
+ {
63
+ "auditor": "corrective-auditor",
64
+ "summary": "The corrective Step covers the latest findings without changing the Brief.",
65
+ "decision": "continue-fix",
66
+ "reviewedFindingIds": ["REV-001", "REV-002"]
67
+ }
68
+ ```
69
+
70
+ Apply it with `task plan-set --corrective-audit-file <file>` only for the `continue-fix`
71
+ path. The Auditor must differ from the failed-review author and cover every latest finding.
72
+ `replan-required`, `split-required`, and `stop-escalate` are stop decisions: Core does not
73
+ start another implementation loop.
74
+
75
+ For guarded Steps, remediation attempts are also tracked in
76
+ `remediation-events.jsonl`. Two ordinary remediation attempts are allowed. A third ordinary
77
+ retry is blocked until `task corrective-decision` records a current corrective decision in
78
+ `corrective-decisions.jsonl`. `continue-fix` allows bounded continuation; the other decisions
79
+ stop or redirect ordinary execution. If that third, corrective remediation review also fails,
80
+ Core enters a hard stop: a fourth run and another `continue-fix`/`replan-required` decision are
81
+ rejected. Only `split-required` or `stop-escalate` may be recorded. At the corrective boundary,
82
+ `next` derives a distinct `agent:corrective-auditor:<task-id>` actor; selecting that actor is not
83
+ a human approval, while auditor independence remains mandatory.
84
+
85
+ ## Content-only context refresh
86
+
87
+ When `next.contextRefresh` offers an exact option, a project-scoped delegate may run one
88
+ composite transition:
89
+
90
+ ```text
91
+ task context-refresh
92
+ = project-memory reconcile
93
+ + delegated project-memory approve
94
+ + task knowledge-rebind
95
+ + delegated task execution authorize
96
+ ```
97
+
98
+ The command requires the exact Task and Knowledge Map revisions, delegate actor, and grant.
99
+ Core validates both grant transitions before the first write. It is allowed only when an
100
+ already approved source set has content-hash drift and its category, scope, authority, gaps,
101
+ and conflicts are unchanged. New or removed sources and any classification/authority change
102
+ stop on the ordinary visible Knowledge Map flow.
103
+
104
+ ## Chat ownership
105
+
106
+ One Milestone coordinator chat owns Discovery, Task order, exact delegated approvals, merge
107
+ observation, Milestone validation, and final acceptance. Every required Task runs in a
108
+ dedicated user-visible Task chat. A Task chat may use internal Worker and Reviewer contexts,
109
+ but only its delegate coordinator uses the grant. This prevents one long Milestone context
110
+ from accumulating every implementation and review loop.
111
+
112
+ ## Update boundary
113
+
114
+ Before changing the exact npm version, run `update preflight`. A compatible update is safe
115
+ only when the repository is clean, no Step is `in_progress`, and no writer lease is active.
116
+ An expired lease is also a blocker until the ordinary explicit stale-lock repair is completed.
117
+ The command is read-only and reports every blocker. It does not install a package or migrate
118
+ state. When `stateSchemaVersion` remains `2`, the external project state is reused unchanged.
119
+ Existing schema 2 projects then use `state adoption-prepare` and `state adoption-apply`; they
120
+ do not use `state migrate` for schema-2 adoption.
121
+
122
+ Alpha.7 also exposes `update rescue-preflight` for one narrow alpha.6 deadlock: a pending strict
123
+ review whose completion commit changed canonical knowledge while Knowledge rebind is forbidden
124
+ by the still-in-progress Step. Eligibility requires an exact alpha.6 dependency, one pending
125
+ review, exact clean completion HEAD, valid history, and no active lease. The command is read-only
126
+ and returns only stale-lock repair plus strict-review actions.
127
+
128
+ ## Milestone closure
129
+
130
+ After every current `required` Task is `merged`, run `milestone validate` on the clean base
131
+ HEAD. `next` exposes a completion policy and the state-bound final gate. The coordinator must
132
+ compare Result, evidence, Plan hash, and validated HEAD. A delegate may accept only through an
133
+ exact `milestone.final_accept` option, must remain the recorded actor, and must pass the
134
+ current `MSA-*` code. Without that option the ordinary later-message human gate applies.
135
+
136
+ ## Bounded Milestone autonomy and C1 handoff
137
+
138
+ Initial assembly may materialize every linked Task before one complete `milestone plan-set`;
139
+ the Milestone cannot execute until all reverse memberships are classified. Ordinary semantic
140
+ scope change remains explicit and human-only through `milestone scope-change-prepare` and
141
+ `milestone scope-change-apply`.
142
+
143
+ After the initial Plan, one human may approve a time-bound (maximum 72 hours) Milestone
144
+ Autonomy Contract. It creates a milestone-scoped grant for Task/Milestone execution and final
145
+ acceptance plus Project Memory approval only inside an atomic content-only Task context refresh
146
+ for the same Milestone. Standalone Project Memory approval remains forbidden. The contract binds
147
+ the immutable outcome, success signal, acceptance, checks, discovery, and base branch.
148
+ `milestone autonomy-evolve` may only alter Task memberships; it records the
149
+ agent actor plus the autonomy-contract event hash in the journaled scope-change sidecar and
150
+ supersedes execution authorization. Any semantic drift, expiry, revocation, actor mismatch,
151
+ or contract hash mismatch fails closed.
152
+
153
+ `C1` handoff uses `task handoff-prepare`, `task claim --claim-token ...`, and terminal
154
+ `task handback-create`. When target actor is omitted, Core derives
155
+ `agent:worker:<task-id>`. Preparation returns a one-time token and prompt bound to a stable
156
+ `handoffId`, revision, Brief/Plan/Knowledge hashes, Milestone and Task display numbers,
157
+ expected next action, delegate/grant, creation time, and expiry. Only the claim-token hash is
158
+ stored; `task handoff-show` cannot recover it. Claim fails closed on expiry, actor, token,
159
+ revision, context, grant, or writer-owner mismatch. While pending, `next` blocks normal
160
+ execution behind claim; while claimed, only the
161
+ claimant may mutate with the bound writer token. Milestone-linked Tasks require this claimed
162
+ posture before start. Terminal handback preserves status, merge/result/evidence/review and
163
+ Knowledge bindings, limitations, and recommended next action. This is machine-bound actor and
164
+ lease evidence only; it is not proof of a separate thread.
package/docs/decisions.md CHANGED
@@ -57,3 +57,42 @@ This document closes the requirement gaps identified during the V2 design review
57
57
  both actors and the policy hash; revocation blocks future uses. This is an additive schema
58
58
  2 entity and optional authorization metadata, so existing schema 2 projects require no
59
59
  migration. It is local policy evidence, not a cryptographic identity signature.
60
+ 11. **Core-owned Step commit.** `task run` dispatches a Worker that leaves changes
61
+ uncommitted. For an active Step, `next` returns the exact `task step-complete` transition
62
+ and Step ID. That transition validates history and allowed paths, runs checks, creates
63
+ the atomic commit, and records evidence. A manual Worker commit is unrecorded history and
64
+ fails closed without changing persisted Task state. This changes navigation and
65
+ diagnostics only; state schema 2 and protocol 1 remain unchanged.
66
+ 12. **Autonomous correction guardrail.** The initial Plan must make migration,
67
+ concurrency, restart/replay, crash-window, and provider risks visible. After two failed
68
+ independent reviews, another corrective Plan requires a distinct Auditor covering every
69
+ latest finding. The audit is append-only artifact evidence; no Task state field or schema
70
+ change is required.
71
+ 13. **Content-only context refresh.** A delegate may compose reconcile, approval, knowledge
72
+ rebind, and execution reauthorization only when the approved source classification is
73
+ identical and only content hashes changed. Core validates both delegated transitions
74
+ before writing. Source-set, category, scope, authority, gap, or conflict changes stay on
75
+ the ordinary visible approval path. State schema 2 and protocol 1 remain unchanged.
76
+ 14. **Autonomous chat and closure boundary.** A Milestone coordinator owns orchestration and
77
+ final acceptance while each required Task uses a dedicated user-visible Task chat.
78
+ `next` exposes the Milestone completion contract, and delegated acceptance retains the
79
+ delegate actor and exact state-bound MSA code.
80
+ 15. **Safe update preflight.** Dependency updates begin with a read-only preflight requiring
81
+ a clean checkout, no running Step, and no active writer lease. It does not install,
82
+ migrate, or mutate project state.
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,6 +52,20 @@ 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.7 does not widen the generic delegation allow-list. Generic delegated approval does not authorize:
56
+
57
+ - `state adoption-apply`
58
+ - `milestone scope-change-prepare`
59
+ - `milestone scope-change-apply`
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.
68
+
55
69
  ## Starting a delegate chat
56
70
 
57
71
  A grant does not start an agent and is not attached to a Codex chat automatically. Open a new
@@ -74,6 +88,10 @@ scope changes are not approval transitions: the delegate stops and asks the user
74
88
  Independent Reviewer roles may implement or review work, but the coordinating delegate alone
75
89
  uses the grant and passes `--delegation-grant` to the Core transition.
76
90
 
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.
94
+
77
95
  ### Milestone delegate prompt
78
96
 
79
97
  Use project scope when the Milestone does not exist yet. An existing Milestone and its linked
@@ -99,8 +117,9 @@ project, status active, delegate, scope, transitions и expiresAt. Не созд
99
117
  вернул exact delegatedApprovalOptions для этого DGR-ID и transition; actor
100
118
  всегда agent:deputy, никогда user.
101
119
 
102
- Required Tasks выполняй последовательно. Для каждой Task можешь создать
103
- отдельный Codex-чат, передав ему Task delegate prompt, тот же actor и DGR-ID;
120
+ Required Tasks выполняй последовательно. Для каждой Task обязательно создай
121
+ отдельный пользовательский Codex-чат, передав ему Task delegate prompt, тот же actor и DGR-ID.
122
+ Milestone-чат не реализует Steps и не накапливает fix-loop всех Tasks;
104
123
  не запускай два writer на одном checkout. Worker и Reviewer не используют
105
124
  grant: approval-команды выполняет только delegate-координатор после их evidence.
106
125
 
@@ -135,19 +154,32 @@ Authorization выполняй только когда текущий next со
135
154
  delegatedApprovalOptions для DGR-ID и task.execution_authorize; используй
136
155
  actor agent:deputy и --delegation-grant, не записывай actor user.
137
156
 
138
- Далее следуй штатному lifecycle: один Step - один writer lease - один commit,
139
- checks и evidence. Worker не использует grant. При изменении Knowledge Map
157
+ Далее следуй штатному lifecycle: один Step - один writer lease. Worker меняет
158
+ только разрешённые файлы и оставляет их uncommitted; затем координатор вызывает
159
+ exact `task step-complete` из `next`, а core выполняет checks, создаёт commit и
160
+ записывает evidence. Worker не использует grant. При изменении Knowledge Map
140
161
  выполни reconcile; approve разрешён только при exact project_memory.approve
141
162
  option этого project-scoped grant. Затем knowledge-rebind и новая authorization.
163
+ Если next содержит exact `contextRefresh` для того же grant, можешь вместо четырёх
164
+ команд выполнить `task context-refresh`; при любом изменении source set,
165
+ category/authority, gaps или conflicts используй обычный видимый процесс.
142
166
 
143
167
  После submit запусти отдельный Independent Reviewer; Reviewer не использует
144
- grant и не исправляет код. Выполни допустимый fix-loop. Final acceptance делай
168
+ grant и не исправляет код. После второго failed review не запускай очередной
169
+ патч: получи отдельный corrective Plan audit, охватывающий все последние findings,
170
+ и передай его через `--corrective-audit-file`. Продолжай только при
171
+ `decision=continue-fix`; остальные решения верни пользователю/координатору.
172
+ Final acceptance делай
145
173
  только при exact task.final_accept option для DGR-ID, затем штатный merge.
146
174
  Если option отсутствует, grant истёк, scope не совпал или требуется смысловое
147
175
  решение пользователя - остановись. В конце покажи Task status, commits, checks,
148
176
  review и delegated authorization event.
149
177
  ```
150
178
 
179
+ Milestone coordinator waits for the dedicated Task chat to return its terminal Task status
180
+ and merge evidence before starting the next required Task. Internal subagents inside one
181
+ oversized Milestone chat are not a substitute for this user-visible Task boundary.
182
+
151
183
  After autonomous work, inspect the recorded events and revoke a broad grant when it is no
152
184
  longer needed. Revocation does not erase completed approvals.
153
185
 
@@ -21,10 +21,25 @@ 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.7, execution authorization also requires a current Plan Risk Audit bound to the same
25
+ Brief, Plan, Knowledge Map, and exact Step set. For existing schema 2 projects upgraded into
26
+ alpha.7, execution additionally requires adoption posture first; remaining legacy scope then
27
+ uses a bootstrap audit over the preserved non-`completed`, non-`skipped` Steps only.
28
+ The audit names a Plan author and independent auditor, binds each guarded failure mode to
29
+ exact executable evidence, and blocks authorization on `split-required` or `stop-escalate`.
30
+
24
31
  Local execution creates `codex/task-<id>-<slug>` from a clean base only after authorization.
25
32
  An externally owned checkout must already use a dedicated non-base branch. The core never
26
33
  creates or removes external worktrees. Each Step declares allowed writes, dependencies, and
27
- checks; unexpected paths or failed checks block its atomic commit.
34
+ checks. `task run` dispatches exactly one Step and returns a writer lease. The Worker changes
35
+ only allowed files and leaves them uncommitted. Repository-level `next` then returns the exact
36
+ `task step-complete` transition for the active Step. That core transition runs checks, stages
37
+ the allowed changes, creates the atomic Step commit, and records evidence. Unexpected paths,
38
+ failed checks, or any manual/unrecorded Worker commit block completion.
39
+
40
+ If the current Plan Risk Audit marks the Step for strict review, the atomic commit is still
41
+ created by core, but the Step remains non-terminal and `next` routes to `task step-review`
42
+ until commit-bound strict review and reviewer attestation pass.
28
43
 
29
44
  After a Step changes approved project knowledge, the Delivery Coordinator reconciles and
30
45
  reapproves the Project Knowledge Map, then runs `task knowledge-rebind` between Steps. The
@@ -35,12 +50,27 @@ active Worker Step, a no-op binding, an invalid knowledge target, or a modified
35
50
  artifact. After the user authorizes the rebound Plan, execution resumes in the existing
36
51
  workspace; if all Steps are complete, the next action is submission.
37
52
 
53
+ When `next.contextRefresh` exposes an eligible project-scoped grant and content-only mode,
54
+ `task context-refresh` may compose reconcile, delegated map approval, rebind, and delegated
55
+ execution reauthorization. Core validates both approval transitions before writing and
56
+ rejects any source-set, category, scope, authority, gap, or conflict change.
57
+
38
58
  Submission requires a clean, auditable Task history and records evidence for the exact
39
59
  Task head. `task review-launch` starts a separate read-only reviewer. A passing fresh review
40
60
  permits Result creation. Human final acceptance binds Brief, Plan, Result, evidence, and
41
61
  the accepted head. Base advancement forces synchronization, checks, review, and acceptance
42
62
  to be repeated before merge.
43
63
 
64
+ The Technical Planner performs a risk review before authorization. Migration work includes a
65
+ populated forward-upgrade check; concurrent state includes deterministic races; restart,
66
+ replay, and crash claims include restart/crash-window evidence; provider work includes
67
+ failure injection and hidden-default verification. After two failed independent reviews,
68
+ another Plan requires a distinct corrective Auditor and `--corrective-audit-file`. Only a
69
+ `continue-fix` audit may continue; replan, split, and stop decisions return to coordination.
70
+ For guarded remediation, a third ordinary retry is blocked until a current
71
+ `task corrective-decision` exists for the same Step and Plan binding. If that corrective
72
+ attempt fails review, the third failure is a hard stop and no fourth run is permitted.
73
+
44
74
  Execution authorization and final acceptance use the human path by default. If the user has
45
75
  previously issued an active delegation grant for the exact transition and scope, the named
46
76
  delegate may perform that transition with `--delegation-grant`. The event keeps the delegate
@@ -63,6 +93,16 @@ and prevents new linked Tasks from starting. A Task that has started cannot be r
63
93
  it can be retained as waived/cancelled with history and reason. Tasks already in progress
64
94
  may finish while an amendment awaits authorization.
65
95
 
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`.
105
+
66
106
  A Milestone has no integration branch. Validation requires all required Tasks to be
67
107
  `merged`, checks the current clean base branch, and writes evidence plus Result. Final
68
108
  acceptance binds those artifacts to the unchanged base HEAD. Cancellation records a reason
@@ -87,6 +127,10 @@ With an eligible `milestone.final_accept` grant, `next` additionally returns
87
127
  turn because the earlier grant-issuance turn is the controlling user decision. Without such
88
128
  an option, the ordinary later-message human gate remains mandatory.
89
129
 
130
+ The Milestone coordinator keeps implementation out of its long-lived context: every required
131
+ Task runs in a dedicated user-visible Task chat. The Milestone chat owns ordering, exact
132
+ delegated transitions, merge observation, cross-Task validation, and final acceptance.
133
+
90
134
  ## Responsibility boundaries
91
135
 
92
136
  | Participant | Responsible for | Cannot decide |