@open-agent-toolkit/cli 0.1.46 → 0.1.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/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 +172 -113
  5. package/assets/docs/cli-utilities/workflow-gates.md +161 -27
  6. package/assets/docs/contributing/skills.md +14 -8
  7. package/assets/docs/provider-sync/providers.md +41 -7
  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 +235 -187
  13. package/assets/docs/workflows/projects/implementation-execution.md +283 -260
  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 +247 -133
  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 +94 -22
  25. package/dist/commands/config/index.d.ts.map +1 -1
  26. package/dist/commands/config/index.js +64 -39
  27. package/dist/commands/doctor/index.d.ts.map +1 -1
  28. package/dist/commands/doctor/index.js +21 -6
  29. package/dist/commands/gate/index.d.ts +7 -1
  30. package/dist/commands/gate/index.d.ts.map +1 -1
  31. package/dist/commands/gate/index.js +544 -67
  32. package/dist/commands/gate/review-verdict.d.ts +16 -0
  33. package/dist/commands/gate/review-verdict.d.ts.map +1 -1
  34. package/dist/commands/gate/review-verdict.js +72 -9
  35. package/dist/commands/project/dispatch-ceiling/index.d.ts.map +1 -1
  36. package/dist/commands/project/dispatch-ceiling/index.js +452 -16
  37. package/dist/commands/providers/codex/materialize.d.ts.map +1 -1
  38. package/dist/commands/providers/codex/materialize.js +6 -1
  39. package/dist/commands/shared/frontmatter.d.ts +4 -0
  40. package/dist/commands/shared/frontmatter.d.ts.map +1 -1
  41. package/dist/commands/shared/frontmatter.js +23 -0
  42. package/dist/commands/status/index.d.ts +1 -0
  43. package/dist/commands/status/index.d.ts.map +1 -1
  44. package/dist/commands/status/index.js +10 -4
  45. package/dist/commands/sync/index.d.ts.map +1 -1
  46. package/dist/commands/sync/index.js +10 -3
  47. package/dist/commands/sync/sync.types.d.ts +1 -0
  48. package/dist/commands/sync/sync.types.d.ts.map +1 -1
  49. package/dist/config/oat-config.d.ts +19 -2
  50. package/dist/config/oat-config.d.ts.map +1 -1
  51. package/dist/config/oat-config.js +139 -24
  52. package/dist/config/resolve.d.ts +8 -0
  53. package/dist/config/resolve.d.ts.map +1 -1
  54. package/dist/config/resolve.js +66 -2
  55. package/dist/engine/index.d.ts +1 -1
  56. package/dist/engine/index.d.ts.map +1 -1
  57. package/dist/engine/index.js +1 -1
  58. package/dist/engine/scanner.d.ts +1 -0
  59. package/dist/engine/scanner.d.ts.map +1 -1
  60. package/dist/engine/scanner.js +17 -1
  61. package/dist/fs/paths.d.ts +4 -0
  62. package/dist/fs/paths.d.ts.map +1 -1
  63. package/dist/fs/paths.js +18 -1
  64. package/dist/providers/ceiling/registry.d.ts +1 -0
  65. package/dist/providers/ceiling/registry.d.ts.map +1 -1
  66. package/dist/providers/ceiling/registry.js +12 -5
  67. package/dist/providers/codex/codec/catalog.d.ts +14 -0
  68. package/dist/providers/codex/codec/catalog.d.ts.map +1 -0
  69. package/dist/providers/codex/codec/catalog.js +21 -0
  70. package/dist/providers/codex/codec/materialize.d.ts.map +1 -1
  71. package/dist/providers/codex/codec/materialize.js +6 -5
  72. package/dist/providers/codex/codec/shared.d.ts +19 -0
  73. package/dist/providers/codex/codec/shared.d.ts.map +1 -1
  74. package/dist/providers/codex/codec/shared.js +98 -5
  75. package/dist/providers/codex/codec/sync-extension.d.ts.map +1 -1
  76. package/dist/providers/codex/codec/sync-extension.js +142 -32
  77. package/dist/providers/identity/stamp.d.ts.map +1 -1
  78. package/dist/providers/identity/stamp.js +4 -0
  79. package/dist/shared/types.d.ts +1 -0
  80. package/dist/shared/types.d.ts.map +1 -1
  81. package/dist/shared/types.js +4 -0
  82. package/package.json +2 -2
@@ -1,346 +1,369 @@
1
1
  ---
2
2
  title: Implementation Execution
3
- description: 'Phase-subagent dispatch, tier detection, runtime dispatch selection, bounded fix loop, plan-declared parallelism, and dry-run mode in oat-project-implement v2.0.'
3
+ description: 'Phase coordination, exact task-worker dispatch, named maximum ceilings, reviews, bounded fixes, plan-declared parallel worktrees, and resumption in oat-project-implement.'
4
4
  ---
5
5
 
6
6
  # Implementation Execution
7
7
 
8
- This page covers how `oat-project-implement` actually runs a plan: tier selection, phase-level subagent dispatch, runtime dispatch selection, the review + fix loop, plan-declared parallelism with worktree fan-in, and dry-run.
8
+ This page describes how `oat-project-implement` executes a plan after planning
9
+ has established a complete ordered candidate ladder and a project named
10
+ ceiling.
9
11
 
10
12
  ## Quick Look
11
13
 
12
- - **When to use:** you have a plan ready and want to understand what happens during `oat-project-implement`.
13
- - **Unit of dispatch:** one phase at a time (not one task). A phase implementer executes all tasks in the phase, commits per task, and returns a single summary.
14
- - **Two tiers, one lock:** capability detection picks Tier 1 (native subagents) or Tier 2 (inline) at start. The tier is locked for the whole run — no mid-run downgrades.
15
- - **Dispatch policy:** implementation resolves an OAT-owned dispatch policy before work starts. Managed policies are `Economy`, `Balanced`, `High`, `Frontier`, and `Uncapped`; `Inherit Host Defaults` explicitly leaves model/effort controls to the host.
16
- - **Runtime dispatch:** each phase uses the lowest available model/effort/control that can confidently complete the work. Capped managed policies cap preferred selections, managed `Uncapped` uses preferred selections directly, and inherit/default mode uses no OAT-selected control.
14
+ - **Phase boundary:** one phase coordinator owns dependency order, integration,
15
+ and the phase summary.
16
+ - **Task boundary:** the coordinator dispatches one exact task worker per task.
17
+ Each worker receives one bounded Task Scope and creates one verified commit.
18
+ - **Named maximum:** a project or narrower phase named ceiling is a maximum over
19
+ configured candidates, not an exact model-family preference.
20
+ - **Serial worktree rule:** task workers run serially in the same worktree.
21
+ Parallelism is limited to plan-declared phase worktrees.
22
+ - **Fail closed:** a missing, above-ceiling, or uninvokable managed candidate
23
+ blocks. OAT does not substitute the coordinator target, a base role, or a
24
+ provider default.
17
25
 
18
- ## Execution model
26
+ ## Execution Layers
19
27
 
20
- ### Tier selection
28
+ ### Orchestrator
21
29
 
22
- At skill start, `oat-project-implement` detects whether the host supports native subagent dispatch for `oat-phase-implementer` and `oat-reviewer`.
30
+ The root `oat-project-implement` workflow resolves project state, chooses Tier
31
+ 1 or Tier 2 mechanics, builds the phase schedule, dispatches coordinators and
32
+ reviewers, owns the review/fix loop, updates artifacts, and performs worktree
33
+ fan-in.
23
34
 
24
- - **Claude Code / Cursor:** native subagent dispatch → Tier 1.
25
- - **Codex multi-agent:** Tier 1 if `spawn_agent` is allowed without authorization, or after an explicit single prompt at skill start if authorization is required. Codex subagent dispatch should use self-contained scope packets with fresh context; do not assume pinned OAT roles can also inherit the full parent thread.
26
- - **Authorization declined or agents do not resolve:** Tier 2 (inline). The orchestrator reads `.agents/agents/oat-phase-implementer.md` and `.agents/agents/oat-reviewer.md` as reference and executes that process itself.
35
+ ### Phase coordinator
27
36
 
28
- The approval decision covers both phase implementation and checkpoint review for the run. The orchestrator should not drift into a mixed mode based on conversational emphasis alone; if Tier 1 was not approved, stay inline throughout unless the user explicitly requests mixed execution.
37
+ A Phase Scope selects coordinator mode in `oat-phase-implementer`. The
38
+ coordinator reads the phase artifacts once, retains task dependency order,
39
+ selects one exact configured target for each task, waits for and verifies every
40
+ worker result and commit, then performs phase-wide integration verification and
41
+ self-review.
29
42
 
30
- The selected tier is reported to the user and locked for the remainder of the run:
43
+ The coordinator must not implement ordinary plan tasks itself. Its execution
44
+ target is not a task target and cannot be reused as a fallback.
31
45
 
32
- ```text
33
- [preflight] Checking subagent availability…
34
- → oat-phase-implementer + oat-reviewer: available
35
- → Selected: Tier 1 — Subagents
36
- ```
46
+ ### Task worker
37
47
 
38
- ### Dispatch policy preflight
48
+ A Task Scope selects worker mode in the same canonical agent instructions. The
49
+ worker implements exactly one task, runs that task's verification, creates one
50
+ commit, returns a compact result, and stops. It does not dispatch another worker
51
+ or coordinate the phase.
39
52
 
40
- Before phase work starts, `oat-project-implement` resolves and prints the dispatch policy for the current provider. For the conceptual model and per-provider enforcement (Codex vs Claude vs unsupported), see [Dispatch Policy](dispatch-ceiling.md).
53
+ This dual-mode contract lets every materialized Codex
54
+ `oat-phase-implementer-<model>-<effort>` role act as either the coordinator or
55
+ the exact bounded worker without recursive coordinator dispatch.
41
56
 
42
- The resolver is the source of truth. The command name remains `dispatch-ceiling` for compatibility:
57
+ ## Tier Selection
43
58
 
44
- ```bash
45
- oat project dispatch-ceiling resolve --provider codex --preflight --json
46
- ```
59
+ At skill start, OAT detects whether the host can run the coordinator,
60
+ task-worker, and reviewer routes:
61
+
62
+ - **Tier 1:** native provider subagent dispatch.
63
+ - **Tier 2:** guarded sequential coordinator mechanics when native role
64
+ selection is unavailable.
47
65
 
48
- Resolution order:
66
+ Tier 2 does not authorize inline task implementation by the coordinator. A
67
+ managed task still requires an exact registered role, an exact provider model
68
+ argument, or a fresh Codex child pinned to the resolver-returned model and
69
+ effort. If the current context cannot dispatch that worker, implementation
70
+ blocks.
49
71
 
50
- 1. `workflow.dispatchPolicy.mode` / `workflow.dispatchPolicy.policy` from effective config
51
- 2. Compatibility `workflow.dispatchCeiling.providers.<provider>` from effective config
52
- 3. `oat_dispatch_policy` in project `state.md` frontmatter
53
- 4. Legacy `oat_dispatch_ceiling` in project `state.md` frontmatter
54
- 5. Interactive implementation preflight prompt
55
- 6. Non-interactive unresolved state blocks before work starts
72
+ Codex may require one explicit authorization prompt for multi-agent dispatch.
73
+ That approval covers coordinators, task workers, and reviewers for the run. Tier
74
+ mechanics remain locked after selection; they never change the target contract.
56
75
 
57
- Runtime dispatch reads the resolved policy and provider-specific selection only. If no policy is configured, the interactive preflight prompt offers the policy choices; non-interactive mode blocks.
76
+ ## Dispatch Readiness
58
77
 
59
- **Policy options (interactive prompt):**
78
+ Planning through spec-driven, quick-start, import-plan, or provider-plan-via-
79
+ import performs the same readiness setup:
60
80
 
61
- | Option | Mode | Codex | Claude |
62
- | --------------------- | ------- | -------- | -------- |
63
- | Economy | managed | `medium` | `sonnet` |
64
- | Balanced | managed | `high` | `sonnet` |
65
- | High | managed | `xhigh` | `opus` |
66
- | Frontier | managed | `xhigh` | `fable` |
67
- | Uncapped | managed | none | none |
68
- | Inherit Host Defaults | inherit | none | none |
81
+ 1. Inspect the effective ordered candidate ladders.
82
+ 2. If incomplete, show the complete bundled recommendation and ask whether
83
+ `--shared`, `--local`, or `--user` should own adoption.
84
+ 3. Recheck after non-destructive adoption. Remaining gaps block readiness.
85
+ 4. Record the active project named maximum in project `state.md`, not user
86
+ config.
87
+ 5. Optionally record a narrower phase named maximum in plan Dispatch Profile.
69
88
 
70
- For Codex, provider default effort is displayed when available but is not treated as managed `Uncapped` or as a cap. Provider defaults apply only to explicit inherit/default behavior or base/unpinned fallback paths.
89
+ See [Dispatch Policy](dispatch-ceiling.md) for ladder shapes and ownership.
71
90
 
72
- ```text
73
- Dispatch policy: balanced (codex, managed capped — materialized-role)
74
- Resolved cap: high
75
- Source: project state
76
- Provider default effort: medium
77
- 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.
91
+ Before phase work, implementation runs provider preflight:
92
+
93
+ ```bash
94
+ oat project dispatch-ceiling resolve \
95
+ --provider <active-provider> \
96
+ --preflight \
97
+ --json
78
98
  ```
79
99
 
80
- **Enforcement modes** (from resolver):
100
+ An unresolved non-interactive preflight blocks. Managed `Uncapped` and
101
+ `Inherit Host Defaults` are explicit modes; omitted policy state is not an
102
+ implicit fallback.
81
103
 
82
- - `enforced` the adapter compiled concrete dispatch args and the provider accepted them (Codex: materialized model+effort roles; Claude: Task `model` parameter).
83
- - `advisory` — the provider is supported but no value resolved, or an upgrade request was not honored by the provider.
84
- - `unsupported` — the provider has no registered adapter; the policy is informational only. Dispatch follows provider behavior.
104
+ ## Resolve the Effective Named Maximum
85
105
 
86
- In non-interactive mode, an unresolved policy blocks before any implementation work:
106
+ For each phase, the orchestrator determines the task maximum:
87
107
 
88
- ```text
89
- BLOCKED: Codex dispatch policy is unresolved in non-interactive mode.
90
- Set workflow.dispatchPolicy.mode/workflow.dispatchPolicy.policy, workflow.dispatchCeiling.providers.codex, oat_dispatch_policy, or legacy oat_dispatch_ceiling.
91
- ```
108
+ 1. Read project `state.md:oat_dispatch_policy.policy`.
109
+ 2. Read the phase's optional Dispatch Profile row.
110
+ 3. An explicit `economy`, `balanced`, `high`, or `frontier` phase value narrows
111
+ the project maximum and records `task_ceiling_source: phase`.
112
+ 4. Blank, absent, or `auto` uses the project maximum and records
113
+ `task_ceiling_source: project`.
114
+ 5. Reject an unknown phase tier or one above the project maximum.
92
115
 
93
- Dry-run reports unresolved policy and planned behavior without writing project state.
94
-
95
- ### Runtime dispatch selection
96
-
97
- Tier selection decides whether OAT uses native subagents or inline fallback. Runtime dispatch selection is separate: it decides which provider-specific model and effort controls to use for a specific phase when the host exposes those axes.
98
-
99
- The default rule is conservative: use the lowest available model and/or effort that can confidently complete the phase. Escalate before dispatch when the phase is high-risk, broad, cross-cutting, or when retry evidence suggests the current control is underpowered.
100
-
101
- The orchestrator considers, in order:
102
-
103
- 1. A valid `## Dispatch Profile` override row in `plan.md`, if present and the host can honor it.
104
- 2. The phase's files, risk, requirements, and recent review/fix-loop evidence.
105
- 3. The host's actual control surface by axis.
106
-
107
- Model and effort are separate axes. Each axis logs one of these states:
108
-
109
- - `selected:<value>` — the host exposes the axis and the orchestrator chose a value.
110
- - `provider-default` — Codex base/unpinned role follows configured/provider default effort for explicit inherit/default behavior or fallback paths.
111
- - `inherited` — the host exposes the axis and the orchestrator deliberately defers to the parent session.
112
- - `not-applicable` — this host/API has no meaningful per-dispatch concept for that axis.
113
- - `host-auto` — exceptional; the host uses that axis internally but the orchestrator cannot read or pin it.
114
-
115
- In Codex, implementation and fix dispatch classify a preferred effort (`low`, `medium`, `high`, or `xhigh`) and pass it to `oat project dispatch-ceiling resolve --provider codex --role implementer --preferred <effort>`. For capped managed policies, the resolver selects `min(preferred, resolved_cap)` and returns a materialized role name compiled from an explicit model+effort target. For managed `Uncapped`, the resolver selects the preferred materialized role with no cap. For inherit/default mode, it returns no materialized role and OAT uses the base/unpinned role. Reviewer dispatch targets the configured cap only when a capped managed policy exists; managed `Uncapped` and inherit/default use base `oat-reviewer` fallback.
116
-
117
- Because Codex preferred values are effort names while dispatch matrix cells are
118
- keyed by OAT tiers, managed `Uncapped` maps preferred efforts through the
119
- managed tier table before resolving matrix targets. For example, `xhigh` maps to
120
- the highest matching tier, `frontier`, so `--preferred xhigh` can resolve a
121
- `frontier` Codex matrix target such as
122
- `oat-phase-implementer-gpt-5-6-sol-xhigh`.
123
-
124
- In Claude Code, implementation and fix dispatch classify a preferred model tier (`haiku`, `sonnet`, `opus`, or `fable`) and pass it to `oat project dispatch-ceiling resolve --provider claude --role implementer --preferred <model> --orchestrator-tier <current-orchestrator-tier>`. Capped policies select `min(preferred, resolved_cap)`, managed `Uncapped` selects the preferred model, and inherit/default omits `model`. Reviewer dispatch passes a `model` only when the resolver returns one. The separate effort axis is `not-applicable`.
125
-
126
- Dispatch logs use a consistent structured block so provider behavior is comparable without flattening the model and effort axes:
127
-
128
- ```text
129
- OAT Dispatch: Phase p01 implementation
130
- Host: Claude Code
131
- Model axis: selected:sonnet
132
- Effort axis: not-applicable
133
- Dispatch target: oat-phase-implementer
134
- Rationale: multi-file integration with mock wiring; sonnet is the lowest sufficient Claude model.
135
-
136
- OAT Dispatch: Phase p02 implementation
137
- Host: Codex
138
- Preferred effort: high
139
- Dispatch policy: economy
140
- Resolved cap: medium
141
- Selected effort: medium
142
- Policy source: repo config
143
- Provider default effort: high
144
- Selection mode: capped
145
- Model axis: selected:gpt-5.6-terra
146
- Effort axis: selected:medium
147
- Dispatch target: oat-phase-implementer-gpt-5-6-terra-medium
148
- Rationale: shared TypeScript/config substrate; high preferred due to integration risk, capped by configured policy.
149
-
150
- OAT Dispatch: Phase p03 review
151
- Host: Codex
152
- Dispatch policy: high
153
- Resolved cap: xhigh
154
- Selected effort: xhigh
155
- Policy source: project state
156
- Provider default effort: medium
157
- Selection mode: review-target
158
- Model axis: selected:gpt-5.6-terra
159
- Effort axis: selected:xhigh
160
- Dispatch target: oat-reviewer-gpt-5-6-terra-xhigh
161
- Rationale: reviewer runs at the configured policy cap for deterministic quality gate behavior.
162
-
163
- OAT Dispatch: Phase p03 implementation
164
- Host: Codex
165
- Preferred effort: xhigh
166
- Dispatch policy: uncapped
167
- Resolved cap: none
168
- Selected effort: xhigh
169
- Policy source: project state
170
- Provider default effort: medium
171
- Selection mode: uncapped
172
- Model axis: selected:gpt-5.6-sol
173
- Effort axis: selected:xhigh
174
- Dispatch target: oat-phase-implementer-gpt-5-6-sol-xhigh
175
- Rationale: high-risk phase; managed uncapped policy allows the preferred materialized target.
176
-
177
- OAT Dispatch: Phase p04 implementation
178
- Host: Other
179
- Model axis: host-auto
180
- Effort axis: host-auto
181
- Dispatch target: host default
182
- Rationale: host does not expose readable or pinnable dispatch controls; rationale maps to standard effort.
183
-
184
- OAT Dispatch: p02-t10 sidecar exploration
185
- Host: Codex
186
- Preferred effort: provider-default
187
- Dispatch policy: high
188
- Resolved cap: xhigh
189
- Selected effort: provider-default
190
- Policy source: project state
191
- Provider default effort: xhigh
192
- Model axis: inherited
193
- Effort axis: provider-default
194
- Dispatch target: explorer
195
- Rationale: read-only sidecar exploration; generic explorer payload does not pin an OAT-managed effort variant.
116
+ Under a High maximum, configured Economy, Balanced, and High candidates remain
117
+ eligible. Different tasks in the same phase can therefore use different lower
118
+ candidates without changing project state.
119
+
120
+ ## Phase Scope
121
+
122
+ The orchestrator sends one coordinator a Phase Scope:
123
+
124
+ ```yaml
125
+ project: .oat/projects/shared/example
126
+ phase: p02
127
+ mode: implement
128
+ artifact_paths:
129
+ plan: .oat/projects/shared/example/plan.md
130
+ design: .oat/projects/shared/example/design.md
131
+ implementation: .oat/projects/shared/example/implementation.md
132
+ workflow_mode: quick
133
+ active_provider: codex
134
+ project_ceiling_tier: high
135
+ phase_ceiling_tier: balanced
136
+ task_ceiling_tier: balanced
137
+ task_ceiling_source: phase
138
+ commit_convention: 'feat({scope}): {description}'
139
+ coordinator_target: oat-phase-implementer-gpt-5-6-terra-high
196
140
  ```
197
141
 
198
- Phase and review scope packets include dispatch context when the orchestrator has resolved it: `model_axis`, `effort_axis`, `dispatch_policy`, `dispatch_ceiling`, `policy_source`, `ceiling_source` as a compatibility alias, `provider_default_effort`, and `dispatch_rationale`.
142
+ The coordinator target starts the coordinator only. It is never inherited by a
143
+ task.
199
144
 
200
- Generic sidecars such as built-in `explorer` are not OAT-managed implementer, reviewer, or fix roles. If a sidecar payload does not pin a reliable effort/model control, log it as provider-default rather than classifying the task complexity as a selected effort. Sidecar results are advisory context; implementation and review/fix gates still follow the OAT-managed dispatch rules above.
145
+ ## Per-Task Selection
201
146
 
202
- ### Dispatch Profile overrides
147
+ For every task in dependency order, the coordinator classifies only that
148
+ bounded task, chooses one exact candidate at or below the named maximum, and
149
+ calls the resolver with invocation-only `--ceiling-tier`.
203
150
 
204
- `plan.md` should omit `## Dispatch Profile` by default. Missing dispatch rows are normal, because runtime selection has fresher phase context and host capability information at execution time.
151
+ ```bash
152
+ # Codex
153
+ oat project dispatch-ceiling resolve \
154
+ --provider codex \
155
+ --role implementer \
156
+ --ceiling-tier balanced \
157
+ --candidate-model gpt-5.6-terra \
158
+ --candidate-effort medium \
159
+ --project-path .oat/projects/shared/example \
160
+ --json
161
+
162
+ # Claude
163
+ oat project dispatch-ceiling resolve \
164
+ --provider claude \
165
+ --role implementer \
166
+ --ceiling-tier balanced \
167
+ --candidate-model sonnet \
168
+ --json
169
+
170
+ # Cursor
171
+ oat project dispatch-ceiling resolve \
172
+ --provider cursor \
173
+ --role implementer \
174
+ --ceiling-tier balanced \
175
+ --candidate-model 'opaque:model/balanced [v2]' \
176
+ --json
177
+ ```
205
178
 
206
- Add Dispatch Profile rows only when the user has an explicit constraint or preference, such as "use high reasoning effort for the security implementation phase" or "keep documentation-only phases on the lowest tier." Override rows should include a rationale explaining why runtime selection should not decide on its own.
179
+ The override accepts `economy`, `balanced`, `high`, or `frontier`. It applies
180
+ only to that resolver call and never writes config or project state. JSON
181
+ reports `source: invocation` while `providers.<provider>.cellSource` identifies
182
+ the config layer that owns the candidate.
207
183
 
208
- ### Per-phase loop
184
+ The coordinator requires the requested candidate, `selection.candidateTier`,
185
+ `selection.ceilingTier`, exact target, and dispatch arguments to agree. A
186
+ candidate above the maximum or absent from the configured ladder blocks.
209
187
 
210
- For each phase in the plan (whether sequential or inside a parallel group):
188
+ ## Exact Provider Invocation
211
189
 
212
- 1. **Select runtime dispatch control** for the phase and log the chosen control plus rationale.
213
- 2. **Dispatch the selected implementer role** with a Phase Scope block (project path, phase id, artifact paths, commit convention, workflow mode, and dispatch context when known). In Codex, selected model+effort axes use the resolver-returned materialized role name, such as `oat-phase-implementer-gpt-5-6-terra-xhigh`. Base `oat-phase-implementer` means provider-default/unpinned fallback.
214
- 3. **Receive the summary:** `DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED`.
215
- - `BLOCKED` stops the run and surfaces the blocker to the user.
216
- 4. **Dispatch the selected reviewer role** with a Review Scope block (phase id, commit range, optional files-changed hint, and dispatch context). The commit range is authoritative; the file list is only orientation metadata. In Codex, pass this as a self-contained packet with `fork_context: false`; use the resolver-returned materialized reviewer role only for capped managed policies, and use base `oat-reviewer` for managed `Uncapped` or inherit/default. In Claude Code, pass a review `model` only when the resolver returns one and always record `effort_axis=not-applicable`. If the reviewer does not conclude on the first wait, poll once more, then send a concise "return now with current findings" nudge before falling back inline for that phase.
217
- 5. **Parse the verdict:** zero Critical + zero Important findings → `pass`; otherwise `fail`.
218
- 6. **On fail, run the bounded fix loop** (see below).
219
- 7. **Update artifacts** (`implementation.md`, `plan.md` review row, `state.md`) and make the mandatory bookkeeping commit.
220
- 8. **Phase review gate** — when `oat_phase_review_gate` selects the phase, run the optional non-pausing external gate (`oat gate review`) after the step 7 bookkeeping commit and before the HiLL check. A passing gate continues automatically; a blocking gate is received and fixed, reusing the bounded fix loop's `oat_orchestration_retry_limit`. See [Reviews → Phase review gate](reviews.md#phase-review-gate).
221
- 9. **HiLL checkpoint** if the phase id is listed in `oat_plan_hill_phases`.
190
+ Build the complete host payload before writing dispatch logs:
222
191
 
223
- ### Bounded fix loop
192
+ - **Codex:** use `providers.codex.dispatchArgs.variant` as the actual
193
+ `agent_type`. If the registered role cannot be selected, launch a fresh Codex
194
+ child pinned to `selection.target.model` and `selection.target.effort` with
195
+ canonical `oat-phase-implementer` instructions and the Task Scope.
196
+ - **Claude:** pass `providers.claude.dispatchArgs.model` as the actual Task
197
+ `model`. Its separate effort axis is `not-applicable`.
198
+ - **Cursor:** pass `providers.cursor.dispatchArgs.model` byte-for-byte as the
199
+ actual invocation model. The string is opaque; do not normalize it or infer
200
+ family, effort, cost, or capability from its spelling. That opaque value is
201
+ the enforced model argument.
224
202
 
225
- On a `fail` verdict:
203
+ If exact controls cannot be applied, fail closed. A transient retry reuses the
204
+ same complete provider payload. Substantive escalation re-resolves another
205
+ configured candidate within the same named maximum and bounded retry budget.
226
206
 
227
- - Read `oat_orchestration_retry_limit` from `state.md` frontmatter (default `2`, range `0–5`).
228
- - For each retry: re-dispatch the implementer in `fix` mode with the review artifact and findings, then re-dispatch the reviewer.
229
- - On `pass` → exit the loop; the phase disposition becomes `merged` (sequential) or `merged` (parallel, after fan-in).
230
- - On retries exhausted:
231
- - **Sequential mode:** STOP the run with phase id, unresolved findings, and review artifact path.
232
- - **Parallel group mode:** mark the phase `excluded`, do not merge its worktree, continue the remaining phases in the group, and report it in Outstanding Items.
207
+ ## Task Scope and Commit Verification
233
208
 
234
- Tier is never silently downgraded. If a Tier 1 dispatch has a transient failure, the orchestrator retries exactly once; a second failure is treated the same as fix-loop exhaustion for that phase.
209
+ Each worker receives only one task:
235
210
 
236
- ### Escalation termini
211
+ ```yaml
212
+ mode: task-worker
213
+ task_id: p02-t03
214
+ task_name: Add correlation validation
215
+ task_plan: |
216
+ Implement only p02-t03 using its RED/GREEN steps.
217
+ file_boundary:
218
+ - packages/cli/src/commands/gate/index.ts
219
+ - packages/cli/src/commands/gate/index.test.ts
220
+ verification:
221
+ - pnpm --filter @open-agent-toolkit/cli exec vitest run src/commands/gate/index.test.ts
222
+ commit_convention: 'feat(gate): validate correlation'
223
+ ceiling_tier: balanced
224
+ ceiling_source: phase
225
+ dispatch_target: oat-phase-implementer-gpt-5-6-terra-medium
226
+ dispatch_args:
227
+ agent_type: oat-phase-implementer-gpt-5-6-terra-medium
228
+ ```
237
229
 
238
- When escalation re-dispatches at a stronger control, the ladder is provider-specific:
230
+ The Task Scope never contains the whole phase task list. Before dispatch, the
231
+ coordinator records `PRE_TASK_HEAD`. After the worker returns, it verifies:
239
232
 
240
- - **Codex:** `selected:low -> selected:medium -> selected:high -> selected:xhigh`, capped by the resolved managed cap when one exists. Managed `Uncapped` can select the preferred value; inherit/default mode has no OAT escalation control.
241
- - **Claude Code:** `selected:haiku -> selected:sonnet -> selected:opus -> selected:fable`, capped by the resolved managed cap when one exists. Managed `Uncapped` can select the preferred model; inherit/default mode has no OAT escalation control.
233
+ - returned task ID and terminal result
234
+ - verification status
235
+ - reported commit equals current `HEAD`
236
+ - exactly one new commit follows `PRE_TASK_HEAD`
237
+ - changed paths stay inside `file_boundary`
238
+ - the worktree is clean
242
239
 
243
- Escalation re-dispatches still count against the bounded retry budget; escalation changes the dispatch control, it does not grant extra retry attempts.
240
+ Only then does it select the next candidate. Workers run one at a time,
241
+ serially in the same worktree.
244
242
 
245
- ## Plan-declared parallelism
243
+ ## Phase Integration and Review
246
244
 
247
- Phases whose task file sets do not overlap may execute concurrently. Declare this in `plan.md` frontmatter:
245
+ After all task commits are verified, the coordinator runs phase-wide
246
+ verification and integration self-review without editing ordinary task files.
247
+ Its summary records each task's exact target, result, commit, and verification.
248
248
 
249
- ```yaml
250
- oat_plan_parallel_groups: [['p02', 'p03'], ['p04', 'p05']]
251
- ```
249
+ The root orchestrator then dispatches the phase reviewer:
252
250
 
253
- - Each inner array is a group of phases that run concurrently — one worktree per phase.
254
- - Phases not listed in any group run sequentially in plan order.
255
- - Groups themselves run sequentially group `[p02, p03]` merges before group `[p04, p05]` starts.
256
- - Empty or missing field fully sequential, no worktrees created, behavior identical to today's `oat-project-implement`.
251
+ - A capped managed reviewer uses the final candidate at its configured review
252
+ ceiling.
253
+ - Codex uses the exact materialized reviewer role or a fresh pinned child.
254
+ - Claude and Cursor bind the exact resolver-returned model argument.
255
+ - Managed `Uncapped` and explicit inherit/default retain their documented base
256
+ reviewer behavior.
257
+ - Timeout retries preserve the exact role or complete model payload.
257
258
 
258
- ### How a parallel group runs
259
+ Inline review is allowed only with verified equivalent current-host model and
260
+ effort controls. That exception is limited to explicit inherit or
261
+ managed-uncapped base-role behavior; capped managed review never downgrades
262
+ inline. If a review timeout occurs, retry once with the same exact role or
263
+ pinned model payload. If exact dispatch still cannot conclude, fail closed and
264
+ block.
259
265
 
260
- 1. **Bootstrap worktrees** via `oat-worktree-bootstrap-auto`, one per phase, branch name `{project-name}/{pNN}`.
261
- - The bootstrap checks inherited git cleanliness before the all-scope provider sync sweep.
262
- - If that sync leaves `.oat/sync/manifest.json` or provider directories dirty, bootstrap commits only existing or tracked sync-managed paths (`.oat/sync/manifest.json`, `.claude`, `.cursor`, `.codex`) as `chore: run sync` and reports `sync_commit: pass | fail | skip`.
263
- - If any bootstrap fails, cancel successful worktrees and **degrade the entire group** to sequential inline execution.
264
- 2. **Concurrent dispatch** of `oat-phase-implementer` into each worktree (Tier 1 only — Tier 2 cannot run concurrently and also degrades to sequential).
265
- 3. **Wait for terminal verdicts** (`pass` or `failed`) across every phase in the group.
266
- 4. **Fan-in reconciliation in plan order:** for each passing phase, `git merge --no-ff {project-name}/{pNN}`. Integration verification (`pnpm test && pnpm lint && pnpm type-check`) runs after each merge.
267
- 5. **Failed phases are excluded** — their worktrees are preserved and logged in `implementation.md` Outstanding Items. Passing phases still merge (partial merge-back, not atomic).
268
- 6. **Worktree cleanup** runs for merged phases; preserved for excluded phases.
269
- 7. **Bookkeeping commit** + HiLL checkpoint check after the group finishes.
266
+ The review commit range is authoritative. Zero Critical and zero Important
267
+ findings pass; otherwise the bounded fix loop begins.
270
268
 
271
- ### Merge-conflict handling
269
+ ## Bounded Fix Loop
272
270
 
273
- When a merge produces a conflict:
271
+ `oat_orchestration_retry_limit` defaults to `2` and accepts `0` through `5`.
272
+ For each retry:
274
273
 
275
- 1. `git merge --no-ff` is aborted.
276
- 2. `git cherry-pick` of the phase's commits is attempted.
277
- 3. If cherry-pick also conflicts, an **inline conflict-resolution subagent** is dispatched via the Task tool. The orchestrator **never reads conflicted files itself** — that context belongs in a fresh subagent.
278
- 4. The subagent reads conflicted files and project artifacts (`plan.md`, `design.md`, `spec.md`), applies a resolution, runs integration verification, and returns:
279
- - `RESOLVED` merge is committed; orchestrator proceeds.
280
- - `UNRESOLVABLE` or `VERIFICATION_FAILED` → STOP the run with phase id, conflicting files, worktree path, and the subagent's reasoning summary.
274
+ 1. Group findings into bounded one-task fix scopes.
275
+ 2. Reuse the phase coordinator in fix mode.
276
+ 3. Resolve one exact candidate per fix under the same named maximum.
277
+ 4. Dispatch and verify one fix worker at a time.
278
+ 5. Re-dispatch the reviewer over the updated range.
281
279
 
282
- The orchestrator does not proceed past a broken merge.
280
+ The coordinator does not apply fixes itself. Retry exhaustion stops sequential
281
+ execution; in a parallel phase group, the failed phase is excluded and its
282
+ worktree is preserved for diagnosis.
283
283
 
284
- ## Validating plan metadata
284
+ ## Plan-Declared Parallelism
285
285
 
286
- Before dispatching, `oat-project-implement` invokes the validator CLI:
286
+ Parallelism applies across independent phases, not tasks in one worktree:
287
287
 
288
- ```bash
289
- oat project validate-plan --project-path "${PROJECT_PATH}"
288
+ ```yaml
289
+ oat_plan_parallel_groups: [['p02', 'p03'], ['p04', 'p05']]
290
290
  ```
291
291
 
292
- The command enforces:
292
+ - One worktree and one coordinator are created per phase.
293
+ - Coordinators in separate declared worktrees may run concurrently.
294
+ - Every coordinator still dispatches its task workers serially.
295
+ - Phases outside groups run sequentially in plan order.
296
+ - Groups themselves fan in before the next group starts.
297
+
298
+ ### Parallel group flow
299
+
300
+ 1. Bootstrap each worktree with `oat-worktree-bootstrap-auto` from the current
301
+ orchestration HEAD.
302
+ 2. Verify every worktree HEAD before dispatch. Any bootstrap/base mismatch
303
+ degrades the whole group to sequential target-preserving execution.
304
+ 3. Dispatch one phase coordinator per worktree.
305
+ 4. Wait for terminal phase results.
306
+ 5. Merge passing phases back in plan order with integration verification after
307
+ each merge.
308
+ 6. Preserve excluded worktrees and record them in Outstanding Items.
309
+ 7. Clean merged worktrees, commit bookkeeping, then evaluate HiLL checkpoints.
293
310
 
294
- - `oat_plan_parallel_groups` is either missing/empty (treated as fully sequential) or a non-empty nested array of phase ID strings.
295
- - Every referenced phase id exists in the plan body.
296
- - No phase id appears in more than one group.
297
- - No singleton groups (each group must contain at least 2 phases).
298
- - Frontmatter YAML parses cleanly — malformed frontmatter fails with exit 1.
311
+ If merge and cherry-pick both conflict, the orchestrator dispatches a bounded
312
+ conflict-resolution subagent. It does not resolve the conflict in the root
313
+ context. An unresolved or verification-failing conflict stops fan-in.
299
314
 
300
- Non-zero exit stops the run. The skill does not re-implement validation in prose — the CLI is the single source of truth.
315
+ ## Phase Review Gate and HiLL
301
316
 
302
- ## Dry-run mode
317
+ After standard review passes and bookkeeping is committed, an enabled
318
+ `oat_phase_review_gate` may run a target-neutral external review for the phase.
319
+ Passing artifacts are still received for durable disposition; blocking
320
+ findings return through the bounded fix loop. Reusable lifecycle gate commands
321
+ declare the project but do not pin a provider target.
303
322
 
304
- Run with `--dry-run` to preview a run without dispatching anything:
323
+ HiLL pauses remain phase boundaries. They run only after the phase or parallel
324
+ group is integrated, reviewed, and tracked.
325
+
326
+ ## Dry Run
305
327
 
306
328
  ```bash
307
329
  oat-project-implement --dry-run
308
330
  ```
309
331
 
310
- Dry-run:
311
-
312
- - Performs tier selection and plan validation.
313
- - Builds the execution schedule (singleton phases + parallel groups in plan order).
314
- - Prints the planned dispatches and worktree layout.
315
- - Exits 0 without dispatching subagents, creating worktrees, or modifying files.
316
-
317
- Use dry-run as a sanity check after editing `oat_plan_parallel_groups` to confirm the schedule matches your intent.
332
+ Dry-run performs preflight and plan validation, resolves the phase schedule and
333
+ named maxima, and prints planned coordinator/worktree routing. It does not
334
+ dispatch coordinators or workers, create worktrees, or modify files.
318
335
 
319
336
  ## Resumption
320
337
 
321
- On re-invocation after a partial run:
338
+ On re-invocation:
322
339
 
323
- 1. Read `implementation.md` for the most recent orchestration-runs entry.
324
- 2. Compare phase counts against the plan's phase list; phases not covered by any run are the resume targets.
325
- 3. Read `state.md` for `oat_current_task` and cross-check with git log.
326
- 4. If a phase committed implementer output but has no review verdict recorded, the reviewer is re-dispatched for that phase's current HEAD.
327
- 5. If un-cleaned worktrees remain from a prior parallel group, the orchestrator lists them and asks whether to resume or clean up.
340
+ 1. Read `implementation.md`, `plan.md`, and `state.md`.
341
+ 2. Advance a stale pointer to the first incomplete task.
342
+ 3. Cross-check the latest bookkeeping commit with Git.
343
+ 4. Resume an incomplete coordinator at the next unverified task commit.
344
+ 5. Re-dispatch a missing phase reviewer for the current committed phase range.
345
+ 6. Report leftover parallel worktrees before resuming or cleaning them.
328
346
 
329
- First-ever invocations skip resumption detection.
347
+ The one-task commit boundary lets resumption distinguish completed work from an
348
+ unverified worker return without rerunning the whole phase.
330
349
 
331
- ## State and artifact updates
350
+ ## State and Artifact Updates
332
351
 
333
- After each phase (or parallel group) completes, `oat-project-implement` updates:
352
+ After a phase or parallel group completes, `oat-project-implement` updates:
334
353
 
335
- - `implementation.md` appends a `### Run N` entry between the `<!-- orchestration-runs-start -->` markers with tier, dispatch rationale, phase outcomes, parallel groups, and outstanding items.
336
- - `plan.md` updates the reviews table lifecycle (`pending` → `passed` or `fixes_added` → `fixes_completed` → `passed`).
337
- - `state.md` updates `oat_current_task`, `oat_last_commit`, `oat_project_state_updated`, and persists `oat_orchestration_retry_limit` if the user overrode the default.
354
+ - `implementation.md`: task outcomes, exact targets, commits, verification,
355
+ phase summary, review results, and deviations
356
+ - `plan.md`: task status and review lifecycle
357
+ - `state.md`: current task, last commit, phase status, and timestamp
338
358
 
339
- Legacy `oat_execution_mode: subagent-driven` in existing projects is silently ignored and removed on the next bookkeeping write.
359
+ It creates a separate bookkeeping commit after implementation commits. Legacy
360
+ `oat_execution_mode: subagent-driven` is ignored and removed on the next write.
340
361
 
341
362
  ## Related
342
363
 
343
- - [Lifecycle](lifecycle.md) where implementation sits in the full project flow.
344
- - [Artifacts](artifacts.md) — `plan.md` frontmatter contract, including `oat_plan_parallel_groups`.
345
- - [HiLL Checkpoints](hill-checkpoints.md) orthogonal pause semantics; fires after a phase or group completes and merges.
346
- - [CLI Reference](../../reference/cli-reference.md) `oat project validate-plan` and other commands.
364
+ - [Dispatch Policy](dispatch-ceiling.md) - candidate ladders, named maxima, and
365
+ exact provider resolution.
366
+ - [Lifecycle](lifecycle.md) - implementation in the full project flow.
367
+ - [Artifacts](artifacts.md) - plan/state shapes and parallel groups.
368
+ - [Reviews](reviews.md) - standard and external phase reviews.
369
+ - [HiLL Checkpoints](hill-checkpoints.md) - phase pause semantics.