oficina / equipo Public

spec: exploration tasks (rev 1)

A task kind, change or explore. Explore ends at Review's approval, the
preview and Paul's choice (build this one, try again, drop it), never a
merge. Protocol 10 for the previews capability and record_task's kind.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 76c8391f59bb1acf074b8fa5e9c67d11e6dc1fef parent 55a424a
1 file changed, +163 −0
  • docs/superpowers/specs/2026-11-12-equipo-exploration-tasks.md +163 −0
diff --git a/docs/superpowers/specs/2026-11-12-equipo-exploration-tasks.md b/docs/superpowers/specs/2026-11-12-equipo-exploration-tasks.md
new file mode 100644
index 00000000..9dca9b76
--- /dev/null
+++ b/docs/superpowers/specs/2026-11-12-equipo-exploration-tasks.md
@@ -0,0 +1,163 @@
+# Equipo: exploration tasks
+
+Status: 2026-11-12, revision 1. Drafted by Claude (Opus 5.5) on
+`exploration-tasks` from main 7140df3. Builds on thin v1 (tasks and
+steps), merge authority (the gate), release preview (protocol 9) and
+needs-you triage (thin v1).
+
+## 0. Why
+
+Paul, on the barber mockups task: "Why is it trying to merge mockups
+anyway?" Equipo has one kind of task, a change that ends in a merge.
+Mockups, prototypes, design options and spikes are exploration: they end
+at a preview and Paul's choice, never a merge.
+
+Staging's `tk5fen4uajpn` (paulca/threatmin, "Create two clickable barber
+app mockups") is Ready to merge: checks passed, Review approved with a
+preview config, its preview failed `preview_failed` (no credential), and
+the merge failed `merge_failed`. It is not merged.
+
+## 1. The kind
+
+- `chat_tasks.kind`: `change` (empty reads as change; today's behaviour)
+ or `explore`.
+- **The coordinator sets it** on `record_task` (`kind`, optional,
+ default `change`). Its house rule says: mockups, prototypes, design
+ options and spikes are `explore`; anything meant to ship is `change`.
+- **Paul switches it** on the task page (`POST /api/v1/tasks/{id}/kind
+ {kind, revision}`, the page form): the creator, an owner, current task
+ revision, not merging and not ended. The switch writes a thread note and
+ re-runs `advance`:
+ - to `explore`: open merge cards for the task are withdrawn,
+ `merge_asked` cleared, the stage leaves Ready to merge for In review,
+ and the explore flow (§2) continues from what is judged;
+ - to `change`: the direction card is withdrawn, and the change flow
+ continues (checks on the candidate if none ran, then Review's verdict
+ stands and the gate decides as usual).
+
+## 2. The explore flow
+
+1. **Engineering** builds. Its brief (instance-written, model-facing)
+ says this is an exploration and requires `release/preview.json`
+ (`{"output": "<dir>"}`) naming the committed static output.
+2. **No checks step.** Review reads the candidate next. Its brief says
+ it is an exploration: judge whether it does what was asked and is safe
+ to publish as a static preview, not production readiness. Changes
+ requested take the ordinary fix rounds; then needs-you triage asks, as
+ for any task.
+3. **Approved:** the release preview runs as today (approval with
+ `has_preview`, protocol 9, off until the credential exists). Preview
+ steps stay ancillary.
+4. **The choice.** Once the candidate is approved and its preview step,
+ if one was scheduled, has ended, `NeedsYou` is `direction` and one
+ card per candidate (`direction_asked`, as `merge_asked`) goes to the
+ creator: "Which direction for %s?" with
+ - **Build this one:** a new `change` task, linked
+ (`explored_from` on it, `built_as` on this one), title "Build: %s",
+ brief this task's brief plus a line naming the explored branch and
+ SHA, and its base the candidate, so Engineering starts from the
+ branch's tip; it is started at once. This task ends `done`.
+ - **Try again**, with Paul's note (required, at most 1,000 bytes):
+ another Engineering round on the candidate, the note in its brief
+ (`chat_steps.note`). Never budgeted (Paul's tap).
+ - **Drop it:** the task is cancelled through the ordinary cancel path;
+ the branch stays on Amadan.
+ The card and the task page show the preview link when the candidate
+ has a deployed preview, else a link to the branch on Amadan with
+ "Previews aren't set up yet" (the primary reports previews off) or
+ "There's no preview of this version" (anything else).
+5. **Never a merge.** `mergegate.Decide` returns `never` for an explore
+ task, first, whatever else holds (`Inputs.Explore`); `startMerge`,
+ `personMerge` and `answerMerge` refuse one (`ErrNotMergeable`); the
+ explore flow never reaches Ready to merge.
+
+## 3. Triage and housekeeping
+
+- `direction` is a genuine decision: `triage.Classify` leaves it in Needs
+ you (no recommendation). The stall sweep never kicks a task waiting
+ for its direction.
+- Housekeeping's duplicate detectors only pair tasks of the same kind:
+ an explore task is never combined with, or linked as a duplicate of, a
+ change task.
+
+## 4. The barber task
+
+At start-up, `ExploreOnce(tk5fen4uajpn)`: if the task exists, is not
+ended, not merged and not merging, it is switched to `explore` through
+the same store function as Paul's switch, with actor `equipo`, once: a
+ledger row (`kind_switch`, key `explore:<task>`) is written either way it
+acts, so a later start never switches it again, even if Paul switched it
+back. Merged or ended: nothing, and the row records that it looked.
+
+## 5. Wire: protocol 10
+
+`wire.ProtocolExplore` (10) becomes `ProtocolCurrent`:
+- `Capabilities.previews` (bool, omitempty): the primary loaded a
+ preview credential. Absent below 10, so "off" is said only when a
+ primary at 10 says so.
+- `record_task`'s `kind` argument.
+
+**Downgrade** (its own step, first in the chain):
+- a hello's `previews` is dropped below 10;
+- a `tool_call` for `record_task` loses `kind` below 10, so an older
+ instance's strict decoder never sees it (the task is a change, as
+ before).
+
+| Combination | Behaviour |
+|---|---|
+| new instance, runner at 9 | no `kind` arrives (change); Paul's switch still works; previews unknown: the card says there is no preview unless one deployed |
+| old instance, new runner | spoken 9: `kind` and `previews` are dropped; everything is a change, as today |
+| new both | as specified |
+
+Schedule: `schedulePreview` also skips a primary at 10 that reports
+previews off (no doomed preview step).
+
+## 6. Data
+
+Migration 0067 (additive): `chat_tasks.kind`, `explored_from`,
+`built_as`, `direction_asked`; `chat_steps.note`. `wire.Task` gains
+`kind`, `explored_from`, `built_as` (task refs) and `direction`
+(`{preview_url, branch_url, previews_off}`) for the card; `AnswerCard`
+gains an optional `note`.
+
+## 7. Tests, failing first
+
+Contracts (`internal/thintest`):
+- `TestExploreFlow`: record with `kind: explore`; Engineering's brief
+ requires the preview config; no checks; Review approves with a
+ preview; the preview deploys; the direction card with the link; no
+ merge step at any point.
+- `TestExploreBuildThisOne`: a linked change task, started from the
+ candidate, this task done.
+- `TestExploreTryAgain`: a round with the note; a note is required.
+- `TestExploreDropIt`: cancelled, branch untouched (no command to the
+ forge).
+- `TestExploreNeverMerges`: the gate, a person's Merge on the task page,
+ a forged merge card answer: all refused.
+- `TestExploreKindSwitch`: change at Ready to merge to explore (card
+ withdrawn, direction asked); explore to change (checks run, gate
+ decides); refused while merging, ended, for a teammate, stale revision.
+- `TestExplorePreviewsOff`: a primary at 10 without previews: no preview
+ step, the card says previews aren't set up and links the branch.
+- `TestExploreBarberOnce`: start-up switches the open task once; Paul
+ switches it back; a restart leaves it; a merged task is untouched.
+- `TestExploreNotCombined`: housekeeping never folds an explore task
+ with a change task.
+- `TestExploreDirectionStays`: triage and the sweep leave it in Needs you.
+- Mixed versions: a runner at 9 (no `kind`, previews unknown).
+
+Unit: `Decide` with `Explore`; `Encode` drops `previews` and `kind` below
+10 and keeps them at 10. Every guard broken once and its test watched
+failing.
+
+## 8. Copy (delegated Astra pass)
+
+The direction card's question, three answers and the note field; the
+preview, branch, "previews aren't set up" and "no preview" lines; the
+kind switch's two actions and its thread note; "Build: %s"; the task
+page's kind label; Needs you `direction`.
+
+## 9. Out of scope
+
+Choosing between several explore tasks side by side; deleting previews
+or branches; exploration in a repository Equipo creates for it.