@open-agent-toolkit/cli 0.2.26 → 0.2.28

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 (76) hide show
  1. package/assets/NOTICES.md +156 -0
  2. package/assets/agents/oat-phase-implementer.md +312 -7
  3. package/assets/docs/contributing/explainer-kit-verification.md +125 -0
  4. package/assets/docs/contributing/index.md +1 -0
  5. package/assets/docs/reference/troubleshooting.md +47 -0
  6. package/assets/docs/workflows/projects/artifacts.md +24 -6
  7. package/assets/docs/workflows/projects/implementation-execution.md +151 -1
  8. package/assets/docs/workflows/skills/explainer-kit-providers.md +144 -0
  9. package/assets/docs/workflows/skills/explainer-kit.md +121 -69
  10. package/assets/docs/workflows/skills/index.md +1 -0
  11. package/assets/public-package-versions.json +4 -4
  12. package/assets/skills/explainer-kit/SKILL.md +18 -3
  13. package/assets/skills/explainer-kit/recipes/project-recap.json +43 -16
  14. package/assets/skills/explainer-kit/references/contracts.md +167 -20
  15. package/assets/skills/explainer-kit/references/golden-conformance.md +80 -0
  16. package/assets/skills/explainer-kit/references/visual-authoring.md +92 -0
  17. package/assets/skills/explainer-kit/references/visual-review.md +57 -0
  18. package/assets/skills/explainer-kit/schemas/author-request.v2.schema.json +172 -1
  19. package/assets/skills/explainer-kit/schemas/build-record.schema.json +7 -1
  20. package/assets/skills/explainer-kit/schemas/fact-base.schema.json +38 -2
  21. package/assets/skills/explainer-kit/schemas/manifest.schema.json +25 -1
  22. package/assets/skills/explainer-kit/schemas/run-request.schema.json +4 -0
  23. package/assets/skills/explainer-kit/schemas/set-plan.v1.schema.json +149 -0
  24. package/assets/skills/explainer-kit/schemas/visual-review-request.v1.schema.json +117 -0
  25. package/assets/skills/explainer-kit/schemas/visual-review-result.v1.schema.json +80 -0
  26. package/assets/skills/explainer-kit/scripts/lib/browser-runtime.mjs +148 -4
  27. package/assets/skills/explainer-kit/scripts/lib/catalog.mjs +243 -0
  28. package/assets/skills/explainer-kit/scripts/lib/contracts.mjs +586 -8
  29. package/assets/skills/explainer-kit/scripts/lib/diagram.mjs +285 -8
  30. package/assets/skills/explainer-kit/scripts/lib/durability.mjs +35 -0
  31. package/assets/skills/explainer-kit/scripts/lib/fact-base.mjs +144 -8
  32. package/assets/skills/explainer-kit/scripts/lib/package-coverage.mjs +379 -0
  33. package/assets/skills/explainer-kit/scripts/lib/png.mjs +287 -0
  34. package/assets/skills/explainer-kit/scripts/lib/qa.mjs +280 -8
  35. package/assets/skills/explainer-kit/scripts/lib/recipes.mjs +132 -3
  36. package/assets/skills/explainer-kit/scripts/lib/records.mjs +513 -21
  37. package/assets/skills/explainer-kit/scripts/lib/render.mjs +67 -3
  38. package/assets/skills/explainer-kit/scripts/lib/s3-static.mjs +43 -1
  39. package/assets/skills/explainer-kit/scripts/lib/set-plan.mjs +208 -0
  40. package/assets/skills/explainer-kit/scripts/lib/source-backlinks.mjs +218 -0
  41. package/assets/skills/explainer-kit/scripts/lib/visual-review.mjs +380 -0
  42. package/assets/skills/explainer-kit/scripts/render-qa.mjs +48 -10
  43. package/assets/skills/explainer-kit/scripts/run.mjs +859 -134
  44. package/assets/skills/oat-dispatch-subagents/SKILL.md +16 -3
  45. package/assets/skills/oat-explainer-kit/SKILL.md +40 -12
  46. package/assets/skills/oat-explainer-kit/references/author-callback.md +12 -10
  47. package/assets/skills/oat-explainer-kit/references/lifecycle-contract.md +40 -2
  48. package/assets/skills/oat-explainer-kit/references/visual-review-callback.md +72 -0
  49. package/assets/skills/oat-explainer-kit/scripts/bind-project-sources.mjs +167 -5
  50. package/assets/skills/oat-explainer-kit/scripts/finalize-tracked-run.mjs +92 -5
  51. package/assets/skills/oat-explainer-kit/scripts/run.mjs +324 -2
  52. package/assets/skills/oat-project-autonomous/references/gate-inventory.md +2 -2
  53. package/assets/skills/oat-project-document/references/docs/autonomy-contract.md +2 -2
  54. package/assets/skills/oat-project-implement/SKILL.md +5 -4
  55. package/assets/skills/oat-project-implement/references/dispatch-and-dry-run.md +21 -0
  56. package/assets/skills/oat-project-implement/references/docs/autonomy-contract.md +2 -2
  57. package/assets/skills/oat-project-implement/references/phase-execution.md +359 -12
  58. package/assets/skills/oat-project-pr-final/references/docs/autonomy-contract.md +2 -2
  59. package/assets/skills/oat-project-quick-start/references/docs/autonomy-contract.md +2 -2
  60. package/assets/templates/state.md +7 -0
  61. package/dist/commands/project/archive/archive-utils.d.ts +1 -0
  62. package/dist/commands/project/archive/archive-utils.d.ts.map +1 -1
  63. package/dist/commands/project/archive/archive-utils.js +109 -42
  64. package/dist/commands/project/archive/explainer-package-coverage.d.ts +14 -0
  65. package/dist/commands/project/archive/explainer-package-coverage.d.ts.map +1 -0
  66. package/dist/commands/project/archive/explainer-package-coverage.js +27 -0
  67. package/dist/commands/project/archive/explainer-source-backlinks.d.ts +18 -0
  68. package/dist/commands/project/archive/explainer-source-backlinks.d.ts.map +1 -0
  69. package/dist/commands/project/archive/explainer-source-backlinks.js +27 -0
  70. package/dist/commands/project/archive/push-runner.d.ts +2 -1
  71. package/dist/commands/project/archive/push-runner.d.ts.map +1 -1
  72. package/dist/commands/project/archive/push-runner.js +5 -1
  73. package/dist/release/public-package-contract.d.ts +6 -0
  74. package/dist/release/public-package-contract.d.ts.map +1 -1
  75. package/dist/release/public-package-contract.js +75 -0
  76. package/package.json +2 -2
@@ -0,0 +1,156 @@
1
+ # NOTICES
2
+
3
+ This file records attribution for externally-sourced prose incorporated
4
+ into this repository. When you adapt or lift prose from an external
5
+ project into a skill, template, or doc, add an entry here — do not
6
+ add attribution footers to the skill files themselves.
7
+
8
+ ## Obra Superpowers
9
+
10
+ **Source:** https://github.com/obra/superpowers
11
+ **License:** MIT
12
+ **Version referenced:** 5.0.7
13
+
14
+ ### `brainstorming` skill
15
+
16
+ Source file: `skills/brainstorming/SKILL.md`
17
+
18
+ Passages adapted or lifted verbatim into OAT:
19
+
20
+ - "Exploring approaches" (4 lines) — used in `oat-project-design` Component 3.5 (approach reaffirmation)
21
+ - "Presenting the design" (5 lines) — used in `oat-project-design` Component 4 (section iterator)
22
+ - "Design for isolation and clarity" (4 lines) — used as a principle in `oat-project-design`
23
+ - Self-review four-check template — used in `oat-project-design` Component 6
24
+ - User-review gate phrasing — used in `oat-project-design` Component 7
25
+
26
+ Consumer OAT skills: `oat-project-design`, `oat-project-quick-start`
27
+ (via lightweight-design mode choice inheriting the same prose).
28
+
29
+ ### Upstream MIT license
30
+
31
+ ```text
32
+ MIT License
33
+
34
+ Copyright (c) 2025 Jesse Vincent
35
+
36
+ Permission is hereby granted, free of charge, to any person obtaining a copy
37
+ of this software and associated documentation files (the "Software"), to deal
38
+ in the Software without restriction, including without limitation the rights
39
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
40
+ copies of the Software, and to permit persons to whom the Software is
41
+ furnished to do so, subject to the following conditions:
42
+
43
+ The above copyright notice and this permission notice shall be included in all
44
+ copies or substantial portions of the Software.
45
+
46
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
49
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
50
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
51
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
52
+ SOFTWARE.
53
+ ```
54
+
55
+ ### `brainstorming` skill — visual companion
56
+
57
+ Source files: `skills/brainstorming/scripts/{server.cjs, start-server.sh,
58
+ stop-server.sh, frame-template.html, helper.js}` and
59
+ `skills/brainstorming/visual-companion.md`.
60
+
61
+ Files lifted into OAT (under `.agents/skills/oat-brainstorm/`):
62
+
63
+ - `scripts/server.cjs`, `scripts/stop-server.sh`, `scripts/frame-template.html`,
64
+ `scripts/helper.js` — verbatim from upstream.
65
+ - `scripts/start-server.sh` — verbatim except for default persistence-path
66
+ changes (`.superpowers/brainstorm/` → OAT-managed prefixes:
67
+ `<project>/.oat/brainstorm/`, `<repo-root>/.oat/brainstorm/`,
68
+ `~/.oat/brainstorm/`).
69
+ - `references/visual-companion.md` — adapted prose: persistence paths and
70
+ example invocations updated to OAT conventions.
71
+
72
+ Consumer OAT skills: `oat-brainstorm`.
73
+
74
+ ## shadcn/improve
75
+
76
+ **Source:** https://github.com/shadcn/improve/tree/main/skills/improve
77
+ **License:** MIT
78
+ **Version referenced:** `main` (retrieved 2026-07-12)
79
+
80
+ ### `improve` skill
81
+
82
+ Source files: `skills/improve/SKILL.md` and
83
+ `skills/improve/references/{audit-playbook.md,closing-the-loop.md,plan-template.md}`.
84
+
85
+ Files copied into `.agents/skills/oat-repo-improve/`; the skill identifier,
86
+ heading, invocation examples, and generated-plan attribution were renamed for
87
+ the OAT repository namespace.
88
+
89
+ ### Upstream MIT license
90
+
91
+ ```text
92
+ MIT License
93
+
94
+ Copyright (c) 2026 shadcn
95
+
96
+ Permission is hereby granted, free of charge, to any person obtaining a copy
97
+ of this software and associated documentation files (the "Software"), to deal
98
+ in the Software without restriction, including without limitation the rights
99
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
100
+ copies of the Software, and to permit persons to whom the Software is
101
+ furnished to do so, subject to the following conditions:
102
+
103
+ The above copyright notice and this permission notice shall be included in all
104
+ copies or substantial portions of the Software.
105
+
106
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
107
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
108
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
109
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
110
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
111
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
112
+ SOFTWARE.
113
+ ```
114
+
115
+ ## visual-explainer
116
+
117
+ **Source:** https://github.com/nicobailon/visual-explainer
118
+ **License:** MIT
119
+ **Version referenced:** 0.8.1
120
+
121
+ ### Explainer templates and render QA
122
+
123
+ Visual presentation and QA patterns were adapted into
124
+ `.agents/skills/explainer-kit/`, including self-contained HTML shells,
125
+ responsive navigation, slide-deck interaction and print behavior, overflow
126
+ containment, reduced-motion handling, and structural/render checks.
127
+
128
+ The OAT implementation replaces upstream branding, destinations, invocation
129
+ commands, and example content with destination-neutral contracts, themes,
130
+ templates, and fixtures. Consumer OAT skill: `explainer-kit`.
131
+
132
+ ### Upstream MIT license
133
+
134
+ ```text
135
+ MIT License
136
+
137
+ Copyright (c) 2025 Nico Bailon
138
+
139
+ Permission is hereby granted, free of charge, to any person obtaining a copy
140
+ of this software and associated documentation files (the "Software"), to deal
141
+ in the Software without restriction, including without limitation the rights
142
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
143
+ copies of the Software, and to permit persons to whom the Software is
144
+ furnished to do so, subject to the following conditions:
145
+
146
+ The above copyright notice and this permission notice shall be included in all
147
+ copies or substantial portions of the Software.
148
+
149
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
150
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
151
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
152
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
153
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
154
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
155
+ SOFTWARE.
156
+ ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oat-phase-implementer
3
- version: 1.0.10
3
+ version: 1.0.11
4
4
  description: Implements one plan phase end-to-end, commits each task separately, self-checks between tasks, and handles bounded review fixes when resumed by oat-project-implement.
5
5
  tools: Read, Write, Edit, Bash, Grep, Glob, Task
6
6
  color: cyan
@@ -26,7 +26,7 @@ The root supplies:
26
26
 
27
27
  - `project`: active OAT project path;
28
28
  - `phase`: one phase ID;
29
- - `mode`: `implement` or `fix`;
29
+ - `mode`: `implement`, `fix`, or `recover`;
30
30
  - `artifact_paths`: available plan, design, spec, discovery, implementation,
31
31
  and imported-plan paths;
32
32
  - `workflow_mode`: `spec-driven`, `quick`, or `import`;
@@ -35,6 +35,8 @@ The root supplies:
35
35
  - `worktree`: assigned phase worktree or orchestration checkout;
36
36
  - launcher-owned dispatch policy, target, arguments, axes, selection reason,
37
37
  candidates, and formal dispatch stamp;
38
+ - `phase_recovery_limit`, `phase_recovery_attempts_used`,
39
+ `original_request_id`, and the root-resolved recovery authorization source;
38
40
  - optional `parallel_group`, `expected_base_sha`, and smoke run metadata.
39
41
 
40
42
  Fix mode also supplies:
@@ -45,8 +47,21 @@ Fix mode also supplies:
45
47
  - `original_request_id`: original phase dispatch request;
46
48
  - `continuation_event`: resume linkage for this fix attempt.
47
49
 
50
+ Recover mode also supplies:
51
+
52
+ - `original_request_id` and `continuation_event`;
53
+ - `recovery_base_head`, `original_task_id`, and immutable `original_commit`;
54
+ - `defect_class`, `discovered_by`, `bounded_correction_scope`, and
55
+ `bounded_files`;
56
+ - `phase_recovery_limit`, `phase_recovery_attempts_used`, and the authoritative
57
+ `pending_attempt` ledger entry;
58
+ - `focused_verification` and `phase_verification`; and
59
+ - the exact original `dispatch_target` plus launcher-owned axes and stamp.
60
+
48
61
  Reject a missing/unknown phase, an unrecognized mode, a base mismatch, or a
49
- fix request without bounded findings.
62
+ fix request without bounded findings. Reject recover mode when any recover input
63
+ is absent, the continuation does not link to the original request, or the
64
+ pending attempt cannot be reconciled.
50
65
 
51
66
  ## Shared Dispatch Contract
52
67
 
@@ -101,6 +116,195 @@ After formatting, run the repository's applicable gate set over the produced
101
116
  diff, explicitly including artifact writes. This supplements rather than
102
117
  replaces every task and phase verification command below.
103
118
 
119
+ ## Prevention and Post-Commit Recovery
120
+
121
+ Prevention is the first recovery control. Before every planned task commit:
122
+
123
+ 1. format every changed file;
124
+ 2. run the declared task verification;
125
+ 3. run every repository-discovered cheap check applicable to the changed
126
+ surface when it is discoverable and proportionate; and
127
+ 4. when a task changes emitted output, build/test configuration, packaging, or
128
+ equivalent behavior, run the discoverable scoped build or test before
129
+ commit when its cost is proportionate.
130
+
131
+ Run those checks in that order before commit. Broad repository tests or builds
132
+ may remain phase-level when running them per task is disproportionate.
133
+ Corrections completed before the planned task commit are prevention and do not
134
+ consume a phase recovery attempt.
135
+
136
+ When a task-transition or phase check discovers a post-commit failure, classify
137
+ it before editing. Automatic recovery is allowed only when all conditions hold:
138
+
139
+ - the failure is an obvious in-scope lint, type, test, build, or composition
140
+ defect discovered by declared task, transition, or phase verification;
141
+ - the correction is mechanically bounded and unambiguous, remains within phase
142
+ intent and public requirements, and any file-boundary expansion is
143
+ mechanically derived and in-phase;
144
+ - architecture, security, product scope, requirements, and public behavior do
145
+ not change;
146
+ - the work is non-destructive, reversible, and does not cross credential,
147
+ protected-branch, or other consequential boundaries;
148
+ - the exact target remains unchanged and bindable regardless of handle state
149
+ and stays equal to the launcher-owned dispatch target;
150
+ - handle continuity follows one of the authorized alternatives below;
151
+ - attempt accounting follows one of the authorized alternatives below; and
152
+ - focused plus relevant phase verification can establish correctness.
153
+
154
+ Handle and exact-target continuity use these mutually compatible branches:
155
+
156
+ 1. When the accepted handle is available or resumable, use same-handle
157
+ continuation.
158
+ 2. When the accepted handle is unavailable or unresumable, an unchanged,
159
+ bindable exact target plus a lifecycle-authorized recover scope, a reconciled
160
+ pending attempt, and continuation linkage authorizes fresh `mode: recover`.
161
+ 3. A lost or unbindable exact target requires a direction-required stop with no
162
+ fallback.
163
+
164
+ Handle unavailability alone does not make automatic recovery ineligible or
165
+ stop it. It selects the second branch only when all its conditions hold.
166
+
167
+ Attempt accounting uses exactly one of these alternatives:
168
+
169
+ 1. **Pending completion:** a matching `pending_attempt` may continue only after
170
+ complete reconciliation of the authoritative ledger, original request,
171
+ immutable original commit at the same history position, bounded worktree
172
+ diff, and unchanged exact target. Continue and finish that same reserved
173
+ attempt without incrementing `used_attempts` or creating another
174
+ reservation, even when the existing count equals the limit.
175
+ 2. **New reservation:** when no `pending_attempt` exists,
176
+ `phase_recovery_attempts_used < phase_recovery_limit` is mandatory. Atomically
177
+ increment usage and write the new reservation before editing.
178
+
179
+ For the final-attempt boundary, `limit=1`, `used=1`, and a fully reconciled
180
+ matching `pending_attempt` continue and finish the same reserved attempt
181
+ without incrementing usage. With `limit=1`, `used=1`, and no `pending_attempt`,
182
+ stop direction-required before edit with no new reservation and no fallback.
183
+
184
+ Record the eligibility evidence before editing. A new reservation consumes one
185
+ attempt before editing; continuation of a reconciled pending attempt does not
186
+ consume another. Apply the bounded correction and run the focused and phase
187
+ checks before creating a candidate commit. If either check fails, restore the
188
+ bounded files to their original committed content without rewriting history,
189
+ atomically mark the reservation `failed`, durably commit only that ledger
190
+ transition, and stop. When both checks pass, atomically mark the reservation
191
+ `completed` and create one append-only candidate recovery commit containing the
192
+ bounded correction plus that transition.
193
+
194
+ Immediately rerun the focused and phase checks against the committed HEAD.
195
+ These post-commit reruns are the authoritative recovery result. On pass, the
196
+ candidate is the successful recovery commit. On failure, atomically replace the
197
+ `completed` marker with `failed`, durably commit that ledger-only transition,
198
+ preserve the candidate commit as immutable, claim no successful recovery
199
+ commit, and stop. Any failed edit, commit, or re-verification leaves the attempt
200
+ consumed. Preserve the accepted task commit at the same history position; never
201
+ amend, reset, rebase, squash, replace its task ID, or conceal it. Mechanically
202
+ related failures from the same verification command may use one atomic attempt
203
+ and successful recovery commit. Independent failures require separate attempts.
204
+ At three recovery events, report an elevated recovery-volume warning but
205
+ continue while the predicate and budget remain valid.
206
+
207
+ A suspected infrastructure or flake failure permits one no-edit rerun without
208
+ attempt consumption. If the repeated unexplained failure remains ambiguous,
209
+ stop without editing. Never turn contradictory evidence into a speculative
210
+ repair.
211
+
212
+ Stop with `DONE_WITH_CONCERNS` or `BLOCKED`, do not edit, and request direction
213
+ for any ambiguous or contradictory case; architecture, security, product, or
214
+ requirements decision; non-mechanical boundary widening; destructive,
215
+ irreversible, credential-bearing, or protected-branch work; retry exhaustion;
216
+ dirty worktree or dirty history; inability to establish correctness; missing
217
+ original-request or missing exact-target provenance; unverifiable commit range;
218
+ malformed recovery event; exact-target loss; or governance cap. No stop
219
+ condition authorizes fallback or another model, provider, route, or worker.
220
+
221
+ Every post-commit disposition returns exactly one canonical recovery event,
222
+ including recovered, direction-required, and failed-attempt outcomes. The event
223
+ must preserve original request, original commit, defect class, discovering
224
+ check, disposition, authorization, attempt/budget, dispatch target, recovery
225
+ commit when one exists, verification outcome, and reason. This allows defect
226
+ count, prompt count, and successful repair count to remain independently
227
+ measurable.
228
+
229
+ A `direction-required` disposition reached before any reservation leaves
230
+ `pending_attempt: null`, does not increment `used_attempts`, and performs no
231
+ edit or recovery commit. Its event carries the stop-boundary evidence so root
232
+ can validate and record the terminal stop without expecting a `completed` or
233
+ `failed` marker.
234
+
235
+ ### Authoritative Attempt Ledger
236
+
237
+ The active project's
238
+ `oat_phase_recovery_policy.phase_attempt_usage.<pNN>` entry in `state.md` is the
239
+ one authoritative durable per-phase attempt ledger. The phase implementer has a
240
+ narrow exception to root-owned bookkeeping: while it owns the worktree, it may
241
+ atomically replace only that ledger entry. It must not alter any other project
242
+ tracking field.
243
+
244
+ Before the first code edit for a new recovery attempt, atomically increment
245
+ `used_attempts` and write `pending_attempt` with the attempt number, event ID,
246
+ original request, original task/commit, discovering check, exact target, and
247
+ reservation HEAD. This reservation happens before editing and survives
248
+ interruption. Never decrement or reset `used_attempts`.
249
+
250
+ On same-handle resume or recover mode, reconcile the supplied nonzero
251
+ `used_attempts` and `pending_attempt` against `state.md`, Git history, and the
252
+ bounded worktree diff. Complete reconciliation includes the ledger identities,
253
+ original request, immutable original commit at the same history position,
254
+ bounded diff, and unchanged exact target. Continue the same attempt without
255
+ consuming another attempt. Reject an unreconciled resume before further
256
+ editing. A new attempt is exhausted when `used_attempts` is equal to or greater
257
+ than `phase_recovery_limit`; an already-pending matching attempt may only finish
258
+ or fail and does not receive another reservation.
259
+
260
+ Run focused and phase checks before a candidate commit. A pre-commit failure
261
+ restores the bounded files and commits only the `failed` transition. A
262
+ pre-commit pass atomically marks the pending entry `completed` and creates the
263
+ candidate recovery commit with the bounded code change plus that transition.
264
+ Immediately rerun both checks against committed HEAD. Those reruns are
265
+ authoritative: a pass leaves the committed `completed` marker for root
266
+ validation, while a failure atomically replaces it with `failed` in a separate
267
+ ledger-only evidence commit and claims no successful recovery commit. If any
268
+ required terminal marker cannot be committed, preserve the working tree and
269
+ report the attempt as unreconciled; root must fail closed without bookkeeping.
270
+
271
+ The final matching committed `completed` or `failed` marker is the committed
272
+ pre-bookkeeping terminal handoff for an attempted recovery. A report of
273
+ `recovered` or `failed-attempt` returns with that marker still present. A
274
+ pre-attempt `direction-required` report instead returns with
275
+ `pending_attempt: null`, unchanged usage, and evidence of no reservation, edit,
276
+ or recovery commit. An active, mismatched, prematurely cleared, unreconciled,
277
+ or contradictory attempted-recovery marker must fail closed before root
278
+ bookkeeping. Root clears an attempted-recovery marker only after validating the
279
+ report, immutable original history, exact target and axes, canonical event,
280
+ attempt count, recovery commit when successful, and authoritative focused plus
281
+ phase verification. Root records a valid pre-attempt `direction-required`
282
+ event without clearing a marker. Clearing always retains monotonic
283
+ `used_attempts`; failed attempts also preserve their terminal-stop disposition.
284
+ Only the post-bookkeeping null state is settled for an attempted recovery.
285
+
286
+ ### Canonical Recovery Event
287
+
288
+ Emit this exact heading, label order, and enum vocabulary for every post-commit
289
+ disposition:
290
+
291
+ ```markdown
292
+ ### Recovery Event {event-id}
293
+
294
+ - Phase/task: {phase and originating task when known}
295
+ - Original request: {original_request_id}
296
+ - Original commit: {immutable task commit}
297
+ - Defect class: lint | type | test | build | composition | other
298
+ - Discovered by: {exact verification command or transition check}
299
+ - Disposition: recovered | direction-required | failed-attempt
300
+ - Authorization: phase-standing | operator-extension | operator-scope
301
+ - Attempt: {used}/{phase_recovery_limit}
302
+ - Dispatch target: {exact launcher-owned implementation target}
303
+ - Recovery commit: {sha or -}
304
+ - Verification: {focused and relevant phase result}
305
+ - Reason: {eligibility or stop-boundary evidence}
306
+ ```
307
+
104
308
  ## Mode: Implement
105
309
 
106
310
  ### 1. Verify Phase Base
@@ -125,7 +329,12 @@ For every task:
125
329
  3. Follow RED/GREEN/refactor ordering when specified.
126
330
  4. Implement only that task. Optional nested help does not transfer task
127
331
  ownership or commit authority.
128
- 5. Run every task verification command.
332
+ 5. Apply the Prevention and Post-Commit Recovery ordering: format, run every
333
+ declared task verification, run applicable discoverable proportionate cheap
334
+ checks, and, for emitted output or build/test configuration changes, run a
335
+ scoped build/test before commit. Broad repository tests and builds may stay at
336
+ the phase boundary when per-task execution is disproportionate. This
337
+ prevention does not consume a recovery attempt.
129
338
  6. Self-review requirements, behavioral tests, scope, and accidental changes.
130
339
  7. Fix any issue before committing.
131
340
  8. Create exactly one task commit using `commit_convention`.
@@ -139,8 +348,9 @@ For every task:
139
348
  - every task verification passed; and
140
349
  - the worktree is clean.
141
350
  10. Perform a brief between-task transition check before starting the next
142
- task. If the committed task is defective, stop with `DONE_WITH_CONCERNS` or
143
- `BLOCKED`; do not amend, add an unplanned task commit, or conceal it.
351
+ task. If the committed task is defective, apply the post-commit eligibility,
352
+ accounting, append-only recovery, event, and stop contract above. Never
353
+ amend or conceal the task commit.
144
354
 
145
355
  Do not skip, reorder, combine, or split planned task commits.
146
356
 
@@ -149,6 +359,8 @@ Do not skip, reorder, combine, or split planned task commits.
149
359
  After all task commits:
150
360
 
151
361
  - run phase-wide verification;
362
+ - apply the same post-commit recovery contract to an eligible phase-level
363
+ composition failure;
152
364
  - verify task outputs compose correctly;
153
365
  - compare the phase result with design/spec/discovery;
154
366
  - confirm no task boundary or dependency was missed; and
@@ -166,10 +378,12 @@ report.
166
378
  **Phase:** {phase-id}
167
379
  **Tasks executed:** {N} of {N}
168
380
  **Phase base:** {sha}
381
+ **Final head:** {sha}
169
382
  **Commits:** {first sha}..{last sha}
383
+ **Recovery attempts:** {used}/{phase_recovery_limit}
170
384
  **Phase verification:** pass | fail
171
385
  **Confidence:** high | medium | low
172
- **Request ID:** {request_id}
386
+ **Request ID:** {original_request_id}
173
387
  **Dispatch target:** {launcher-owned target}
174
388
  **Dispatch stamp:** {formal Dispatch: line}
175
389
 
@@ -179,6 +393,10 @@ report.
179
393
  | ------- | ------ | ------ | ------------ | --------------- |
180
394
  | pNN-tNN | done | {sha} | pass | {bounded files} |
181
395
 
396
+ ### Recovery Events
397
+
398
+ - {None, or exactly one canonical event per recovered, direction-required, or failed-attempt disposition}
399
+
182
400
  ### Optional Nested Dispatches
183
401
 
184
402
  - {None, or request ID / bounded purpose / exact target / terminal outcome}
@@ -192,6 +410,93 @@ report.
192
410
  - {None or concise reason/evidence}
193
411
  ```
194
412
 
413
+ ## Mode: Recover
414
+
415
+ Recover mode is a continuation of a post-commit recovery attempt already
416
+ authorized when the original accepted handle cannot resume. It is not phase
417
+ implementation, review-fix mode, fallback, or replay.
418
+
419
+ Require this self-contained Recover Scope:
420
+
421
+ ```yaml
422
+ mode: recover
423
+ original_request_id: { original phase request }
424
+ continuation_event: { generic continuation_events identifier }
425
+ recovery_base_head: { current immutable Git HEAD }
426
+ original_task_id: { originating planned task }
427
+ original_commit: { immutable task commit }
428
+ defect_class: { lint|type|test|build|composition|other }
429
+ discovered_by: { exact command or transition check }
430
+ bounded_correction_scope: { mechanical correction only }
431
+ bounded_files: { declared or mechanically derived in-phase files }
432
+ phase_recovery_limit: { resolved total limit }
433
+ phase_recovery_attempts_used: { authoritative nonzero used count }
434
+ pending_attempt: { matching authoritative ledger entry }
435
+ focused_verification: { exact failing check }
436
+ phase_verification: { relevant phase command }
437
+ dispatch_target: { exact original launcher-owned target }
438
+ dispatch_axes: { unchanged original launcher-owned axes }
439
+ dispatch_stamp: { original formal Dispatch line }
440
+ ```
441
+
442
+ 1. Validate every recover input. Confirm the exact launcher-owned target equals
443
+ the original target and the generic `continuation_events` record links
444
+ `continuation_event` to `original_request_id`.
445
+ 2. Confirm HEAD exactly equals `recovery_base_head`; the `original_commit`
446
+ remains immutable at the same history position; and the worktree contains
447
+ only the reconciled pending ledger reservation plus an optional mechanically
448
+ bounded diff inside `bounded_files`. Any other dirt or history change
449
+ blocks.
450
+ 3. Reconcile the authoritative `pending_attempt` and nonzero
451
+ `phase_recovery_attempts_used` with `state.md`. Recover mode continues that
452
+ same consumed attempt and must not increment usage again. Missing,
453
+ contradictory, or unreconciled state blocks before editing.
454
+ 4. Apply or complete only `bounded_correction_scope`. Recover mode must not
455
+ replay planned tasks and must not require, fabricate, or consume a review
456
+ artifact.
457
+ 5. Apply the bounded correction, then run `focused_verification` and
458
+ `phase_verification` before creating a candidate commit. If either check
459
+ fails, restore `bounded_files` to their original committed content,
460
+ atomically mark the pending entry `failed`, durably commit only that
461
+ ledger transition, emit one `failed-attempt` event, and stop.
462
+ 6. When both pre-commit checks pass, atomically mark the pending entry
463
+ `completed` and create one append-only candidate recovery commit containing
464
+ only `bounded_files` plus that ledger transition.
465
+ 7. Immediately rerun `focused_verification` and `phase_verification` against the
466
+ committed HEAD; these reruns are authoritative. On pass, emit one `recovered`
467
+ event and report the candidate as the successful recovery commit. On
468
+ failure, atomically replace `completed` with `failed`, durably commit that
469
+ ledger-only transition, emit one `failed-attempt` event, preserve the
470
+ consumed attempt and immutable candidate, and claim no successful recovery
471
+ commit. If terminal evidence cannot be committed, report an unreconciled
472
+ block that root must reject before bookkeeping. Never amend history or
473
+ launch fallback.
474
+ 8. Return the report below. `DONE` is accepted success;
475
+ `DONE_WITH_CONCERNS` and `BLOCKED` may be accepted terminal stops and must
476
+ still report provenance, accounting, immutable history, and the event.
477
+
478
+ ```markdown
479
+ ## Phase Recovery Continuation Report
480
+
481
+ **Status:** DONE | DONE_WITH_CONCERNS | BLOCKED
482
+ **Phase:** {phase-id}
483
+ **Original request ID:** {original_request_id}
484
+ **Continuation event:** {continuation_event}
485
+ **Recovery base:** {recovery_base_head}
486
+ **Original task/commit:** {original_task_id} / {original_commit}
487
+ **Attempt:** {phase_recovery_attempts_used}/{phase_recovery_limit}
488
+ **Dispatch target:** {same exact launcher-owned target}
489
+ **Dispatch stamp:** {original formal Dispatch line}
490
+ **Pending handoff:** {completed|failed}
491
+ **Recovery commit:** {sha or -}
492
+ **Verification:** {focused result}; {phase result}
493
+ **Recovery event:** {event-id}
494
+
495
+ ### Concerns or Block
496
+
497
+ - {None or bounded terminal-stop evidence}
498
+ ```
499
+
195
500
  ## Mode: Fix
196
501
 
197
502
  Fix mode is a continuation of a successfully completed phase, not a replay.
@@ -0,0 +1,125 @@
1
+ ---
2
+ title: Verifying Explainer Kit
3
+ description: 'Maintainer runbook for semantic golden cases, temporary real-Chromium evidence, and release validation.'
4
+ ---
5
+
6
+ # Verifying Explainer Kit
7
+
8
+ Explainer Kit uses portable behavioral goldens and a real-browser release gate.
9
+ The goal is not pixel identity: output may change markup, spacing, and
10
+ composition when it preserves the same meaning, topology, interactions, and
11
+ evidence quality.
12
+
13
+ ## Golden cases
14
+
15
+ The suite under
16
+ `.agents/skills/explainer-kit/tests/fixtures/golden/` contains three
17
+ portable semantic cases:
18
+
19
+ | Case | What it proves |
20
+ | ------------------------------ | ---------------------------------------------------------- |
21
+ | `simple` | Viewport-sized lead evidence and a cohesive baseline recap |
22
+ | `non-linear` | Exact branch, fan-in, and cycle preservation |
23
+ | `explainer-authoring-redesign` | Archive-only rebuild from a dense completed project record |
24
+
25
+ Every case retains only its descriptor, source input, and content-addressed
26
+ source record. The three cases share one rubric. Generated artifacts, browser
27
+ evidence, screenshots, manifests, catalogs, and review results stay in a
28
+ temporary test directory and are never committed. Paths are
29
+ repository-relative; machine roots, home-relative paths, `file://` URLs,
30
+ Windows drive paths, and UNC paths are rejected.
31
+
32
+ ## Prerequisites
33
+
34
+ - Install workspace dependencies.
35
+ - Ensure the repository-supported Chromium runtime is installed and launchable.
36
+ - Run from the repository root.
37
+
38
+ The end-to-end benchmarks require an actual launched Chromium session. A
39
+ deterministic fixture session is valid only for bounded unit/integration tests
40
+ and cannot satisfy a golden production path.
41
+
42
+ ## Run the golden suite
43
+
44
+ ```bash
45
+ node --test \
46
+ .agents/skills/explainer-kit/tests/golden-conformance.test.mjs
47
+ ```
48
+
49
+ A passing run proves:
50
+
51
+ - one planner-owned hub, architecture view, and deck;
52
+ - source and terminology cohesion;
53
+ - exact topology and catalog parity;
54
+ - mobile, tablet, and desktop Chromium evidence;
55
+ - one independent critic invocation; and
56
+ - a passing terminal review without correction.
57
+
58
+ The focused integration suites below separately exercise the one-correction
59
+ ceiling.
60
+
61
+ The suite recomputes semantic-input hashes, grounds every claim in retained
62
+ source evidence, and evaluates the shared rubric against live runtime output.
63
+ A prose claim or status label without runtime proof does not pass.
64
+
65
+ ## Inspect generated evidence
66
+
67
+ The suite materializes each case's runtime package under its temporary working
68
+ directory, validates it, and removes it at test completion. Add a local
69
+ debugger breakpoint or temporarily disable cleanup when diagnosing a failure;
70
+ do not add generated runtime output to the fixture directories.
71
+
72
+ ## Focused integrity suites
73
+
74
+ Use these when changing browser identity, immutable evidence, resume, or archive
75
+ contracts:
76
+
77
+ ```bash
78
+ node --test \
79
+ .agents/skills/explainer-kit/tests/records.test.mjs \
80
+ .agents/skills/explainer-kit/tests/run.integration.test.mjs
81
+
82
+ node --test \
83
+ .agents/skills/explainer-kit/tests/browser-runtime.test.mjs \
84
+ .agents/skills/explainer-kit/tests/qa.test.mjs \
85
+ .agents/skills/explainer-kit/tests/contracts.test.mjs \
86
+ .agents/skills/explainer-kit/tests/durability.test.mjs \
87
+ .agents/skills/explainer-kit/tests/rebuildability.test.mjs
88
+
89
+ pnpm --filter @open-agent-toolkit/cli exec vitest run \
90
+ src/commands/project/archive/archive-utils.test.ts \
91
+ src/release/public-package-contract.test.ts
92
+
93
+ node --test tools/smoke/explainer-kit/*.test.mjs
94
+ ```
95
+
96
+ ## Release gate
97
+
98
+ The required publishable-package gate is:
99
+
100
+ ```bash
101
+ pnpm release:validate
102
+ ```
103
+
104
+ It validates all five lockstep public package tarballs and then runs the bounded
105
+ curated-style/template matrix in real Chromium. The visual gate retains 65
106
+ machine-readable viewport, clipping, motion, keyboard, no-JavaScript, and print
107
+ measurements. Missing Chromium or untrusted retained evidence fails closed.
108
+
109
+ For the full repository closeout, also run the standard checks documented in
110
+ the root `AGENTS.md`:
111
+
112
+ ```bash
113
+ pnpm check
114
+ pnpm type-check
115
+ pnpm test
116
+ pnpm build
117
+ pnpm lint
118
+ pnpm format
119
+ pnpm build:docs
120
+ git diff --check
121
+ ```
122
+
123
+ Do not treat an isolated transient timeout as a product pass or failure without
124
+ reproducing the failing test. Preserve the exact-head successful rerun evidence
125
+ used for release closure.
@@ -17,4 +17,5 @@ Use this section when you are changing OAT itself rather than consuming it as a
17
17
  - [Commit Conventions](commit-conventions.md) - Traceable commit patterns for project and docs work.
18
18
  - [Hooks and Safety](hooks-and-safety.md) - Safety and mutation contracts for provider-sync behavior.
19
19
  - [Smoke Testing](smoke-testing.md) - Runbook for the live workflow smoke runner: prerequisites, scenarios, evidence reports, and recovery.
20
+ - [Verifying Explainer Kit](explainer-kit-verification.md) - Golden recap cases, real-Chromium evidence, fixture regeneration, and release validation.
20
21
  - [Verifying Cursor Pins](verifying-cursor-pins.md) - Runbook for probe-verifying a Cursor model pin before shipping it.