codex-workflow-v2 2.0.0-beta.10 → 2.0.0-beta.12

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 (78) hide show
  1. package/README.md +47 -13
  2. package/dist/src/alpha6/handoff.d.ts +4 -3
  3. package/dist/src/alpha6/handoff.js +58 -3
  4. package/dist/src/alpha6/handoff.js.map +1 -1
  5. package/dist/src/alpha6/mechanical-feasibility.d.ts +7 -0
  6. package/dist/src/alpha6/mechanical-feasibility.js +303 -0
  7. package/dist/src/alpha6/mechanical-feasibility.js.map +1 -0
  8. package/dist/src/alpha6/milestone.d.ts +25 -2
  9. package/dist/src/alpha6/milestone.js +359 -32
  10. package/dist/src/alpha6/milestone.js.map +1 -1
  11. package/dist/src/alpha6/plan-integrity.d.ts +14 -0
  12. package/dist/src/alpha6/plan-integrity.js +127 -0
  13. package/dist/src/alpha6/plan-integrity.js.map +1 -0
  14. package/dist/src/alpha6/remediation.d.ts +3 -2
  15. package/dist/src/alpha6/remediation.js +168 -55
  16. package/dist/src/alpha6/remediation.js.map +1 -1
  17. package/dist/src/alpha6/review.d.ts +5 -0
  18. package/dist/src/alpha6/review.js +110 -2
  19. package/dist/src/alpha6/review.js.map +1 -1
  20. package/dist/src/cli.js +14 -2
  21. package/dist/src/cli.js.map +1 -1
  22. package/dist/src/contracts.d.ts +82 -1
  23. package/dist/src/git.d.ts +1 -1
  24. package/dist/src/git.js +8 -1
  25. package/dist/src/git.js.map +1 -1
  26. package/dist/src/index.d.ts +1 -0
  27. package/dist/src/index.js +1 -0
  28. package/dist/src/index.js.map +1 -1
  29. package/dist/src/lifecycle/corrective-replan.js +8 -3
  30. package/dist/src/lifecycle/corrective-replan.js.map +1 -1
  31. package/dist/src/reviewer.d.ts +26 -0
  32. package/dist/src/reviewer.js +54 -1
  33. package/dist/src/reviewer.js.map +1 -1
  34. package/dist/src/version.d.ts +1 -1
  35. package/dist/src/version.js +1 -1
  36. package/dist/src/workflow.d.ts +5 -0
  37. package/dist/src/workflow.js +449 -148
  38. package/dist/src/workflow.js.map +1 -1
  39. package/docs/autonomy-guardrails.md +42 -33
  40. package/docs/beta11-plan-integrity-recovery-brief.md +38 -0
  41. package/docs/decisions.md +5 -4
  42. package/docs/delegated-approval.md +5 -4
  43. package/docs/development-flow.md +38 -12
  44. package/docs/lifecycle/state-machine-stabilization.md +2 -2
  45. package/docs/pdf/README.md +24 -0
  46. package/docs/pdf/codex-workflow-v2-architecture-ru.pdf +0 -0
  47. package/docs/pdf/codex-workflow-v2-chat-only-guide-ru.pdf +0 -0
  48. package/docs/pdf/codex-workflow-v2-technical-reference-ru.pdf +0 -0
  49. package/docs/pdf/requirements.txt +1 -0
  50. package/docs/pdf/sources/codex-workflow-v2-architecture-ru.md +235 -0
  51. package/docs/pdf/sources/codex-workflow-v2-chat-only-guide-ru.md +334 -0
  52. package/docs/pdf/sources/codex-workflow-v2-technical-reference-ru.md +414 -0
  53. package/docs/problem-briefs/01-pre-implementation-integrity.md +478 -0
  54. package/docs/problem-briefs/02-minimal-step-integrity.md +411 -0
  55. package/docs/problem-briefs/03-minimal-agent-context-integrity.md +358 -0
  56. package/docs/problem-briefs/04-task-dependency-and-structural-replacement-integrity.md +566 -0
  57. package/docs/problem-briefs/BRIEF-TEMPLATE.md +56 -0
  58. package/docs/problem-briefs/README.md +120 -0
  59. package/docs/problem-briefs/evidence/p01-mechanical-feasibility-corpus.md +90 -0
  60. package/docs/problem-briefs/evidence/signal-v4-pre-m3-replay.md +246 -0
  61. package/docs/release.md +17 -6
  62. package/docs/split-required-recovery.md +19 -26
  63. package/docs/validation-report.md +83 -70
  64. package/package.json +5 -1
  65. package/plugins/codex-workflow-gateway/.codex-plugin/plugin.json +1 -1
  66. package/plugins/codex-workflow-gateway/references/protocol.md +31 -9
  67. package/plugins/codex-workflow-gateway/skills/codex-workflow-gateway/SKILL.md +23 -6
  68. package/references/state-machine.md +18 -13
  69. package/references/validation-and-review.md +11 -4
  70. package/schemas/authorization-event.schema.json +64 -1
  71. package/schemas/corrective-decision-event.schema.json +48 -3
  72. package/schemas/milestone-scope-change-event.schema.json +6 -1
  73. package/schemas/milestone.schema.json +6 -1
  74. package/schemas/review-result.schema.json +17 -1
  75. package/schemas/step-review-event.schema.json +15 -0
  76. package/schemas/task-handoff-event.schema.json +18 -2
  77. package/scripts/generate-pdf-docs.py +513 -0
  78. package/scripts/run-pdf-docs.mjs +62 -0
@@ -0,0 +1,358 @@
1
+ ---
2
+ brief_id: WF2-P03
3
+ problem: "Different agent context and late discovery of coordination problems"
4
+ status: hypothesis
5
+ owner: null
6
+ created_at: 2026-08-23
7
+ approved_at: null
8
+ implemented_at: null
9
+ revision: 3
10
+ ---
11
+
12
+ # Brief — Minimal Agent Context Integrity
13
+
14
+ ## 0. Evidence status
15
+
16
+ The architectural omission is **confirmed**, but the claimed failure cause is **not confirmed**.
17
+
18
+ Current role context supplies the Task Brief, current Plan when present, selected Knowledge Map
19
+ sources, Task revision, write/read boundaries, commands, and role-specific stop conditions. It does
20
+ not directly supply:
21
+
22
+ - current Milestone objective and revision;
23
+ - canonical upstream/downstream Task dependencies;
24
+ - relevant sibling Task boundaries;
25
+ - ownership reserved by another Task;
26
+ - unresolved cross-Task prerequisites.
27
+
28
+ This absence alone does not prove P03. The same late failure may instead mean:
29
+
30
+ ```text
31
+ A. authoritative decomposition was wrong
32
+ B. correct authoritative fact existed but was missing/stale in context
33
+ C. correct fact was supplied but the agent reasoned incorrectly
34
+ D. required fact did not exist in Workflow authority
35
+ E. P01/P02 should have stopped the route before context mattered
36
+ ```
37
+
38
+ P03 solves only B and stale-context variants.
39
+
40
+ The Signal pre-M3 replay cannot establish B:
41
+
42
+ - Workflow stopped at a legitimate project-memory human gate before Task materialization;
43
+ - the synthetic Milestone was implemented outside Workflow;
44
+ - one agent retained the full experiment context instead of receiving separate
45
+ Planner/Worker/Reviewer packets;
46
+ - old active M3 Tasks and replacement decisions were intentionally excluded.
47
+
48
+ Therefore no authoritative P03 enforcement may be materialized from the replay result alone.
49
+
50
+ Implementation decision: **NO-GO**. A narrower prompt would be easy to generate, but without a
51
+ confirmed category-B failure and authoritative sources for the projected facts it would only make
52
+ context larger, not demonstrably more correct.
53
+
54
+ ## 1. Problem
55
+
56
+ An authority-bearing agent decision can be locally valid yet globally inconsistent when a relevant
57
+ coordination fact already known to Workflow is absent or stale in that role's context.
58
+
59
+ Relevant facts can include:
60
+
61
+ - Milestone objective;
62
+ - current Task objective and boundary;
63
+ - concrete upstream/downstream dependencies;
64
+ - sibling boundary relevant to the decision;
65
+ - ownership allocated to this or another Task;
66
+ - unresolved prerequisite;
67
+ - known blocker;
68
+ - current authority revisions.
69
+
70
+ Roles do not need identical prompts or full Milestone history. They need only the current facts
71
+ required for the exact decision.
72
+
73
+ ## 2. Preconditions
74
+
75
+ P03 cannot become authoritative until the facts it projects are authoritative elsewhere:
76
+
77
+ - P01-A owns only mechanical Plan-feasibility evidence and does not supply semantic Task boundaries,
78
+ ownership, prerequisite, output, or admission facts.
79
+ - Deferred P01-B or another approved authority must own those semantic facts before P03 can project
80
+ them.
81
+ - P04 owns concrete Task dependency edges and predecessor status.
82
+ - Existing Task/Plan/Knowledge authority owns local execution facts.
83
+ - P02 owns Step dependency and Step semantic validity.
84
+
85
+ P03 must not create substitute ownership, prerequisite, dependency, or Step models when those facts
86
+ do not exist.
87
+
88
+ If a required fact is absent from Workflow authority, the result is `context-insufficient` or a P01
89
+ decomposition gap—not an invented empty list or implicit permission.
90
+
91
+ ## 3. Proposed solution
92
+
93
+ If fresh replay validates the hypothesis, extend the current role-specific `ContextEnvelope` with a
94
+ derived coordination projection equivalent to:
95
+
96
+ ```text
97
+ CoordinationContext {
98
+ milestone {
99
+ id
100
+ objective
101
+ revision
102
+ planHash
103
+ }
104
+
105
+ task {
106
+ id
107
+ objective
108
+ revision
109
+ briefHash
110
+ planHash
111
+ baseBranch
112
+ evaluatedBaseHead
113
+ baseCommit?
114
+ }
115
+
116
+ upstreamDependencies[]
117
+ downstreamDependencies[]
118
+ relevantSiblingBoundaries[]
119
+
120
+ ownership {
121
+ owned[]
122
+ reservedByOthers[]
123
+ unknown[]
124
+ }
125
+
126
+ unresolvedPrerequisites[]
127
+ knownBlockers[]
128
+ }
129
+ ```
130
+
131
+ This is a logical projection, not a new authoritative schema object. It is rebuilt from current
132
+ Workflow state and may be discarded at any time.
133
+
134
+ Before `task start`, `baseCommit` is absent in current Task state. Planning and authorization
135
+ context therefore uses `baseBranch` plus its evaluated HEAD, consistent with P01-A. After start,
136
+ the recorded `baseCommit` may also be projected when the exact role decision requires it.
137
+
138
+ ### 3.1 Decision-specific projection
139
+
140
+ Planner:
141
+
142
+ - Milestone objective;
143
+ - current Task boundary;
144
+ - concrete relevant dependencies;
145
+ - sibling ownership that constrains the proposed Plan;
146
+ - unresolved prerequisites.
147
+
148
+ Worker:
149
+
150
+ - current Brief, Plan, and Step;
151
+ - satisfied upstream outputs required by that Step;
152
+ - write/ownership boundary;
153
+ - current execution blockers.
154
+
155
+ Reviewer:
156
+
157
+ - reviewed authority and evidence;
158
+ - relevant Task/Milestone boundary;
159
+ - dependencies and ownership needed to evaluate findings;
160
+ - no unrelated sibling implementation details.
161
+
162
+ Coordinator:
163
+
164
+ - runnable and blocked Task set;
165
+ - unresolved dependency bindings;
166
+ - current revisions and required human gates.
167
+
168
+ ### 3.2 Packet and chat-boundary compatibility
169
+
170
+ Current Task-chat protocol deliberately excludes sibling Task details, sibling Plans, and
171
+ Coordinator transcript from the TaskContextPacket. P03 must not bypass that isolation by copying
172
+ them into chat text.
173
+
174
+ If P03 is later approved, coordination facts must be generated by Core as a narrow authoritative
175
+ `ContextEnvelope` projection. `relevantSiblingBoundaries[]` may contain only the normalized
176
+ constraint needed by the current decision, its source authority, and freshness binding—not a
177
+ sibling Brief, Plan, implementation detail, or chat history. The project-local gateway protocol and
178
+ Core envelope schema must be revised together before this projection becomes mandatory.
179
+
180
+ If the source authority cannot emit such a normalized constraint, P03 reports
181
+ `context-insufficient`; it must not reconstruct one by reading and summarizing sibling prose.
182
+
183
+ ### 3.3 Sufficiency and freshness
184
+
185
+ ```text
186
+ ROLE_CONTEXT_READY =
187
+ required_authoritative_facts_exist
188
+ AND required_facts_are_projected
189
+ AND relevant_bindings_are_current
190
+ AND no_known_context_conflict
191
+ ```
192
+
193
+ Possible failures:
194
+
195
+ ```text
196
+ context-insufficient
197
+ context-stale
198
+ ```
199
+
200
+ Minimum freshness bindings reuse existing authority:
201
+
202
+ ```text
203
+ taskRevision
204
+ briefHash
205
+ planHash
206
+ baseBranch / evaluatedBaseHead before start
207
+ baseCommit after start when relevant
208
+ milestoneRevision
209
+ milestonePlanHash
210
+ membershipRevision
211
+ ```
212
+
213
+ Only bindings relevant to the role's decision are mandatory. A changed unrelated sibling must not
214
+ invalidate a local decision.
215
+
216
+ Old context is never repaired in place:
217
+
218
+ ```text
219
+ authority changes -> old packet stale -> discard -> rebuild
220
+ ```
221
+
222
+ ### 3.4 Unknown does not mean permitted
223
+
224
+ Projection must distinguish:
225
+
226
+ ```text
227
+ known empty
228
+ known owned by current Task
229
+ known reserved by another Task
230
+ explicitly unresolved
231
+ not represented by Workflow authority
232
+ ```
233
+
234
+ An empty list cannot silently represent the last two cases.
235
+
236
+ ## 4. Fresh hypothesis validation
237
+
238
+ Historical active-Milestone recovery and old M3 Task identifiers are excluded from the mandatory
239
+ materialization evidence. The new mandatory test is a fresh, version-pinned, role-separated replay.
240
+
241
+ ### 4.1 Fresh role-separated scenario
242
+
243
+ From a clean pre-Milestone repository:
244
+
245
+ 1. Run Discovery without importing later active-Milestone state.
246
+ 2. Materialize Tasks with authoritative semantic boundary facts from P01-B or another approved
247
+ source and canonical P04 dependencies.
248
+ 3. Build Planner, Worker, and Reviewer packets independently.
249
+ 4. Give a Planner a proposal that would enter a sibling's authoritative scope.
250
+ 5. Verify that the relevant boundary is present without supplying the sibling's full Plan.
251
+ 6. Change a relevant authority revision and verify that the old result cannot authorize a
252
+ transition.
253
+ 7. Change an irrelevant sibling and verify that the local context remains usable.
254
+
255
+ The replay must classify every detected conflict as A–E.
256
+
257
+ ### 4.2 Required category-B evidence
258
+
259
+ P03 is supported only if at least one material case proves:
260
+
261
+ ```text
262
+ the fact was authoritative and correct
263
+ AND the role needed it
264
+ AND the old packet omitted or stale-bound it
265
+ AND P01/P02 did not already block the route
266
+ AND the minimal projection prevents the harmful decision
267
+ ```
268
+
269
+ Without this evidence, P03 remains deferred.
270
+
271
+ The replay must also identify the exact pre-existing authority record and field from which every
272
+ projected boundary, ownership fact, prerequisite, and blocker is derived. A fact recoverable only
273
+ from agent reasoning, Coordinator chat, or a sibling Plan does not satisfy category B.
274
+
275
+ ### 4.3 Historical replay
276
+
277
+ Historical completed Tasks may be used as additional regression evidence, but no specific old
278
+ T07/T09/T10 topology is mandatory. Historical replay must not import active status, replacement
279
+ authority, or later decisions into fresh Discovery.
280
+
281
+ ### 4.4 Successful-task controls
282
+
283
+ Verify:
284
+
285
+ - no unrelated sibling internals become mandatory;
286
+ - no new agent call is introduced;
287
+ - context stays within current budget;
288
+ - previously successful local Tasks receive no systematic blockers;
289
+ - repeated packet derivation is deterministic.
290
+
291
+ ## 5. Dependencies and conflicts
292
+
293
+ - P03 depends on P01 boundary/prerequisite authority and P04 Task dependencies.
294
+ - P01-A alone does not satisfy the first dependency; P03 requires deferred P01-B or an equivalent
295
+ approved semantic authority.
296
+ - P03 may use P02 Step facts but cannot evaluate Step validity.
297
+ - P03 must not duplicate Plan feasibility or semantic admission.
298
+ - Full sibling Briefs/Plans, Coordinator chat history, and a global Context Graph are unnecessary.
299
+ - Context freshness must reuse existing revisions/hashes rather than introduce a new credential or
300
+ evidence lifecycle.
301
+ - Mandatory sibling-context projection would conflict with the current Task-chat isolation rule;
302
+ Core envelope and gateway protocol changes must be one reviewed contract change.
303
+
304
+ ## 6. Design approval gate
305
+
306
+ P03 remains `NO-GO`. It may move from `hypothesis` to `approved` only when:
307
+
308
+ 1. Fresh role-separated replay demonstrates at least one category-B or stale-context failure.
309
+ 2. P01/P02 do not already fully prevent that failure.
310
+ 3. Every projected fact names an existing authoritative source and field.
311
+ 4. The minimal projection exposes the fact before the harmful decision.
312
+ 5. The Core-envelope and Task-chat protocol changes agree on the exact permitted sibling-boundary
313
+ projection.
314
+ 6. Missing authority is represented as insufficient/unknown, never permitted.
315
+ 7. Relevant and irrelevant freshness bindings are defined without a new credential lifecycle.
316
+ 8. Successful-task controls show no systematic blocker or material context-budget regression.
317
+
318
+ ## 7. Implementation acceptance
319
+
320
+ P03 may move from `approved` to `implemented` only when:
321
+
322
+ 1. Relevant authority changes invalidate the old result.
323
+ 2. Irrelevant authority changes do not create false staleness.
324
+ 3. Different roles receive consistent values for the same fact.
325
+ 4. Packets are derived, disposable, deterministic, and contain no sibling Plan or chat transcript.
326
+ 5. Missing authority fails closed as `context-insufficient`.
327
+ 6. No new mandatory agent call or lifecycle stage is introduced.
328
+ 7. No global Context Graph, Contract Registry, ownership model, dependency model, or context
329
+ credential lifecycle is introduced.
330
+ 8. Fresh role-separated E2E and successful-task replay pass without systematic false blockers.
331
+
332
+ ## 8. Non-goals
333
+
334
+ - fixing incorrect authoritative decomposition;
335
+ - creating missing Task dependencies or ownership authority;
336
+ - preventing reasoning errors when correct context was supplied;
337
+ - full Milestone history or sibling Plans in every packet;
338
+ - Coordinator/chat transcript transmission;
339
+ - Plan feasibility or Step semantic validation;
340
+ - replacement rewiring;
341
+ - mandatory Design Review;
342
+ - global knowledge/RAG/context graph.
343
+
344
+ ## 9. Decision log
345
+
346
+ - 2026-08-23 — Revision 1 created as `hypothesis`.
347
+ - 2026-08-24 — Current role-context omission confirmed by source inspection.
348
+ - 2026-08-24 — Signal replay found insufficient evidence to attribute a material failure to missing
349
+ or stale role context.
350
+ - 2026-08-24 — Mandatory old T07/T09/T10 replay removed; fresh role-separated replay is now the
351
+ approval gate.
352
+ - 2026-08-24 — P01/P04 authority made an explicit prerequisite for P03.
353
+ - 2026-08-24 — Revision 3 clarified that P01-A does not supply semantic boundary/ownership
354
+ authority, corrected the pre-start base binding, and made Core-envelope/gateway chat isolation a
355
+ joint compatibility gate.
356
+ - 2026-08-24 — P03 remains `NO-GO` until category-B evidence names an exact pre-existing authority
357
+ source and proves that the minimal projection prevents a material error.
358
+ - 2026-08-24 — Status intentionally remains `hypothesis`; category-B evidence is still absent.