oficina / equipo Public

spec: exploration tasks rev 2

Round 1's cuts: no downgrade into a change, previews withheld from the
first hello, explorations route before merge handling, switches only at
rest with judgements per kind, the card bound to its candidate, Build
this one from the default branch in one transaction, kind-equal
duplicates, a trusted one-time barber switch, nothing waits on previews.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 00e02bada9c75661667fc8d3ff20bb72ef6b0f83 parent d1f2d2c
1 file changed, +167 −113
  • docs/superpowers/specs/2026-11-12-equipo-exploration-tasks.md +167 −113
diff --git a/docs/superpowers/specs/2026-11-12-equipo-exploration-tasks.md b/docs/superpowers/specs/2026-11-12-equipo-exploration-tasks.md
index e26c6e94..11e0a9d8 100644
--- a/docs/superpowers/specs/2026-11-12-equipo-exploration-tasks.md
+++ b/docs/superpowers/specs/2026-11-12-equipo-exploration-tasks.md
@@ -1,10 +1,10 @@
# Equipo: exploration tasks
-Status: 2026-11-12, revision 1, **NOT READY** after Astra's one round
-(§10). Not built. 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).
+Status: 2026-11-12, revision 2. Revision 1 (33afeb9) drew NOT READY from
+Astra round 1 (§11); the coordinator approved the cuts in §10. Drafted by
+Claude (Opus 5.5) on `exploration-tasks` from main 7140df3. Builds on
+thin v1, merge authority, release preview (protocol 9) and needs-you
+triage.
## 0. Why
@@ -15,157 +15,211 @@ 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.
+preview config, its preview failed `preview_failed` (no credential) and
+its merge failed `merge_failed`. Not merged.
## 1. The kind
-- `chat_tasks.kind`: `change` (empty reads as change; today's behaviour)
- or `explore`.
+- `chat_tasks.kind`: `change` ("" reads as change; today's behaviour) or
+ `explore`. Each step records the kind it was dispatched under
+ (`chat_steps.kind`).
- **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`.
+ default `change`). Its house rule: 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).
+ {kind, revision}` and the page form). Only the creator, an owner, at
+ the task's current revision, and only **at rest**: the task is not
+ ended, cancel-requested or merging, no step of it is queued or running
+ (previews included), and no merge step is unfinished. One transaction:
+ - to `explore`: open merge cards withdrawn; `merge_asked`, `ready_sha`
+ and `merge_eligible` cleared; Ready to merge goes back to In review;
+ - to `change`: open direction cards withdrawn;
+ - either way `direction_asked` is cleared, a thread note says what
+ changed, and `advance` runs.
+- **Judgements count only for their kind.** `progressFor` takes a Review
+ verdict only from a Review dispatched under the task's kind, or under
+ `change` (a change Review is at least as strict). So a task switched to
+ `change` gets checks and a change Review on its candidate before the
+ gate ever decides; switched to `explore`, an earlier change approval
+ stands.
## 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
+`advanceTask` routes an exploration to `advanceExplore` **first**, before
+the merge handling, so merge steps (the barber task's failed one
+included) never steer it, and nothing of it reaches Ready to merge.
+
+1. **Engineering** builds. Its brief (instance-written) says this is an
+ exploration and requires `release/preview.json` (`{"output":
+ "<dir>"}`) naming committed static output.
+2. **No checks.** 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`.
+3. **Approved:** the release preview is scheduled as today (approval
+ with `has_preview`, protocol 9; previews stay ancillary), and at once,
+ without waiting for it, the **direction card**: one per candidate
+ (`direction_asked`), in the creator's conversation, "Which direction
+ for %s?", answers **Build this one**, **Try again** (with a note) and
+ **Drop it**. `NeedsYou` is `direction`. The preview line is filled in
+ when the card or task is shown: the candidate's deployed preview link;
+ else the branch on Amadan with "Previews aren't set up yet" (the
+ primary, at protocol 10, reports previews off) or "There's no preview
+ of this version" (anything else).
+4. **An answer** is valid only on an open card at its revision, for the
+ creator, while the task is an exploration, its newest candidate is
+ `direction_asked`, approved under the rules of §1, the branch is at it,
+ and no step is queued or running; else 409 with the card. A new
+ candidate, a branch move, an ending and a kind switch withdraw the
+ card.
+ - **Build this one**, in the answer's transaction: a new `change` task
+ of the creator in the same project (inserted directly: no
+ similarity check, no housekeeping pass), title "Build: %s", brief
+ this task's brief and a paragraph naming the explored branch and
+ commit to read for the design. It starts **from the default
+ branch**, like any task, and is started at once (its Engineering
+ step dispatched). `explored_from` on it, `built_as` on this task,
+ which ends `done`. A second answer finds the card answered (409);
+ `built_as` set also refuses.
- **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.
+ another Engineering round on the candidate with the note in its
+ brief (`chat_steps.note`). Paul's tap: never budgeted.
+ - **Drop it:** the ordinary cancel of a task at rest. The branch stays.
+5. **Never a merge.** `mergegate.Decide` returns `never` for an
+ exploration first, a person's Merge included (`Inputs.Explore`);
+ `startMerge` refuses one too; `mergeOffered` is false for one.
+
+## 3. Triage, the sweep and duplicates
+
+- `direction` is a genuine decision: `triage.Classify` leaves it in
+ Needs you with no recommendation. The stall sweep's kick runs
+ `advance`, which for an exploration is `advanceExplore`.
+- **Kinds never meet as duplicates.** `similarTasks` (record_task's own
+ check and its `DuplicateOf`), the duplicate detectors' view and the
+ combine and link actions (`foldable`, `hkLink`, checked again in the
+ transaction) only pair tasks of the same kind.
+
+## 4. The barber task, once
+
+`Store.ExploreOnce(ctx, "tk5fen4uajpn")` at start-up, after re-triage:
+one transaction, a trusted bootstrap entry (no person principal):
+- a ledger row (`chat_housekeeping`, detector `kind_switch`, key
+ `explore:<task>`) exists: nothing (it already ran);
+- the task is missing, ended or merged: the row is written (`expired`,
+ reason `ended`), nothing else;
+- the task is merging, cancel-requested, or a step is queued or running:
+ nothing is written (transient; the next start looks again);
+- otherwise the same internal switch as Paul's (§1, without the person
+ and revision checks) and the row (`done`), together.
+Paul switching it back later is never undone: the row exists.
## 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.
+ preview credential.
+- `record_task`'s `kind`.
-**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).
+**Downgrade** (its own step; `Encode` accumulates every step's flag):
+- a hello's `previews` is dropped below 10, and the runner's first hello
+ never carries it (it is sent before the welcome): the next hello does
+ once the welcome says 10, as for empty repositories;
+- below 10, `record_task`'s `kind: "change"` is dropped; `kind:
+ "explore"` is **kept**, so an older instance's strict decoder refuses
+ the whole call (an exploration never becomes a change). The runner,
+ knowing its spoken protocol, answers such a call itself first with a
+ tool error saying Equipo needs an update before it can record an
+ exploration.
| 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 instance, runner at 9 | no `kind` arrives: changes; Paul's switch works; previews unknown, so the card says there is no preview unless one deployed |
+| old instance, new runner | spoken 9: explorations are refused with the update message; changes as today |
| new both | as specified |
-Schedule: `schedulePreview` also skips a primary at 10 that reports
-previews off (no doomed preview step).
+`schedulePreview` skips a primary at 10 that reports previews off.
## 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`
+`built_as`, `direction_asked`; `chat_steps.kind`, `note`. `wire.Task`
+gains `kind` (omitempty), `explored_from`, `built_as` (task refs) and
+`direction` (`{preview_url, branch_url, previews_off}`); `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.
+ requires the preview config; no checks; Review's brief says
+ exploration; approval with a preview schedules it and raises the
+ direction card at once; the card shows the preview once deployed; no
+ merge step ever.
+- `TestExploreBuildThisOne`: a linked change task, from the default
+ branch, its brief naming the branch and commit, started; this task
+ done; a replayed answer 409.
+- `TestExploreTryAgain`: a round with the note; no note refused; a new
+ candidate withdraws the card and asks again.
+- `TestExploreDropIt`: cancelled; nothing sent to the forge.
+- `TestExploreNeverMerges`: the gate, the task page's Merge and a merge
+ card answer: refused.
+- `TestExploreKindSwitch`: change at Ready to merge to explore (merge card
+ withdrawn, direction asked); explore to change (checks and a change
+ Review before the gate); refused while a step runs, merging, ended,
+ for a teammate, at a stale revision; a round trip asks again.
- `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.
+- `TestExploreBarberOnce`: the failed-merge state switches once and
+ raises the direction card; Paul switches it back; another start leaves
+ it; merged, ended and missing write the row; running writes nothing.
+- `TestExploreKindsNotDuplicates`: record_task's similarity, combine and
+ link never pair an exploration with a change.
- `TestExploreDirectionStays`: triage and the sweep leave it in Needs you.
-- Mixed versions: a runner at 9 (no `kind`, previews unknown).
+- Mixed versions: a runner at 9; the record_task downgrade both ways.
-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.
+Unit: `Decide` with `Explore`; `Encode` at 10 and below; the first hello
+without previews. 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`.
+The direction card's question, three answers and the note field and its
+notes after answering; the preview, branch, "previews aren't set up"
+and "no preview" lines; the kind label, the two switch actions and their
+thread notes; "Build: %s" and the build brief's paragraph; 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.
+Choosing between several explorations side by side; deleting previews
+or branches; waiting for a preview before asking.
+
+## 10. Round 1 and where it went
+
+1. Downgrade into a change: `kind: explore` is never stripped; an old
+ instance refuses the call and the runner says why (§5).
+2. First hello: `previews` withheld until the welcome; flags accumulate
+ (§5).
+3. The barber's failed merge: explorations route before merge handling
+ (§2).
+4. Running work: switches only at rest; judgements count only for their
+ kind (§1).
+5. Card validity: bound to the candidate, revalidated on answer,
+ withdrawn on every change, reset on a switch (§2.4).
+6. Inherited changes: "Build this one" starts from the default branch
+ and names the explored branch in its brief (§2.4).
+7. Atomic, replay-safe build: one transaction, a direct insert, the card
+ and `built_as` as guards (§2.4).
+8. Duplicates: kind equality in every pairing and in the transaction
+ (§3).
+9. Bootstrap: a trusted entry, row and switch together, transient states
+ write nothing (§4).
+10. Previews: nothing waits for them; the card fills the line in when
+ shown (§2.3).
-## 10. Astra round 1: NOT READY
+## 11. Astra round 1 (revision 1): NOT READY
-`gpt-6-astra`, effort high, read-only, against this revision and main
+`gpt-6-astra`, effort high, read-only, against revision 1 and main
7140df3. Findings as given, shortened; revision 2 must answer each.
1. **Critical, §5.** Dropping `kind: explore` below 10 turns an