codex-workflow-v2 2.0.0-beta.13.8 → 2.0.0-beta.14

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 (281) hide show
  1. package/README.md +27 -388
  2. package/dist/reviewer-runtime-build.json +96 -32
  3. package/dist/src/alpha6/adoption.d.ts +2 -0
  4. package/dist/src/alpha6/adoption.js +22 -0
  5. package/dist/src/alpha6/adoption.js.map +1 -1
  6. package/dist/src/alpha6/captured-check-evidence.d.ts +51 -0
  7. package/dist/src/alpha6/captured-check-evidence.js +152 -0
  8. package/dist/src/alpha6/captured-check-evidence.js.map +1 -0
  9. package/dist/src/alpha6/component-owner.d.ts +15 -1
  10. package/dist/src/alpha6/component-owner.js +44 -2
  11. package/dist/src/alpha6/component-owner.js.map +1 -1
  12. package/dist/src/alpha6/corrective-decision-boundary.d.ts +4 -0
  13. package/dist/src/alpha6/corrective-decision-boundary.js +47 -0
  14. package/dist/src/alpha6/corrective-decision-boundary.js.map +1 -0
  15. package/dist/src/alpha6/downstream-proof.d.ts +1 -25
  16. package/dist/src/alpha6/downstream-proof.js +0 -171
  17. package/dist/src/alpha6/downstream-proof.js.map +1 -1
  18. package/dist/src/alpha6/failed-step-planning-recovery.d.ts +10 -0
  19. package/dist/src/alpha6/failed-step-planning-recovery.js +93 -0
  20. package/dist/src/alpha6/failed-step-planning-recovery.js.map +1 -0
  21. package/dist/src/alpha6/literal-test-invocation.d.ts +2 -0
  22. package/dist/src/alpha6/literal-test-invocation.js +106 -0
  23. package/dist/src/alpha6/literal-test-invocation.js.map +1 -0
  24. package/dist/src/alpha6/milestone.d.ts +2 -0
  25. package/dist/src/alpha6/milestone.js +10 -1
  26. package/dist/src/alpha6/milestone.js.map +1 -1
  27. package/dist/src/alpha6/navigation-dirty-carryover.d.ts +11 -0
  28. package/dist/src/alpha6/navigation-dirty-carryover.js +130 -0
  29. package/dist/src/alpha6/navigation-dirty-carryover.js.map +1 -0
  30. package/dist/src/alpha6/plan-integrity.js +7 -5
  31. package/dist/src/alpha6/plan-integrity.js.map +1 -1
  32. package/dist/src/alpha6/plan-risk.d.ts +2 -0
  33. package/dist/src/alpha6/plan-risk.js +10 -3
  34. package/dist/src/alpha6/plan-risk.js.map +1 -1
  35. package/dist/src/alpha6/remediation.d.ts +6 -21
  36. package/dist/src/alpha6/remediation.js +161 -476
  37. package/dist/src/alpha6/remediation.js.map +1 -1
  38. package/dist/src/alpha6/root-cause-replan-carryover.d.ts +4 -1
  39. package/dist/src/alpha6/root-cause-replan-carryover.js +29 -5
  40. package/dist/src/alpha6/root-cause-replan-carryover.js.map +1 -1
  41. package/dist/src/beta1/project-transaction.d.ts +3 -1
  42. package/dist/src/beta1/project-transaction.js +6 -2
  43. package/dist/src/beta1/project-transaction.js.map +1 -1
  44. package/dist/src/checks/runner.d.ts +26 -0
  45. package/dist/src/checks/runner.js +223 -0
  46. package/dist/src/checks/runner.js.map +1 -0
  47. package/dist/src/checks/task-sync.d.ts +10 -0
  48. package/dist/src/checks/task-sync.js +41 -0
  49. package/dist/src/checks/task-sync.js.map +1 -0
  50. package/dist/src/checks/worker.d.ts +1 -0
  51. package/dist/src/checks/worker.js +154 -0
  52. package/dist/src/checks/worker.js.map +1 -0
  53. package/dist/src/cli-actions.d.ts +2 -2
  54. package/dist/src/cli-actions.js +3 -15
  55. package/dist/src/cli-actions.js.map +1 -1
  56. package/dist/src/cli.js +14 -98
  57. package/dist/src/cli.js.map +1 -1
  58. package/dist/src/contracts.d.ts +35 -32
  59. package/dist/src/dependency-provenance.d.ts +2 -2
  60. package/dist/src/dependency-provenance.js +12 -69
  61. package/dist/src/dependency-provenance.js.map +1 -1
  62. package/dist/src/domain/base-sync-conflict.d.ts +13 -0
  63. package/dist/src/domain/base-sync-conflict.js +32 -0
  64. package/dist/src/domain/base-sync-conflict.js.map +1 -0
  65. package/dist/src/domain/step-start-admission.d.ts +4 -0
  66. package/dist/src/domain/step-start-admission.js +9 -0
  67. package/dist/src/domain/step-start-admission.js.map +1 -0
  68. package/dist/src/domain/virgin-registration.d.ts +3 -0
  69. package/dist/src/domain/virgin-registration.js +65 -0
  70. package/dist/src/domain/virgin-registration.js.map +1 -0
  71. package/dist/src/errors.d.ts +1 -1
  72. package/dist/src/errors.js.map +1 -1
  73. package/dist/src/gateway-handshake.js +0 -8
  74. package/dist/src/gateway-handshake.js.map +1 -1
  75. package/dist/src/git.d.ts +3 -1
  76. package/dist/src/git.js +41 -14
  77. package/dist/src/git.js.map +1 -1
  78. package/dist/src/graph.js +25 -3
  79. package/dist/src/graph.js.map +1 -1
  80. package/dist/src/index.d.ts +1 -0
  81. package/dist/src/lifecycle/corrective-replan.js +3 -3
  82. package/dist/src/lifecycle/corrective-replan.js.map +1 -1
  83. package/dist/src/navigation-actions.d.ts +9 -0
  84. package/dist/src/navigation-actions.js +72 -0
  85. package/dist/src/navigation-actions.js.map +1 -0
  86. package/dist/src/navigation-update-artifact.d.ts +5 -0
  87. package/dist/src/navigation-update-artifact.js +227 -0
  88. package/dist/src/navigation-update-artifact.js.map +1 -0
  89. package/dist/src/navigation-update.d.ts +39 -0
  90. package/dist/src/navigation-update.js +82 -0
  91. package/dist/src/navigation-update.js.map +1 -0
  92. package/dist/src/observation.js +52 -29
  93. package/dist/src/observation.js.map +1 -1
  94. package/dist/src/observed-routes.js +5 -6
  95. package/dist/src/observed-routes.js.map +1 -1
  96. package/dist/src/pending-review-update.d.ts +0 -13
  97. package/dist/src/pending-review-update.js +1 -6
  98. package/dist/src/pending-review-update.js.map +1 -1
  99. package/dist/src/reviewer.d.ts +1 -1
  100. package/dist/src/reviewer.js +20 -17
  101. package/dist/src/reviewer.js.map +1 -1
  102. package/dist/src/runtime.d.ts +3 -0
  103. package/dist/src/runtime.js +6 -0
  104. package/dist/src/runtime.js.map +1 -0
  105. package/dist/src/state/corrective-replan-executor.d.ts +10 -0
  106. package/dist/src/state/corrective-replan-executor.js +37 -1
  107. package/dist/src/state/corrective-replan-executor.js.map +1 -1
  108. package/dist/src/state/corrective-replan-public-schema.js +15 -2
  109. package/dist/src/state/corrective-replan-public-schema.js.map +1 -1
  110. package/dist/src/state/corrective-replan-public.js +6 -5
  111. package/dist/src/state/corrective-replan-public.js.map +1 -1
  112. package/dist/src/state/corrective-replan-transaction.d.ts +1 -0
  113. package/dist/src/state/corrective-replan-transaction.js +12 -11
  114. package/dist/src/state/corrective-replan-transaction.js.map +1 -1
  115. package/dist/src/state/corrective-yield-executor.js +2 -2
  116. package/dist/src/state/corrective-yield-executor.js.map +1 -1
  117. package/dist/src/state/corrective-yield-transaction.d.ts +1 -0
  118. package/dist/src/state/corrective-yield-transaction.js +11 -10
  119. package/dist/src/state/corrective-yield-transaction.js.map +1 -1
  120. package/dist/src/state/lock.d.ts +4 -0
  121. package/dist/src/state/lock.js +21 -0
  122. package/dist/src/state/lock.js.map +1 -1
  123. package/dist/src/version.d.ts +1 -1
  124. package/dist/src/version.js +1 -1
  125. package/dist/src/version.js.map +1 -1
  126. package/dist/src/workflow-blocker-route.d.ts +8 -0
  127. package/dist/src/workflow-blocker-route.js +106 -0
  128. package/dist/src/workflow-blocker-route.js.map +1 -0
  129. package/dist/src/workflow.d.ts +48 -63
  130. package/dist/src/workflow.js +698 -1470
  131. package/dist/src/workflow.js.map +1 -1
  132. package/docs/autonomy-guardrails.md +26 -304
  133. package/docs/decisions.md +14 -112
  134. package/docs/development-flow.md +35 -238
  135. package/docs/project-memory.md +31 -50
  136. package/docs/release-app-evidence.md +190 -0
  137. package/docs/release.md +95 -363
  138. package/docs/updating-existing-project.md +19 -717
  139. package/package.json +11 -13
  140. package/plugins/codex-workflow-gateway/.codex-plugin/plugin.json +2 -2
  141. package/plugins/codex-workflow-gateway/references/chat-dispatch.md +73 -197
  142. package/plugins/codex-workflow-gateway/references/codebase-memory-routing.md +57 -0
  143. package/plugins/codex-workflow-gateway/references/protocol.md +42 -445
  144. package/plugins/codex-workflow-gateway/scripts/chat-dispatch.mjs +7 -1
  145. package/plugins/codex-workflow-gateway/scripts/chat-model-policy.mjs +10 -8
  146. package/plugins/codex-workflow-gateway/scripts/chat-registry.mjs +23 -5
  147. package/plugins/codex-workflow-gateway/skills/codex-workflow-gateway/SKILL.md +66 -740
  148. package/references/state-machine.md +4 -4
  149. package/roles/technical-planner.md +1 -1
  150. package/schemas/corrective-decision-event.schema.json +3 -1
  151. package/schemas/project-knowledge-map.schema.json +3 -1
  152. package/schemas/remediation-event.schema.json +10 -1
  153. package/schemas/task.schema.json +46 -2
  154. package/schemas/transition-payloads.schema.json +16 -1
  155. package/src/alpha6/adoption.ts +1123 -0
  156. package/src/alpha6/captured-check-evidence.ts +132 -0
  157. package/src/alpha6/check-support-anchor.ts +128 -0
  158. package/src/alpha6/component-owner.ts +168 -0
  159. package/src/alpha6/corrective-decision-boundary.ts +39 -0
  160. package/src/alpha6/downstream-proof.ts +520 -0
  161. package/src/alpha6/failed-step-planning-recovery.ts +88 -0
  162. package/src/alpha6/handoff.ts +1443 -0
  163. package/src/alpha6/journal.ts +473 -0
  164. package/src/alpha6/literal-test-invocation.ts +84 -0
  165. package/src/alpha6/mechanical-feasibility.ts +488 -0
  166. package/src/alpha6/milestone.ts +2192 -0
  167. package/src/alpha6/navigation-dirty-carryover.ts +154 -0
  168. package/src/alpha6/npm-check-contract.ts +47 -0
  169. package/src/alpha6/plan-integrity.ts +298 -0
  170. package/src/alpha6/plan-risk.ts +1480 -0
  171. package/src/alpha6/preexecution-replan.ts +187 -0
  172. package/src/alpha6/remediation-cause.ts +98 -0
  173. package/src/alpha6/remediation.ts +2438 -0
  174. package/src/alpha6/review.ts +1198 -0
  175. package/src/alpha6/root-cause-replan-carryover.ts +491 -0
  176. package/src/alpha6/store-sidecars.ts +335 -0
  177. package/src/alpha7/autonomy.ts +411 -0
  178. package/src/alpha7/corrective-recovery.ts +1332 -0
  179. package/src/artifacts.ts +130 -0
  180. package/src/beta1/project-transaction.ts +355 -0
  181. package/src/change-explanation.ts +153 -0
  182. package/src/checks/runner.ts +245 -0
  183. package/src/checks/task-sync.ts +41 -0
  184. package/src/checks/worker.ts +149 -0
  185. package/src/cli-actions.ts +107 -0
  186. package/src/cli.ts +1457 -0
  187. package/src/contracts.ts +1494 -0
  188. package/src/credential-output.ts +89 -0
  189. package/src/credential-transport.ts +215 -0
  190. package/src/delegation.ts +190 -0
  191. package/src/dependency-provenance.ts +472 -0
  192. package/src/diagnostics.ts +93 -0
  193. package/src/domain/base-sync-conflict.ts +35 -0
  194. package/src/domain/completed-step-carryover.ts +76 -0
  195. package/src/domain/discovery.ts +27 -0
  196. package/src/domain/plan-semantics.ts +58 -0
  197. package/src/domain/step-start-admission.ts +10 -0
  198. package/src/domain/validation.ts +177 -0
  199. package/src/domain/virgin-registration.ts +46 -0
  200. package/src/errors.ts +24 -0
  201. package/src/fs-utils.ts +61 -0
  202. package/src/gateway-handshake.ts +95 -0
  203. package/src/git.ts +183 -0
  204. package/src/graph.ts +342 -0
  205. package/src/historical-step-provenance.ts +136 -0
  206. package/src/index.ts +23 -0
  207. package/src/lifecycle/canonical-hash.ts +28 -0
  208. package/src/lifecycle/catalog.ts +202 -0
  209. package/src/lifecycle/compiler-inspection.ts +29 -0
  210. package/src/lifecycle/core-static-readiness.ts +132 -0
  211. package/src/lifecycle/corrective-replan-authority.ts +136 -0
  212. package/src/lifecycle/corrective-replan-binding-manifest.ts +51 -0
  213. package/src/lifecycle/corrective-replan-credential-core.ts +408 -0
  214. package/src/lifecycle/corrective-replan-credential-schema.ts +54 -0
  215. package/src/lifecycle/corrective-replan-credentials.ts +48 -0
  216. package/src/lifecycle/corrective-replan.ts +843 -0
  217. package/src/lifecycle/evaluator.ts +48 -0
  218. package/src/lifecycle/fingerprint.ts +488 -0
  219. package/src/lifecycle/immutable.ts +8 -0
  220. package/src/lifecycle/implementation-table.ts +118 -0
  221. package/src/lifecycle/index.ts +8 -0
  222. package/src/lifecycle/schema-artifact.ts +263 -0
  223. package/src/lifecycle/semantic-registry.ts +572 -0
  224. package/src/lifecycle/types.ts +838 -0
  225. package/src/memory.ts +273 -0
  226. package/src/migration.ts +161 -0
  227. package/src/navigation-actions.ts +70 -0
  228. package/src/navigation-update-artifact.ts +198 -0
  229. package/src/navigation-update.ts +121 -0
  230. package/src/observation.ts +225 -0
  231. package/src/observed-routes.ts +660 -0
  232. package/src/operational-contract.ts +125 -0
  233. package/src/pending-review-update.ts +175 -0
  234. package/src/repository.ts +99 -0
  235. package/src/reviewer.ts +1879 -0
  236. package/src/runtime.ts +6 -0
  237. package/src/state/corrective-replan-executor.ts +818 -0
  238. package/src/state/corrective-replan-public-schema.ts +83 -0
  239. package/src/state/corrective-replan-public.ts +908 -0
  240. package/src/state/corrective-replan-transaction.ts +949 -0
  241. package/src/state/corrective-yield-executor.ts +327 -0
  242. package/src/state/corrective-yield-transaction.ts +730 -0
  243. package/src/state/lock.ts +902 -0
  244. package/src/state/store.ts +567 -0
  245. package/src/transition-core.ts +330 -0
  246. package/src/ulid.ts +24 -0
  247. package/src/version.ts +2 -0
  248. package/src/workflow-blocker-route.ts +109 -0
  249. package/src/workflow.ts +10172 -0
  250. package/docs/alpha7.1-implementation-brief.md +0 -268
  251. package/docs/alpha7.2-corrective-context-refresh-brief.md +0 -484
  252. package/docs/alpha7.2.1-remediation-recovery-brief.md +0 -86
  253. package/docs/beta1-stabilization-brief.md +0 -165
  254. package/docs/beta11-plan-integrity-recovery-brief.md +0 -38
  255. package/docs/beta13.2-signal-review-recovery.md +0 -38
  256. package/docs/beta2-initial-assembly-navigation-brief.md +0 -616
  257. package/docs/change-model.md +0 -118
  258. package/docs/delegated-approval.md +0 -254
  259. package/docs/lifecycle/state-machine-stabilization.md +0 -641
  260. package/docs/pdf/README.md +0 -24
  261. package/docs/pdf/codex-workflow-v2-architecture-ru.pdf +0 -0
  262. package/docs/pdf/codex-workflow-v2-chat-only-guide-ru.pdf +0 -0
  263. package/docs/pdf/codex-workflow-v2-technical-reference-ru.pdf +0 -0
  264. package/docs/pdf/requirements.txt +0 -1
  265. package/docs/pdf/sources/codex-workflow-v2-architecture-ru.md +0 -478
  266. package/docs/pdf/sources/codex-workflow-v2-chat-only-guide-ru.md +0 -508
  267. package/docs/pdf/sources/codex-workflow-v2-technical-reference-ru.md +0 -778
  268. package/docs/pending-review-update.md +0 -15
  269. package/docs/problem-briefs/01-pre-implementation-integrity.md +0 -482
  270. package/docs/problem-briefs/02-minimal-step-integrity.md +0 -411
  271. package/docs/problem-briefs/03-minimal-agent-context-integrity.md +0 -358
  272. package/docs/problem-briefs/04-task-dependency-and-structural-replacement-integrity.md +0 -573
  273. package/docs/problem-briefs/BRIEF-TEMPLATE.md +0 -56
  274. package/docs/problem-briefs/README.md +0 -120
  275. package/docs/problem-briefs/evidence/p01-mechanical-feasibility-corpus.md +0 -90
  276. package/docs/problem-briefs/evidence/signal-v4-pre-m3-replay.md +0 -246
  277. package/docs/split-required-recovery.md +0 -47
  278. package/docs/stable-release-defect-register.md +0 -730
  279. package/docs/validation-report.md +0 -182
  280. package/scripts/generate-pdf-docs.py +0 -524
  281. package/scripts/run-pdf-docs.mjs +0 -62
@@ -1,118 +0,0 @@
1
- # Execution context and change explanation
2
-
3
- A change is explained before it is attempted. The explanation is not an approval, a new grant,
4
- or a replacement lifecycle. Existing Core `next` remains authoritative.
5
-
6
- ## One execution context
7
-
8
- App dispatch defaults to a worktree. An explicitly requested `executionMode: "local"` creates
9
- in the saved project instead. Use local only when the user requested that execution environment.
10
- The dispatch prompt separates repository identity from the child's actual write destination.
11
- Correlated App readback records the real checkout root. A second readback cannot silently move
12
- that bound Worker into another checkout, even when both share a Git common directory.
13
-
14
- Before the first write and after a branch/cwd change, call the packaged registry action
15
- `dispatch-context-check --reservation-id ... --file ... --project-id ...` with:
16
-
17
- ```json
18
- {
19
- "observation": { "thread": {
20
- "id": "actual-bound-thread-uuid", "kind": "codex", "hostId": "local",
21
- "cwd": "/absolute/actual/worker/checkout"
22
- } },
23
- "writeRoot": "/absolute/actual/worker/checkout",
24
- "expectedBranch": "exact-branch-from-fresh-Task"
25
- }
26
- ```
27
-
28
- Use a fresh App `read_thread` observation, never a fabricated cwd. This read-only check detects
29
- repository, checkout, write-root and branch mismatch. It does not replace Task revision, actor,
30
- lease/credential or external permission checks. Do not send another create request, change the
31
- target directory, or hand off an active writer merely to clear a mismatch. Reconcile the existing
32
- Worker and Workflow context. Tracked dispatch without recorded executionContext needs a correlated `dispatch-observe` before
33
- this check can match; it does not invent an existing checkout binding.
34
-
35
- ## One change card
36
-
37
- `change explain --task TASK-ID --file proposal.json --repo /actual/checkout --json` reads the
38
- current Task and `next` from one observation. It changes no workflow state or product file.
39
-
40
- ```json
41
- {
42
- "reason": "The current check requires one additional support file.",
43
- "paths": ["tools/check-support.ts"],
44
- "intent": "implementation",
45
- "expectedRevision": 12,
46
- "executionContext": {
47
- "cwd": "/absolute/actual/worker/checkout",
48
- "writeRoot": "/absolute/actual/worker/checkout",
49
- "expectedBranch": "exact-task-branch"
50
- },
51
- "externalDecision": "unknown"
52
- }
53
- ```
54
-
55
- `paths` are exact normalized relative file paths, not globs. `expectedPlanHash` is also accepted.
56
- Inputs are closed; an agent cannot add a `supportProven` or `approved` flag. `externalDecision:
57
- "denied"` preserves an external denial as a separate blocker. It does not call or emulate the
58
- external permission service. `intent` may instead be `membership` or `semantic-scope`; declaring
59
- intent never proves semantic safety. Omitted context is reported as not supplied, not verified.
60
-
61
- The card binds Task revision/Plan, HEAD, request and bytes of proposed plus observed dirty paths.
62
- Undeclared dirty files are included; escaping symlinks block byte inspection. The output contains
63
- no confirmation/claim/writer values and no proposed file contents. A proposal hash is a diagnostic
64
- binding, not an apply token; always refresh `next` and ordinary mutation preconditions.
65
-
66
- ## Adaptation routes
67
-
68
- - Implementation fixes continue within the same Task when the current Core route permits it.
69
- Review count alone does not select corrective planning.
70
- - `bounded-plan-amendment` appears only when Core advertises the exact eligible check-support
71
- scope extension and every out-of-Step file is covered by that evidence. Execute the existing
72
- `task plan-integrity-recover` route and fresh `next`; its existing atomic evidence and authority
73
- rules apply. The card never edits `allowedWrites`, enlarges a grant, or supplies an arbitrary
74
- new Plan. This release reuses the proven bounded amendment mechanism rather than adding a
75
- competing mutation protocol.
76
- - An unproved additional file requires Plan review. No broad glob or diff-size rule grants
77
- automatic extension. Runtime changes and component-owner recovery retain their current audits.
78
- - Corrective planning and downstream recovery retain existing Task/Worker identity and historical
79
- evidence. A Knowledge context refresh does not resolve a Plan conflict.
80
- - Membership is distinct from implementation. Existing audited remediation and full-contract
81
- membership evolution remain the only corresponding machine routes. A reported membership
82
- intent does not authorize deletion of a required Task or weakened acceptance.
83
- - Semantic scope requires an explicit user decision. External denial remains independent of
84
- Workflow grants and file scope.
85
-
86
- `requiresUser: null` means the card has not established a specific human gate, not that all
87
- checks passed. The card is advisory and cannot intercept arbitrary editor/tool writes. Gateway
88
- agents must invoke the context check and fresh Core route before writing. No claim is made that
89
- an external approval system will accept the resulting operation.
90
-
91
- For a legacy Worker already bound before dispatch markers existed, the read-only context check
92
- uses its existing thread/host plus a freshly supplied Task repository root. It explicitly reports
93
- that historical checkout provenance is unavailable, preserves the legacy registry bytes and
94
- never creates or adopts another Worker. A tracked Worker whose checkout changes still reports a
95
- mismatch; no automatic App handoff or silent registry migration is performed.
96
-
97
- ## Later independent corrective evidence after a fix review
98
-
99
- A failed guarded Step can reveal a Plan obstruction after its immutable strict review recorded
100
- `fix` without a Plan conflict. On a clean current Task checkout, after at least two real remediation
101
- failures and with no decision already bound to the current ordinal, `next` can expose the optional
102
- `correctiveDecisionOption`. The ordinary fix action remains the default. No failure, repeated run,
103
- review rewrite or arbitrary scope extension is required to obtain an independent corrective audit.
104
- The option is absent while a Step runs, a pending handoff exists, or an earlier navigation gate
105
- blocks ordinary continuation. Existing writer/C1 actor and token requirements still apply; a
106
- legitimate claimed Worker credential does not disable this independent audit route.
107
-
108
- Only a genuine independent audit justifies using the existing `task corrective-decision` command.
109
- Its resulting append-only decision preserves the original review and completed Steps. A decision
110
- requiring replan leads to the existing corrective yield/prepare/confirmation route, including its
111
- separate Human gate; the option supplies no replacement authority, grant or permission to write
112
- additional files. A conflicting existing decision cannot be overwritten.
113
-
114
- The option's revision, Brief/Plan/HEAD and remediation event hashes describe the observation used
115
- for the audit. They are not a new apply token or additional executor-enforced hash contract: the
116
- existing executor checks its revision, current decision ordinal, audit independence and actor/token
117
- preconditions. Refresh `next` and audit evidence before recording, including after a HEAD change
118
- that does not change the Task revision. Never treat stale option output as authorization.
@@ -1,254 +0,0 @@
1
- # Delegated Approval
2
-
3
- Delegated approval is an optional local authority grant. It lets a named agent actor cross
4
- selected Project Knowledge Map, Task, and Milestone approval transitions without pretending
5
- to be the user. Human approval remains the default.
6
-
7
- ## Policy and issuance
8
-
9
- A policy contains:
10
-
11
- - `principal`: the user audit identity;
12
- - `delegate`: a distinct agent audit identity;
13
- - `scope`: the current project, one Milestone, or one Task;
14
- - `transitions`: an allow-list of Knowledge Map, Task, and Milestone approvals;
15
- - `expiresAt`: a required future UTC timestamp.
16
-
17
- `delegation prepare` normalizes the policy, hashes it with the local project ID, and returns
18
- a deterministic `DGA-*` confirmation code. The gateway displays the complete binding and
19
- ends the turn. `delegation grant` is permitted only after a later user message confirms the
20
- same code. Duplicate issuance of the same exact policy is rejected.
21
-
22
- ## Storage and compatibility
23
-
24
- Each grant is an independently revisioned schema 2 entity at:
25
-
26
- ```text
27
- $CODEX_HOME/workflow-state/v2/projects/<project-id>/delegations/<DGR-ID>/state.json
28
- ```
29
-
30
- Existing schema 2 project, Task, Milestone, Knowledge Map, graph, and authorization records
31
- are not rewritten. The new directory and authorization metadata are additive, so an existing
32
- project needs no state migration. After the first delegated transition, downgrading is not
33
- recommended because an older package cannot enforce or fully explain the new audit metadata.
34
-
35
- ## Use and audit
36
-
37
- The core checks current status, expiry, actor equality, allowed transition, and scope before
38
- writing the lifecycle change. A Milestone-scoped grant also covers linked Tasks in that
39
- Milestone. Every delegated authorization event contains:
40
-
41
- ```text
42
- authorizationMode = delegated
43
- actor = <delegate>
44
- delegation.grantId
45
- delegation.policyHash
46
- delegation.principal
47
- delegation.delegate
48
- delegation.transition
49
- ```
50
-
51
- `next` exposes active matching grants as `delegatedApprovalOptions`. Milestone final
52
- acceptance still requires the current `MSA-*` code, preserving the revision/hash/HEAD binding;
53
- the pre-issued grant replaces only the later human-message requirement.
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
-
69
- ## Full contract during an active Milestone
70
-
71
- The human may request `milestone autonomy-prepare` / `milestone autonomy-grant` while a
72
- Milestone is `active`, as well as before its initial execution. This supports first full
73
- issuance or replacement after expiry/revocation without resetting the Milestone, altering
74
- its Plan or completed Task evidence, or recreating its Worker. Planning, blocked, validating,
75
- final-acceptance and terminal Milestones are not eligible for this route.
76
-
77
- Preparation is read-only. It requires a coherent registered repository, a complete current
78
- Plan and active Knowledge Map. Its MAC binds the status, revision, Plan, semantic scope,
79
- principal, delegate, exact expiry (at most 72 hours), policy and previous authority state.
80
- Show this complete contract and obtain a separate exact human confirmation. Never renew a
81
- contract automatically or treat general delegated execution as permission to issue authority.
82
-
83
- A still-valid full contract cannot be replaced. An explicitly revoked or expired contract
84
- may be replaced using a freshly prepared MAC. The previous confirmed code cannot undo a
85
- revocation. Exact retries retain the same contract/grant; an interrupted event-first write
86
- can be completed only with its original matching confirmation. Issuance and milestone grant
87
- revocation share a Milestone lock. History remains append-only.
88
-
89
- `next` exposes optional `activeMilestoneAutonomyOptions` even when a linked Task is selected;
90
- this does not change the immediate Task action or waive its credential/review/recovery gates.
91
- A coexisting generic grant remains unchanged and does not gain membership evolution or atomic
92
- context-refresh authority. The new full contract carries those existing bounded capabilities;
93
- it never grants standalone Project Knowledge approval or a semantic scope change.
94
-
95
- ## Starting a delegate chat
96
-
97
- A grant does not start an agent and is not attached to a Codex chat automatically. Open a new
98
- Local chat in the same Codex Project and give it both the exact `delegate` value and `DGR-ID`.
99
- The chat must resolve the project-local package, run handshake/doctor/status/next, and read the
100
- grant before doing work. The earlier `DGA-*` code is not needed again; it authorized issuance,
101
- not use.
102
-
103
- Before the first mutation, the delegate verifies:
104
-
105
- - project identity matches the grant's project;
106
- - `status` is `active` and `expiresAt` is still in the future;
107
- - the exact chat actor equals `delegate`;
108
- - scope covers the requested Milestone or Task;
109
- - the needed transition is present;
110
- - `next.delegatedApprovalOptions` contains this grant at the approval point.
111
-
112
- The delegate must not create, renew, broaden, or replace its own grant. Product ambiguity and
113
- scope changes are not approval transitions: the delegate stops and asks the user. Worker and
114
- Independent Reviewer roles may implement or review work, but the coordinating delegate alone
115
- uses the grant and passes `--delegation-grant` to the Core transition.
116
-
117
- Ordinary semantic Milestone scope changes remain journaled, human-only lifecycle actions. A
118
- contract delegate may evolve only the membership graph inside the cryptographically bound
119
- semantic scope. The separate beta.12.11 `milestone remediation-materialize` route is not delegation
120
- and does not widen this allow-list: Core derives it only from a current blocking Plan Risk Audit and
121
- a previously authorized active Milestone. Its topology effect is fixed to one new required upstream
122
- Task plus one dependency edge, with all Milestone semantics preserved. The resulting
123
- `corrective-derived` Task approvals remain valid only while that exact derived Milestone authority
124
- is current; final Milestone acceptance is unaffected.
125
-
126
- ### Milestone delegate prompt
127
-
128
- Use project scope when the Milestone does not exist yet. An existing Milestone and its linked
129
- Tasks may use Milestone scope.
130
-
131
- ```text
132
- Работай как delegate-координатор Workflow V2 для одного Milestone.
133
- Delegate actor: agent:deputy
134
- Delegation grant: <DGR-ID>
135
- Milestone ID: <AUTO или MS-ID>
136
- Требования пользователя: <вставить требования без пересказа lifecycle>
137
-
138
- Все CLI-, Git-, test-команды и координацию Codex-чатов выполняешь ты.
139
- Начни с AGENTS.md, project-local gateway handshake, doctor, status и next.
140
- Выполни delegation show для указанного DGR-ID и до мутаций проверь:
141
- project, status active, delegate, scope, transitions и expiresAt. Не создавай,
142
- не продлевай и не расширяй grant.
143
-
144
- Для AUTO проведи Discovery и не materialize Milestone при blocking unknowns.
145
- Не принимай новые продуктовые решения и не расширяй scope: при смысловой
146
- неопределённости остановись и спроси меня. Подготовь Milestone и связанные
147
- тонкие Tasks. На approval-переходе используй grant только если текущий next
148
- вернул exact delegatedApprovalOptions для этого DGR-ID и transition; actor
149
- всегда agent:deputy, никогда user.
150
-
151
- Required Tasks выполняй последовательно. Для каждой Task обязательно создай
152
- новую standalone Codex task через create_thread, а не fork/handoff/продолжение этого чата.
153
- Передай только TaskContextPacket из свежего Workflow state: repository, exact Milestone/Task ID,
154
- membership ordinal, Task revision/title, Brief/Plan bindings, requirements/acceptance, Task-local
155
- scope/checks/stop conditions, маршрут status -> next --task <exact Task ID> и тот же actor/DGR-ID
156
- только когда они требуются. Не передавай transcript этого чата, sibling Tasks, recovery narrative,
157
- reasoning, confirmation codes, handoff credentials или writer tokens.
158
- Title обязателен и выделяется проектным registry:
159
- #NNN · M<NN>/T<NN> · Task · <Task title> · <TASK-ID>. До dispatch проверь уникальность
160
- Task-ID-to-thread mapping, выполни exact registry readback и проверь Task-only input. Служебный
161
- codex_delegation envelope с source_thread_id допустим, parent turns/transcript запрещены. Если
162
- title отсутствует или изменён, явно переименуй и перепроверь. Ошибка create_thread не разрешает
163
- fallback на fork_thread.
164
- Если readback изменён, применяй только deterministic fallback registry; полный `#NNN`, ordinal и
165
- entity ID сохраняются. В
166
- TaskContextPacket потребуй закрытый secret-free CoordinatorReport на terminal/attention boundary:
167
- Task ID, observed revision/status, outcome, next action, requiresUser, blocker class,
168
- commits/checks/review evidence; никаких confirmation/handoff/writer bearer values.
169
- После dispatch не завершай coordinator turn. Жди текущий Task-чат через bounded wait_threads,
170
- сохраняй cursor, а при completed/attention прочитай чат и выполни свежий status -> общий next.
171
- Если та же Task остаётся nonterminal и точный next допускает non-human continuation, продолжи тот
172
- же чат через send_message_to_thread. Пользователя привлекай только для mandatory human/semantic
173
- gate, external permission, unrecoverable integrity conflict или исчерпанного infrastructure retry.
174
- Следующий Task-чат создавай только после подтверждённого Core terminal+merged результата текущей
175
- Task. Завершать Milestone-чат при работающей nonterminal Task можно лишь по явной команде
176
- checkpoint либо при таком блокере; обязательно сохрани Task/thread/host/title/cursor mapping и
177
- fresh next для возобновления без duplicate dispatch.
178
- Milestone-чат не реализует Steps и не накапливает fix-loop всех Tasks;
179
- не запускай два writer на одном checkout. Worker и Reviewer не используют
180
- grant: approval-команды выполняет только delegate-координатор после их evidence.
181
-
182
- После merge всех required Tasks выполни Milestone validation. Если next вернул
183
- milestone.final_accept для этого grant, проверь Result/evidence/HEAD и примени
184
- grant с текущим MSA-code в том же turn. Если exact option нет, остановись перед
185
- human gate. В конце покажи Milestone status, authorization event, использованный
186
- grant/transition и результаты проверок.
187
- ```
188
-
189
- ### Task delegate prompt
190
-
191
- Use Task scope for one existing Task. A new standalone Task with `AUTO` requires project
192
- scope; a Milestone-scoped grant covers Tasks linked to that Milestone.
193
-
194
- ```text
195
- Выполни или возобнови одну Task через Workflow V2 как delegate.
196
- Delegate actor: agent:deputy
197
- Delegation grant: <DGR-ID>
198
- Milestone ID: <MS-ID или NONE>
199
- Task ID: <TASK-ID или AUTO>
200
- Цель standalone Task: <только если AUTO>
201
-
202
- Все CLI-, Git- и test-команды выполняешь ты. Начни с AGENTS.md,
203
- project-local gateway handshake, doctor, status и next. Выполни delegation
204
- show для DGR-ID и до мутаций проверь project, active status, delegate,
205
- scope, transitions и expiresAt. Не создавай и не меняй grant.
206
-
207
- Не меняй пользовательские требования и scope. Для AUTO сначала проведи
208
- Discovery; при blocking unknowns остановись. Подготовь проверяемый Plan.
209
- Authorization выполняй только когда текущий next содержит exact
210
- delegatedApprovalOptions для DGR-ID и task.execution_authorize; используй
211
- actor agent:deputy и --delegation-grant, не записывай actor user.
212
-
213
- Далее следуй штатному lifecycle: один Step - один writer lease. Worker меняет
214
- только разрешённые файлы и оставляет их uncommitted; затем координатор вызывает
215
- exact `task step-complete` из `next`, а core выполняет checks, создаёт commit и
216
- записывает evidence. Worker не использует grant. При изменении Knowledge Map
217
- выполни reconcile; approve разрешён только при exact project_memory.approve
218
- option этого project-scoped grant. Затем knowledge-rebind и новая authorization.
219
- Если next возвращает top-level `action: task context-refresh` и exact `contextRefresh` для того же
220
- grant, выполни только `task context-refresh`; не запускай перед ним standalone reconcile. Exact
221
- Plan-declared supporting additions допустимы только когда их признал Core. При любом другом
222
- изменении source set, category/authority, gaps или conflicts используй обычный видимый процесс.
223
-
224
- После submit запусти отдельный Independent Reviewer; Reviewer не использует
225
- grant и не исправляет код. Failed review возвращает ту же Task в remediation: добавь или измени
226
- remediation Step и снова проведи review. Количество failed reviews не требует отдельного
227
- corrective Plan audit. Для каждого finding Reviewer использует `route=fix` по умолчанию;
228
- `route=replan` допустим только с точным Plan clause, доказательством невозможности обычного fix и
229
- минимальным изменением Plan. Objective, requirements и acceptance через remediation не меняются.
230
- Final acceptance делай
231
- только при exact task.final_accept option для DGR-ID, затем штатный merge.
232
- Если option отсутствует, grant истёк, scope не совпал или требуется смысловое
233
- решение пользователя - остановись. В конце покажи Task status, commits, checks,
234
- review и delegated authorization event.
235
- ```
236
-
237
- Milestone coordinator waits for the dedicated Task chat to return its terminal Task status
238
- and merge evidence before starting the next required Task. Internal subagents inside one
239
- oversized Milestone chat are not a substitute for this user-visible Task boundary.
240
-
241
- After autonomous work, inspect the recorded events and revoke a broad grant when it is no
242
- longer needed. Revocation does not erase completed approvals.
243
-
244
- ## Revocation and limits
245
-
246
- `delegation revoke` requires the exact principal actor, current grant revision, and a reason.
247
- It blocks future uses and preserves past events. Expiry is checked at every use and does not
248
- need a state mutation.
249
-
250
- This mechanism is policy evidence, not cryptographic process identity. The local CLI cannot
251
- prove that a particular Codex process owns the delegate label. Keep project-wide grants
252
- short-lived and use narrower scopes once entity IDs exist. External side effects such as
253
- payments, secrets, production deployment, or live trading need their own provider-level
254
- authorization and must not rely on this grant alone.