@open-agent-toolkit/cli 0.1.46 → 0.1.50

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 (98) hide show
  1. package/assets/agents/oat-phase-implementer.md +202 -191
  2. package/assets/agents/oat-reviewer.md +11 -1
  3. package/assets/config/dispatch-matrix-recommendation.json +120 -13
  4. package/assets/docs/cli-utilities/configuration.md +213 -113
  5. package/assets/docs/cli-utilities/workflow-gates.md +178 -27
  6. package/assets/docs/contributing/skills.md +14 -8
  7. package/assets/docs/provider-sync/providers.md +46 -8
  8. package/assets/docs/provider-sync/scope-and-surface.md +2 -2
  9. package/assets/docs/reference/cli-reference.md +3 -1
  10. package/assets/docs/reference/oat-directory-structure.md +27 -26
  11. package/assets/docs/workflows/projects/artifacts.md +31 -1
  12. package/assets/docs/workflows/projects/dispatch-ceiling.md +297 -197
  13. package/assets/docs/workflows/projects/implementation-execution.md +306 -249
  14. package/assets/docs/workflows/projects/lifecycle.md +26 -5
  15. package/assets/docs/workflows/projects/reviews.md +27 -2
  16. package/assets/migration/pjm-restructure.md +1 -1
  17. package/assets/public-package-versions.json +4 -4
  18. package/assets/skills/oat-project-implement/SKILL.md +290 -149
  19. package/assets/skills/oat-project-import-plan/SKILL.md +173 -16
  20. package/assets/skills/oat-project-next/SKILL.md +2 -2
  21. package/assets/skills/oat-project-plan/SKILL.md +122 -92
  22. package/assets/skills/oat-project-plan-writing/SKILL.md +246 -15
  23. package/assets/skills/oat-project-quick-start/SKILL.md +157 -107
  24. package/assets/skills/oat-project-review-provide/SKILL.md +110 -22
  25. package/assets/skills/oat-project-review-provide-remote/SKILL.md +28 -1
  26. package/dist/commands/config/index.d.ts +3 -0
  27. package/dist/commands/config/index.d.ts.map +1 -1
  28. package/dist/commands/config/index.js +92 -125
  29. package/dist/commands/doctor/index.d.ts +3 -0
  30. package/dist/commands/doctor/index.d.ts.map +1 -1
  31. package/dist/commands/doctor/index.js +57 -95
  32. package/dist/commands/gate/index.d.ts +7 -1
  33. package/dist/commands/gate/index.d.ts.map +1 -1
  34. package/dist/commands/gate/index.js +615 -67
  35. package/dist/commands/gate/review-verdict.d.ts +16 -0
  36. package/dist/commands/gate/review-verdict.d.ts.map +1 -1
  37. package/dist/commands/gate/review-verdict.js +72 -9
  38. package/dist/commands/project/dispatch-ceiling/index.d.ts.map +1 -1
  39. package/dist/commands/project/dispatch-ceiling/index.js +567 -99
  40. package/dist/commands/providers/codex/materialize.d.ts.map +1 -1
  41. package/dist/commands/providers/codex/materialize.js +6 -1
  42. package/dist/commands/shared/frontmatter.d.ts +4 -0
  43. package/dist/commands/shared/frontmatter.d.ts.map +1 -1
  44. package/dist/commands/shared/frontmatter.js +23 -0
  45. package/dist/commands/status/index.d.ts +1 -0
  46. package/dist/commands/status/index.d.ts.map +1 -1
  47. package/dist/commands/status/index.js +10 -4
  48. package/dist/commands/sync/index.d.ts.map +1 -1
  49. package/dist/commands/sync/index.js +10 -3
  50. package/dist/commands/sync/sync.types.d.ts +1 -0
  51. package/dist/commands/sync/sync.types.d.ts.map +1 -1
  52. package/dist/config/dispatch-matrix.d.ts +59 -0
  53. package/dist/config/dispatch-matrix.d.ts.map +1 -0
  54. package/dist/config/dispatch-matrix.js +264 -0
  55. package/dist/config/oat-config.d.ts +9 -18
  56. package/dist/config/oat-config.d.ts.map +1 -1
  57. package/dist/config/oat-config.js +99 -120
  58. package/dist/config/resolve.d.ts +8 -0
  59. package/dist/config/resolve.d.ts.map +1 -1
  60. package/dist/config/resolve.js +66 -1
  61. package/dist/engine/index.d.ts +1 -1
  62. package/dist/engine/index.d.ts.map +1 -1
  63. package/dist/engine/index.js +1 -1
  64. package/dist/engine/scanner.d.ts +1 -0
  65. package/dist/engine/scanner.d.ts.map +1 -1
  66. package/dist/engine/scanner.js +17 -1
  67. package/dist/fs/paths.d.ts +4 -0
  68. package/dist/fs/paths.d.ts.map +1 -1
  69. package/dist/fs/paths.js +18 -1
  70. package/dist/providers/ceiling/registry.d.ts +1 -0
  71. package/dist/providers/ceiling/registry.d.ts.map +1 -1
  72. package/dist/providers/ceiling/registry.js +12 -5
  73. package/dist/providers/codex/codec/catalog.d.ts +14 -0
  74. package/dist/providers/codex/codec/catalog.d.ts.map +1 -0
  75. package/dist/providers/codex/codec/catalog.js +21 -0
  76. package/dist/providers/codex/codec/materialize.d.ts.map +1 -1
  77. package/dist/providers/codex/codec/materialize.js +6 -5
  78. package/dist/providers/codex/codec/shared.d.ts +19 -0
  79. package/dist/providers/codex/codec/shared.d.ts.map +1 -1
  80. package/dist/providers/codex/codec/shared.js +98 -5
  81. package/dist/providers/codex/codec/sync-extension.d.ts.map +1 -1
  82. package/dist/providers/codex/codec/sync-extension.js +142 -32
  83. package/dist/providers/identity/availability.d.ts +12 -0
  84. package/dist/providers/identity/availability.d.ts.map +1 -1
  85. package/dist/providers/identity/availability.js +72 -29
  86. package/dist/providers/identity/dispatch-report.d.ts +124 -0
  87. package/dist/providers/identity/dispatch-report.d.ts.map +1 -0
  88. package/dist/providers/identity/dispatch-report.js +285 -0
  89. package/dist/providers/identity/dispatch-validation.d.ts +28 -0
  90. package/dist/providers/identity/dispatch-validation.d.ts.map +1 -0
  91. package/dist/providers/identity/dispatch-validation.js +149 -0
  92. package/dist/providers/identity/stamp.d.ts +2 -0
  93. package/dist/providers/identity/stamp.d.ts.map +1 -1
  94. package/dist/providers/identity/stamp.js +7 -1
  95. package/dist/shared/types.d.ts +1 -0
  96. package/dist/shared/types.d.ts.map +1 -1
  97. package/dist/shared/types.js +4 -0
  98. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: oat-project-implement
3
- version: 2.0.31
4
- description: Use when plan.md is ready for execution. Dispatches phase-level subagents with bounded fix loops; supports plan-declared parallel phase groups with worktree-isolated execution and ordered fan-in.
3
+ version: 2.0.34
4
+ description: Use when plan.md is ready for execution. Dispatches phase coordinators that select one exact target-pinned worker per task; supports bounded fix loops and plan-declared worktree-isolated parallel phases.
5
5
  oat_gateable: true
6
6
  argument-hint: '[--retry-limit <N>] [--dry-run]'
7
7
  disable-model-invocation: true
@@ -104,6 +104,23 @@ PROJECTS_ROOT="${PROJECTS_ROOT%/}"
104
104
 
105
105
  ### Step 0.5: Capability Detection and Tier Selection
106
106
 
107
+ **Mandatory target-first order:** Complete Dispatch Policy Preflight and resolve
108
+ the concrete managed Codex target before probing generic agent availability or
109
+ locking Tier 1/Tier 2. A concrete target takes precedence over tier selection:
110
+ use the exact registered role, or an explicitly pinned fresh Codex child when
111
+ that role is unavailable. If neither route is possible, inline execution is
112
+ allowed only with verified equivalent current-host model and effort controls;
113
+ otherwise block before work starts. Explicit inherit/default and documented
114
+ managed-uncapped reviewer behavior remain the only base-role exceptions.
115
+
116
+ When a concrete managed Codex role is unavailable or the host cannot select
117
+ it, launch a fresh Codex child pinned to the resolver-returned model and effort
118
+ with canonical role instructions. If that fresh child cannot be launched, fail
119
+ closed and block; never substitute the coordinator or base role.
120
+
121
+ Use base `oat-phase-implementer` only for the allowed exceptions above:
122
+ explicit inherit/default behavior. It is never a managed task-worker fallback.
123
+
107
124
  Detect whether native subagent dispatch is available. The detection logic follows the same pattern used by `oat-project-review-provide` but produces a two-tier outcome (no fresh-session tier — this skill runs autonomously and cannot block on user-initiated fresh sessions mid-run).
108
125
 
109
126
  Detection logic:
@@ -124,7 +141,10 @@ Detection logic:
124
141
  - Approved → Tier 1.
125
142
  - Declined → Tier 2.
126
143
 
127
- - If the host does not resolve either agent Tier 2.
144
+ - If the host does not resolve either generic agent, first attempt the exact
145
+ registered role or explicitly pinned fresh-child route for any concrete
146
+ managed target. Select Tier 2 only when inline execution is allowed by the
147
+ target-first rule above.
128
148
 
129
149
  **Approval scope rule:** this Tier selection applies to both phase implementation and checkpoint review. Do not infer a mixed mode from conversational emphasis on review checkpoints. If the user has not explicitly approved Tier 1 for the run, stay Tier 2 throughout. Mixed mode is only valid when the user explicitly requests it.
130
150
 
@@ -147,7 +167,7 @@ Do not print `[0/N]` for this preflight step. The implementation denominator is
147
167
 
148
168
  **Hard pre-work guard:** before any code edit, test run, or implementation commit, print the selected tier and reason. If Tier 2 is selected, the reason must be one of the three allowed Tier 2 reasons above. Do not run tests, edit files, or create implementation commits until Step 0.5 has completed and the tier report has been printed.
149
169
 
150
- **Tier is locked for the remainder of the run.** Subsequent phase implementation and review dispatches use the same tier. No mid-run re-evaluation or downgrade unless the user explicitly asks to change execution mode.
170
+ **Tier is locked for the remainder of the run only after the dispatch target is resolved.** Subsequent coordinator, task-worker, fix, and review dispatches use the same tier. Tier controls mechanics only: every managed task worker still resolves its own exact target beneath the recorded project or phase named maximum. No mid-run downgrade is allowed.
151
171
 
152
172
  **Recovery if Step 0.5 was skipped:** If implementation work has already started inline before completing Step 0.5, STOP immediately. Preserve any work in progress, complete or revert to a clean task boundary, and re-run Step 0.5 before continuing. Do not silently continue in Tier 2.
153
173
 
@@ -173,13 +193,13 @@ Use the CLI resolver as the source of truth. The command name remains
173
193
  policy:
174
194
 
175
195
  ```bash
176
- oat project dispatch-ceiling resolve --provider <active-provider> --preflight --json
196
+ oat project dispatch-ceiling resolve --provider <active-provider> --preflight --report-scope implementation-preflight --report-action implementation --json
177
197
  ```
178
198
 
179
199
  If `oat` is not in PATH, use:
180
200
 
181
201
  ```bash
182
- pnpm run cli -- project dispatch-ceiling resolve --provider <active-provider> --preflight --json
202
+ pnpm run cli -- project dispatch-ceiling resolve --provider <active-provider> --preflight --report-scope implementation-preflight --report-action implementation --json
183
203
  ```
184
204
 
185
205
  Resolution order:
@@ -242,7 +262,7 @@ OAT Dispatch Tier: balanced (codex, managed capped — pinned-variant)
242
262
  Resolved cap: high
243
263
  Source: project state
244
264
  Provider default effort: medium
245
- Note: OAT will use resolver-returned materialized Codex role names up to high. Base/unpinned roles resolve through the provider default only on fallback paths.
265
+ Note: OAT will use resolver-returned materialized Codex role names up to high. Base/unpinned roles resolve through the provider default only for explicit inherit/default behavior or the documented managed-uncapped reviewer exception.
246
266
  ```
247
267
 
248
268
  If no policy resolves and the session is interactive, present the dispatch
@@ -276,10 +296,10 @@ OAT applies managed policies where the provider exposes a reliable mechanism
276
296
  (Codex: pinned variants; Claude: Task model parameter). Other providers may
277
297
  treat managed policies as advisory.
278
298
 
279
- **Managed capped policy selection** persists `mode: managed`,
280
- `policy`, and the compiled provider targets. On selection, print the exact
281
- compiled result (e.g., "Dispatch policy set: balanced -> Codex: high · Claude:
282
- sonnet") before proceeding.
299
+ **Managed capped policy selection** persists only `mode: managed`, the named
300
+ maximum `policy`, and `source`. The named maximum leaves lower configured
301
+ candidates eligible; do not copy compiled provider/model targets into project
302
+ state. On selection, print the named maximum before proceeding.
283
303
 
284
304
  **Uncapped** persists explicit managed uncapped state. OAT still manages
285
305
  dispatch selection. It does not write provider caps, and it must not be
@@ -300,9 +320,6 @@ Persist in project `state.md` frontmatter using the normalized shape:
300
320
  oat_dispatch_policy:
301
321
  mode: managed
302
322
  policy: balanced
303
- providers:
304
- codex: high
305
- claude: sonnet
306
323
  source: project-state
307
324
  ```
308
325
 
@@ -328,7 +345,7 @@ exists, rerun the resolver with non-interactive behavior and stop before work
328
345
  starts if it blocks:
329
346
 
330
347
  ```bash
331
- oat project dispatch-ceiling resolve --provider <active-provider> --preflight --non-interactive
348
+ oat project dispatch-ceiling resolve --provider <active-provider> --preflight --non-interactive --report-scope implementation-preflight --report-action implementation
332
349
  ```
333
350
 
334
351
  ```text
@@ -341,15 +358,17 @@ modifying project state.
341
358
 
342
359
  ### Runtime dispatch selection
343
360
 
344
- Before each phase implementation, fix, or review dispatch, choose and log the
345
- runtime dispatch controls. This is separate from Tier 1/Tier 2 execution mode:
346
- Tier 1/Tier 2 decides whether OAT uses subagents or inline fallback; runtime
347
- dispatch selection decides model/effort controls for the specific work.
361
+ Before coordinator bootstrap and before each task-worker, fix, or review
362
+ dispatch, choose and log runtime controls. Resolve these controls before
363
+ applying Tier 1/Tier 2 mechanics. A coordinator target never becomes a task
364
+ target: managed tasks use an exact resolver candidate beneath the recorded
365
+ project or phase named ceiling. Inline execution must preserve equivalent
366
+ controls or use a documented exception.
348
367
 
349
368
  Use these inputs:
350
369
 
351
370
  - resolved dispatch policy, source, and provider-specific selection
352
- - phase ID and phase scope
371
+ - phase ID and the current bounded task scope
353
372
  - optional `## Dispatch Profile` row in `plan.md`
354
373
  - host-exposed provider controls, by axis
355
374
  - prior outcomes for the phase, including review results and failed retries
@@ -371,6 +390,32 @@ an ordered matrix route:
371
390
  entry before retrying, up to the last available route entry and within
372
391
  `oat_orchestration_retry_limit`.
373
392
 
393
+ #### Dispatch Report V1 contract
394
+
395
+ Every implementation, fix, and review resolver invocation MUST pass explicit
396
+ report context:
397
+
398
+ - implementation: `--report-scope <phase-or-task> --report-action implementation`
399
+ - fix: `--report-scope <phase-or-task> --report-action fix`
400
+ - review: `--report-scope <phase-or-review-scope> --report-action review`
401
+
402
+ Require `dispatchReport.schemaVersion: 1` in the completed resolver JSON before
403
+ dispatch. Consume the report as the human/audit source: render the versioned
404
+ block with `formatDispatchReport(dispatchReport)` semantics, and derive the
405
+ formal compatibility line only through
406
+ `formatDispatchStamp(dispatchReport)` / `toDispatchStampRecord(dispatchReport)`.
407
+ Never hand-assemble a second `Dispatch:` schema from policy labels, role names,
408
+ candidate strings, or target names.
409
+
410
+ The exact provider invocation remains authoritative in
411
+ `providers.<provider>.dispatchArgs` and `providers.<provider>.selection.target`;
412
+ the report does not replace or weaken target-pinned dispatch. Add independently
413
+ observed runtime identity to `dispatchReport.runtimeIdentity` only when such an
414
+ observation exists. Requested/configured controls are not runtime observation.
415
+ For gate-originated review, keep `dispatchReport.gateInvocation`, existing
416
+ work-producer `diversity`, and reviewer `runtimeIdentity` as three distinct
417
+ facts; producer stamps or self-report never overwrite configured invocation.
418
+
374
419
  Axis states:
375
420
 
376
421
  - `selected:<value>` - host exposes the axis and the orchestrator chose a value.
@@ -381,21 +426,34 @@ Axis states:
381
426
 
382
427
  Codex rules:
383
428
 
384
- 1. Codex effort order is `low < medium < high < xhigh`.
429
+ **Managed Codex execution invariant:** When the resolver returns a model+effort
430
+ target, prefer the exact registered role or variant from
431
+ `providers.codex.dispatchArgs.variant`. If the current host cannot select that
432
+ exact registered target, launch a fresh Codex child with the resolver target's
433
+ explicit model, reasoning effort, and canonical role instructions from
434
+ `.agents/agents/oat-phase-implementer.md` or
435
+ `.agents/agents/oat-reviewer.md`. Workflow correctness must not require provider
436
+ restart or hot reload. A managed base role is forbidden when a concrete target
437
+ was requested; never silently downgrade to it. Base roles remain valid only for
438
+ explicit inherit/default behavior and the documented managed-uncapped reviewer
439
+ fallback.
440
+
441
+ 1. Codex effort order is `low < medium < high < xhigh < max`.
385
442
  2. Classify preferred effort from scope:
386
443
  - `low`: trivial docs-only, narrow single-file, or mechanical changes
387
444
  - `medium`: normal multi-file implementation and moderate integration risk
388
445
  - `high`: broad architecture, security/auth/redaction boundaries, subtle state behavior, or repeated substantive review failures
389
446
  - `xhigh`: highest-risk work that requires a capped policy to allow xhigh or a managed `Uncapped` policy to select it
447
+ - `max`: exceptional frontier work whose risk or cross-cutting scope justifies the first-class maximum reasoning control
390
448
  3. For capped managed implementer/fix work, selected effort is `min(preferred, resolved_cap)`.
391
449
  4. For managed `Uncapped` implementer/fix work, selected effort is the preferred effort with no cap.
392
450
  5. For inherit/default mode, the resolver returns no selected dispatch args. Use the base/unpinned Codex role, log `Selected effort: provider-default`, display provider default effort when known, and do not describe this as managed uncapped behavior.
393
- 6. For implementer/fix dispatch: call `oat project dispatch-ceiling resolve --provider codex --role implementer --preferred <preferred-effort> --escalation-level <route-level>`; read `providers.codex.selection.selectedValue`, `providers.codex.dispatchArgs.variant`, `providers.codex.selection.target`, and any `providers.codex.target` for the selected materialized Codex role name or route target. Never pass a cap-only implementer variant when `selection.selectedValue` is lower.
394
- 7. For review dispatch: call `oat project dispatch-ceiling resolve --provider codex --role reviewer`; read `providers.codex.dispatchArgs.variant` and `providers.codex.selection.target`.
451
+ 6. For managed capped task-worker/fix dispatch, choose an exact configured candidate. For implementation, call `oat project dispatch-ceiling resolve --provider codex --role implementer --ceiling-tier <project-or-phase-tier> --candidate-model <model> --candidate-effort <effort> --escalation-level <route-level> --report-scope <task-id> --report-action implementation --json`. For a bounded fix, use `oat project dispatch-ceiling resolve --provider codex --role implementer --ceiling-tier <project-or-phase-tier> --candidate-model <model> --candidate-effort <effort> --escalation-level <route-level> --report-scope <task-id> --report-action fix --json`. Read `providers.codex.dispatchArgs.variant` and `providers.codex.selection.target`; never reuse the coordinator role or a cap-only variant. `--preferred` remains compatibility behavior outside the exact task-worker path.
452
+ 7. For review dispatch: call `oat project dispatch-ceiling resolve --provider codex --role reviewer --report-scope <phase-or-review-scope> --report-action review --json`; read `providers.codex.dispatchArgs.variant` and `providers.codex.selection.target`.
395
453
  - Capped managed policy: reviewer targets the configured cap for deterministic quality gate behavior.
396
454
  - Managed `Uncapped`: no reviewer target exists; use base/unpinned reviewer fallback and log `selectionMode=no-review-target`, `selectedValue=null`, and `effort_axis=provider-default`.
397
455
  - Inherit/default: no reviewer target exists; use base/unpinned reviewer fallback and log `selectionMode=inherit-default`, `selectedValue=null`, and `effort_axis=provider-default`.
398
- 8. Codex payload-first assertion applies only when the resolver returns a materialized model+effort variant. If `providers.codex.dispatchArgs.variant` is present, the actual `spawn_agent` payload MUST use it as `agent_type`; when that variant came from a Codex model+effort target, log `model_axis=selected:<model>` and `effort_axis=selected:<effort>` from resolver output. If the resolver returns no variant, use the base role and log provider-default. Always derive `model_axis` and `effort_axis` from resolver output, not from legacy role-name parsing.
456
+ 8. Codex payload-first assertion applies whenever the resolver returns a materialized model+effort target. If `providers.codex.dispatchArgs.variant` is present, the actual `spawn_agent` payload MUST use it as `agent_type`; when that variant came from a Codex model+effort target, log `model_axis=selected:<model>` and `effort_axis=selected:<effort>` from resolver output. If a concrete managed target has no usable variant, use the explicitly pinned fresh-child route or block. Use the base role and log provider-default only for explicit inherit/default behavior or the documented managed-uncapped reviewer exception. Always derive `model_axis` and `effort_axis` from resolver output, not from legacy role-name parsing.
399
457
  9. Do not use top-level per-call `reasoning_effort` as the standard OAT selected-effort path; dogfooding showed that path can be inconsistent.
400
458
 
401
459
  Claude rules:
@@ -408,28 +466,38 @@ Claude rules:
408
466
  - Review dispatch:
409
467
  - Capped managed policy: target the configured policy cap directly.
410
468
  - Managed `Uncapped` or inherit/default: no reviewer target exists; omit `model` and log inherited/default model behavior.
411
- - For implementer/fix dispatch, call `oat project dispatch-ceiling resolve --provider claude --role implementer --preferred <preferred-model> --orchestrator-tier <current-orchestrator-tier> --escalation-level <route-level>`; for review dispatch, call the same resolver with `--role reviewer` and no `--preferred`. Read `providers.claude.selection.selectedValue`, `providers.claude.dispatchArgs.model`, and any `providers.claude.target` for the selected model string or route target. Pass `--orchestrator-tier` so the resolver can flag above-orchestrator upgrade requests and set `verifyOnDispatch` correctly.
469
+ - For managed capped task-worker/fix dispatch, call `oat project dispatch-ceiling resolve --provider claude --role implementer --ceiling-tier <project-or-phase-tier> --candidate-model <model> --orchestrator-tier <current-orchestrator-tier> --escalation-level <route-level> --report-scope <task-id> --report-action implementation --json` for implementation. For a bounded fix, call `oat project dispatch-ceiling resolve --provider claude --role implementer --ceiling-tier <project-or-phase-tier> --candidate-model <model> --orchestrator-tier <current-orchestrator-tier> --escalation-level <route-level> --report-scope <task-id> --report-action fix --json`. For review dispatch, call the resolver with `--role reviewer --report-scope <phase-or-review-scope> --report-action review --json` and no candidate flags. Read `providers.claude.dispatchArgs.model` and pass it exactly on the actual Task invocation.
412
470
  - Pass `model: "<value>"` when `model_axis=selected:<value>` on the Task tool call.
413
471
  - Keep `effort_axis=not-applicable`; Claude Code has no separate per-dispatch effort axis.
414
472
 
473
+ Cursor rules:
474
+
475
+ - Treat every configured Cursor candidate string as opaque. Do not normalize it
476
+ or infer capability from its spelling.
477
+ - For managed capped task-worker/fix dispatch, call
478
+ `oat project dispatch-ceiling resolve --provider cursor --role implementer --ceiling-tier <project-or-phase-tier> --candidate-model <opaque-model> --report-scope <task-id> --report-action implementation --json`
479
+ for implementation. For a bounded fix, call
480
+ `oat project dispatch-ceiling resolve --provider cursor --role implementer --ceiling-tier <project-or-phase-tier> --candidate-model <opaque-model> --report-scope <task-id> --report-action fix --json`.
481
+ - Require `providers.cursor.dispatchArgs.model` and pass that exact byte-for-byte
482
+ string as the actual Cursor invocation model. If the host cannot apply it,
483
+ fail closed.
484
+
415
485
  Payload-first invariant:
416
486
 
417
487
  - Build the actual host dispatch argument map before logging.
418
488
  - Do not emit `selected:<value>` unless the host invocation contains the corresponding role/model selection.
419
489
  - Derive `Dispatch target` and `Effort axis` / `Model axis` from the payload.
420
- - After the payload is built, append a formal dispatch stamp to Dispatch Notes
421
- for every implementation, fix, and review dispatch. Use the p01 grammar
422
- exactly:
490
+ - After the payload is built, append the compatibility stamp returned from
491
+ `formatDispatchStamp(dispatchReport)` to Dispatch Notes for every
492
+ implementation, fix, and review dispatch. The derived line retains the p01
493
+ grammar exactly:
423
494
  `Dispatch: scope=<phase-or-task> action=<implementation|fix|review> role=<implementer|fix|reviewer> producer=<slug|unknown> provenance=<declared|observed|inferred|unknown> model_axis=<axis> effort_axis=<axis> dispatch_policy=<policy|unknown> dispatch_ceiling=<value|none> target=<target|unknown>`.
424
- Derive `producer` and `provenance` from the resolver payload and actual host
425
- arguments. Only concrete model arguments, including same-harness route model
426
- args for model-arg providers, declare producer identity. Codex materialized
427
- model+effort variants declare `model_axis=selected:<model>` and
428
- `effort_axis=selected:<effort>` from resolver output, but keep
429
- `producer=unknown provenance=unknown` unless an observed/inferred model
430
- identity is available. Base/unpinned or deferred cross-harness paths are also
431
- `producer=unknown provenance=unknown` unless an observed/inferred identity is
432
- available. Do not write prose-only or legacy comma-separated stamp forms.
495
+ Populate the report from the completed resolver and actual host arguments.
496
+ Only independently observed or otherwise supported runtime evidence may
497
+ populate runtime producer identity. Codex materialized model+effort variants
498
+ retain selected model/effort controls while keeping runtime identity
499
+ not-reported unless evidence exists. Do not write prose-only, hand-built, or
500
+ legacy comma-separated stamp forms.
433
501
 
434
502
  Human-facing dispatch display rules:
435
503
 
@@ -458,10 +526,10 @@ Route: {route label or target path | none}; level={0 | 1 | ... | none}
458
526
  Requested controls: {model=<value|none>, effort=<value|none>, target=<value|unknown>}
459
527
  Configured defaults: {provider default effort/model | unknown | not-applicable}
460
528
  Runtime confirmation: {observed:<slug> | declared:<slug> | not-observable | mismatch:<detail>}
461
- Preferred effort: {low | medium | high | xhigh | provider-default | not-applicable}
529
+ Preferred effort: {low | medium | high | xhigh | max | provider-default | not-applicable}
462
530
  OAT Dispatch Tier: {economy | balanced | high | frontier | uncapped | inherit host defaults | legacy capped}
463
531
  Resolved cap: {resolved cap value | none}
464
- Selected effort: {low | medium | high | xhigh | provider-default | not-applicable}
532
+ Selected effort: {low | medium | high | xhigh | max | provider-default | not-applicable}
465
533
  Policy source: {repo config | project state | preflight prompt}
466
534
  Provider default effort: {value | unknown | not-applicable}
467
535
  Selection mode: {capped | uncapped | review-target | no-review-target | inherit-default}
@@ -565,7 +633,7 @@ Generic sidecar/explorer dispatch:
565
633
 
566
634
  - Built-in or generic sidecars such as `explorer` are not OAT-managed implementer, reviewer, or fix roles.
567
635
  - If a sidecar spawn payload does not explicitly pin a reliable effort/model control, log `Preferred effort: provider-default`, `Selected effort: provider-default`, and `Effort axis: provider-default`.
568
- - Do not classify a generic sidecar as `Preferred effort: low|medium|high|xhigh` unless the actual host invocation contains the corresponding reliable selection. If the host has no reliable effort control for that sidecar, use provider-default wording instead.
636
+ - Do not classify a generic sidecar as `Preferred effort: low|medium|high|xhigh|max` unless the actual host invocation contains the corresponding reliable selection. If the host has no reliable effort control for that sidecar, use provider-default wording instead.
569
637
  - Sidecar outputs are advisory context only. Implementation work and review/fix gates still follow the OAT-managed dispatch rules above.
570
638
 
571
639
  Codex generic explorer example:
@@ -628,13 +696,14 @@ Dispatch policy: {policy}; selected={selected value | none}; cap={value | none}
628
696
  **Log examples (matching resolver output):**
629
697
 
630
698
  ```text
631
- Dispatch policy: balanced; selected=high; cap=high (codex, enforced — variant oat-phase-implementer-gpt-5-6-sol-high)
632
- Dispatch policy: high; selected=xhigh; cap=xhigh (codex, enforced — variant oat-reviewer-gpt-5-6-terra-xhigh)
699
+ Dispatch policy: balanced; selected=xhigh; cap=xhigh (codex, enforced — variant oat-phase-implementer-gpt-5-6-terra-xhigh)
700
+ Dispatch policy: high; selected=high; cap=high (codex, enforced — variant oat-reviewer-gpt-5-6-sol-high)
701
+ Dispatch policy: frontier; selected=max; cap=max (codex, enforced — variant oat-reviewer-gpt-5-6-sol-max)
633
702
  Dispatch policy: uncapped; selected=xhigh; cap=none (codex, enforced — variant oat-phase-implementer-gpt-5-6-terra-xhigh)
634
703
  Dispatch policy: inherit host defaults; selected=none; cap=none (codex, advisory — base role follows provider default)
635
704
  Dispatch policy: balanced; selected=sonnet; cap=sonnet (claude, enforced — Task model arg)
636
705
  Dispatch policy: frontier; selected=fable; cap=fable (claude, enforced — Task model arg)
637
- Dispatch policy: high; selected=none; cap=high (cursor, unsupportedno adapter; informational)
706
+ Cursor opaque model-string example: Dispatch policy: frontier; selected=gpt-5.6-sol-max; cap=gpt-5.6-sol-max (cursor, enforcedmodel arg gpt-5.6-sol-max)
638
707
  Dispatch policy: unresolved; selected=none; cap=none (codex, advisory — policy set but no value resolved)
639
708
  ```
640
709
 
@@ -952,98 +1021,139 @@ Initialize project state so other skills (e.g., `oat-project-progress`) reflect
952
1021
 
953
1022
  ### Step 5: Per-Phase Execution
954
1023
 
955
- For each phase `pNN` in the plan (or each phase in the current parallel group), the orchestrator dispatches phase-level work as follows.
956
-
957
- **Tier 1 dispatch (native subagents):**
1024
+ For each phase `pNN` in the plan (or each phase in a plan-declared parallel
1025
+ worktree group), dispatch exactly one phase coordinator. The coordinator reads
1026
+ the phase once and dispatches one exact task worker per task. It must not
1027
+ implement ordinary plan tasks in its own context.
958
1028
 
959
- 1. Build the Phase Scope block:
960
-
961
- ```
962
- project: {PROJECT_PATH}
963
- phase: {pNN}
964
- mode: implement
965
- artifact_paths:
966
- plan: {PROJECT_PATH}/plan.md
967
- design: {PROJECT_PATH}/design.md
968
- spec: {PROJECT_PATH}/spec.md
969
- implementation: {PROJECT_PATH}/implementation.md
970
- discovery: {PROJECT_PATH}/discovery.md
971
- delta_recording: record any intentional divergence from spec/design/plan in implementation.md with rationale, source of truth, and follow-up artifact disposition
972
- commit_convention: {from plan.md header}
973
- workflow_mode: {from state.md or plan.md frontmatter}
974
- model_axis: {selected:<value> | inherited | not-applicable | host-auto; omit if unknown}
975
- effort_axis: {selected:<value> | provider-default | inherited | not-applicable | host-auto; omit if unknown}
976
- dispatch_policy: {economy | balanced | high | frontier | uncapped | inherit host defaults | legacy capped; omit if unknown}
977
- dispatch_ceiling: {resolved cap value; omit if none or unknown}
978
- policy_source: {repo config | project state | preflight prompt; omit if unknown}
979
- ceiling_source: {repo config | project state | preflight prompt; omit if unknown; compatibility alias for policy_source}
980
- provider_default_effort: {value | unknown | not-applicable; omit if unknown}
981
- dispatch_route_level: {integer route level; omit when no ordered route is in play}
982
- dispatch_target: {resolver target or host-specific dispatch target; omit if unknown}
983
- dispatch_stamp: {exact `Dispatch: ...` line written to Dispatch Notes; omit if not yet written}
984
- dispatch_rationale: {short rationale; omit if unknown}
985
- ```
1029
+ #### Resolve the Task Maximum
986
1030
 
987
- 2. Perform a pre-dispatch assertion against the host invocation parameters. The Phase Scope fields are audit/context fields; selected axes must also be represented in the actual host dispatch call.
988
- - Codex implementer/fix dispatch:
989
- - Before building the `spawn_agent` argument map, classify the phase complexity and choose preferred effort (`low`, `medium`, `high`, or `xhigh`), determine the current route level (Dispatch Profile floor or `0`), then call `oat project dispatch-ceiling resolve --provider codex --role implementer --preferred <preferred-effort> --escalation-level <route-level>`.
990
- - Build the `spawn_agent` argument map from `providers.codex.selection.selectedValue`, `providers.codex.dispatchArgs.variant`, and `providers.codex.selection.target` before logging the dispatch. If `providers.codex.target.crossHarness` is true, the resolver intentionally returns no native dispatch args; log the deferred target and use provider-default/base fallback only when that is the explicit selected fallback. If `effort_axis=selected:<value>`, the argument map MUST use the materialized Codex role name returned in `providers.codex.dispatchArgs.variant` as `agent_type`; do not re-derive an effort-only role name from the selected effort. Then derive the `OAT Dispatch:` block `Model axis:` and `Effort axis:` fields from resolver output and that same argument map.
991
- - Example selected payload shape: `agent_type: "oat-phase-implementer-gpt-5-6-sol-low"` and a Phase Scope message containing `model_axis: selected:gpt-5.6-sol` and `effort_axis: selected:low`.
992
- - Immediately after spawning, compare the returned Codex status line with the selected effort before waiting on the agent. If the spawned status reports a different effort than the selected value (for example, the log says `effort_axis=selected:medium` but the spawn result reports `gpt-5.5 high`), treat this as an orchestration deviation. Stop, record the deviation in `implementation.md`, and redispatch with corrected parameters before continuing. Do not use work from the mismatched dispatch.
993
- - If the resolver returns no `dispatchArgs.variant`, use base `agent_type: "oat-phase-implementer"` only for provider-default/base fallback and omit `reasoning_effort`. The dispatch rationale MUST say this is a base/unpinned fallback and include provider default effort when known. Use base `oat-phase-implementer` only when the resolver returns no `dispatchArgs.variant`.
994
- - Claude Code implementer/fix dispatch:
995
- - If `model_axis=selected:<value>`, the Task tool call MUST include `model: "<value>"`.
996
- - If `model_axis=inherited`, omit `model`.
1031
+ Before coordinator dispatch, read the project named ceiling from
1032
+ `state.md:oat_dispatch_policy.policy`. Then inspect the optional plan
1033
+ `## Dispatch Profile` row for this phase:
997
1034
 
998
- 3. Dispatch the selected implementer role (Tier 1 via provider-native subagent mechanism) — the resolver-returned materialized Codex role name in `providers.codex.dispatchArgs.variant`, or base `oat-phase-implementer` only when no variant is returned for provider-default fallback — with the Phase Scope block as input and with the asserted host invocation parameters.
1035
+ 1. An explicit phase `economy`, `balanced`, `high`, or `frontier` narrows the
1036
+ project maximum and sets `task_ceiling_source: phase`.
1037
+ 2. Blank, absent, or `auto` uses the project maximum and sets
1038
+ `task_ceiling_source: project`.
1039
+ 3. Reject an unknown tier or a phase tier above the project tier.
1040
+ 4. `uncapped` and explicit inherit/default retain their existing policy
1041
+ semantics and have no named `--ceiling-tier`; never synthesize one.
999
1042
 
1000
- 4. Receive the structured summary (DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED).
1043
+ The project or phase named ceiling is a maximum, not the coordinator target or
1044
+ an exact family preference. Under High, lower configured Economy, Balanced, and
1045
+ High candidates remain available for different tasks.
1001
1046
 
1002
- **Tier 2 dispatch (inline fallback):**
1047
+ #### Build and Dispatch Phase Scope
1003
1048
 
1004
- If Tier 2 is selected, do not dispatch. Instead:
1005
-
1006
- 1. Read `.agents/agents/oat-phase-implementer.md` for the phase-execution process.
1007
- 2. Execute that process yourself against the same Phase Scope.
1008
- 3. Produce an equivalent summary in your own context.
1009
-
1010
- #### Handling Implementer Status
1049
+ ```yaml
1050
+ project: {PROJECT_PATH}
1051
+ phase: {pNN}
1052
+ mode: implement
1053
+ artifact_paths:
1054
+ plan: {PROJECT_PATH}/plan.md
1055
+ design: {PROJECT_PATH}/design.md
1056
+ spec: {PROJECT_PATH}/spec.md
1057
+ implementation: {PROJECT_PATH}/implementation.md
1058
+ discovery: {PROJECT_PATH}/discovery.md
1059
+ workflow_mode: {spec-driven|quick|import}
1060
+ active_provider: {codex|claude|cursor|other}
1061
+ project_ceiling_tier: {named project maximum; omit when none}
1062
+ phase_ceiling_tier: {explicit narrower phase maximum; omit for auto/blank}
1063
+ task_ceiling_tier: {effective project or phase named ceiling}
1064
+ task_ceiling_source: {project|phase}
1065
+ commit_convention: {from plan.md}
1066
+ coordinator_target: {resolver-selected coordinator target}
1067
+ ```
1011
1068
 
1012
- - **DONE:** Proceed to phase review (Step below).
1013
- - **DONE_WITH_CONCERNS:** Read the concerns block. If any concern is correctness-related (bug, wrong behavior, missing requirement), address it before review — re-dispatch implementer with a targeted fix instruction. If concerns are advisory (e.g., "this file is getting large"), note them in `implementation.md` and proceed to review.
1014
- - **NEEDS_CONTEXT:** Provide the missing context (usually an artifact path or a cross-phase reference) and re-dispatch. This counts toward the retry limit.
1015
- - **BLOCKED:** STOP the run. Surface the block to the user with:
1016
- - Phase ID
1017
- - What the implementer reported as blocking
1018
- - Recommended next step (plan fix, external resolution, user guidance)
1019
- Do not proceed to subsequent phases while a phase is blocked.
1069
+ Tier 1 uses the already resolved exact coordinator role/model payload and sends
1070
+ the Phase Scope. A concrete Codex coordinator uses
1071
+ `providers.codex.dispatchArgs.variant`; when the registered role cannot be
1072
+ selected, use the fresh child pinned to the resolver's model and effort with
1073
+ canonical coordinator instructions. Claude and Cursor coordinator calls pass
1074
+ their exact resolver model argument.
1020
1075
 
1021
- #### Confidence-Based Dispatch Escalation
1076
+ Tier 2 may run the coordinator instructions in the current context only when
1077
+ that context can still dispatch every exact task worker. Tier 2 never permits
1078
+ the coordinator to edit ordinary task files. If no exact worker route exists,
1079
+ block before phase work.
1022
1080
 
1023
- Escalate the runtime dispatch control when there is evidence that the current control is underpowered:
1081
+ #### Per-Task Coordinator Contract
1024
1082
 
1025
- - implementer reports low confidence
1026
- - implementer reports a reasoning or capability blockage
1027
- - the same phase fails substantive review twice
1028
- - the fix loop repeats the same class of error
1083
+ For each task in dependency order, the coordinator must:
1029
1084
 
1030
- When escalation is needed:
1085
+ 1. Classify only that bounded task and choose one configured candidate at or
1086
+ below `task_ceiling_tier`.
1087
+ 2. Call the exact candidate resolver with the invocation-only named maximum:
1031
1088
 
1032
- 1. If a stronger available control exists, re-dispatch at the next stronger control and include the reason in the scope packet. The escalation ladder is provider-specific:
1033
- - **Route-backed matrix cells:** increment `--escalation-level` by one and re-resolve before using provider-specific ladders. The resolver's `providers.<provider>.target.routeLength` is the route bound; never advance past the final route entry.
1034
- - **Codex:** `selected:low -> selected:medium -> selected:high -> selected:xhigh`, capped by the resolved managed cap when one exists; managed `Uncapped` may select up to the preferred value; inherit/default mode has no OAT escalation control.
1035
- - **Claude Code:** `selected:haiku -> selected:sonnet -> selected:opus -> selected:fable`, capped by the resolved managed cap when one exists; managed `Uncapped` may select up to the preferred model; inherit/default mode has no OAT escalation control.
1036
- 2. Count the escalation redispatch against the existing bounded retry budget. Escalation changes the control; it does not create extra retry attempts.
1037
- 3. Record a compact formal stamp in `implementation.md` when practical; surrounding prose may describe why the route advanced, but the `Dispatch:` line itself must stay parseable:
1038
- - `Dispatch: scope=p03 action=implementation role=implementer producer=gpt-5.5-xhigh provenance=declared model_axis=selected:gpt-5.5-xhigh effort_axis=not-applicable dispatch_policy=high dispatch_ceiling=gpt-5.5-xhigh target=cursor`
1039
- - `Dispatch: scope=p03 action=implementation role=implementer producer=opus provenance=declared model_axis=selected:opus effort_axis=not-applicable dispatch_policy=high dispatch_ceiling=opus target=claude`
1040
- - `Dispatch: scope=p03 action=implementation role=implementer producer=unknown provenance=unknown model_axis=selected:gpt-5.6-sol effort_axis=selected:high dispatch_policy=high dispatch_ceiling=high target=oat-phase-implementer-gpt-5-6-sol-high`
1041
- - `Dispatch: scope=p02 action=implementation role=implementer producer=unknown provenance=unknown model_axis=host-auto effort_axis=host-auto dispatch_policy=unknown dispatch_ceiling=none target=unknown`
1042
- 4. If the phase is already at the strongest available control, do not invent a stronger tier. Provide more context, split the phase, revise the plan, or stop for user direction.
1089
+ ```bash
1090
+ oat project dispatch-ceiling resolve \
1091
+ --provider <active-provider> \
1092
+ --role implementer \
1093
+ --ceiling-tier <project-or-phase-named-tier> \
1094
+ --candidate-model <exact-model> \
1095
+ --report-scope <task-id> \
1096
+ --report-action implementation \
1097
+ --project-path "$PROJECT_PATH" \
1098
+ --json
1099
+ ```
1043
1100
 
1044
- #### Dispatch Retry (Transient Failures)
1101
+ Codex also passes `--candidate-effort <exact-effort>`. The returned top-level
1102
+ `source` must be `invocation`; `providers.<provider>.cellSource` continues to
1103
+ identify the config layer that owns the candidate definition. This command
1104
+ is read-only and must never persist its override.
1105
+
1106
+ 3. Build the actual provider invocation before logging:
1107
+ - Codex uses `providers.codex.dispatchArgs.variant` as `agent_type`, or the
1108
+ exact fresh pinned-child model/effort route when native role selection is
1109
+ unavailable.
1110
+ - Claude passes `providers.claude.dispatchArgs.model` as the actual Task
1111
+ `model`.
1112
+ - Cursor passes `providers.cursor.dispatchArgs.model` byte-for-byte as the
1113
+ actual invocation model. Treat the string as opaque and never normalize or
1114
+ infer capability from it.
1115
+ 4. Send one bounded Task Scope, never the full phase task list:
1116
+
1117
+ ```yaml
1118
+ mode: task-worker
1119
+ task_id: { one pNN-tNN ID }
1120
+ task_name: { task title }
1121
+ task_plan: { only this task's steps }
1122
+ file_boundary: { only this task's files }
1123
+ verification: { only this task's verification commands }
1124
+ commit_convention: { exact expected task commit }
1125
+ ceiling_tier: { effective named maximum }
1126
+ ceiling_source: { project|phase }
1127
+ dispatch_target: { resolver-returned exact target }
1128
+ dispatch_args: { complete actual provider payload }
1129
+ ```
1045
1130
 
1046
- If a Tier 1 dispatch fails (agent did not resolve, returned empty, etc.), retry exactly once. If the second attempt also fails, treat the phase as `failed` via the same mechanism as fix-loop retry exhaustion (see Step 7 below). Tier is never silently downgraded.
1131
+ 5. Dispatch one exact task worker and wait for its terminal result before the
1132
+ next task. Workers in the same worktree run serially; task fan-out is
1133
+ forbidden. Parallelism remains limited to plan-declared phase/worktree
1134
+ groups.
1135
+ 6. Verify the worker's task ID, result, tests, file boundary, clean worktree,
1136
+ and reported commit against `git rev-parse HEAD` and the pre-task HEAD. A
1137
+ worker must contribute exactly one verified task commit.
1138
+ 7. Record each task's exact target, result, and commit in the returned **Task
1139
+ Dispatch Summary**, then perform phase-wide verification and integration
1140
+ self-review without editing ordinary task files.
1141
+
1142
+ If a candidate is missing or absent, exceeds or is above the named ceiling, or
1143
+ cannot be invoked with exact controls, fail closed and block the phase. Never
1144
+ fall back or downgrade to the coordinator target, base role, or inferred
1145
+ provider default. A transient retry reuses the same complete provider payload;
1146
+ a substantive escalation re-resolves within the same named maximum and bounded
1147
+ retry limit.
1148
+
1149
+ #### Handling Coordinator Status
1150
+
1151
+ - **DONE:** verify the Task Dispatch Summary, then proceed to phase review.
1152
+ - **DONE_WITH_CONCERNS:** correctness concerns require a new bounded exact fix
1153
+ worker before review; advisory concerns are recorded.
1154
+ - **NEEDS_CONTEXT:** supply only the missing context and retry within the bound.
1155
+ - **BLOCKED:** stop and surface the phase, task, exact target, and reason. Do not
1156
+ proceed to later phases.
1047
1157
 
1048
1158
  ### Per-Phase Review
1049
1159
 
@@ -1053,8 +1163,11 @@ After the implementer returns DONE (or DONE_WITH_CONCERNS without correctness co
1053
1163
 
1054
1164
  - Use the same tier that was selected at start.
1055
1165
  - For Codex with a capped managed policy, dispatch the materialized reviewer role returned in `providers.codex.dispatchArgs.variant` for deterministic quality gates.
1166
+ - If that exact registered reviewer role is not selectable in the current host session, launch a fresh Codex child with explicit model, reasoning effort, and canonical role instructions from `.agents/agents/oat-reviewer.md`; never substitute the managed base role and never require restart/hot reload.
1056
1167
  - For Codex with managed `Uncapped` or inherit/default mode, no reviewer target exists; use base `oat-reviewer`, log `effort_axis=provider-default`, and explain that the base role follows the provider default.
1057
- - For Claude Code with a capped managed policy, pass the resolved cap as the review `model`; managed `Uncapped` or inherit/default mode omits `model` because no reviewer target exists. Always keep `effort_axis=not-applicable`.
1168
+ - For Claude Code with a capped managed policy, require `providers.claude.dispatchArgs.model` and pass that exact value as the review `model`; managed `Uncapped` or inherit/default mode omits `model` because no reviewer target exists. Always keep `effort_axis=not-applicable`.
1169
+ - For Cursor with a concrete managed reviewer target, require `providers.cursor.dispatchArgs.model` and pass that exact opaque, unnormalized string as the actual review invocation's `model` argument.
1170
+ - Build the actual provider invocation before logging the reviewer target. If the host cannot apply the required Claude or Cursor model argument, fail closed or block unless inline execution has verified equivalent current-host controls.
1058
1171
  - Tier 1: dispatch the selected reviewer target via provider-native subagent mechanism with Review Scope:
1059
1172
 
1060
1173
  ```
@@ -1077,11 +1190,11 @@ After the implementer returns DONE (or DONE_WITH_CONCERNS without correctness co
1077
1190
  ```
1078
1191
 
1079
1192
  - For Codex Tier 1 dispatches, send the Review Scope block as a self-contained packet and keep fresh context (`fork_context: false`). The reviewer is expected to reconstruct context from git state and the OAT artifacts listed above.
1080
- - For Codex Tier 1 review dispatches, use the materialized Codex role name from `providers.codex.dispatchArgs.variant` only when the resolver returns a reviewer variant for a capped managed policy. A Codex materialized reviewer role selected from a model+effort target must carry `model_axis=selected:<model>` and `effort_axis=selected:<effort>` from resolver output. Use base `oat-reviewer` only when the resolver returns no `dispatchArgs.variant` for managed `Uncapped`, inherit/default mode, or provider-default fallback, and log `effort_axis=provider-default`. For Claude Code review dispatches, do not pass a per-review effort override because the effort axis is not applicable; pass `model` only when the resolver returns a selected review model.
1193
+ - For Codex Tier 1 review dispatches, use the materialized Codex role name from `providers.codex.dispatchArgs.variant` only when the resolver returns a reviewer variant for a capped managed policy. A Codex materialized reviewer role selected from a model+effort target must carry `model_axis=selected:<model>` and `effort_axis=selected:<effort>` from resolver output. Use base `oat-reviewer` only when the resolver returns no `dispatchArgs.variant` for managed `Uncapped`, inherit/default mode, or provider-default fallback, and log `effort_axis=provider-default`. For Claude Code, pass `model: providers.claude.dispatchArgs.model` for a concrete managed reviewer and never pass a per-review effort override. For Cursor, pass `model: providers.cursor.dispatchArgs.model` byte-for-byte for a concrete managed reviewer.
1081
1194
  - Treat the commit range as authoritative for review scope. `files_changed` is optional orientation metadata only.
1082
- - If a Codex reviewer does not return a terminal result on the first wait, poll once more. If it still has not concluded, send one concise nudge to return immediately with current findings. If the reviewer still does not conclude, treat the Tier 1 review dispatch as failed for this phase and perform the review inline instead of waiting indefinitely.
1195
+ - If a reviewer does not return a terminal result on the first wait, poll once more. If it still has not concluded, send one concise nudge to return immediately with current findings. If the reviewer still does not conclude, treat the target-preserving review dispatch as failed for this phase. Retry the same exact role, pinned fresh-child route, or complete Claude/Cursor invocation payload within the retry bound, preserving the exact model argument; never downgrade a timed-out managed reviewer to unpinned inline execution.
1083
1196
 
1084
- - Tier 2: inline — read `.agents/agents/oat-reviewer.md` and perform the review yourself.
1197
+ - Tier 2: read `.agents/agents/oat-reviewer.md` and review inline only with verified equivalent current-host model and effort controls, explicit inherit/default behavior, or the documented managed-uncapped reviewer behavior. Otherwise block.
1085
1198
 
1086
1199
  **Verdict outcomes:**
1087
1200
 
@@ -1098,9 +1211,9 @@ On reviewer verdict `fail`, run a bounded fix loop.
1098
1211
 
1099
1212
  1. Read `oat_orchestration_retry_limit` from `state.md` frontmatter (default: `2`, range 0–5).
1100
1213
  2. For each retry (up to the limit):
1101
- a. Select/log fix dispatch axes from the fix scope, advance the route level by one after repeated review failure when the resolver reports an ordered target route, then perform the same pre-dispatch assertion used for implementation dispatch. A Codex fix dispatch with `effort_axis=selected:<value>` MUST use the materialized Codex role name returned in `providers.codex.dispatchArgs.variant`; a Claude Code fix dispatch with `model_axis=selected:<value>` MUST pass `model: "<value>"` on the Task call. Every fix dispatch writes the formal `Dispatch: scope=<phase-or-task> action=fix role=fix producer=<slug|unknown> provenance=<declared|observed|inferred|unknown> model_axis=<axis> effort_axis=<axis> dispatch_policy=<policy|unknown> dispatch_ceiling=<value|none> target=<target|unknown>` stamp before waiting on the implementer result.
1102
- b. Dispatch the selected phase implementer role in `fix` mode (Tier 1) OR read the agent and apply fixes inline (Tier 2), with: - `review_artifact`: the path written by the reviewer - `findings`: the Critical + Important findings list - `prior_summary`: the last implementer summary
1103
- c. Receive the fix summary.
1214
+ a. Convert Critical/Important findings into bounded fix scopes associated with one planned task/file boundary at a time. Do not hand one worker the full phase finding list.
1215
+ b. Reuse the phase coordinator in `fix` mode. It selects an exact candidate under the same project or phase named ceiling with `--ceiling-tier`, then emits one Task Scope per bounded fix. Codex uses `providers.codex.dispatchArgs.variant`; Claude and Cursor pass their exact `providers.<provider>.dispatchArgs.model` value on the actual invocation. Every fix worker writes the formal `Dispatch: scope=<phase-or-task> action=fix role=fix producer=<slug|unknown> provenance=<declared|observed|inferred|unknown> model_axis=<axis> effort_axis=<axis> dispatch_policy=<policy|unknown> dispatch_ceiling=<value|none> target=<target|unknown>` stamp before execution.
1216
+ c. Receive and verify each fix result and commit. The coordinator must not apply fixes itself, and Tier 2 does not authorize inline task edits.
1104
1217
  d. Re-dispatch the reviewer with the updated commit range.
1105
1218
  e. Parse the new verdict.
1106
1219
  f. If pass → exit the loop successfully.
@@ -1134,10 +1247,10 @@ If the gate is enabled and the current phase is selected:
1134
1247
  - Do not pass `--target` in normal execution; the existing gate config selects the cross-provider target.
1135
1248
  - The gate CLI injects gate context into the review prompt. The produced review artifact must use `oat_review_invocation: gate`.
1136
1249
 
1137
- 2. Parse the JSON result. The gate verdict (`exit_nonzero_on: {threshold}`) decides whether the phase **stops**; it does not decide whether sub-threshold findings are ignored. Either way the produced artifact must be **consumed** — passing gate artifacts are not left unprocessed at the top level of `reviews/`.
1138
- - `status: "ok"` / exit code `0` means the phase gate passed at the configured threshold, so the phase does not stop. Still run `oat-project-review-receive` for the reported artifact path in non-pausing **judgment-sweep** mode (pass gate-passed context so receive selects sweep disposition). The sweep makes a per-finding judgment for each Medium/Minor — defer to final (default), address now (small/contained/low-risk fixes only), or reject with rationale — writes those durable dispositions into `implementation.md`, and archives the artifact. Then continue without pausing. Address-now fixes from a passing gate do **not** re-trigger the standard reviewer or re-gate the phase.
1139
- - `status: "blocked"` / non-zero exit due to review findings means blocking findings exist. Run `oat-project-review-receive` for the reported artifact path (blocking disposition) before treating the gate review as consumed.
1140
- - A non-zero exit caused by target execution failure, artifact validation failure, or missing review artifact is an operational failure. Stop and surface the gate output; do not continue as if the gate passed.
1250
+ 2. Parse the JSON result. Before invoking review-receive, all three receive-eligibility conditions must hold: `status` is `ok` or `blocked`, the envelope explicitly sets `receiveEligible: true`, and `handoff` is non-null. A missing or contradictory field is an operational failure even when `artifactPath` is present. The gate verdict (`exit_nonzero_on: {threshold}`) decides whether the phase **stops**; it does not decide whether sub-threshold findings are ignored. Once eligibility is established, the produced artifact must be **consumed** — passing gate artifacts are not left unprocessed at the top level of `reviews/`.
1251
+ - With eligibility established, `status: "ok"` / exit code `0` means the phase gate passed at the configured threshold, so the phase does not stop. Run `oat-project-review-receive` for the reported artifact path in non-pausing **judgment-sweep** mode (pass gate-passed context so receive selects sweep disposition). The sweep makes a per-finding judgment for each Medium/Minor — defer to final (default), address now (small/contained/low-risk fixes only), or reject with rationale — writes those durable dispositions into `implementation.md`, and archives the artifact. Then continue without pausing. Address-now fixes from a passing gate do **not** re-trigger the standard reviewer or re-gate the phase.
1252
+ - With eligibility established, `status: "blocked"` / non-zero exit due to review findings means blocking findings exist. Run `oat-project-review-receive` for the reported artifact path (blocking disposition) before treating the gate review as consumed.
1253
+ - Any other status, or a non-zero exit caused by target execution failure, artifact validation failure, or missing review artifact, is an operational failure. Stop and surface the gate output; do not continue as if the gate passed.
1141
1254
 
1142
1255
  3. If `oat-project-review-receive` adds fix tasks (blocking gate, or a sweep address-now fix that revealed a Critical/Important concern):
1143
1256
  - Return to task execution for the newly added review-fix tasks.
@@ -1153,18 +1266,18 @@ For a parallel group, run selected phase gates after fan-in and bookkeeping, one
1153
1266
 
1154
1267
  When the current schedule entry is a multi-phase group, execute as follows.
1155
1268
 
1156
- **Tier 2 degradation:** If Tier 2 was selected at skill start, Tier 2 cannot run concurrent subagents. Degrade the entire group to sequential inline execution — run each phase in the group sequentially on the orchestration branch. Do not create worktrees. Proceed through the per-phase loop (dispatch / review / fix-loop / bookkeeping) for each phase in plan order.
1269
+ **Tier 2 degradation:** If Tier 2 was selected at skill start, Tier 2 cannot run concurrent subagents. Degrade the group to sequential target-preserving execution on the orchestration branch. Do not create worktrees. For every phase, retain the exact role or pinned fresh child; inline is permitted only by the verified-equivalent-controls or documented-exception guard. Proceed through the per-phase loop in plan order.
1157
1270
 
1158
1271
  **Tier 1 parallel execution:**
1159
1272
 
1160
1273
  1. **Bootstrap worktrees:** for each phase in the group, invoke `oat-worktree-bootstrap-auto` with branch name `{project-name}/{pNN}` and base = orchestration branch.
1161
1274
 
1162
1275
  > ⚠️ **CRITICAL — DO NOT substitute host-native worktree primitives.** Bootstrap MUST go through `oat-worktree-bootstrap-auto` with an explicit `--base` set to the current orchestration branch HEAD (capture `EXPECTED_HEAD=$(git rev-parse HEAD)` from the orchestration cwd before dispatching). Do not use Claude Code's `Agent({ isolation: "worktree" })`, Cursor's equivalent, or any other host-native isolation primitive in lieu of this skill — those mechanisms may use the primary repo's checkout (often `main`) as the base regardless of the orchestrator's current branch, silently producing a worktree that cannot see prior phase commits and forcing the entire group to degrade to sequential.
1163
- - If **any** bootstrap fails, cancel any worktrees that bootstrapped successfully for this group and degrade the whole group to sequential inline execution. Log the degradation reason to `implementation.md` Outstanding Items.
1276
+ - If **any** bootstrap fails, cancel any worktrees that bootstrapped successfully for this group and degrade the whole group to sequential target-preserving execution. Log the degradation reason to `implementation.md` Outstanding Items.
1164
1277
 
1165
- 2. **Verify worktree HEAD before dispatch (base-mismatch gate):** After bootstrap, verify each worktree is at the expected orchestration HEAD. From the orchestration cwd, capture `EXPECTED_HEAD=$(git rev-parse HEAD)` _before_ invoking bootstrap. After bootstrap, for each new worktree path, run `git -C {worktree-path} rev-parse HEAD` and confirm it matches `EXPECTED_HEAD`, or run `git -C {worktree-path} merge-base --is-ancestor "$EXPECTED_HEAD" HEAD` and confirm it succeeds (exit 0). If either check fails for any phase, treat the bootstrap as failed for that phase, cancel any successful sibling worktrees in this group, and degrade the entire group to sequential inline execution — same mechanism as a primary bootstrap failure. Log the mismatch to `implementation.md` Outstanding Items, including the observed and expected SHAs (`expected={EXPECTED_HEAD}, observed={observed-head-sha}, phase={pNN}, worktree={path}`).
1278
+ 2. **Verify worktree HEAD before dispatch (base-mismatch gate):** After bootstrap, verify each worktree is at the expected orchestration HEAD. From the orchestration cwd, capture `EXPECTED_HEAD=$(git rev-parse HEAD)` _before_ invoking bootstrap. After bootstrap, for each new worktree path, run `git -C {worktree-path} rev-parse HEAD` and confirm it matches `EXPECTED_HEAD`, or run `git -C {worktree-path} merge-base --is-ancestor "$EXPECTED_HEAD" HEAD` and confirm it succeeds (exit 0). If either check fails for any phase, treat the bootstrap as failed for that phase, cancel any successful sibling worktrees in this group, and degrade the entire group to sequential target-preserving execution — same mechanism as a primary bootstrap failure. Log the mismatch to `implementation.md` Outstanding Items, including the observed and expected SHAs (`expected={EXPECTED_HEAD}, observed={observed-head-sha}, phase={pNN}, worktree={path}`).
1166
1279
 
1167
- 3. **Concurrent dispatch:** for each successfully bootstrapped worktree (passing the base-mismatch gate above), dispatch `oat-phase-implementer` (with the worktree as working directory) concurrently. Each dispatch runs the per-phase loop internally (implementer reviewer fix-loop).
1280
+ 3. **Concurrent phase dispatch:** for each successfully bootstrapped worktree (passing the base-mismatch gate above), dispatch one `oat-phase-implementer` coordinator with the worktree as its working directory. Coordinators may run concurrently across these plan-declared phase worktrees, but every coordinator dispatches its own task workers serially in that one worktree. The outer orchestration loop retains review and bounded-fix handling.
1168
1281
 
1169
1282
  4. **Wait for all phases:** do not proceed until every phase in the group reports a terminal verdict (pass or excluded).
1170
1283
 
@@ -1209,7 +1322,7 @@ When the current schedule entry is a multi-phase group, execute as follows.
1209
1322
 
1210
1323
  d. Parse the subagent's return status: - `RESOLVED` → subagent has committed the merge; orchestrator proceeds to integration verification (Step 6) and the next phase in the group. - `UNRESOLVABLE` or `VERIFICATION_FAILED` → STOP the run. Surface to user with phase ID, conflicting files, worktree path, subagent's reasoning summary. Do not merge remaining phases.
1211
1324
 
1212
- **Tier 2 (inline) exception:** In Tier 2 runs, parallel groups already degrade to sequential, so fan-in conflicts don't arise from this code path. If a conflict ever surfaces in Tier 2 (e.g., from another operation), the orchestrator resolves inline since the whole run is already inline consistent with Tier 2 semantics.
1325
+ **Tier 2 conflict exception:** In Tier 2 runs, parallel groups already degrade to sequential, so fan-in conflicts do not arise from this code path. If a conflict surfaces from another operation, inline resolution is allowed only when the current-host controls satisfy the same verified-equivalence or documented-exception guard; otherwise stop for a target-preserving route.
1213
1326
 
1214
1327
  6. **Integration verification after each merge:**
1215
1328
 
@@ -1567,12 +1680,27 @@ echo "$FINAL_ROW"
1567
1680
 
1568
1681
  **Workflow preference check (before prompting):**
1569
1682
 
1683
+ First resolve the final reviewer target with the same target-first contract as
1684
+ per-phase review. A concrete managed Codex target must use its exact registered
1685
+ reviewer or an explicitly pinned fresh child. A concrete managed Claude or
1686
+ Cursor target must put `providers.claude.dispatchArgs.model` or
1687
+ `providers.cursor.dispatchArgs.model` respectively into the actual provider
1688
+ invocation as the exact `model` argument; Cursor strings remain opaque. On
1689
+ timeout or retry, preserve the same exact role or complete invocation payload,
1690
+ including the model argument. If the host cannot apply the required role or
1691
+ model argument, fail closed or block unless verified equivalent current-host
1692
+ controls permit inline execution. The preference below chooses only among
1693
+ routes that preserve that target; it cannot authorize generic inline or base
1694
+ execution. Inline remains available only with verified equivalent current-host
1695
+ controls or an allowed explicit inherit/default or managed-uncapped reviewer
1696
+ base-role exception.
1697
+
1570
1698
  ```bash
1571
1699
  REVIEW_MODEL=$(oat config get workflow.reviewExecutionModel 2>/dev/null || true)
1572
1700
  ```
1573
1701
 
1574
1702
  - **If `REVIEW_MODEL` is `subagent`:** Print `Review execution: subagent (from workflow.reviewExecutionModel).` Dispatch the review subagent directly via the Task tool. No prompt.
1575
- - **If `REVIEW_MODEL` is `inline`:** Print `Review execution: inline (from workflow.reviewExecutionModel).` Run the review in-context per `oat-project-review-provide` skill. No prompt.
1703
+ - **If `REVIEW_MODEL` is `inline`:** Honor it only when the inline route satisfies the verified-equivalent-controls or documented-exception guard. Otherwise use the exact/pinned route or block. When allowed, print `Review execution: inline (from workflow.reviewExecutionModel).` and run the review in-context per `oat-project-review-provide`.
1576
1704
  - **If `REVIEW_MODEL` is `fresh-session`:** This is a **soft preference with escape hatch** because the agent cannot run the review in a fresh session on the user's behalf. Print the guidance block below, then handle the user's response per the three outcomes listed after it.
1577
1705
  - **If unset or invalid:** Fall through to the standard 3-tier prompt below.
1578
1706
 
@@ -1595,7 +1723,7 @@ Enter 1 or 2 to run the review here, or press Enter to wait.
1595
1723
  **Fresh-session response outcomes:**
1596
1724
 
1597
1725
  - User enters `1` → dispatch the subagent review (same behavior as `REVIEW_MODEL=subagent`).
1598
- - User enters `2` → run the review inline (same behavior as `REVIEW_MODEL=inline`).
1726
+ - User enters `2` → apply the same guarded inline behavior as `REVIEW_MODEL=inline`; this choice does not waive managed target controls.
1599
1727
  - User presses Enter (or equivalent no-input confirmation) → pause the session and wait for the fresh-session review to complete before continuing.
1600
1728
 
1601
1729
  **Standard prompt (when preference is unset):**
@@ -1608,7 +1736,7 @@ Implementation complete. Final review required.
1608
1736
  Review options:
1609
1737
  1. Run review in this session via a subagent (recommended if provider supported)
1610
1738
  2. Run review in a fresh session and return to this session to receive review
1611
- 3. Run review inline
1739
+ 3. Run review inline when current-host controls are verified equivalent
1612
1740
 
1613
1741
  To run in a separate session use: oat-project-review-provide code final
1614
1742
  ```
@@ -1617,7 +1745,7 @@ To run in a separate session use: oat-project-review-provide code final
1617
1745
 
1618
1746
  - If subagent (option 1): Agent spawns the review via Task tool — no command needed from user
1619
1747
  - If fresh session (option 2): User runs `oat-project-review-provide code final` in a separate session, then returns here
1620
- - If inline (option 3): Agent executes the review directly per oat-project-review-provide skill
1748
+ - If inline (option 3): Agent first verifies equivalent current-host controls or an allowed exception, then executes the review per `oat-project-review-provide`; otherwise it uses the exact/pinned route or blocks
1621
1749
  - After review: User runs `oat-project-review-receive` to process findings
1622
1750
  - If Critical/Important findings: Fix tasks added, re-run the `oat-project-implement` skill
1623
1751
  - Loop until final review passes (max 3 cycles per oat-project-review-receive)
@@ -1721,24 +1849,37 @@ Before reporting this skill as complete, run the configured gate as the final st
1721
1849
 
1722
1850
  If the command returns JSON `null`, no gate is configured; the skill is complete.
1723
1851
 
1724
- 2. If a gate config is returned, run its `command` exactly as configured. Capture stdout, stderr, and the exit code. A zero exit code means the gate passed and the skill is complete.
1852
+ 2. Export the resolved project path into the command shell:
1853
+
1854
+ ```bash
1855
+ export PROJECT_PATH
1856
+ ```
1857
+
1858
+ If the resolved command invokes `oat gate review`, the configured review command must already include `--project "$PROJECT_PATH"` and must not include `--target <id>`. A valid reusable shape is `oat gate review --project "$PROJECT_PATH" ...`. If the declaration is missing, stop and migrate the stored gate command; do not inject or append arguments at execution time.
1859
+
1860
+ 3. Execute the resolved command exactly as configured. Capture stdout, stderr, the exit code, and the structured JSON result. A zero exit code means the review passed its threshold, but it does not by itself authorize artifact receipt or complete the handoff.
1725
1861
 
1726
- 3. Review-artifact handoff:
1727
- - If the gate reports a produced review artifact, the host must run `oat-project-review-receive` to receive and disposition that artifact before treating the review as consumed.
1728
- - This applies to `oat gate review ...` outputs regardless of whether the gate ultimately exits zero or nonzero; the command output owns the exact artifact path, and receive-review owns disposition and archival.
1862
+ 4. Review-artifact handoff:
1863
+ - Parse the structured gate result. An exit code or artifact path alone never authorizes `oat-project-review-receive`.
1864
+ - Invoke receive only when all three conditions hold: `status` is `ok` or `blocked`, the envelope explicitly sets `receiveEligible: true`, and a non-null `handoff` confirms the artifact was corroborated.
1865
+ - `receiveEligible: false` is a hard stop even when `artifactPath` is present. Never receive `targeting_correlation_failed`; correct the project/run routing and run a new gate.
1866
+ - Keep `artifact_validation_failed` outside receive until the artifact is corrected and the gate successfully revalidates it. Treat `review_failed`, unknown statuses, null handoffs, and contradictory eligibility fields as operational failures.
1867
+ - `blocked` exits nonzero but is receive-eligible; `ok` exits zero and still requires durable receive disposition. Route by structured status and eligibility, not by exit code.
1729
1868
 
1730
- 4. If the command exits nonzero, use `description` to orient the next steps and handle `onFailure`:
1869
+ 5. If the command exits nonzero, use `description` to orient the next steps and handle `onFailure`:
1731
1870
  - `block`: read gate feedback, remediate, and re-run the gate up to `maxAttempts` attempts (default `2`). If attempts are exhausted, escalate to the human with accumulated feedback and append that feedback to `implementation.md`. Treat a launch failure, missing CLI, or no eligible runtime as escalation-biased and do not spend it as a remediation attempt.
1732
1871
  - `prompt`: surface the gate failure and ask the human how to proceed.
1733
1872
  - `warn`: record the gate failure and continue.
1734
1873
 
1735
- 5. Runtime selection note (V1): the step runs the gate `command` as-is and reads no OAT runtime env var. By default, `oat gate review` and `oat gate cross-provider-exec` resolve the current host from built-in `hostDetectionCommand`s and avoid the same runtime when no exact target is supplied. Reusable lifecycle skill-gate commands should normally omit `--target <id>` so independent review stays provider-neutral. Use explicit targets only for manual/debug commands or deliberate local/user-specific overrides; do not hardcode provider/model targets in bundled skill guidance or shared lifecycle gate examples.
1874
+ 6. Runtime selection note (V1): the step runs the gate `command` as-is and reads no OAT runtime env var. By default, `oat gate review` and `oat gate cross-provider-exec` resolve the current host from built-in `hostDetectionCommand`s and avoid the same runtime when no exact target is supplied. Reusable lifecycle skill-gate commands must not include `--target <id>` so independent review stays provider-neutral. Use explicit targets only for manual/debug commands or deliberate local/user-specific overrides; do not hardcode provider/model targets in bundled skill guidance or shared lifecycle gate examples.
1736
1875
 
1737
1876
  ## Success Criteria
1738
1877
 
1739
- - All tasks executed in order
1878
+ - One exact target-pinned worker executed each task in dependency order
1879
+ - The phase coordinator did not implement ordinary task work in its own context
1880
+ - Same-worktree task workers ran serially; only plan-declared phase worktrees ran in parallel
1740
1881
  - TDD discipline followed
1741
- - Each task has a commit
1882
+ - Each task result and commit was verified against HEAD and its file boundary
1742
1883
  - Implementation.md tracks all progress
1743
1884
  - Final verification passes
1744
1885
  - Final review passes (no Critical/Important findings)