@open-agent-toolkit/cli 0.1.42 → 0.1.45

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 (60) hide show
  1. package/assets/agents/oat-phase-implementer.md +11 -7
  2. package/assets/agents/oat-reviewer.md +6 -4
  3. package/assets/config/dispatch-matrix-recommendation.json +23 -0
  4. package/assets/docs/cli-utilities/configuration.md +95 -40
  5. package/assets/docs/cli-utilities/workflow-gates.md +79 -16
  6. package/assets/docs/contributing/code.md +10 -4
  7. package/assets/docs/contributing/hooks-and-safety.md +23 -0
  8. package/assets/docs/reference/oat-directory-structure.md +26 -24
  9. package/assets/docs/workflows/projects/dispatch-ceiling.md +193 -80
  10. package/assets/docs/workflows/projects/implementation-execution.md +68 -45
  11. package/assets/docs/workflows/projects/index.md +2 -2
  12. package/assets/docs/workflows/projects/lifecycle.md +17 -2
  13. package/assets/public-package-versions.json +4 -4
  14. package/assets/skills/oat-project-implement/SKILL.md +232 -100
  15. package/assets/skills/oat-project-plan/SKILL.md +80 -30
  16. package/assets/skills/oat-project-plan-writing/SKILL.md +10 -10
  17. package/assets/skills/oat-project-quick-start/SKILL.md +80 -30
  18. package/assets/templates/plan.md +4 -4
  19. package/assets/templates/state.md +12 -3
  20. package/dist/commands/config/index.d.ts +6 -0
  21. package/dist/commands/config/index.d.ts.map +1 -1
  22. package/dist/commands/config/index.js +432 -11
  23. package/dist/commands/doctor/index.d.ts +6 -1
  24. package/dist/commands/doctor/index.d.ts.map +1 -1
  25. package/dist/commands/doctor/index.js +138 -4
  26. package/dist/commands/gate/index.d.ts +39 -2
  27. package/dist/commands/gate/index.d.ts.map +1 -1
  28. package/dist/commands/gate/index.js +343 -30
  29. package/dist/commands/internal/cursor-current-target.d.ts +37 -0
  30. package/dist/commands/internal/cursor-current-target.d.ts.map +1 -0
  31. package/dist/commands/internal/cursor-current-target.js +228 -0
  32. package/dist/commands/internal/index.d.ts.map +1 -1
  33. package/dist/commands/internal/index.js +2 -0
  34. package/dist/commands/project/dispatch-ceiling/index.d.ts.map +1 -1
  35. package/dist/commands/project/dispatch-ceiling/index.js +646 -56
  36. package/dist/config/dispatch-ceiling-preset.d.ts +37 -1
  37. package/dist/config/dispatch-ceiling-preset.d.ts.map +1 -1
  38. package/dist/config/dispatch-ceiling-preset.js +20 -0
  39. package/dist/config/oat-config.d.ts +25 -6
  40. package/dist/config/oat-config.d.ts.map +1 -1
  41. package/dist/config/oat-config.js +123 -11
  42. package/dist/config/resolve.d.ts.map +1 -1
  43. package/dist/config/resolve.js +16 -0
  44. package/dist/manifest/manifest.types.d.ts +12 -12
  45. package/dist/providers/ceiling/registry.d.ts.map +1 -1
  46. package/dist/providers/ceiling/registry.js +22 -1
  47. package/dist/providers/codex/codec/sync-extension.js +1 -1
  48. package/dist/providers/identity/availability.d.ts +22 -0
  49. package/dist/providers/identity/availability.d.ts.map +1 -0
  50. package/dist/providers/identity/availability.js +119 -0
  51. package/dist/providers/identity/family.d.ts +13 -0
  52. package/dist/providers/identity/family.d.ts.map +1 -0
  53. package/dist/providers/identity/family.js +32 -0
  54. package/dist/providers/identity/provenance.d.ts +21 -0
  55. package/dist/providers/identity/provenance.d.ts.map +1 -0
  56. package/dist/providers/identity/provenance.js +65 -0
  57. package/dist/providers/identity/stamp.d.ts +35 -0
  58. package/dist/providers/identity/stamp.d.ts.map +1 -0
  59. package/dist/providers/identity/stamp.js +171 -0
  60. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  {
2
- "cli": "0.1.42",
3
- "docs-config": "0.1.42",
4
- "docs-theme": "0.1.42",
5
- "docs-transforms": "0.1.42"
2
+ "cli": "0.1.45",
3
+ "docs-config": "0.1.45",
4
+ "docs-theme": "0.1.45",
5
+ "docs-transforms": "0.1.45"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oat-project-implement
3
- version: 2.0.25
3
+ version: 2.0.28
4
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.
5
5
  oat_gateable: true
6
6
  argument-hint: '[--retry-limit <N>] [--dry-run]'
@@ -163,12 +163,14 @@ Forbidden: Selected: Tier 2 — Inline because the user did not separately menti
163
163
 
164
164
  **Legacy state migration:** If `state.md` contains `oat_execution_mode: subagent-driven`, silently ignore it. On the next bookkeeping write, remove that key. Do not redirect to `oat-project-subagent-implement` — that skill is deprecated.
165
165
 
166
- ### Dispatch Ceiling Preflight
166
+ ### Dispatch Policy Preflight
167
167
 
168
- Before any phase work, resolve and print the OAT dispatch ceiling. This is a
168
+ Before any phase work, resolve and print the OAT dispatch policy. This is a
169
169
  preflight gate, not a mid-run question.
170
170
 
171
- Use the CLI resolver as the source of truth:
171
+ Use the CLI resolver as the source of truth. The command name remains
172
+ `dispatch-ceiling` for compatibility, but the returned contract is dispatch
173
+ policy:
172
174
 
173
175
  ```bash
174
176
  oat project dispatch-ceiling resolve --provider <active-provider> --preflight --json
@@ -182,10 +184,12 @@ pnpm run cli -- project dispatch-ceiling resolve --provider <active-provider> --
182
184
 
183
185
  Resolution order:
184
186
 
185
- 1. Config keys `workflow.dispatchCeiling.providers.<provider>` (local > shared > user)
186
- 2. Project `state.md` frontmatter key `oat_dispatch_ceiling`
187
- 3. Interactive implementation preflight prompt (below)
188
- 4. Non-interactive unresolved: block before work starts
187
+ 1. Config keys `workflow.dispatchPolicy.mode` / `workflow.dispatchPolicy.policy` (local > shared > user)
188
+ 2. Compatibility config keys `workflow.dispatchCeiling.providers.<provider>` (local > shared > user)
189
+ 3. Project `state.md` frontmatter key `oat_dispatch_policy`
190
+ 4. Legacy project `state.md` frontmatter key `oat_dispatch_ceiling`
191
+ 5. Interactive implementation preflight prompt (below)
192
+ 6. Non-interactive unresolved: block before work starts
189
193
 
190
194
  **JSON response shape** (from `--json`):
191
195
 
@@ -194,6 +198,8 @@ Resolution order:
194
198
  "status": "resolved",
195
199
  "provider": "codex",
196
200
  "value": "high",
201
+ "policyMode": "managed",
202
+ "policy": "balanced",
197
203
  "source": "project-state",
198
204
  "preset": "balanced",
199
205
  "unresolved": false,
@@ -209,7 +215,10 @@ Resolution order:
209
215
  "role": "implementer",
210
216
  "preferredValue": null,
211
217
  "selectedValue": "high",
212
- "capped": false
218
+ "capped": false,
219
+ "selectionMode": "capped",
220
+ "policyMode": "managed",
221
+ "policy": "balanced"
213
222
  }
214
223
  }
215
224
  }
@@ -220,58 +229,88 @@ Read `providers.<active-provider>` for the concrete dispatch controls. The
220
229
  `dispatchArgs` field carries the provider-specific argument to pass through
221
230
  (Codex: `variant` name; Claude: `model` string). For implementer/fix dispatch,
222
231
  pass `--preferred <preferred-effort>` and use `selection.selectedValue` as the
223
- selected axis value. Never re-derive these from the preset label or a ceiling-only
224
- variant the resolver is the single compilation/join point.
232
+ selected axis value when it is present. Never re-derive these from the policy
233
+ label or a ceiling-only variant - the resolver is the single compilation/join
234
+ point.
225
235
 
226
236
  Print before phase work:
227
237
 
228
238
  ```text
229
- Dispatch ceiling: high (codex, enforced — pinned-variant)
230
- Source: project state | Preset: balanced
239
+ Dispatch policy: balanced (codex, managed capped — pinned-variant)
240
+ Resolved cap: high
241
+ Source: project state
231
242
  Provider default effort: medium
232
- Note: OAT will use pinned subagent variants up to high. Base/unpinned roles resolve through the provider default.
243
+ Note: OAT will use pinned subagent variants up to high. Base/unpinned roles resolve through the provider default only on fallback paths.
233
244
  ```
234
245
 
235
- If no ceiling resolves and the session is interactive, present the preset
236
- prompt once before starting work:
246
+ If no policy resolves and the session is interactive, present the dispatch
247
+ policy prompt once before starting work:
237
248
 
238
249
  ```text
239
- No dispatch ceiling is configured for this project.
250
+ No dispatch policy is configured for this project.
240
251
 
241
- Set the dispatch ceilingthe maximum subagent tier OAT may use.
252
+ Set the dispatch policyhow OAT should choose subagent model/effort controls.
242
253
 
243
- 1. Balanced (recommended) — Codex: high · Claude: sonnet
244
- 2. Maximum — Codex: xhigh · Claude: opus (reviews always run at this tier)
245
- 3. Cost-conscious — Codex: medium · Claude: sonnet
246
- 4. Advanced set per provider
247
- 5. No ceiling
254
+ Managed capped policies:
255
+ 1. Economy — Codex: medium · Claude: sonnet
256
+ 2. Balanced — Codex: high · Claude: sonnet (recommended)
257
+ 3. High Codex: xhigh · Claude: opus
258
+ 4. Frontier — Codex: xhigh · Claude: fable
248
259
 
249
- OAT applies this where the provider exposes a reliable mechanism (Codex: pinned
250
- variants; Claude: Task model parameter). Other providers may treat it as advisory.
260
+ Managed uncapped:
261
+ 5. Uncapped OAT selects the preferred implementer/fix target without a stored maximum cap.
262
+
263
+ Host defaults:
264
+ 6. Inherit Host Defaults — OAT does not select model/effort controls.
265
+
266
+ OAT applies managed policies where the provider exposes a reliable mechanism
267
+ (Codex: pinned variants; Claude: Task model parameter). Other providers may
268
+ treat managed policies as advisory.
251
269
  ```
252
270
 
253
- **Preset selection** persists `preset` + compiled per-provider values. On
254
- selection, print the exact compiled result (e.g., "Ceiling set: balanced
255
- Codex: high · Claude: sonnet") before proceeding.
271
+ **Managed capped policy selection (options 1-4)** persists `mode: managed`,
272
+ `policy`, and the compiled provider targets. On selection, print the exact
273
+ compiled result (e.g., "Dispatch policy set: balanced -> Codex: high · Claude:
274
+ sonnet") before proceeding.
256
275
 
257
- **Advanced (option 4)** prompts for each provider's value individually, then
258
- persists `providers` + `source` only no `preset` key.
276
+ **Uncapped (option 5)** persists explicit managed uncapped state. It does not
277
+ write provider caps, and it must not be represented by leaving dispatch policy
278
+ state absent.
259
279
 
260
- **No ceiling (option 5)** leaves `oat_dispatch_ceiling` unset; implementer
261
- subagents run at provider defaults.
280
+ **Inherit Host Defaults (option 6)** persists explicit inherit/default state.
281
+ Use this only when the user wants OAT to leave implementation, fix, and review
282
+ model/effort controls to the executing host/provider.
262
283
 
263
284
  Persist in project `state.md` frontmatter using the normalized shape:
264
285
 
265
286
  ```yaml
266
- oat_dispatch_ceiling:
267
- preset: balanced # omit when Advanced was chosen
287
+ oat_dispatch_policy:
288
+ mode: managed
289
+ policy: balanced
268
290
  providers:
269
291
  codex: high
270
292
  claude: sonnet
271
293
  source: project-state
272
294
  ```
273
295
 
274
- If no ceiling resolves and `OAT_NON_INTERACTIVE=1` or no user-response channel
296
+ For `Uncapped`:
297
+
298
+ ```yaml
299
+ oat_dispatch_policy:
300
+ mode: managed
301
+ policy: uncapped
302
+ source: project-state
303
+ ```
304
+
305
+ For `Inherit Host Defaults`:
306
+
307
+ ```yaml
308
+ oat_dispatch_policy:
309
+ mode: inherit
310
+ source: project-state
311
+ ```
312
+
313
+ If no policy resolves and `OAT_NON_INTERACTIVE=1` or no user-response channel
275
314
  exists, rerun the resolver with non-interactive behavior and stop before work
276
315
  starts if it blocks:
277
316
 
@@ -280,11 +319,11 @@ oat project dispatch-ceiling resolve --provider <active-provider> --preflight --
280
319
  ```
281
320
 
282
321
  ```text
283
- BLOCKED: Codex dispatch ceiling is unresolved in non-interactive mode.
284
- Set workflow.dispatchCeiling.providers.codex in .oat/config.json or oat_dispatch_ceiling in project state.
322
+ BLOCKED: Codex dispatch policy is unresolved in non-interactive mode.
323
+ Set workflow.dispatchPolicy.mode/workflow.dispatchPolicy.policy, workflow.dispatchCeiling.providers.codex, oat_dispatch_policy, or legacy oat_dispatch_ceiling.
285
324
  ```
286
325
 
287
- Dry-run mode must report the unresolved ceiling and planned behavior without
326
+ Dry-run mode must report the unresolved policy and planned behavior without
288
327
  modifying project state.
289
328
 
290
329
  ### Runtime dispatch selection
@@ -296,12 +335,29 @@ dispatch selection decides model/effort controls for the specific work.
296
335
 
297
336
  Use these inputs:
298
337
 
299
- - resolved dispatch ceiling and source
338
+ - resolved dispatch policy, source, and provider-specific selection
300
339
  - phase ID and phase scope
301
340
  - optional `## Dispatch Profile` row in `plan.md`
302
341
  - host-exposed provider controls, by axis
303
342
  - prior outcomes for the phase, including review results and failed retries
304
343
 
344
+ Route selection is part of runtime dispatch selection when the resolver returns
345
+ an ordered matrix route:
346
+
347
+ - Start every implementation/fix scope at route level `0` unless the plan's
348
+ `## Dispatch Profile` names a different starting route level for that
349
+ phase/task. Level `0` is the route floor.
350
+ - Pass `--escalation-level <route-level>` on implementer/fix resolver calls.
351
+ Single-axis providers ignore this flag and keep their normal capped `min()`
352
+ behavior.
353
+ - Read `providers.<provider>.target` and `providers.<provider>.selection.target`
354
+ from resolver JSON when present. A target with `crossHarness: true` is an
355
+ explicit deferred cross-harness target: log it as advisory and do not invent a
356
+ same-harness fallback.
357
+ - On repeated review failure or retry-loop escalation, advance by one route
358
+ entry before retrying, up to the last available route entry and within
359
+ `oat_orchestration_retry_limit`.
360
+
305
361
  Axis states:
306
362
 
307
363
  - `selected:<value>` - host exposes the axis and the orchestrator chose a value.
@@ -317,19 +373,29 @@ Codex rules:
317
373
  - `low`: trivial docs-only, narrow single-file, or mechanical changes
318
374
  - `medium`: normal multi-file implementation and moderate integration risk
319
375
  - `high`: broad architecture, security/auth/redaction boundaries, subtle state behavior, or repeated substantive review failures
320
- - `xhigh`: highest-risk work that requires the configured ceiling to allow xhigh
321
- 3. Selected effort is `min(preferred, resolved_ceiling)` for implementer/fix work.
322
- 4. For implementer/fix dispatch: call `oat project dispatch-ceiling resolve --provider codex --role implementer --preferred <preferred-effort>`; read `providers.codex.selection.selectedValue` and `providers.codex.dispatchArgs.variant` for the selected role name (e.g., `oat-phase-implementer-medium`). The resolver caps the preferred effort against the ceiling; never pass a ceiling-only implementer variant when `selection.selectedValue` is lower.
323
- 5. For review dispatch: call `oat project dispatch-ceiling resolve --provider codex --role reviewer`; read `providers.codex.dispatchArgs.variant` for the reviewer role name (e.g., `oat-reviewer-high`). Reviewer always targets the ceiling for deterministic quality gate behavior.
324
- 6. Use base/unpinned Codex roles only as a fallback or explicit provider-default choice. Log `Selected effort: provider-default`, display provider default effort when known, and do not describe this as parent-ceiling inheritance.
325
- 7. Do not use top-level per-call `reasoning_effort` as the standard OAT selected-effort path; dogfooding showed that path can be inconsistent.
376
+ - `xhigh`: highest-risk work that requires a capped policy to allow xhigh or a managed `Uncapped` policy to select it
377
+ 3. For capped managed implementer/fix work, selected effort is `min(preferred, resolved_cap)`.
378
+ 4. For managed `Uncapped` implementer/fix work, selected effort is the preferred effort with no cap.
379
+ 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.
380
+ 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`, and any `providers.codex.target` for the selected role name or route target. Never pass a cap-only implementer variant when `selection.selectedValue` is lower.
381
+ 7. For review dispatch: call `oat project dispatch-ceiling resolve --provider codex --role reviewer`; read `providers.codex.dispatchArgs.variant`.
382
+ - Capped managed policy: reviewer targets the configured cap for deterministic quality gate behavior.
383
+ - Managed `Uncapped`: no reviewer target exists; use base/unpinned reviewer fallback and log `selectionMode=no-review-target`, `selectedValue=null`, and `effort_axis=provider-default`.
384
+ - Inherit/default: no reviewer target exists; use base/unpinned reviewer fallback and log `selectionMode=inherit-default`, `selectedValue=null`, and `effort_axis=provider-default`.
385
+ 8. Codex payload-first assertion applies only when the resolver returns a pinned variant. If `effort_axis=selected:<value>`, the actual `spawn_agent` payload MUST use the matching pinned `agent_type`. If the resolver returns no variant, use the base role and log provider-default.
386
+ 9. Do not use top-level per-call `reasoning_effort` as the standard OAT selected-effort path; dogfooding showed that path can be inconsistent.
326
387
 
327
388
  Claude rules:
328
389
 
329
- - Claude ceiling is model-based: `haiku < sonnet < opus`.
330
- - Implementer/fix dispatch: classify the preferred model (`haiku`, `sonnet`, or `opus`) and pass it to the resolver as `--preferred <preferred-model>`. The resolver selects the lowest sufficient model capped by the resolved Claude ceiling (`min(preferred, ceiling)`).
331
- - Review dispatch: target the resolved Claude ceiling directly.
332
- - For implementer/fix dispatch, call `oat project dispatch-ceiling resolve --provider claude --role implementer --preferred <preferred-model> --orchestrator-tier <current-orchestrator-tier>`; for review dispatch, call the same resolver with `--role reviewer` and no `--preferred`. Read `providers.claude.selection.selectedValue` and `providers.claude.dispatchArgs.model` for the selected model string to pass. Pass `--orchestrator-tier` so the resolver can flag above-orchestrator upgrade requests and set `verifyOnDispatch` correctly.
390
+ - Claude policy selection is model-based: `haiku < sonnet < opus < fable`.
391
+ - Implementer/fix dispatch: classify the preferred model (`haiku`, `sonnet`, `opus`, or `fable`) and pass it to the resolver as `--preferred <preferred-model>`.
392
+ - Capped managed policy: the resolver selects `min(preferred, resolved_cap)`.
393
+ - Managed `Uncapped`: the resolver selects the preferred model with no cap.
394
+ - Inherit/default: the resolver returns no selected model; omit `model` so Claude Code inherits host/default behavior.
395
+ - Review dispatch:
396
+ - Capped managed policy: target the configured policy cap directly.
397
+ - Managed `Uncapped` or inherit/default: no reviewer target exists; omit `model` and log inherited/default model behavior.
398
+ - 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.
333
399
  - Pass `model: "<value>"` when `model_axis=selected:<value>` on the Task tool call.
334
400
  - Keep `effort_axis=not-applicable`; Claude Code has no separate per-dispatch effort axis.
335
401
 
@@ -338,6 +404,19 @@ Payload-first invariant:
338
404
  - Build the actual host dispatch argument map before logging.
339
405
  - Do not emit `selected:<value>` unless the host invocation contains the corresponding role/model selection.
340
406
  - Derive `Dispatch target` and `Effort axis` / `Model axis` from the payload.
407
+ - After the payload is built, append a formal dispatch stamp to Dispatch Notes
408
+ for every implementation, fix, and review dispatch. Use the p01 grammar
409
+ exactly:
410
+ `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>`.
411
+ Derive `producer` and `provenance` from the resolver payload and actual host
412
+ arguments. Only concrete model arguments, including same-harness route model
413
+ args for model-arg providers, declare producer identity. Codex pinned
414
+ variants declare the effort axis only; record `effort_axis=selected:<value>`
415
+ and keep `producer=unknown provenance=unknown` unless an observed/inferred
416
+ model identity is available. Base/unpinned or deferred cross-harness paths are
417
+ also `producer=unknown provenance=unknown` unless an observed/inferred
418
+ identity is available. Do not write prose-only or legacy comma-separated stamp
419
+ forms.
341
420
 
342
421
  Structured dispatch log:
343
422
 
@@ -345,14 +424,18 @@ Structured dispatch log:
345
424
  OAT Dispatch: Phase {phase_id} {implementation | fix | review}
346
425
  Host: {Claude Code | Codex | Cursor | other host}
347
426
  Preferred effort: {low | medium | high | xhigh | provider-default | not-applicable}
348
- Dispatch ceiling: {resolved ceiling value}
427
+ Dispatch policy: {economy | balanced | high | frontier | uncapped | inherit host defaults | legacy capped}
428
+ Resolved cap: {resolved cap value | none}
349
429
  Selected effort: {low | medium | high | xhigh | provider-default | not-applicable}
350
- Ceiling source: {repo config | project state | preflight prompt}
430
+ Policy source: {repo config | project state | preflight prompt}
351
431
  Provider default effort: {value | unknown | not-applicable}
432
+ Selection mode: {capped | uncapped | review-target | no-review-target | inherit-default}
433
+ Route level: {0 | 1 | ... | none}
352
434
  Model axis: { selected:<value> | inherited | not-applicable | host-auto }
353
435
  Effort axis: { selected:<value> | provider-default | inherited | not-applicable | host-auto }
354
436
  Dispatch target: {host-specific subagent/role/tool target}
355
- Rationale: {short rationale grounded in phase scope and any ceiling cap}
437
+ Dispatch stamp: 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>
438
+ Rationale: {short rationale grounded in phase scope and any policy cap/uncapped/default behavior}
356
439
  ```
357
440
 
358
441
  Codex capped example:
@@ -361,46 +444,70 @@ Codex capped example:
361
444
  OAT Dispatch: Phase p02 implementation
362
445
  Host: Codex
363
446
  Preferred effort: high
364
- Dispatch ceiling: medium
447
+ Dispatch policy: economy
448
+ Resolved cap: medium
365
449
  Selected effort: medium
366
- Ceiling source: repo config
450
+ Policy source: repo config
367
451
  Provider default effort: high
452
+ Selection mode: capped
368
453
  Model axis: inherited
369
454
  Effort axis: selected:medium
370
455
  Dispatch target: oat-phase-implementer-medium
371
- Rationale: normal multi-file implementation; high preferred due to integration risk, capped by configured ceiling.
456
+ Rationale: normal multi-file implementation; high preferred due to integration risk, capped by configured policy.
372
457
  ```
373
458
 
374
- Codex reviewer example:
459
+ Codex uncapped implementer example:
460
+
461
+ ```text
462
+ OAT Dispatch: Phase p02 implementation
463
+ Host: Codex
464
+ Preferred effort: xhigh
465
+ Dispatch policy: uncapped
466
+ Resolved cap: none
467
+ Selected effort: xhigh
468
+ Policy source: project state
469
+ Provider default effort: medium
470
+ Selection mode: uncapped
471
+ Model axis: inherited
472
+ Effort axis: selected:xhigh
473
+ Dispatch target: oat-phase-implementer-xhigh
474
+ Rationale: high-risk phase; managed uncapped policy allows the preferred pinned variant. Actual host support for upward effort selection must be verified by the dispatching host.
475
+ ```
476
+
477
+ Codex capped reviewer example:
375
478
 
376
479
  ```text
377
480
  OAT Dispatch: Phase p02 review
378
481
  Host: Codex
379
482
  Preferred effort: high
380
- Dispatch ceiling: high
381
- Selected effort: high
382
- Ceiling source: project state
483
+ Dispatch policy: high
484
+ Resolved cap: xhigh
485
+ Selected effort: xhigh
486
+ Policy source: project state
383
487
  Provider default effort: medium
488
+ Selection mode: review-target
384
489
  Model axis: inherited
385
- Effort axis: selected:high
386
- Dispatch target: oat-reviewer-high
387
- Rationale: reviewer runs at the configured ceiling for deterministic quality gate behavior.
490
+ Effort axis: selected:xhigh
491
+ Dispatch target: oat-reviewer-xhigh
492
+ Rationale: reviewer runs at the configured policy cap for deterministic quality gate behavior.
388
493
  ```
389
494
 
390
- Codex base/unpinned fallback example:
495
+ Codex inherit/default fallback example:
391
496
 
392
497
  ```text
393
498
  OAT Dispatch: Phase p02 review
394
499
  Host: Codex
395
500
  Preferred effort: provider-default
396
- Dispatch ceiling: high
501
+ Dispatch policy: inherit host defaults
502
+ Resolved cap: none
397
503
  Selected effort: provider-default
398
- Ceiling source: project state
504
+ Policy source: project state
399
505
  Provider default effort: medium
506
+ Selection mode: inherit-default
400
507
  Model axis: inherited
401
508
  Effort axis: provider-default
402
509
  Dispatch target: oat-reviewer
403
- Rationale: base unpinned role fallback; effective effort follows Codex provider default.
510
+ Rationale: explicit inherit/default policy; base unpinned role follows Codex provider default.
404
511
  ```
405
512
 
406
513
  Generic sidecar/explorer dispatch:
@@ -416,9 +523,10 @@ Codex generic explorer example:
416
523
  OAT Dispatch: p02-t10 sidecar exploration
417
524
  Host: Codex
418
525
  Preferred effort: provider-default
419
- Dispatch ceiling: xhigh
526
+ Dispatch policy: high
527
+ Resolved cap: xhigh
420
528
  Selected effort: provider-default
421
- Ceiling source: project state
529
+ Policy source: project state
422
530
  Provider default effort: xhigh
423
531
  Model axis: inherited
424
532
  Effort axis: provider-default
@@ -435,12 +543,22 @@ effort_axis:
435
543
  selected:<value> | provider-default | inherited | not-applicable | host-auto,
436
544
  }
437
545
  dispatch_ceiling: { resolved ceiling value }
546
+ dispatch_policy:
547
+ {
548
+ economy | balanced | high | frontier | uncapped | inherit host defaults | legacy capped,
549
+ }
438
550
  ceiling_source: { repo config | project state | preflight prompt }
551
+ policy_source: { repo config | project state | preflight prompt }
439
552
  provider_default_effort: { value | unknown | not-applicable }
553
+ dispatch_route_level:
554
+ { integer route level; omit when no ordered route is in play }
555
+ dispatch_target:
556
+ { resolver target or host-specific dispatch target; omit if unknown }
557
+ dispatch_stamp: { exact `Dispatch: ...` line written to Dispatch Notes }
440
558
  dispatch_rationale: { short rationale }
441
559
  ```
442
560
 
443
- ### Dispatch Ceiling Enforcement Log
561
+ ### Dispatch Policy Enforcement Log
444
562
 
445
563
  After each phase dispatch (implementation, fix, or review), append one enforcement
446
564
  log line. The log reflects the `mode` and `mechanism` returned by
@@ -449,18 +567,20 @@ log line. The log reflects the `mode` and `mechanism` returned by
449
567
  **Three-state log format:**
450
568
 
451
569
  ```text
452
- Dispatch ceiling: {value} ({provider}, {mode} — {mechanism detail})
570
+ Dispatch policy: {policy}; selected={selected value | none}; cap={value | none} ({provider}, {mode} — {mechanism detail})
453
571
  ```
454
572
 
455
573
  **Log examples (matching resolver output):**
456
574
 
457
575
  ```text
458
- Dispatch ceiling: high (codex, enforced — variant oat-phase-implementer-high)
459
- Dispatch ceiling: high (codex, enforced — variant oat-reviewer-high)
460
- Dispatch ceiling: sonnet (claude, enforced — Task model arg)
461
- Dispatch ceiling: opus (claude, enforcedTask model arg)
462
- Dispatch ceiling: high (cursor, unsupportedno adapter; informational)
463
- Dispatch ceiling: unresolved (codex, advisoryceiling set but no value resolved)
576
+ Dispatch policy: balanced; selected=high; cap=high (codex, enforced — variant oat-phase-implementer-high)
577
+ Dispatch policy: high; selected=xhigh; cap=xhigh (codex, enforced — variant oat-reviewer-xhigh)
578
+ Dispatch policy: uncapped; selected=xhigh; cap=none (codex, enforced — variant oat-phase-implementer-xhigh)
579
+ Dispatch policy: inherit host defaults; selected=none; cap=none (codex, advisorybase role follows provider default)
580
+ Dispatch policy: balanced; selected=sonnet; cap=sonnet (claude, enforcedTask model arg)
581
+ Dispatch policy: frontier; selected=fable; cap=fable (claude, enforcedTask model arg)
582
+ Dispatch policy: high; selected=none; cap=high (cursor, unsupported — no adapter; informational)
583
+ Dispatch policy: unresolved; selected=none; cap=none (codex, advisory — policy set but no value resolved)
464
584
  ```
465
585
 
466
586
  **Verify-on-upgrade (`verifyOnDispatch: true`):**
@@ -471,16 +591,18 @@ logging `enforced`, confirm the actual model/tier used by the dispatched agent.
471
591
  If the provider honored the request, log `enforced`. If it did not:
472
592
 
473
593
  ```text
474
- Dispatch ceiling: opus (claude, advisory — provider did not honor upgrade; ran sonnet)
594
+ Dispatch policy: high; selected=opus; cap=opus (claude, advisory — provider did not honor upgrade; ran sonnet)
475
595
  ```
476
596
 
477
597
  **`enforced`** — the adapter compiled concrete dispatch args and the provider
478
598
  accepted them. Log value + provider + mechanism detail (variant name or "Task
479
599
  model arg").
480
600
 
481
- **`advisory`** — the adapter supports the ceiling but no concrete value resolved,
482
- or the provider is known but could not be verified. Log with note "ceiling set
483
- but no value resolved" or "provider did not honor upgrade; ran \<tier\>".
601
+ **`advisory`** — the adapter supports the policy but no concrete value resolved,
602
+ the policy intentionally inherits provider defaults, or the provider is known
603
+ but could not be verified. Log with note "policy set but no value resolved",
604
+ "base role follows provider default", or "provider did not honor upgrade; ran
605
+ \<tier\>".
484
606
 
485
607
  **`unsupported`** — the provider has no registered adapter. Log with note "no
486
608
  adapter; informational". Never block on unsupported — dispatch follows provider
@@ -796,16 +918,21 @@ For each phase `pNN` in the plan (or each phase in the current parallel group),
796
918
  workflow_mode: {from state.md or plan.md frontmatter}
797
919
  model_axis: {selected:<value> | inherited | not-applicable | host-auto; omit if unknown}
798
920
  effort_axis: {selected:<value> | provider-default | inherited | not-applicable | host-auto; omit if unknown}
799
- dispatch_ceiling: {resolved ceiling value; omit if unknown}
800
- ceiling_source: {repo config | project state | preflight prompt; omit if unknown}
921
+ dispatch_policy: {economy | balanced | high | frontier | uncapped | inherit host defaults | legacy capped; omit if unknown}
922
+ dispatch_ceiling: {resolved cap value; omit if none or unknown}
923
+ policy_source: {repo config | project state | preflight prompt; omit if unknown}
924
+ ceiling_source: {repo config | project state | preflight prompt; omit if unknown; compatibility alias for policy_source}
801
925
  provider_default_effort: {value | unknown | not-applicable; omit if unknown}
926
+ dispatch_route_level: {integer route level; omit when no ordered route is in play}
927
+ dispatch_target: {resolver target or host-specific dispatch target; omit if unknown}
928
+ dispatch_stamp: {exact `Dispatch: ...` line written to Dispatch Notes; omit if not yet written}
802
929
  dispatch_rationale: {short rationale; omit if unknown}
803
930
  ```
804
931
 
805
932
  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.
806
933
  - Codex implementer/fix dispatch:
807
- - Before building the `spawn_agent` argument map, classify the phase complexity and choose preferred effort (`low`, `medium`, `high`, or `xhigh`), then call `oat project dispatch-ceiling resolve --provider codex --role implementer --preferred <preferred-effort>`.
808
- - Build the `spawn_agent` argument map from `providers.codex.selection.selectedValue` and `providers.codex.dispatchArgs.variant` before logging the dispatch. If `effort_axis=selected:low|medium|high|xhigh`, the argument map MUST use the matching `agent_type`: `"oat-phase-implementer-low"`, `"oat-phase-implementer-medium"`, `"oat-phase-implementer-high"`, or `"oat-phase-implementer-xhigh"`. Then derive the `OAT Dispatch:` block `Effort axis:` field from that same argument map.
934
+ - 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>`.
935
+ - Build the `spawn_agent` argument map from `providers.codex.selection.selectedValue` and `providers.codex.dispatchArgs.variant` 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:low|medium|high|xhigh`, the argument map MUST use the matching `agent_type`: `"oat-phase-implementer-low"`, `"oat-phase-implementer-medium"`, `"oat-phase-implementer-high"`, or `"oat-phase-implementer-xhigh"`. Then derive the `OAT Dispatch:` block `Effort axis:` field from that same argument map.
809
936
  - Example selected low payload shape: `agent_type: "oat-phase-implementer-low"` and a Phase Scope message containing `effort_axis: selected:low`.
810
937
  - 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.
811
938
  - If `effort_axis=provider-default`, use base `agent_type: "oat-phase-implementer"` and omit `reasoning_effort`. The dispatch rationale MUST say this is a base/unpinned fallback and include provider default effort when known.
@@ -848,13 +975,15 @@ Escalate the runtime dispatch control when there is evidence that the current co
848
975
  When escalation is needed:
849
976
 
850
977
  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:
851
- - **Codex:** `selected:low -> selected:medium -> selected:high -> selected:xhigh`, capped by the resolved Codex dispatch ceiling.
852
- - **Claude Code:** `selected:haiku -> selected:sonnet -> selected:opus`, capped by the resolved Claude dispatch ceiling.
978
+ - **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.
979
+ - **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.
980
+ - **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.
853
981
  2. Count the escalation redispatch against the existing bounded retry budget. Escalation changes the control; it does not create extra retry attempts.
854
- 3. Record a compact note in `implementation.md` when practical:
855
- - `Dispatch: p03 escalated to model_axis=selected:opus, effort_axis=not-applicable after repeated review failures.` (Claude Code)
856
- - `Dispatch: p03 escalated to effort_axis=selected:high, model_axis=inherited after repeated review failures.` (Codex)
857
- - `Dispatch: p02 remained model_axis=host-auto, effort_axis=host-auto; no explicit stronger control is exposed by this host.`
982
+ 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:
983
+ - `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`
984
+ - `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`
985
+ - `Dispatch: scope=p03 action=implementation role=implementer producer=unknown provenance=unknown model_axis=inherited effort_axis=selected:high dispatch_policy=high dispatch_ceiling=high target=oat-phase-implementer-high`
986
+ - `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`
858
987
  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.
859
988
 
860
989
  #### Dispatch Retry (Transient Failures)
@@ -868,8 +997,9 @@ After the implementer returns DONE (or DONE_WITH_CONCERNS without correctness co
868
997
  **Dispatch:**
869
998
 
870
999
  - Use the same tier that was selected at start.
871
- - For Codex, dispatch the reviewer variant matching the resolved ceiling (`oat-reviewer-low|medium|high|xhigh`) for deterministic quality gates.
872
- - For Claude Code, cap any selected review model by the resolved Claude ceiling and keep `effort_axis=not-applicable`.
1000
+ - For Codex with a capped managed policy, dispatch the reviewer variant matching the resolved cap (`oat-reviewer-low|medium|high|xhigh`) for deterministic quality gates.
1001
+ - 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.
1002
+ - 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`.
873
1003
  - Tier 1: dispatch the selected reviewer target via provider-native subagent mechanism with Review Scope:
874
1004
 
875
1005
  ```
@@ -881,16 +1011,18 @@ After the implementer returns DONE (or DONE_WITH_CONCERNS without correctness co
881
1011
  workflow_mode: {from state.md}
882
1012
  artifact_paths: {same as Phase Scope}
883
1013
  tasks_in_scope: {list of pNN-tNN IDs in the phase}
884
- dispatch_ceiling: {resolved ceiling value}
885
- ceiling_source: {repo config | project state | preflight prompt}
1014
+ dispatch_policy: {economy | balanced | high | frontier | uncapped | inherit host defaults | legacy capped}
1015
+ dispatch_ceiling: {resolved cap value | null}
1016
+ policy_source: {repo config | project state | preflight prompt}
1017
+ ceiling_source: {repo config | project state | preflight prompt} # compatibility alias for policy_source
886
1018
  provider_default_effort: {value | unknown | not-applicable}
887
- model_axis: inherited
888
- effort_axis: selected:{resolved Codex ceiling} # on Codex; use not-applicable on Claude Code
889
- dispatch_rationale: reviewer runs at the configured ceiling for deterministic quality gate behavior
1019
+ model_axis: {inherited | selected:<Claude model>}
1020
+ effort_axis: {selected:<Codex value> | provider-default | not-applicable}
1021
+ dispatch_rationale: {capped reviewer target | uncapped/inherit reviewer fallback}
890
1022
  ```
891
1023
 
892
1024
  - 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.
893
- - For Codex Tier 1 review dispatches, use `agent_type: "oat-reviewer-low|medium|high|xhigh"` matching the resolved ceiling. Use base `oat-reviewer` only as a 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; if selecting a model, cap it by the resolved Claude ceiling.
1025
+ - For Codex Tier 1 review dispatches, use `agent_type: "oat-reviewer-low|medium|high|xhigh"` only when the resolver returns a pinned reviewer variant for a capped managed policy. Use base `oat-reviewer` 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.
894
1026
  - Treat the commit range as authoritative for review scope. `files_changed` is optional orientation metadata only.
895
1027
  - 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.
896
1028
 
@@ -911,7 +1043,7 @@ On reviewer verdict `fail`, run a bounded fix loop.
911
1043
 
912
1044
  1. Read `oat_orchestration_retry_limit` from `state.md` frontmatter (default: `2`, range 0–5).
913
1045
  2. For each retry (up to the limit):
914
- a. Select/log fix dispatch axes from the fix scope, then perform the same pre-dispatch assertion used for implementation dispatch. A Codex fix dispatch with `effort_axis=selected:low|medium|high|xhigh` MUST use matching `agent_type: "oat-phase-implementer-low|medium|high|xhigh"`; a Claude Code fix dispatch with `model_axis=selected:<value>` MUST pass `model: "<value>"` on the Task call.
1046
+ 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:low|medium|high|xhigh` MUST use matching `agent_type: "oat-phase-implementer-low|medium|high|xhigh"`; 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.
915
1047
  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
916
1048
  c. Receive the fix summary.
917
1049
  d. Re-dispatch the reviewer with the updated commit range.
@@ -1067,7 +1199,7 @@ Append a new entry to the `## Orchestration Runs` section between the `<!-- orch
1067
1199
 
1068
1200
  #### Dispatch Notes
1069
1201
 
1070
- - Dispatch: {phase dispatch control and rationale, including escalation notes when applicable}
1202
+ - Dispatch stamps: {formal `Dispatch: ...` records, plus route level and escalation rationale when applicable}
1071
1203
 
1072
1204
  #### Outstanding Items
1073
1205