@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,431 @@
1
+ # Completion And Closeout
2
+
3
+ This reference preserves the route-specific implementation contract. Load it only when the entry skill routes execution here.
4
+
5
+ ### Step 10: Handle Blockers
6
+
7
+ If a task cannot be completed:
8
+
9
+ **Mark as blocked:**
10
+
11
+ ```yaml
12
+ oat_blockers:
13
+ - task_id: { task_id } # e.g., p01-t03
14
+ reason: '{description}'
15
+ since: { date }
16
+ ```
17
+
18
+ **Update task status:**
19
+
20
+ ```markdown
21
+ ### Task {task_id}: {Task Name}
22
+
23
+ **Status:** blocked
24
+ **Blocker:** {description}
25
+ ```
26
+
27
+ **Notify user:**
28
+
29
+ ```
30
+ Task {task_id} blocked: {reason}
31
+
32
+ Options:
33
+ 1. Resolve blocker and continue
34
+ 2. Skip task (mark as deferred)
35
+ 3. Modify plan to address blocker
36
+ ```
37
+
38
+ ### Step 11: Mark Implementation Complete
39
+
40
+ When all plan tasks are complete (i.e., there is no next incomplete `pNN-tNN` task):
41
+
42
+ **Update "Final Summary" (required):**
43
+
44
+ - Before requesting final review / running `oat-project-pr-final`, update the `## Final Summary (for PR/docs)` section in `"$PROJECT_PATH/implementation.md"`:
45
+ - What shipped (capabilities, behavior-level)
46
+ - Key files/modules touched
47
+ - Verification performed (tests/lint/typecheck/build/manual)
48
+ - Design deltas (if any)
49
+ - This should reflect **what was actually implemented**, including any deviations from design and any review-fix work.
50
+
51
+ Update frontmatter:
52
+
53
+ ```yaml
54
+ ---
55
+ oat_status: complete
56
+ oat_ready_for: null
57
+ oat_blockers: []
58
+ oat_last_updated: { today }
59
+ oat_current_task_id: null
60
+ ---
61
+ ```
62
+
63
+ **Important:** `oat_current_task_id` should never point at an already-completed task. If all tasks are done, set it to `null` and proceed to the final review gate.
64
+
65
+ ### Step 12: Update Project State
66
+
67
+ Update `"$PROJECT_PATH/state.md"` so other skills reflect task completion and review gating:
68
+
69
+ **Frontmatter updates:**
70
+
71
+ - `oat_current_task: null`
72
+ - `oat_last_commit: {final_commit_sha}`
73
+ - `oat_blockers: []`
74
+ - `oat_phase: implement`
75
+ - `oat_phase_status: in_progress` (until final review passes)
76
+ - `oat_project_state_updated: "{ISO 8601 UTC timestamp}"`
77
+ - **If** `"implement"` is in `oat_hill_checkpoints`: append `"implement"` to `oat_hill_completed` array
78
+
79
+ **Note:** Only append to `oat_hill_completed` when the phase is configured as a HiLL gate.
80
+
81
+ Update content:
82
+
83
+ ```markdown
84
+ ## Current Phase
85
+
86
+ Implementation - Tasks complete; awaiting final review.
87
+
88
+ ## Progress
89
+
90
+ - ✓ Discovery complete
91
+ - ✓ Specification complete
92
+ - ✓ Design complete
93
+ - ✓ Plan complete
94
+ - ✓ Implementation tasks complete
95
+ - ⧗ Awaiting final review
96
+ ```
97
+
98
+ **Bookkeeping commit (required):**
99
+
100
+ **DO NOT SKIP.** This commit prevents state drift across sessions.
101
+
102
+ After updating state.md to reflect implementation completion, refresh the repo dashboard when available and commit all modified project tracking files:
103
+
104
+ ```bash
105
+ oat state refresh
106
+ git add "$PROJECT_PATH/implementation.md" "$PROJECT_PATH/state.md" "$PROJECT_PATH/plan.md"
107
+ git diff --cached --quiet || git commit -m "chore(oat): update tracking artifacts for implementation complete"
108
+ ```
109
+
110
+ Do not use `git add -A` or glob patterns. Only commit the three project artifacts listed above; `.oat/state.md` is a generated, gitignored dashboard.
111
+
112
+ ### Step 13: Final Verification
113
+
114
+ Run project-wide verification:
115
+
116
+ ```bash
117
+ # Run tests
118
+ pnpm test
119
+
120
+ # Run lint
121
+ pnpm lint
122
+
123
+ # Run type check
124
+ pnpm type-check
125
+
126
+ # Run build
127
+ pnpm build
128
+ ```
129
+
130
+ All must pass before proceeding.
131
+
132
+ ### Step 14: Trigger Final Review
133
+
134
+ **At the final plan phase boundary, a code review is required before PR.**
135
+
136
+ An accepted reviewer `BLOCKED` terminal blocks final review. It does not invoke
137
+ fallback and must not be interpreted as a pass due to absent findings. Stop and
138
+ surface the review target and blocker reason.
139
+
140
+ Before requesting final review, ensure the latest project-artifact bookkeeping is already committed. Review should evaluate the implementation state as it actually stands on the branch, not a half-tracked working tree.
141
+
142
+ Check if final review already completed (preferred source of truth: plan.md Reviews table):
143
+
144
+ ```bash
145
+ FINAL_ROW=$(grep -E "^\\|\\s*final\\s*\\|" "$PROJECT_PATH/plan.md" 2>/dev/null | head -1)
146
+ echo "$FINAL_ROW"
147
+ ```
148
+
149
+ **If final review row exists and status is `passed`:**
150
+
151
+ - Example row:
152
+ - `| final | code | passed | 2026-01-28 | reviews/final-review-2026-01-28T140322Z.md |`
153
+ - Check:
154
+
155
+ ```bash
156
+ echo "$FINAL_ROW" | grep -qE "^\\|\\s*final\\s*\\|.*\\|\\s*passed\\s*\\|" && echo "passed"
157
+ ```
158
+
159
+ - Continue to Step 15 (final closeout)
160
+
161
+ **If final review is not marked `passed`:**
162
+
163
+ - Tell user: "All tasks complete. Final review required before PR."
164
+
165
+ **Workflow preference check (before prompting):**
166
+
167
+ First resolve the final reviewer target with the same target-first contract as
168
+ per-phase review. A concrete managed Codex target must first send its exact
169
+ registered reviewer as native `agent_type`; only a native role-selection
170
+ rejection permits an explicitly pinned fresh child. Spawn acceptance plus the
171
+ launcher payload supplies configured invocation evidence, so missing telemetry,
172
+ missing self-report, or a later `BLOCKED` result cannot trigger fallback. Record
173
+ the final review `target`, `model_axis`, and `effort_axis` from resolver output
174
+ and the constructed launcher payload, never from reviewer self-report. A
175
+ concrete managed Claude or Cursor target must put
176
+ `providers.claude.dispatchArgs.model` or
177
+ `providers.cursor.dispatchArgs.model` respectively into the actual provider
178
+ invocation as the exact `model` argument; Cursor strings remain opaque. Before
179
+ acceptance, a transport retry preserves the exact payload. After acceptance,
180
+ poll, nudge, or continue only through the existing reviewer handle. A terminal
181
+ timeout stops or escalates without another launch; a fresh pinned-child route
182
+ is eligible only after explicit pre-start role-selection rejection. If the host
183
+ cannot apply the required role or model argument, fail closed or block unless
184
+ verified equivalent current-host controls permit inline execution. The preference below chooses only among
185
+ routes that preserve that target; it cannot authorize generic inline or base
186
+ execution. Inline remains available only with verified equivalent current-host
187
+ controls or an allowed explicit inherit/default or managed-uncapped reviewer
188
+ base-role exception.
189
+
190
+ ```bash
191
+ REVIEW_MODEL=$(oat config get workflow.reviewExecutionModel 2>/dev/null || true)
192
+ ```
193
+
194
+ - **If `REVIEW_MODEL` is `subagent`:** Print `Review execution: subagent (from workflow.reviewExecutionModel).` Dispatch the review subagent directly via the Task tool. No prompt.
195
+ - **If `REVIEW_MODEL` is `inline`:** Honor it only when the inline route satisfies the verified-equivalent-controls or documented-exception guard. Otherwise use the exact/pinned route or block. When allowed, print `Review execution: inline (from workflow.reviewExecutionModel).` and run the review in-context per `oat-project-review-provide`.
196
+ - **If `REVIEW_MODEL` is `fresh-session`:** This is a **soft preference with escape hatch** because the agent cannot run the review in a fresh session on the user's behalf. Print the guidance block below, then handle the user's response per the three outcomes listed after it.
197
+ - **If unset or invalid:** Fall through to the standard 3-tier prompt below.
198
+
199
+ **Fresh-session guidance block (print when `REVIEW_MODEL` is `fresh-session`):**
200
+
201
+ ```
202
+ Per your config (workflow.reviewExecutionModel: fresh-session), your
203
+ preference is to run the review in a fresh session.
204
+
205
+ Run `oat-project-review-provide code final` in a separate session, then
206
+ resume this session when the review is complete.
207
+
208
+ If you'd like to review here instead:
209
+ 1) subagent
210
+ 2) inline
211
+
212
+ Enter 1 or 2 to run the review here, or press Enter to wait.
213
+ ```
214
+
215
+ **Fresh-session response outcomes:**
216
+
217
+ - User enters `1` → dispatch the subagent review (same behavior as `REVIEW_MODEL=subagent`).
218
+ - User enters `2` → apply the same guarded inline behavior as `REVIEW_MODEL=inline`; this choice does not waive managed target controls.
219
+ - User presses Enter (or equivalent no-input confirmation) → pause the session and wait for the fresh-session review to complete before continuing.
220
+
221
+ **Standard prompt (when preference is unset):**
222
+
223
+ Offer review options (3-tier capability model):
224
+
225
+ ```
226
+ Implementation complete. Final review required.
227
+
228
+ Review options:
229
+ 1. Run review in this session via a subagent (recommended if provider supported)
230
+ 2. Run review in a fresh session and return to this session to receive review
231
+ 3. Run review inline when current-host controls are verified equivalent
232
+
233
+ To run in a separate session use: oat-project-review-provide code final
234
+ ```
235
+
236
+ **After user chooses:**
237
+
238
+ - If subagent (option 1): Agent spawns the review via Task tool — no command needed from user
239
+ - If fresh session (option 2): User runs `oat-project-review-provide code final` in a separate session, then returns here
240
+ - If inline (option 3): Agent first verifies equivalent current-host controls or an allowed exception, then executes the review per `oat-project-review-provide`; otherwise it uses the exact/pinned route or blocks
241
+ - After review: User runs `oat-project-review-receive` to process findings
242
+ - If Critical/Important findings: Fix tasks added, re-run the `oat-project-implement` skill
243
+ - Loop until final review passes (max 3 cycles per oat-project-review-receive)
244
+
245
+ **After final review is marked `passed`:**
246
+
247
+ - Record the passed final review and keep the project in implementation closeout.
248
+ - Do not append `"implement"` to `oat_hill_completed`, set
249
+ `oat_phase_status: complete`, or offer the normal next-step prompt yet.
250
+ - Continue to **Final HiLL Closeout Sequence**.
251
+
252
+ ### Step 15: Final HiLL Closeout Sequence
253
+
254
+ The final-closeout orchestrator owns this sequence after the phase implementer
255
+ and root-owned phase review have finished. Do not move lifecycle sequencing
256
+ into phase or optional nested workers or weaken exact target selection for
257
+ child dispatches.
258
+
259
+ Identify the final implementation phase from the plan. A final HiLL checkpoint
260
+ exists when `oat_plan_hill_phases` is `[]` (every phase) or when it explicitly
261
+ contains that final phase ID. Defer only a checkpoint on the final implementation
262
+ phase; non-final checkpoint behavior remains unchanged.
263
+
264
+ Run final verification (Step 13). Final review must be `passed` before any
265
+ pre-approval dispatch. If final checkpoint auto-review is enabled, Step 8 has
266
+ already run `oat-project-review-provide code final`; do not run a duplicate
267
+ final review here.
268
+
269
+ Read the effective `workflow.postImplementSequence` once. For a configured
270
+ legacy or structured preference, normalize legacy values before snapshotting:
271
+ `wait` → `{ preApproval: [], postApproval: [] }`, `summary` →
272
+ `{ preApproval: ["summary"], postApproval: [] }`, `pr` → `{ preApproval:
273
+ ["summary", "pr"], postApproval: [] }`, and `docs-pr` → `{ preApproval:
274
+ ["summary", "document", "pr"], postApproval: [] }`.
275
+
276
+ Persist this immutable state before dispatching a child:
277
+
278
+ ```yaml
279
+ oat_post_implement_sequence:
280
+ status: pre_approval # pre_approval | awaiting_approval | post_approval | failed | complete
281
+ final_phase: pNN
282
+ pre_approval: [summary, document, pr]
283
+ pre_approval_completed: []
284
+ approval: pending # pending | approved | not_required
285
+ post_approval: []
286
+ post_approval_completed: []
287
+ failure: null
288
+ ```
289
+
290
+ The snapshot is immutable for this closeout: never re-resolve
291
+ `workflow.postImplementSequence` while it is incomplete. Iterate
292
+ `pre_approval` and `post_approval` in their stored array order; do not sort or
293
+ substitute a vocabulary order. Resume from the first incomplete stored step,
294
+ including a partially completed noncanonical order.
295
+
296
+ For every pending `summary`, `document`, or `pr`, dispatch respectively
297
+ `oat-project-summary`, `oat-project-document`, or `oat-project-pr-final`.
298
+ Every `summary`, `document`, and `pr` child receives the authoritative snapshot
299
+ and must merge state updates without replacing `oat_post_implement_sequence`.
300
+ Re-read and verify the snapshot after every child returns before recording step
301
+ success. If a child removed or altered it, restore the authoritative snapshot,
302
+ record that step as failed, and stop with the boundary, failed step, and exact
303
+ resume command: `oat-project-implement`.
304
+
305
+ Commit each completed step before dispatching the next step. On failure, persist
306
+ `status: failed`, the boundary, the failed step, and concise recovery context.
307
+ A pre-approval failure leaves `approval: pending`; a post-approval failure
308
+ retains `approval: approved`. Fail fast with the boundary, failed step, and
309
+ exact resume command: `oat-project-implement`.
310
+
311
+ 1. Dispatch incomplete `pre_approval` steps in stored order.
312
+ 2. When they succeed and a final checkpoint exists, commit `status:
313
+ awaiting_approval` with `approval: pending` before asking for final HiLL
314
+ approval.
315
+ 3. Record explicit approval as `approval: approved` and `status: post_approval`
316
+ before any post-approval dispatch. Then dispatch incomplete `post_approval`
317
+ steps in stored order.
318
+ 4. A decline or defer keeps `status: awaiting_approval` and `approval: pending`;
319
+ record neither approval nor failure and run no post-approval step. State the
320
+ boundary and exact resume command: `oat-project-implement`.
321
+ 5. If no final checkpoint exists, commit `approval: not_required` before
322
+ post-approval dispatch. `approval: not_required` is valid only when no final
323
+ checkpoint exists.
324
+ 6. After all stored steps finish, commit `status: complete`. Only then complete
325
+ implementation state, append the configured final HiLL completion, and
326
+ continue to the existing next-step behavior.
327
+
328
+ If the preference is unset, do not create a sequence snapshot. When the
329
+ preference is unset, retain the existing next-step prompt only after final
330
+ approval when a final checkpoint is configured.
331
+
332
+ ### Step 16: Prompt for Next Steps
333
+
334
+ Run the standard next-step prompt only when
335
+ `workflow.postImplementSequence` was unset and no sequence snapshot was
336
+ created. It occurs after final approval when a final checkpoint is configured.
337
+ A configured legacy or structured preference has already completed through
338
+ **Final HiLL Closeout Sequence**; do not re-dispatch its steps here. When the
339
+ completed snapshot came from configured `wait`, print
340
+ `Post-implementation: wait (from workflow.postImplementSequence). Run
341
+ follow-up skills manually when ready.` and exit without auto-chaining.
342
+
343
+ **Standard prompt (when preference is unset):**
344
+
345
+ ```
346
+ Final review passed for {project-name}.
347
+
348
+ All tasks complete and verified. Next steps:
349
+
350
+ 1. Generate project summary (oat-project-summary)
351
+ 2. Sync documentation (oat-project-document) — if applicable
352
+ 3. Create final PR (oat-project-pr-final)
353
+
354
+ Options:
355
+ a. Run all three in sequence now
356
+ b. Run summary + PR only (skip docs)
357
+ c. Exit (run individually later)
358
+
359
+ Choose:
360
+ ```
361
+
362
+ **If user chooses sequence (a or b):**
363
+
364
+ 1. Invoke `oat-project-summary` to generate summary.md
365
+ 2. If docs selected: invoke `oat-project-document`
366
+ 3. Invoke `oat-project-pr-final` — this sets `oat_phase_status: pr_open` and guides to revise/complete
367
+
368
+ Do not route directly to `oat-project-complete`. The `pr_open` status set by pr-final is the proper entry to the revision/completion flow.
369
+
370
+ **If user chooses exit (c):**
371
+
372
+ Tell user: "Run the skills individually when ready: oat-project-summary → oat-project-document → oat-project-pr-final"
373
+
374
+ ### Step 17: Output Summary
375
+
376
+ ```
377
+ Implementation complete for {project-name}.
378
+
379
+ Summary:
380
+ - Phases: {N} completed
381
+ - Tasks: {N} completed
382
+ - Commits: {N} created
383
+
384
+ Final verification:
385
+ - Tests: ✓ passing
386
+ - Lint: ✓ clean
387
+ - Types: ✓ valid
388
+ - Build: ✓ success
389
+
390
+ Final review:
391
+ - Status: ✓ passed
392
+ - Artifact: reviews/final-review-{timestamp}.md
393
+
394
+ Next: Create PR or run the oat-project-pr-final skill (when available)
395
+ ```
396
+
397
+ ### Gate Execution
398
+
399
+ Before reporting this skill as complete, run the configured gate as the final step:
400
+
401
+ 1. Resolve the gate for this skill:
402
+
403
+ ```bash
404
+ oat gate resolve <this-skill> --json
405
+ ```
406
+
407
+ If the command returns JSON `null`, no gate is configured; the skill is complete.
408
+
409
+ 2. Export the resolved project path into the command shell:
410
+
411
+ ```bash
412
+ export PROJECT_PATH
413
+ ```
414
+
415
+ If the resolved command invokes `oat gate review`, the configured review command must already include `--project "$PROJECT_PATH"` and must not include `--target <id>`. A valid reusable shape is `oat gate review --project "$PROJECT_PATH" ...`. If the declaration is missing, stop and migrate the stored gate command; do not inject or append arguments at execution time.
416
+
417
+ 3. Execute the resolved command exactly as configured. Capture stdout, stderr, the exit code, and the structured JSON result. A zero exit code means the review passed its threshold, but it does not by itself authorize artifact receipt or complete the handoff.
418
+
419
+ 4. Review-artifact handoff:
420
+ - Parse the structured gate result. An exit code or artifact path alone never authorizes `oat-project-review-receive`.
421
+ - Invoke receive only when all three conditions hold: `status` is `ok` or `blocked`, the envelope explicitly sets `receiveEligible: true`, and a non-null `handoff` confirms the artifact was corroborated.
422
+ - `receiveEligible: false` is a hard stop even when `artifactPath` is present. Never receive `targeting_correlation_failed`; correct the project/run routing and run a new gate.
423
+ - Keep `artifact_validation_failed` outside receive until the artifact is corrected and the gate successfully revalidates it. Treat `review_failed`, unknown statuses, null handoffs, and contradictory eligibility fields as operational failures.
424
+ - `blocked` exits nonzero but is receive-eligible; `ok` exits zero and still requires durable receive disposition. Route by structured status and eligibility, not by exit code.
425
+
426
+ 5. If the command exits nonzero, use `description` to orient the next steps and handle `onFailure`:
427
+ - `block`: read gate feedback, remediate, and re-run the gate up to `maxAttempts` attempts (default `2`). If attempts are exhausted, escalate to the human with accumulated feedback and append that feedback to `implementation.md`. Treat a launch failure, missing CLI, or no eligible runtime as escalation-biased and do not spend it as a remediation attempt.
428
+ - `prompt`: surface the gate failure and ask the human how to proceed.
429
+ - `warn`: record the gate failure and continue.
430
+
431
+ 6. Runtime selection note (V1): the step runs the gate `command` as-is and reads no OAT runtime env var. By default, `oat gate review` and `oat gate cross-provider-exec` resolve the current host from built-in `hostDetectionCommand`s and avoid the same runtime when no exact target is supplied. Reusable lifecycle skill-gate commands must not include `--target <id>` so independent review stays provider-neutral. Use explicit targets only for manual/debug commands or deliberate local/user-specific overrides; do not hardcode provider/model targets in bundled skill guidance or shared lifecycle gate examples.