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
@@ -30,6 +30,13 @@ definition, status, and evidence record, records the old/new binding, supersedes
30
30
  authorization, and cannot run while a Step is in progress. If local state is lost, the map
31
31
  is rebuilt from repository files.
32
32
 
33
+ For delegated autonomy, repository `next` may expose `contextRefresh` when the stored map was
34
+ active and inspection proves content-hash-only drift. `task context-refresh` then performs
35
+ reconcile, delegated map approval, Task rebind, and delegated execution authorization while
36
+ preserving the ordinary audit events. The command rejects new/removed sources, category,
37
+ scope or authority changes, changed gaps, and conflicts. Those changes always remain visible
38
+ for normal classification and approval.
39
+
33
40
  ## Codebase graph
34
41
 
35
42
  The graph is an optional derived index, never the durable memory authority. The gateway asks
package/docs/release.md CHANGED
@@ -20,6 +20,15 @@ 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.7, the release gate also relies on `npm run release:check` to fail if:
24
+
25
+ - canonical entity schema 2 shapes drift;
26
+ - protocol 1 compatibility is no longer additive;
27
+ - the delegated transition allow-list expands;
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.
31
+
23
32
  Tag releases as `v<package-version>`. The tag workflow verifies the tag/package match and
24
33
  uses npm trusted publishing with public access. For a public GitHub repository and public
25
34
  package, npm trusted publishing generates provenance automatically. Publishing is never
@@ -19,7 +19,18 @@ gateway, но не удаляет и не пересоздаёт это сост
19
19
  Никогда не разрешайте агенту вручную редактировать, переносить или удалять внешний state.
20
20
  Команда миграции нужна только тогда, когда документация новой версии прямо сообщает о новой
21
21
  state schema. Совпадение `stateSchemaVersion` до и после обновления означает, что миграция не
22
- нужна.
22
+ нужна. Для alpha.6 при `stateSchemaVersion: 2` применяется не migration, а sidecar-only
23
+ adoption posture.
24
+
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 обычным способом.
23
34
 
24
35
  ## 1. Подготовьте отдельный чат обновления
25
36
 
@@ -33,10 +44,12 @@ Codex и откройте в нужном проекте отдельный ча
33
44
  из npm: https://www.npmjs.com/package/codex-workflow-v2.
34
45
 
35
46
  Все команды выполняешь ты. Сначала прочитай AGENTS.md и определи Git root.
36
- До изменений запусти project-local gateway handshake, doctor, status и next;
47
+ До изменений запусти project-local gateway handshake, doctor, status, next и
48
+ read-only `update preflight`;
37
49
  зафиксируй текущую версию, protocolVersion, stateSchemaVersion, projectId,
38
- активные сущности и наличие writer lease. Если Worker сейчас выполняется,
39
- остановись без обновления.
50
+ активные сущности и наличие writer lease. Продолжай только если preflight
51
+ вернул safe=true: checkout чистый, running Step и active writer lease отсутствуют.
52
+ Иначе остановись без обновления и покажи blockers.
40
53
 
41
54
  Обнови только точную npm-зависимость и lock-файл, без диапазона версий.
42
55
  Не удаляй и не редактируй вручную $CODEX_HOME/workflow-state/v2.
@@ -62,6 +75,9 @@ plugin за пределами workspace. Это ожидаемая границ
62
75
  5. `projectId` совпадает со значением до обновления.
63
76
  6. Существующие Task/Milestone ID, revisions и terminal statuses сохранились.
64
77
  7. Персональный gateway обновлён из установленного пакета.
78
+ 8. `update preflight` до изменения подтвердил чистую lifecycle-границу.
79
+ 9. Для alpha.6 существующий schema 2 проект либо уже имеет `adoption-posture.jsonl`,
80
+ либо `next`/`status` требуют `state adoption-prepare` и затем `state adoption-apply`.
65
81
 
66
82
  Изменение `projectId`, исчезновение сущностей или ошибка unsupported state schema — причина
67
83
  остановиться. Не соглашайтесь на «починку» удалением state. Агент должен вернуть dependency к
@@ -92,6 +108,42 @@ handshake, doctor, status и next. Подтверди точную declared/inst
92
108
  нужно выполнить `scan/reconcile`, показать пользователю изменения классификации и получить
93
109
  approval, если он требуется.
94
110
 
111
+ ## 3.0. Alpha.6 adoption для существующего schema 2 проекта
112
+
113
+ Если проект уже вёлся на alpha.5 или другой schema 2 версии без alpha.6 posture, новый runtime
114
+ не разрешит execution-переходы, пока не будет записан adoption sidecar. Это нормальное
115
+ fail-closed поведение, а не повреждение state.
116
+
117
+ Порядок:
118
+
119
+ 1. `update preflight --repo .`
120
+ 2. `state adoption-prepare --repo .`
121
+ 3. Проверить returned baseline и `ADA-*` confirmation code
122
+ 4. `state adoption-apply --repo . --actor <human-actor> --confirmation-code <ADA-CODE>`
123
+
124
+ Граница должна быть безопасной:
125
+
126
+ - checkout чистый;
127
+ - нет `in_progress` Step;
128
+ - нет active writer lease;
129
+ - stale writer lease сначала чинится обычным repair-путём.
130
+
131
+ Alpha.6 adoption сохраняет:
132
+
133
+ - terminal Milestones со статусом `accepted` или `cancelled`;
134
+ - terminal Tasks со статусом `merged` или `cancelled`;
135
+ - completed и skipped Steps в активных Tasks вместе с их evidence.
136
+
137
+ Alpha.6 adoption не делает:
138
+
139
+ - не переписывает canonical entity JSON;
140
+ - не переоткрывает terminal-сущности;
141
+ - не прогоняет заново уже completed legacy Steps;
142
+ - не использует `state migrate`.
143
+
144
+ После adoption remaining legacy scope должен получить bootstrap Plan Risk Audit только для
145
+ оставшихся non-`completed` и non-`skipped` Step.
146
+
95
147
  ## 3.1. При необходимости включите delegated approval
96
148
 
97
149
  Delegated approval не включается автоматически после обновления. Существующие авторизации и
@@ -147,7 +199,9 @@ Revocation запрещает будущие использования, но н
147
199
  Codex-процесса. Любой процесс с доступом к локальному state и CLI может заявить строку
148
200
  delegate. Поэтому project-wide grant должен быть короткоживущим, а секреты, платежи, реальные
149
201
  торговые операции и иные необратимые действия требуют отдельных технических ограничений и не
150
- должны полагаться только на delegated approval.
202
+ должны полагаться только на delegated approval. Alpha.6 не расширяет allow-list transitions:
203
+ grant не даёт authority на adoption apply, Milestone scope change или другие новые
204
+ human-only guardrails.
151
205
 
152
206
  ## 3.2. Запустите delegate в новом чате
153
207
 
@@ -181,6 +235,10 @@ NN - Standalone delegated task
181
235
  После завершения автономного окна попросите отдельный контрольный чат показать
182
236
  `delegation list`, использованные authorization events и отозвать ненужный широкий grant.
183
237
 
238
+ Для Milestone delegate отдельный Task-чат обязателен для каждой required Task. Это сохраняет
239
+ пользовательский audit trail и не позволяет одному длинному Milestone-чату накапливать
240
+ реализацию, compaction и review всех Tasks.
241
+
184
242
  ## 4. Продолжите начатый Milestone или создайте следующий
185
243
 
186
244
  Terminal Milestone со статусом `accepted` остаётся закрытым. Для следующего результата нужно
@@ -1,38 +1,56 @@
1
1
  # V2 Alpha Validation Report
2
2
 
3
- Release candidate `2.0.0-alpha.4` was validated on 2026-08-12 with Node.js 24.17.0.
3
+ Release candidate `2.0.0-alpha.7` was validated on 2026-08-14 with Node.js 24.17.0.
4
4
 
5
5
  - TypeScript typecheck and build passed.
6
- - All 47 unit and integration tests passed. Coverage includes the complete Task lifecycle,
7
- a Project Knowledge Map change between Steps, preservation of completed Step evidence,
8
- mandatory reauthorization, the public `task knowledge-rebind` CLI route, no-op and active
9
- Worker rejection, current gateway capability negotiation, and rejection of deprecated
10
- state schema instead of migration.
11
- - Delegated approval coverage includes DGA-bound grant issuance, project/Milestone/Task
12
- scopes, Knowledge Map approval, all Task/Milestone execution and final transitions,
13
- `next.delegatedApprovalOptions`, explicit principal/delegate audit metadata, actor,
14
- transition and scope rejection, expiry, revocation, duplicate issuance, and policy-hash
15
- tamper rejection.
16
- - Milestone scheduling now ignores unstarted Tasks with cancelled/waived or terminal
17
- membership paths. Final Milestone acceptance exposes a revision/hash/HEAD-bound human gate,
18
- rejects a wrong code, and regenerates its code after base advancement and revalidation.
19
- - Milestone amendments, graph binding, deterministic V1 snapshot, symlink rejection, writer
20
- leases, and strict reviewer fail-closed behavior also passed.
21
- - npm dry-run packaging produced `codex-workflow-v2-2.0.0-alpha.4.tgz` with runtime, schemas,
22
- roles, references, docs, and plugin source.
23
- - Downstream installation from that tarball and the packaged CLI handshake passed; the
24
- installation created none of the forbidden repository workflow directories.
25
- - Plugin validation and the repository release check passed for `2.0.0-alpha.4`.
26
- - The alpha.4 CLI read the existing Signal schema 2 project state without migration:
27
- project ID `b06d0f18f790f4521a23c770`, accepted Milestone 1 revision 10, historical
28
- authorization events, and all entity IDs were preserved; `delegations` was an empty
29
- additive collection and repository-level `next` remained `idle`.
30
- - The three Russian PDFs were regenerated and all 40 pages were rendered to PNG for visual
31
- inspection; delegated approval, compatibility, grant issuance, audit, revocation, and
32
- chat-only grant issuance and Milestone/Task delegate launch prompts are present without
33
- layout defects.
34
-
35
- The strict reviewer implementation did not change in this release candidate. Its original
36
- 2026-07-16 real Codex CLI isolation probe denied a repository write and returned
37
- `isolationProbe: "denied"`. The reviewer remains fail-closed: inability to prove isolation
38
- records `unverified` and blocks acceptance.
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.
50
+
51
+ Not claimed here:
52
+
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.4",
3
+ "version": "2.0.0-alpha.7",
4
4
  "description": "Requirements-first Codex development workflow with local state and explicit Git ownership.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,13 +8,186 @@ Run:
8
8
  codex-workflow gateway handshake --repo <git-root>
9
9
  ```
10
10
 
11
- Require package name `codex-workflow-v2`, protocol version `1`, state
12
- schema version `2`, and the capabilities needed for the requested operation. Task execution
13
- that may cross a Project Knowledge Map revision requires `task-knowledge-rebind-v1`.
14
- Milestone final acceptance requires `milestone-human-final-gate-v1`.
15
- Autonomous approval requires `delegated-approval-v1`.
11
+ Require:
16
12
 
17
- ## Milestone Human Gate
13
+ - package name `codex-workflow-v2`
14
+ - protocol version `1`
15
+ - state schema version `2`
16
+ - the capabilities needed for the requested operation
17
+
18
+ Current capability set:
19
+
20
+ - `project-memory-v1`
21
+ - `graph-binding-v1`
22
+ - `local-state-v1`
23
+ - `milestone-lifecycle-v1`
24
+ - `milestone-human-final-gate-v1`
25
+ - `delegated-approval-v1`
26
+ - `task-knowledge-rebind-v1`
27
+ - `task-context-refresh-v1`
28
+ - `corrective-plan-audit-v1`
29
+ - `safe-update-preflight-v1`
30
+ - `strict-reviewer-v1`
31
+ - `legacy-snapshot-v1`
32
+ - `plan-risk-audit-sidecar-v1`
33
+ - `step-strict-review-sidecar-v1`
34
+ - `step-remediation-circuit-breaker-sidecar-v1`
35
+ - `milestone-scope-change-sidecar-v1`
36
+ - `milestone-membership-integrity-v1`
37
+ - `task-c1-handoff-sidecar-v1`
38
+ - `semantic-plan-risk-audit-v2`
39
+ - `guarded-remediation-hard-stop-v1`
40
+ - `milestone-reverse-membership-integrity-v1`
41
+ - `task-c1-handoff-bundle-v2`
42
+ - `alpha6-adoption-posture-v1`
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
52
+ not claim compatibility if canonical entity shapes or non-additive command semantics change.
53
+
54
+ ## Alpha.6 adoption posture
55
+
56
+ For an existing schema 2 project without alpha.6 posture, repository-level `next` blocks
57
+ execution behind adoption:
58
+
59
+ - `action: "state adoption-apply"` when the repository is already at a safe boundary
60
+ - `action: "restore safe boundary, then state adoption-prepare"` otherwise
61
+
62
+ Use:
63
+
64
+ ```text
65
+ codex-workflow state adoption-prepare --repo <git-root>
66
+ codex-workflow state adoption-apply --repo <git-root> \
67
+ --actor <HUMAN-ACTOR> --confirmation-code <ADA-CODE>
68
+ ```
69
+
70
+ The confirmation is bound to project identity, package version, protocol version, schema
71
+ version, canonical entity summaries, and the current sidecar baseline hash. Adoption is not
72
+ `state migrate`.
73
+
74
+ ## Worker Step completion and strict Step Review
75
+
76
+ `task run` dispatches one Step and returns its writer token and Worker envelope. The Worker
77
+ must leave all changes uncommitted and must not stage, commit, amend, reset, rebase, or
78
+ modify Git history.
79
+
80
+ While that Step is `in_progress`, repository-level `next` normally returns
81
+ `action: "task step-complete"`, the exact `stepId`, and a `commitPolicy` declaring
82
+ `workflow-core` ownership. The coordinator invokes that transition with the current revision
83
+ and writer token. Core then runs configured checks, validates `allowedWrites`, stages the
84
+ changes, creates the atomic commit, and records evidence.
85
+
86
+ If the current Plan Risk Audit marks that Step for strict review, the commit is still
87
+ workflow-owned, but `next` then returns `action: "task step-review"` with the same `stepId`
88
+ and the exact `completionCommit`. Canonical Step completion remains blocked until the strict
89
+ review and reviewer attestation sidecars verify against that exact commit.
90
+
91
+ An unrecorded commit is Git history drift. Stop instead of adding another commit or editing
92
+ workflow state manually; recovery remains coordinator-controlled.
93
+
94
+ ## Plan Risk Audit and remediation breaker
95
+
96
+ Before `task authorize`, every new alpha.7 Task requires:
97
+
98
+ ```text
99
+ codex-workflow task plan-risk-audit --repo <git-root> \
100
+ --id <TASK-ID> --expected-revision <REVISION> --file <audit.json>
101
+ ```
102
+
103
+ The audit must classify every current Step exactly once, name distinct planner/auditor
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
106
+ unguarded Plan. Missing, stale, `split-required`, or `stop-escalate` evidence blocks
107
+ authorization.
108
+
109
+ For guarded remediation, `next.correctivePlanGate` or the runtime gate blocks a third
110
+ ordinary retry on the same guarded Step until a current corrective decision exists. Record it
111
+ with:
112
+
113
+ ```text
114
+ codex-workflow task corrective-decision --repo <git-root> \
115
+ --id <TASK-ID> --step <STEP-ID> --expected-revision <REVISION> --file <decision.json>
116
+ ```
117
+
118
+ Only `continue-fix` permits bounded continuation. `replan-required`, `split-required`, and
119
+ `stop-escalate` are stop or redirection decisions. If the third corrective review fails, a
120
+ fourth run is prohibited; only split or stop may be recorded.
121
+
122
+ ## Context refresh
123
+
124
+ Use `task context-refresh` only when the same `next` response exposes `contextRefresh` for the
125
+ exact grant. Pass Task revision, map revision, delegate actor, and grant ID. The composite
126
+ operation is restricted to content-hash-only drift and records the ordinary delegated map and
127
+ Task authorization evidence. Any semantic map change remains on the normal visible path.
128
+
129
+ Before updating the installed package, run `update preflight`. Continue only for `safe=true`.
130
+ For an alpha.6 project trapped between a pending strict review and forbidden Knowledge rebind,
131
+ an exact external alpha.7 runner may run `update rescue-preflight`. Continue only for
132
+ `eligible=true` and only with the returned lock-repair and strict-review actions.
133
+
134
+ ## C1 handoff
135
+
136
+ `C1` coordination is machine-bound and local. Use:
137
+
138
+ ```text
139
+ codex-workflow task handoff-prepare --repo <git-root> --id <TASK-ID> \
140
+ --expected-revision <REVISION> --actor <CURRENT-ACTOR> \
141
+ [--target-actor <TARGET-ACTOR>] --reason <TEXT> [--writer-token <TOKEN>] \
142
+ [--delegation-grant <GRANT>] [--expires-at <ISO-TIMESTAMP>]
143
+ codex-workflow task handoff-show --repo <git-root> --id <TASK-ID>
144
+ codex-workflow task claim --repo <git-root> --id <TASK-ID> \
145
+ --expected-revision <REVISION> --actor <TARGET-ACTOR> --claim-token <TOKEN> \
146
+ [--writer-token <WRITER-TOKEN>]
147
+ codex-workflow task handback-create --repo <git-root> --id <TASK-ID> \
148
+ --expected-revision <REVISION> --actor <CLAIMANT> --reason <TEXT> \
149
+ --recommended-next <TEXT> [--limitation <TEXT>] [--writer-token <TOKEN>]
150
+ ```
151
+
152
+ While a handoff is pending, `next` blocks the previous action behind `task claim`. While
153
+ claimed, only the claimant may mutate the Task, and lease-bound mutations must present the
154
+ bound writer token. Milestone-linked Tasks must be claimed before start, and handback is
155
+ terminal and evidence-bound. When target actor is omitted, Core derives
156
+ `agent:worker:<task-id>`. No thread id is required or accepted as authority.
157
+
158
+ ## Milestone assembly, autonomy, and human gate
159
+
160
+ During initial planning, materialize every linked Task and then call `milestone plan-set` once
161
+ with the complete membership. Execution is blocked while reverse membership is incomplete.
162
+
163
+ After that Plan, one human may prepare and grant a maximum-72-hour Milestone Autonomy Contract:
164
+
165
+ ```text
166
+ codex-workflow milestone autonomy-prepare --repo <git-root> --id <MS-ID> \
167
+ --expected-revision <REVISION> --principal <HUMAN> --delegate <AGENT> --expires-at <ISO>
168
+ codex-workflow milestone autonomy-grant --repo <git-root> --id <MS-ID> \
169
+ --expected-revision <REVISION> --principal <HUMAN> --delegate <AGENT> --expires-at <ISO> \
170
+ --confirmation-code <MAC-CODE>
171
+ ```
172
+
173
+ The contract issues a milestone-scoped grant for the existing Task/Milestone approval transitions
174
+ and Project Memory approval only inside an atomic content-only Task context refresh for the same
175
+ Milestone. It cannot approve Project Memory independently. `milestone autonomy-evolve --file
176
+ <plan.json>` is permitted only when outcome, success signal, acceptance, checks, discovery, and
177
+ base branch still match the contract. It journals agent actor plus contract evidence and requires
178
+ reauthorization afterward.
179
+
180
+ After the initial empty planning posture, Milestone scope updates use:
181
+
182
+ ```text
183
+ codex-workflow milestone scope-change-prepare --repo <git-root> \
184
+ --id <MS-ID> --expected-revision <REVISION> --actor <HUMAN-ACTOR> --file <plan.json>
185
+ codex-workflow milestone scope-change-apply --repo <git-root> \
186
+ --id <MS-ID> --expected-revision <REVISION> --actor <HUMAN-ACTOR> \
187
+ --confirmation-code <MSC-CODE> --file <plan.json>
188
+ ```
189
+
190
+ This ordinary semantic-change path is human-only. Generic delegated approval never authorizes it.
18
191
 
19
192
  At `awaiting_final_acceptance`, `next` returns `requiredHumanGate` with kind
20
193
  `milestone_final_acceptance`, Milestone ID, revision, Plan/Result/evidence hashes, validated
@@ -42,6 +215,9 @@ as `--delegation-grant`. The resulting authorization event records the grant and
42
215
  For `milestone.final_accept`, also pass the current `MSA-*` code; the existing grant replaces
43
216
  the later-message requirement, not the state binding.
44
217
 
218
+ Delegated approval does not cover adoption apply or the ordinary semantic Milestone scope-change
219
+ path. Membership-only evolution requires the separate Milestone Autonomy Contract.
220
+
45
221
  ## Graph Refresh Request
46
222
 
47
223
  The package returns:
@@ -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,6 +43,10 @@ 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
+ When `next` exposes an exact delegated `contextRefresh`, use `task context-refresh` only for
47
+ the returned Task/map revisions, actor, and grant. Never use it when the source set,
48
+ classification, authority, gaps, or conflicts changed.
49
+
41
50
  ## Product Or Workflow Graph Refresh
42
51
 
43
52
  1. Run `graph refresh-request --kind product|workflow --mode moderate`.
@@ -57,8 +66,12 @@ independently blocks the workflow.
57
66
 
58
67
  - Scope Lead: architecture and broad search only.
59
68
  - Technical Planner: architecture, search, and trace evidence.
60
- - Worker: targeted search, trace, and snippets for its Step.
69
+ - Worker: targeted search, trace, and snippets for its Step. It leaves all file changes
70
+ uncommitted and never stages or mutates Git history; the coordinator invokes the exact
71
+ `task step-complete` returned by `next`, and core owns checks, commit creation, and evidence.
61
72
  - Delivery Coordinator: list, status, index, detect, and bind lifecycle.
73
+ - A Milestone Delivery Coordinator creates a dedicated user-visible Task chat for every
74
+ required Task and keeps implementation out of the Milestone chat.
62
75
  - Independent Reviewer: receives recorded evidence and confirms critical
63
76
  claims against files, Git, and tests.
64
77
 
@@ -95,6 +108,27 @@ option is returned, follow the ordinary human-gate rule above. Knowledge Map app
95
108
  delegable only through an explicit project-scoped `project_memory.approve` permission. Scope
96
109
  changes, grant issuance, and grant expansion are never delegated by `delegated-approval-v1`.
97
110
 
111
+ For an entire Milestone, prefer one bounded `milestone autonomy-prepare` gate after the complete
112
+ initial membership Plan exists. Show principal, delegate, expiry, semantic-scope hash, policy
113
+ hash, and `MAC-*` code, then stop. A later exact approval permits `milestone autonomy-grant`.
114
+ The resulting grant covers the existing Task/Milestone approval transitions and the Project
115
+ Memory approval portion of an atomic content-only Task context refresh for the same Milestone;
116
+ it never permits standalone Project Memory approval. It also permits `milestone autonomy-evolve`
117
+ only for membership changes; any change to outcome, success signal, acceptance, checks,
118
+ discovery, or base branch requires the ordinary human scope-change gate. Never self-renew or
119
+ replace the contract.
120
+
121
+ After two failed Task reviews, follow `next.correctivePlanGate`: obtain a distinct read-only
122
+ corrective Auditor result and pass it through `--corrective-audit-file`. Do not continue for
123
+ replan, split, or stop decisions.
124
+
125
+ When `next` returns a derived C1 Worker or corrective Auditor actor, use that exact actor without
126
+ asking the user to name one. Derivation removes a routing pause; handoff claim, writer lease,
127
+ strict review, and auditor-independence checks remain mandatory.
128
+
129
+ Before an npm package update, run the project-local `update preflight` and stop unless it
130
+ returns `safe=true` with a clean checkout, no running Step, and no active writer lease.
131
+
98
132
  ## Stop Conditions
99
133
 
100
134
  - Dependency version is missing, ranged, or differs from the installed package.
@@ -3,5 +3,8 @@
3
3
  The default mode uses a dedicated task branch in the current clean checkout. The core
4
4
  does not create or remove worktrees. An externally supplied worktree or clone must already
5
5
  be on a dedicated non-base branch; its provider owns merge and cleanup. Every completed
6
- Step becomes one commit with Task and Step trailers. Unexpected changed paths block the
7
- commit. Base advancement invalidates validation and final acceptance before merge.
6
+ Step becomes one commit with Task and Step trailers. The Worker leaves its changes
7
+ uncommitted; `task step-complete` owns configured checks, staging, commit creation, and Step
8
+ evidence. A Worker must not run `git add`, `git commit`, amend, reset, rebase, or otherwise
9
+ change Git history. Unexpected changed paths or unrecorded commits block Step completion.
10
+ Base advancement invalidates validation and final acceptance before merge.
@@ -6,6 +6,22 @@ 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.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
+ surface is additive and capability-advertised.
12
+
13
+ Before execution authorization, every alpha.7 Task must have a current Plan Risk Audit bound
14
+ to the current Brief, Plan, Knowledge Map, and exact Step set. The audit is required even when
15
+ all Steps are unguarded, must name distinct planner/auditor actors, and must bind guarded
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
18
+ `stop-escalate` evidence blocks authorization.
19
+
20
+ If the current Plan Risk Audit marks a Step for strict review, `task step-complete` still
21
+ creates the workflow-owned commit but keeps the Step non-terminal. Repository `next` routes to
22
+ `task step-review` until a valid strict review and reviewer attestation bind to that exact
23
+ commit.
24
+
9
25
  Human approval remains the default. A user may instead issue a time-bound delegation grant
10
26
  after confirming a deterministic `DGA-*` code bound to the project and exact policy hash.
11
27
  The policy names a distinct principal and delegate, a project/Milestone/Task scope, and an
@@ -21,6 +37,12 @@ bindings, supersedes execution authorization, and returns the Task to
21
37
  `awaiting_execution_authorization`. It cannot run while a Step is `in_progress` or while the
22
38
  Task is `blocked`; unrelated blocks must be resolved through their owning transition.
23
39
 
40
+ For guarded remediation, two ordinary remediation attempts are allowed. A third
41
+ ordinary retry is blocked until a current corrective decision exists for the same Step and
42
+ Plan binding. `continue-fix` allows bounded continuation; `replan-required`,
43
+ `split-required`, and `stop-escalate` stop ordinary execution. A failed third corrective
44
+ attempt is a hard stop: no fourth run or new continue/replan decision is accepted.
45
+
24
46
  Milestone authorization is bound to its Plan and membership revision. Plan amendments
25
47
  supersede authorization. Milestone validation and acceptance are bound to the current base
26
48
  HEAD. In `awaiting_final_acceptance`, `next` returns a state-bound human gate. The agent must
@@ -34,6 +56,27 @@ but the acceptance command still requires the current `MSA-*` code so the use re
34
56
  to the validated revision, hashes, and HEAD. Grant issuance itself always remains a prior
35
57
  human turn boundary.
36
58
 
59
+ During initial planning, all linked Tasks may be materialized before one complete
60
+ `milestone plan-set`; execution remains blocked until every reverse membership is classified.
61
+ After that boundary, semantic updates use human-only `milestone scope-change-prepare` and
62
+ `milestone scope-change-apply`. A human-confirmed, expiring Milestone Autonomy Contract may
63
+ use `milestone autonomy-evolve` only for membership changes while outcome, success signal,
64
+ acceptance, checks, discovery, and base branch remain fixed. It may also approve Project Memory
65
+ only within an atomic content-only context refresh for a Task in that Milestone; standalone map
66
+ approval remains forbidden. Both update paths journal
67
+ `state.json`, `plan.json`, and `scope-change-events.jsonl` together. Membership integrity is validated
68
+ before scheduling, Task start, Milestone validation, scope change, and repository `next`.
69
+ The same guard scans in reverse and blocks every live Task whose `milestoneId` is absent from
70
+ the Milestone's required/waived/cancelled classification.
71
+
72
+ `C1` coordination is machine-bound but local: `task handoff-prepare` returns a one-time claim
73
+ token and prompt bound to a stable handoff ID, revision, context hashes, Milestone positions,
74
+ delegate/grant, expected next action, and expiry. `task claim` validates those bindings and
75
+ activates claimant-only mutation; terminal `task handback-create` returns result, evidence,
76
+ review, knowledge, limitation, and recommended-next bindings. Milestone Tasks must be claimed
77
+ before start. If no target is supplied, Core derives `agent:worker:<task-id>`. No part of this
78
+ contract requires or proves a physically separate Codex thread.
79
+
37
80
  Repository-level scheduling respects current Milestone membership. An unstarted linked Task
38
81
  is eligible only for an `active` Milestone with `required` disposition. Historical unstarted
39
82
  Tasks from `waived`, `cancelled`, accepted, or cancelled Milestone paths cannot shadow the
@@ -1,18 +1,45 @@
1
1
  # Validation and Review
2
2
 
3
- Configured Step checks must pass before the Step commit is recorded. Submission produces
3
+ The Worker leaves Step changes uncommitted. `task step-complete` runs the configured checks,
4
+ creates the atomic Step commit, and records its evidence. Manual Worker commits are rejected
5
+ as unrecorded history. Submission produces
4
6
  evidence for the exact task-branch head. Independent review is read-only and produces a
5
7
  version-bound result. Any later commit or change to Brief, Plan, or evidence makes that
6
8
  review stale. The user grants final acceptance only after a passing fresh review and a
7
9
  human-readable Result.
8
10
 
11
+ High-risk evidence is failure-oriented. Migration acceptance includes a populated forward
12
+ upgrade, concurrent state includes deterministic races, restart/replay claims include crash
13
+ windows, and provider integrations include failure injection plus hidden-default checks.
14
+ Happy-path green tests do not replace this evidence.
15
+
16
+ After two failed independent reviews, another corrective Plan requires a distinct Auditor.
17
+ The Auditor covers every latest finding and records `continue-fix`, `replan-required`,
18
+ `split-required`, or `stop-escalate`. Only `continue-fix` may be passed to `task plan-set`
19
+ through `--corrective-audit-file`; the other decisions stop implementation.
20
+
9
21
  The strict path is `task review-launch`. It starts an ephemeral Codex process with user
10
22
  configuration and rules ignored, a read-only sandbox, structured output, and an attempted
11
23
  write probe. The core seals repository HEAD, status, and content before/after the process.
12
24
  Any process error, malformed output, successful write, or changed seal records an
13
25
  `unverified` review and blocks Result creation and final acceptance.
14
26
 
27
+ Alpha.6 adds a Step-level strict path for high-risk work. If the current Plan Risk Audit marks
28
+ the completed Step for strict review, `next` routes to `task step-review` instead of
29
+ advancing ordinary execution. The workflow validates:
30
+
31
+ - the exact completion commit
32
+ - the current Plan hash
33
+ - the Step definition hash
34
+ - the review sidecar chain in `step-review-events.jsonl`
35
+ - the reviewer attestation chain in `reviewer-attestations.jsonl`
36
+
37
+ Any stale, malformed, unverified, or wrong-commit evidence fails closed and keeps the Step out
38
+ of canonical `completed` status.
39
+
15
40
  Milestone validation similarly binds Result and evidence to the clean base HEAD. Its final
16
41
  acceptance is a separate turn: `next` emits a confirmation code bound to the current
17
42
  revision, Plan, Result, evidence, and HEAD; the coordinator shows it and stops. A later user
18
43
  response must explicitly approve that exact code before the CLI transition is invoked.
44
+ With a matching delegated option, the exact delegate may use the current code in the same
45
+ turn, but the authorization event must keep the delegate actor and principal/grant evidence.