@open-agent-toolkit/cli 0.1.55 → 0.1.59

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 (40) hide show
  1. package/assets/agents/oat-phase-implementer.md +195 -238
  2. package/assets/docs/cli-utilities/configuration.md +7 -6
  3. package/assets/docs/contributing/index.md +1 -0
  4. package/assets/docs/contributing/smoke-testing.md +284 -0
  5. package/assets/docs/provider-sync/providers.md +11 -11
  6. package/assets/docs/provider-sync/scope-and-surface.md +2 -2
  7. package/assets/docs/workflows/projects/dispatch-ceiling.md +29 -26
  8. package/assets/docs/workflows/projects/evidence-layers.md +123 -0
  9. package/assets/docs/workflows/projects/implementation-execution.md +160 -406
  10. package/assets/docs/workflows/projects/index.md +8 -0
  11. package/assets/docs/workflows/projects/orchestration-model.md +190 -0
  12. package/assets/docs/workflows/projects/programmatic-execution.md +137 -0
  13. package/assets/docs/workflows/projects/review-flavors.md +129 -0
  14. package/assets/public-package-versions.json +4 -4
  15. package/assets/skills/oat-agent-instructions-analyze/references/docs/provider-reference.md +5 -4
  16. package/assets/skills/oat-agent-instructions-apply/references/docs/provider-reference.md +5 -4
  17. package/assets/skills/oat-dispatch-subagents/SKILL.md +6 -1
  18. package/assets/skills/oat-dispatch-subagents/references/record-schema.md +5 -0
  19. package/assets/skills/oat-project-dispatch-subagents/SKILL.md +37 -15
  20. package/assets/skills/oat-project-implement/SKILL.md +63 -1904
  21. package/assets/skills/oat-project-implement/references/completion-and-closeout.md +431 -0
  22. package/assets/skills/oat-project-implement/references/dispatch-and-dry-run.md +715 -0
  23. package/assets/skills/oat-project-implement/references/phase-execution.md +270 -0
  24. package/assets/skills/oat-project-implement/references/plan-and-resume.md +279 -0
  25. package/assets/skills/oat-project-import-plan/SKILL.md +16 -8
  26. package/assets/skills/oat-project-plan/SKILL.md +15 -7
  27. package/assets/skills/oat-project-plan-writing/SKILL.md +74 -40
  28. package/assets/skills/oat-project-quick-start/SKILL.md +16 -8
  29. package/assets/skills/oat-project-review-provide/SKILL.md +8 -5
  30. package/assets/skills/oat-worktree-bootstrap/SKILL.md +22 -12
  31. package/assets/skills/oat-worktree-bootstrap/references/worktree-conventions.md +8 -8
  32. package/assets/skills/oat-worktree-bootstrap-auto/SKILL.md +233 -44
  33. package/dist/commands/doctor/index.d.ts.map +1 -1
  34. package/dist/commands/doctor/index.js +7 -4
  35. package/dist/commands/gate/index.d.ts +9 -1
  36. package/dist/commands/gate/index.d.ts.map +1 -1
  37. package/dist/commands/gate/index.js +62 -2
  38. package/dist/commands/project/dispatch-ceiling/index.js +2 -2
  39. package/package.json +4 -4
  40. package/assets/skills/oat-worktree-bootstrap-auto/scripts/bootstrap.sh +0 -236
@@ -0,0 +1,270 @@
1
+ # Phase Execution
2
+
3
+ Load this reference only while executing implementation phases.
4
+
5
+ ### Step 5: Per-Phase Execution
6
+
7
+ For each phase `pNN`, or each phase in a plan-declared parallel worktree group,
8
+ resolve and dispatch exactly one phase implementer. The phase implementer reads
9
+ the phase once, directly executes every task in dependency order, creates one
10
+ verified commit per planned task, runs inline between-task self-checks and
11
+ phase-wide verification, and returns a compact Phase Implementation Report.
12
+
13
+ Ordinary tasks do not require per-task workers. A phase implementer may use an
14
+ optional bounded child for beneficial recon, isolated fanout, or specialist
15
+ work under the shared dispatch contract. The phase implementer remains
16
+ responsible for file boundaries, verification, and task commits.
17
+
18
+ #### Resolve and Dispatch the Phase Implementer
19
+
20
+ Before each phase:
21
+
22
+ 1. Resolve the project dispatch policy and optional narrower phase maximum from
23
+ the plan's `## Dispatch Profile`.
24
+ 2. Resolve one exact phase implementer target with
25
+ `--role implementer --ceiling-tier <project-or-phase-named-tier> --report-scope <pNN> --report-action implementation`.
26
+ Use the phase scope, not each task ID. Omit `--ceiling-tier` only for
27
+ uncapped or inherit/default policy.
28
+ 3. Build the provider invocation before recording target, model/effort axes,
29
+ selection reason, candidates, and formal dispatch stamp.
30
+ 4. Record `PHASE_BASE_HEAD=$(git rev-parse HEAD)` and require a clean worktree.
31
+ 5. Send one self-contained Phase Scope:
32
+
33
+ ```yaml
34
+ project: {PROJECT_PATH}
35
+ phase: {pNN}
36
+ mode: implement
37
+ artifact_paths:
38
+ plan: {PROJECT_PATH}/plan.md
39
+ design: {PROJECT_PATH}/design.md
40
+ spec: {PROJECT_PATH}/spec.md
41
+ implementation: {PROJECT_PATH}/implementation.md
42
+ discovery: {PROJECT_PATH}/discovery.md
43
+ workflow_mode: {spec-driven|quick|import}
44
+ active_provider: {codex|claude|cursor|other}
45
+ phase_base_head: {PHASE_BASE_HEAD}
46
+ worktree: {assigned checkout}
47
+ parallel_group: {group or null}
48
+ expected_base_sha: {group base or PHASE_BASE_HEAD}
49
+ commit_convention: {from plan.md}
50
+ request_id: {generic dispatch request ID}
51
+ dispatch_policy: {resolver policy}
52
+ dispatch_ceiling: {resolved project/phase maximum or none}
53
+ dispatch_target: {resolver exact target}
54
+ dispatch_args: {complete provider invocation payload}
55
+ model_axis: {resolver value}
56
+ effort_axis: {resolver value}
57
+ selection_reason: {stable shared reason}
58
+ candidates_considered: {ordered exact candidates}
59
+ dispatch_stamp: {formal Dispatch: line}
60
+ ```
61
+
62
+ Codex first uses the resolver-returned materialized implementer variant as
63
+ native `agent_type`; only explicit pre-start role rejection permits the exact
64
+ pinned fresh-child route. Claude and Cursor pass the exact resolver model
65
+ argument. After acceptance, missing telemetry, timeout, `BLOCKED`, or any other
66
+ terminal outcome cannot trigger fallback or replacement.
67
+
68
+ Tier 2 inline execution is allowed only under the existing verified-equivalent
69
+ controls or documented inherit/default exception. Inline mode executes the
70
+ phase-implementer contract directly; it does not reintroduce mandatory
71
+ task-worker dispatch.
72
+
73
+ Optional third-tier readiness is not a preflight blocker. Codex depth two may be
74
+ provisioned as capability, but default phase execution requires only the root →
75
+ phase-agent depth.
76
+
77
+ #### Verify the Phase Report
78
+
79
+ On return:
80
+
81
+ - require `DONE` or `DONE_WITH_CONCERNS`;
82
+ - verify phase ID, request ID, phase base, task count, and phase verification;
83
+ - for each task, verify its commit is exactly one append-only commit in plan
84
+ order, changes only declared files, and has passing task verification;
85
+ - verify the reported commit range equals the worktree's range from
86
+ `PHASE_BASE_HEAD` to HEAD;
87
+ - require a clean worktree; and
88
+ - validate every optional child record without requiring any child.
89
+
90
+ `NEEDS_CONTEXT` may receive only missing artifact context through the original
91
+ handle. `BLOCKED` is terminal for the attempt. `INVALID_RUN_ABORT` terminates
92
+ every accepted handle owned by the run, preserves invalidating evidence, and
93
+ never authorizes fallback, replacement, or sequential degradation. Sequential
94
+ degradation is forbidden for the invalid run.
95
+
96
+ ### Per-Phase Review
97
+
98
+ The root workflow owns implementation review. After validating the phase
99
+ report, resolve and dispatch exactly one fresh `oat-reviewer` round at the
100
+ configured review ceiling:
101
+
102
+ ```bash
103
+ oat project dispatch-ceiling resolve \
104
+ --provider "$ACTIVE_PROVIDER" \
105
+ --role reviewer \
106
+ --report-scope "$PHASE" \
107
+ --report-action review \
108
+ --project-path "$PROJECT_PATH" \
109
+ --json
110
+ ```
111
+
112
+ Do not pass a task-only `--ceiling-tier` override. Build and record the exact
113
+ review payload before launch. Send a self-contained Review Scope with the phase
114
+ commit range, task IDs and boundaries, artifacts, verification evidence,
115
+ configured axes, selection reason, and candidates. Require a timestamped review
116
+ artifact under the project's `reviews/` directory.
117
+
118
+ For a managed capped review, bind the exact provider argument to the actual
119
+ invocation: `providers.codex.dispatchArgs.variant`,
120
+ `providers.claude.dispatchArgs.model`, or
121
+ `providers.cursor.dispatchArgs.model`. If the root cannot apply, pass, or bind
122
+ the required model or role control, fail closed before launch.
123
+
124
+ After acceptance, poll, nudge, or continue only through the accepted reviewer
125
+ handle. Only explicit pre-start rejection allows another route. Timeout,
126
+ interruption, `BLOCKED`, or contract refusal is the review outcome and never a
127
+ reason to replace an accepted reviewer.
128
+
129
+ Validate artifact scope and commit range. Zero Critical and zero Important
130
+ findings passes. Medium/Minor findings are recorded without blocking.
131
+
132
+ #### Bounded Fix and Re-Review Loop
133
+
134
+ On Critical/Important findings:
135
+
136
+ 1. Read `oat_orchestration_retry_limit` from state (default `2`, range 0–5).
137
+ 2. Resume the original phase implementer handle in `mode: fix` with only the
138
+ review artifact, bounded findings, prior report, original request ID, and a
139
+ continuation event.
140
+ 3. Verify the fix report, commit, file bounds, continuation linkage, passing
141
+ phase verification, and clean worktree.
142
+ 4. Dispatch one new root-owned reviewer round against the updated range.
143
+ 5. Repeat until pass or retry exhaustion.
144
+
145
+ If the original phase handle cannot be resumed after successful phase
146
+ completion, the root may launch at most one fresh phase implementer with the
147
+ same exact target and bounded fix scope. Its generic dispatch record must
148
+ reference the original `request_id` through existing `continuation_events`.
149
+ This is a new fix scope, not replacement of the completed phase launch and not
150
+ a dispatch schema change.
151
+ On hosts that do not support resuming a completed child handle, this fresh
152
+ same-target fix launch is expected rather than an anomalous recovery.
153
+
154
+ Retry exhaustion stops a sequential run. In a parallel group, mark the phase
155
+ `excluded`, do not merge its worktree, and report the review artifact and
156
+ worktree in Outstanding Items.
157
+
158
+ ### Optional External Phase Review Gate
159
+
160
+ After the root-owned per-phase reviewer passes and phase bookkeeping is clean,
161
+ run `oat_phase_review_gate` for selected phases:
162
+
163
+ ```bash
164
+ oat --json gate review \
165
+ --project "$PROJECT_PATH" \
166
+ --review-type code \
167
+ --review-scope "{pNN}" \
168
+ --exit-nonzero-on "{threshold}" \
169
+ '$oat-project-review-provide code {pNN}'
170
+ ```
171
+
172
+ Do not pass `--target` in normal execution. All three receive-eligibility
173
+ conditions must hold: `status` is `ok` or `blocked`, `receiveEligible: true`,
174
+ and `handoff` is non-null.
175
+
176
+ - `ok`: consume the artifact through non-pausing judgment-sweep mode.
177
+ - `blocked`: consume blocking findings, route fixes to the original phase
178
+ implementer under the bounded loop, then re-run root review and the gate.
179
+ - target execution, artifact validation, or missing-artifact failure: stop.
180
+
181
+ Gate retry rounds use the same orchestration retry limit. Gate independence,
182
+ configured provenance, liveness telemetry, and fail-closed behavior are
183
+ unchanged.
184
+
185
+ ### Parallel Group Execution
186
+
187
+ For a multi-phase schedule entry:
188
+
189
+ 1. Capture `EXPECTED_HEAD=$(git rev-parse HEAD)`.
190
+ 2. Bootstrap one worktree per phase through `oat-worktree-bootstrap-auto` with
191
+ explicit base `EXPECTED_HEAD`. Never substitute host-native worktree
192
+ isolation.
193
+ 3. Verify each worktree HEAD equals or descends from `EXPECTED_HEAD` before
194
+ dispatch.
195
+ 4. Dispatch one phase implementer per worktree concurrently. Each agent
196
+ directly executes its phase tasks serially.
197
+ 5. After every phase report, the root dispatches and owns that phase's review
198
+ and bounded fix loop.
199
+ 6. Wait for terminal verdicts, then merge passing phases in plan order using
200
+ `git merge --no-ff`.
201
+ 7. On conflict, abort merge and try phase-commit cherry-pick. If unresolved,
202
+ dispatch a bounded conflict-resolution child; do not reinterpret phase work
203
+ in the root context.
204
+ 8. Run integration verification after each fan-in.
205
+ 9. Clean merged worktrees; preserve excluded worktrees with recorded paths.
206
+ 10. Create one bookkeeping commit after the group, then run selected external
207
+ phase gates in plan order.
208
+
209
+ Smoke containment, ownership registration, base verification, or fixture
210
+ readiness failure invokes known-invalid run abort immediately. Outside smoke
211
+ mode, a bootstrap failure may degrade the whole group to sequential
212
+ target-preserving execution and must be recorded.
213
+
214
+ ### Step 7: Artifact Updates After Each Phase (or Group)
215
+
216
+ After each phase or parallel group:
217
+
218
+ - append an Orchestration Run with phase outcomes, task commits, phase/root
219
+ review result, fix iterations, dispatch stamps, selection reasons,
220
+ candidates, optional nested dispatches, worktrees, and outstanding items;
221
+ - update the plan review row through `fixes_added` / `fixes_completed` /
222
+ `passed` as appropriate;
223
+ - update `state.md` current task, last commit, and timestamp;
224
+ - remove legacy `oat_execution_mode: subagent-driven`; and
225
+ - preserve any configured retry override.
226
+
227
+ Bookkeeping is mandatory:
228
+
229
+ ```bash
230
+ oat state refresh
231
+ git add {PROJECT_PATH}/implementation.md {PROJECT_PATH}/state.md {PROJECT_PATH}/plan.md
232
+ git commit -m "chore(oat): bookkeeping after {pNN} {pass|fail}"
233
+ ```
234
+
235
+ ### Step 8: Check Plan Phase Completion
236
+
237
+ At every phase boundary, verify `implementation.md`, task pointers, phase
238
+ summary, and design/plan deviations. `oat_plan_hill_phases` lists phases after
239
+ which execution pauses; an empty list means every phase.
240
+
241
+ Before a configured non-final HiLL pause, run auto-review when enabled. Scope
242
+ starts after the last passed whole-phase review and ends at the current phase.
243
+ Count only whole-phase scopes: `pNN` or `pNN-pMM`.
244
+
245
+ - Example: prior passed row `p01`, current checkpoint `p03` → review `p02-p03`.
246
+ - Example: no prior passed whole-phase review, current checkpoint `p03` → review `p01-p03`.
247
+
248
+ For the final implementation phase use `oat-project-review-provide code final`
249
+ and do not duplicate the already completed root-owned per-phase review.
250
+
251
+ Example: `["p01", "p04"]` → pause after p01 completes and after p04 completes;
252
+ skip p02, p03.
253
+
254
+ If this is the final implementation phase checkpoint, run
255
+ `oat-project-review-provide code final` and do not run a duplicate final
256
+ phase-only lifecycle review.
257
+
258
+ Defer only a checkpoint on the final implementation phase; non-final checkpoint
259
+ behavior remains unchanged. The final checkpoint continues through final
260
+ verification, final review, and stored pre-approval work before asking for
261
+ approval.
262
+
263
+ After phase summary and task pointer advancement, refresh state and commit the
264
+ three tracking artifacts. Do not use `git add -A`.
265
+
266
+ ### Step 9: Repeat Until Complete
267
+
268
+ Continue Steps 5–8 until every implementation phase is complete or a configured
269
+ checkpoint, terminal review failure, invalid run, or real blocker stops the
270
+ run.
@@ -0,0 +1,279 @@
1
+ # Plan And Resume
2
+
3
+ This reference preserves the route-specific implementation contract. Load it only when the entry skill routes execution here.
4
+
5
+ ### Step 1: Check Plan Complete
6
+
7
+ ```bash
8
+ cat "$PROJECT_PATH/plan.md" | head -10 | grep "oat_status:"
9
+ ```
10
+
11
+ **Required frontmatter:**
12
+
13
+ - `oat_status: complete`
14
+ - `oat_ready_for: oat-project-implement`
15
+
16
+ **If not complete:** Block and ask user to finish plan first.
17
+
18
+ ### Step 1.5: Resumption Detection
19
+
20
+ If `{PROJECT_PATH}/implementation.md` already contains orchestration run entries, we may be resuming an interrupted run.
21
+
22
+ 1. Read `implementation.md` and find the most recent `### Run N` entry.
23
+ 2. Compare its phases-passed / phases-failed / phases-stopped counts against the plan's phase list.
24
+ 3. If there are phases in the plan that are not yet covered by any run entry, those are the resume targets.
25
+ 4. Read `state.md` for `oat_current_task` to cross-check the expected resume point.
26
+ 5. Read `git log` to verify the most recent bookkeeping commit matches the last reported state.
27
+
28
+ **Detected state reconciliation:**
29
+
30
+ - If there is an in-flight phase (implementer committed but no root-owned
31
+ review verdict in `implementation.md`), reconcile its phase and review
32
+ handles before any action:
33
+ - Verify the original phase report, request ID, commit range, and task
34
+ boundaries.
35
+ - When the root reviewer launch was accepted, continue, poll, or nudge only
36
+ through that existing reviewer handle. If it cannot be resumed, block or
37
+ escalate; never replace an accepted review round.
38
+ - When no review was launched, or the attempt was explicitly rejected before
39
+ child start, the root resolves and dispatches the reviewer through the
40
+ normal per-phase flow.
41
+ - When a review artifact was returned, validate its range and structured
42
+ dispatch evidence before fix disposition.
43
+ - Blocking findings resume the original phase implementer in fix mode. If
44
+ that completed phase handle is unavailable, at most one fresh same-target
45
+ implementer may receive the bounded fix scope, linked to the original
46
+ `request_id` through `continuation_events`.
47
+ - If there are un-cleaned worktrees from a prior parallel group, list them and ask the user whether to resume or clean up:
48
+
49
+ ```
50
+ Found un-cleaned worktrees from a prior run:
51
+ - ../worktrees/{name}/p02 — verdict was: excluded
52
+ - ../worktrees/{name}/p03 — verdict was: pass, not merged
53
+
54
+ Resume (merge pending verdicts into orchestration branch) or clean up?
55
+ ```
56
+
57
+ 6. Once resume target is identified, continue from that phase with the normal per-phase flow.
58
+
59
+ **On first-ever invocation** (no prior run entries), skip resumption detection and proceed to Step 2.
60
+
61
+ ### Step 2: Read Plan Document
62
+
63
+ Read `"$PROJECT_PATH/plan.md"` completely to understand:
64
+
65
+ - All phases and tasks
66
+ - File changes per task
67
+ - Verification commands
68
+ - Commit messages
69
+
70
+ ### Step 2.1: Validate Parallelism Metadata
71
+
72
+ Invoke the CLI validator to check plan.md parallelism metadata:
73
+
74
+ ```bash
75
+ oat project validate-plan --project-path "${PROJECT_PATH}"
76
+ ```
77
+
78
+ (If `oat` is not in PATH, use: `pnpm run cli -- project validate-plan --project-path "${PROJECT_PATH}"`)
79
+
80
+ The command validates:
81
+
82
+ - `oat_plan_parallel_groups` is either missing / empty (meaning fully sequential, no check needed) or a nested array of phase ID strings.
83
+ - Every referenced phase ID exists in the plan.
84
+ - No phase ID appears in more than one group.
85
+ - No singleton groups (each group must contain at least 2 phases).
86
+
87
+ **Reactions:**
88
+
89
+ - Exit code 0 → validation passed; continue to Step 2.2.
90
+ - Non-zero exit code → STOP immediately. Surface the validator's stderr output to the user. Do not silently fall back to sequential — the plan must be fixed first.
91
+
92
+ The validation contract is enforced by the CLI command and unit-tested there; the skill is just the consumer.
93
+
94
+ ### Step 2.2: Build Execution Schedule
95
+
96
+ From the phase list and the validated parallel groups, build an execution schedule:
97
+
98
+ - Phases not listed in any group form singleton entries (run sequentially).
99
+ - Each parallel group forms a multi-phase entry (run concurrently in worktrees).
100
+ - Schedule entries execute in plan order.
101
+
102
+ Example:
103
+
104
+ - Plan phases: p01, p02, p03, p04, p05
105
+ - `oat_plan_parallel_groups: [["p02", "p03"], ["p04", "p05"]]`
106
+ - Schedule: `[p01]` → `[p02, p03]` (group) → `[p04, p05]` (group)
107
+
108
+ ### Step 2.5: Confirm Plan HiLL Checkpoints
109
+
110
+ Read `oat_plan_hill_phases` from `"$PROJECT_PATH/plan.md"` frontmatter when present and validate it.
111
+
112
+ - **Valid format:** JSON-like array of phase IDs (e.g., `["p01","p03"]`)
113
+ - **Allowed pre-confirmation state:** field missing entirely on the first implementation run
114
+ - **Invalid format examples:** scalar string, malformed array, unknown phase IDs
115
+
116
+ Determine whether this is a first implementation run:
117
+
118
+ - If `"$PROJECT_PATH/implementation.md"` does not exist, treat as first run.
119
+ - If it exists but still has template placeholders and no completed task evidence, treat as first run.
120
+
121
+ #### Workflow preference check (before prompting)
122
+
123
+ Before presenting the checkpoint prompt to the user, check if a workflow preference has been configured:
124
+
125
+ ```bash
126
+ HILL_DEFAULT=$(oat config get workflow.hillCheckpointDefault 2>/dev/null || true)
127
+ ```
128
+
129
+ - **If `HILL_DEFAULT` is `every`:** Skip the prompt. Write `oat_plan_hill_phases: []` to plan.md frontmatter. Print: `HiLL checkpoints: every phase (from workflow.hillCheckpointDefault)`. Continue to Touchpoint A.
130
+ - **If `HILL_DEFAULT` is `final`:** Skip the prompt. Determine the final phase ID from plan.md (e.g., `p05`) and write `oat_plan_hill_phases: ["<final_phase_id>"]` to plan.md frontmatter. Print: `HiLL checkpoints: final phase only (from workflow.hillCheckpointDefault)`. Continue to Touchpoint A.
131
+ - **If unset, empty, or invalid:** Fall through to the standard prompt behavior below.
132
+
133
+ This preference check only applies on first runs — resuming implementations should trust the existing `oat_plan_hill_phases` value in plan.md (or repair as bookkeeping drift).
134
+
135
+ Prompt behavior:
136
+
137
+ - **If first run:** always present a complete phase-by-phase summary and confirm checkpoint phases before any task execution. A missing `oat_plan_hill_phases` value is the normal unconfirmed state; if a value is already present, treat it as a provisional value to confirm rather than as final.
138
+ - **If resuming and `oat_plan_hill_phases` is valid:** do not re-ask; print active checkpoint config and continue.
139
+ - **If resuming and `oat_plan_hill_phases` is missing/invalid:** treat this as bookkeeping drift, because implementation should already have written the confirmed value before prior task execution. Ask the user to repair the checkpoint configuration before continuing.
140
+
141
+ Required prompt shape for first-run confirmation:
142
+
143
+ 1. Open with plan framing:
144
+ - `This plan has {phase_count} phases. Final phase: {final_phase_id}.`
145
+ 2. Briefly summarize every plan phase in order:
146
+ - `p01 — {short phase summary}`
147
+ - `p02 — {short phase summary}`
148
+ - ...
149
+ - Never omit this summary, even if the plan has only one phase or `oat_plan_hill_phases` already contains a provisional value.
150
+ 3. Ask the checkpoint question using exactly three options:
151
+ - `Which checkpoint behavior do you want?`
152
+ - `1. Stop after each phase (default)`
153
+ - `2. Stop after specific phases, e.g. p02, p05`
154
+ - `3. Stop only after the final phase is completed`
155
+ 4. Map the options to stored values:
156
+ - `1` -> `[]`
157
+ - `2` -> user-specified array such as `["p02","p05"]`
158
+ - `3` -> `["p07"]` (replace `p07` with the actual final phase ID for this plan)
159
+ 5. If a provisional `oat_plan_hill_phases` value already exists, mention it after presenting the three options, but still require the user to choose or confirm one of them.
160
+
161
+ When user confirms/changes:
162
+
163
+ - Update `"$PROJECT_PATH/plan.md"` frontmatter `oat_plan_hill_phases` to the confirmed value before executing tasks.
164
+ - Keep the value stable for the rest of the run unless the user explicitly requests a change.
165
+
166
+ #### Auto-Review at HiLL Checkpoints (Touchpoint A)
167
+
168
+ After checkpoint behavior is confirmed, resolve auto-review preference:
169
+
170
+ 1. Read `workflow.autoReviewAtHillCheckpoints` via `oat config get workflow.autoReviewAtHillCheckpoints`. This uses local > shared > user resolution and falls back to legacy `.oat/config.json` `autoReviewAtCheckpoints` when the workflow key is unset.
171
+ 2. **If config explicitly `true`:** Skip the prompt. Write `oat_auto_review_at_hill_checkpoints: true` to plan.md frontmatter. Print: "Auto-review at HiLL checkpoints: enabled (from workflow.autoReviewAtHillCheckpoints)."
172
+ 3. **If config explicitly `false`:** Skip the prompt. Write `oat_auto_review_at_hill_checkpoints: false` to plan.md frontmatter. Print: "Auto-review at HiLL checkpoints: disabled (from workflow.autoReviewAtHillCheckpoints)."
173
+ 4. **If config is unset:** Add one question after the checkpoint choice:
174
+ ```
175
+ 4. Auto-review at HiLL checkpoints?
176
+ - yes: automatically run the lifecycle review when a HiLL checkpoint phase completes
177
+ - no (default): manual lifecycle review triggering
178
+ ```
179
+ 5. Write `oat_auto_review_at_hill_checkpoints: true|false` to plan.md frontmatter alongside `oat_plan_hill_phases`.
180
+
181
+ This setting controls only the extra `oat-project-review-provide` lifecycle
182
+ review at HiLL checkpoints. It does not control the standard root-owned phase
183
+ review; Tier 1 always runs `oat-reviewer` after each phase.
184
+
185
+ **On resume:** If `oat_auto_review_at_hill_checkpoints` is already present in plan.md frontmatter, skip Touchpoint A entirely — do not re-ask, do not re-read config, do not print the auto-review note. The stored value is authoritative. If only legacy `oat_auto_review_at_checkpoints` is present, treat it as authoritative for this run and write the new `oat_auto_review_at_hill_checkpoints` key on the next plan frontmatter update.
186
+
187
+ ### Step 2.6: Validate Optional Phase Review Gate
188
+
189
+ Read `oat_phase_review_gate` from `"$PROJECT_PATH/plan.md"` frontmatter when present.
190
+
191
+ This is the plan-level `phaseReviewGate` setting: an optional, non-pausing external lifecycle review gate that runs after a phase's standard per-phase self-review passes. It uses the existing `oat gate review` target configuration to run a cross-provider review, then maps the produced review artifact to a blocking/non-blocking gate result.
192
+
193
+ Valid shape:
194
+
195
+ ```yaml
196
+ oat_phase_review_gate:
197
+ enabled: true
198
+ phases: [] # empty or omitted = every implementation phase
199
+ review_type: code
200
+ exit_nonzero_on: important
201
+ ```
202
+
203
+ Validation rules:
204
+
205
+ - Missing, `null`, or `enabled: false` means disabled.
206
+ - `enabled: true` activates the gate.
207
+ - `phases` is optional. If missing or empty (`[]`), run after every implementation phase. If populated, every value must be a known plan phase ID.
208
+ - `review_type` is optional and defaults to `code`. This skill only supports `code` phase gates; any other value is invalid for implementation phase execution.
209
+ - `exit_nonzero_on` is optional and defaults to `important`. Allowed values: `critical`, `important`, `medium`, `minor`.
210
+
211
+ If the setting is invalid, stop before task execution and ask the user to repair `plan.md`. Do not silently disable a malformed gate.
212
+
213
+ This setting is independent from HiLL checkpoints:
214
+
215
+ - It does not pause when the gate passes.
216
+ - It does not append to `oat_hill_completed`.
217
+ - It does not alter `oat_plan_hill_phases` or `oat_auto_review_at_hill_checkpoints`.
218
+ - It uses the existing gate target config; do not hardcode `--target` in reusable plan execution unless the user explicitly asks for manual/debug routing.
219
+
220
+ ### Step 3: Check Implementation State
221
+
222
+ Check if implementation already started:
223
+
224
+ ```bash
225
+ cat "$PROJECT_PATH/implementation.md" 2>/dev/null | head -20
226
+ ```
227
+
228
+ **If exists and has progress:**
229
+
230
+ - Read `oat_current_task_id` from frontmatter (e.g., "p01-t03" or "prev1-t01")
231
+ - **Revision task recognition:** `p-revN` phases and `prevN-tNN` task IDs are treated identically to standard `pNN` phases and `pNN-tNN` tasks for execution purposes. The implement skill does not need special handling — it just follows the plan sequentially.
232
+ - Validate the task pointer:
233
+ - If `oat_current_task_id` points at a task already marked `completed` in the body, advance to the **next incomplete** task (first `pending` / `in_progress` / `blocked` entry).
234
+ - If all tasks are completed, skip ahead to finalization (Step 11+).
235
+ - **Always resume** from the resolved task. Print `Resuming from {task_id}.` Do not prompt.
236
+ - **Fresh start is an explicit override only.** If the user invoked the skill with `fresh=true` (argument), warn `Starting fresh — this will overwrite implementation.md. Any draft logs will be lost.` and proceed with fresh initialization. Do not offer fresh start interactively; it is a rare edge case reserved for corrupt state or deliberate plan rewrites.
237
+
238
+ **Stale-state reconciliation (approval required):**
239
+
240
+ - Before executing tasks, cross-check `plan.md` Reviews status with `implementation.md` + `state.md`.
241
+ - If `plan.md` shows a scope as `passed` but `implementation.md` / `state.md` still says "awaiting re-review" (or leaves `oat_current_task_id` / `oat_current_task` as `null` while future plan tasks are still incomplete), treat this as bookkeeping drift.
242
+ - Resolve the next task from plan order (first incomplete non-review task after the passed scope), then ask:
243
+ - "Detected bookkeeping drift: review is passed in plan.md, but state artifacts still show awaiting re-review. Update artifacts and continue from {next_task_id}?"
244
+ - Only if the user approves:
245
+ - Update `implementation.md` frontmatter `oat_current_task_id: {next_task_id}`
246
+ - Update `state.md` frontmatter `oat_current_task: {next_task_id}` and refresh stale "awaiting re-review" wording
247
+ - Update implementation review notes "Next" guidance to continue implementation (not re-review)
248
+ - If the user declines:
249
+ - Do not auto-edit bookkeeping; pause and ask whether to proceed manually or stop.
250
+
251
+ **If doesn't exist:**
252
+
253
+ - Initialize from template (Step 4)
254
+
255
+ **Important:** Never overwrite an existing `implementation.md` without explicit user confirmation (and warn that draft logs will be lost).
256
+
257
+ ### Step 4: Initialize Implementation Document
258
+
259
+ Copy template: `.oat/templates/implementation.md` → `"$PROJECT_PATH/implementation.md"`
260
+
261
+ Update frontmatter:
262
+
263
+ ```yaml
264
+ ---
265
+ oat_status: in_progress
266
+ oat_ready_for: null
267
+ oat_blockers: []
268
+ oat_last_updated: { today }
269
+ oat_current_task_id: p01-t01 # Stable task ID from plan
270
+ ---
271
+ ```
272
+
273
+ Initialize project state so other skills (e.g., `oat-project-progress`) reflect that implementation has started:
274
+
275
+ - In `"$PROJECT_PATH/state.md"` frontmatter:
276
+ - `oat_phase: implement`
277
+ - `oat_phase_status: in_progress`
278
+ - `oat_current_task: p01-t01`
279
+ - `oat_project_state_updated: "{ISO 8601 UTC timestamp}"`
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oat-project-import-plan
3
- version: 1.4.5
3
+ version: 1.4.6
4
4
  description: Use when you have an external markdown plan to execute with OAT. Preserves the source plan and normalizes it into canonical plan.md format.
5
5
  argument-hint: '<path-to-plan.md> [--provider codex|cursor|claude] [--project <name>]'
6
6
  oat_gateable: true
@@ -326,13 +326,21 @@ Apply the shared loop exactly:
326
326
 
327
327
  - Resolve `workflow.autoArtifactReview.plan`; only an explicit `false` skips the loop.
328
328
  - Resolve `oat_orchestration_retry_limit` from project state, defaulting to `2`.
329
- - For a concrete managed target, dispatch the exact registered reviewer role. If the host cannot select it, launch a fresh Codex child pinned to the resolved model and reasoning effort with the canonical reviewer instructions.
330
- - For Claude or Cursor, pass the exact resolver-returned
331
- `providers.<provider>.dispatchArgs.model` as the actual invocation's model
332
- argument. Preserve the same complete payload on timeout and retry; Cursor
333
- strings remain opaque.
334
- - Run inline only with verified equivalent current-host model and effort controls, or for explicit inherit/default behavior or the managed-uncapped reviewer exception. If none applies, fail closed before artifact review.
335
- - If the reviewer times out or does not conclude, poll and nudge once, then retry the same exact role or pinned child within the retry bound. If that target-preserving retry still fails, fail closed; never downgrade the review to inline.
329
+ - Review in the current planning parent by deliberate inheritance by default.
330
+ Do not launch a managed child unless launcher-owned evidence identifies that
331
+ parent as unknown or below the resolved reviewer ceiling.
332
+ - For that exception only, apply the shared concrete target contract. A Codex
333
+ materialized variant must first be launched as the exact native `agent_type`;
334
+ only a recorded actual pre-start role-selection rejection permits a fresh
335
+ child pinned to the resolved model and effort. Claude and Cursor use the
336
+ exact resolver-returned `providers.<provider>.dispatchArgs.model` value;
337
+ Cursor strings remain opaque.
338
+ - After acceptance, poll, nudge, or continue only through the existing reviewer
339
+ handle. A terminal timeout blocks or escalates without another launch.
340
+ Replacement eligibility is limited to explicit pre-start rejection.
341
+ - Run an exception inline only with verified equivalent current-host model and
342
+ effort controls. Default inherited review runs in the planning parent. If
343
+ neither route applies, fail closed before artifact review.
336
344
  - Apply Critical and Important artifact-local fixes when unambiguous and limited to canonical conformance/completeness; offer Medium and Minor fixes instead of silently applying them.
337
345
  - Re-dispatch after rewrites until clean or the retry bound is exhausted.
338
346
  - Update the `plan` artifact row in the `## Reviews` table to `passed` when clean. If residual findings remain, preserve the row and surface the residual findings before downstream handoff.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oat-project-plan
3
- version: 1.3.13
3
+ version: 1.3.14
4
4
  description: Use when design.md is complete and executable implementation tasks are needed. Breaks design into bite-sized TDD tasks in canonical plan.md format.
5
5
  oat_gateable: true
6
6
  disable-model-invocation: true
@@ -462,13 +462,21 @@ Apply the shared loop exactly:
462
462
 
463
463
  - Resolve `workflow.autoArtifactReview.plan`; only an explicit `false` skips the loop.
464
464
  - Resolve `oat_orchestration_retry_limit` from project state, defaulting to `2`.
465
- - For a concrete managed target, dispatch the exact registered reviewer role. If the host cannot select it, launch a fresh Codex child pinned to the resolved model and reasoning effort with the canonical reviewer instructions.
466
- - For Claude or Cursor, pass the exact resolver-returned
467
- `providers.<provider>.dispatchArgs.model` value as the actual invocation's
468
- model argument. Preserve that same complete payload on timeout and retry;
465
+ - Review in the current planning parent by deliberate inheritance by default.
466
+ Do not launch a managed child unless launcher-owned evidence identifies that
467
+ parent as unknown or below the resolved reviewer ceiling.
468
+ - For that exception only, apply the shared concrete target contract. A Codex
469
+ materialized variant must first be launched as the exact native `agent_type`;
470
+ only a recorded actual pre-start role-selection rejection permits a fresh
471
+ child pinned to the resolved model and effort. Claude and Cursor use the
472
+ exact resolver-returned `providers.<provider>.dispatchArgs.model` value;
469
473
  Cursor strings remain opaque.
470
- - Run inline only with verified equivalent current-host model and effort controls, or for explicit inherit/default behavior or the managed-uncapped reviewer exception. If none applies, fail closed before artifact review.
471
- - If the reviewer times out or does not conclude, poll and nudge once, then retry the same exact role or pinned child within the retry bound. If that target-preserving retry still fails, fail closed; never downgrade the review to inline.
474
+ - After acceptance, poll, nudge, or continue only through the existing reviewer
475
+ handle. A terminal timeout blocks or escalates without another launch.
476
+ Replacement eligibility is limited to explicit pre-start rejection.
477
+ - Run an exception inline only with verified equivalent current-host model and
478
+ effort controls. Default inherited review runs in the planning parent. If
479
+ neither route applies, fail closed before artifact review.
472
480
  - Apply Critical and Important artifact-local fixes when unambiguous; offer Medium and Minor fixes instead of silently applying them.
473
481
  - Re-dispatch after rewrites until clean or the retry bound is exhausted.
474
482
  - Update the `plan` artifact row in the `## Reviews` table to `passed` when clean. If residual findings remain, preserve the row and surface the residual findings before downstream handoff.