Plan: jobs that keep moving, phases 0 to 4, against today's main
The implementation plan for the approved "Jobs that keep moving" design, with Paul's rulings of 2026-11-25 (O1, O2, O4, O5 as proposed; O3, O6 as written). - Marks what is already built on Base main (3bcec1e) and Equipo main (927a031a): phase 0's credential and gitleaks fixes are done; decision cards (cf0614ec) are unmerged and collide with protocol 29 and migration 0095; refreshJobs covers part of the sweep. - Renumbers: decision cards protocol 30, phase 2 protocol 31, phase 3 protocol 32; migrations 0107 to 0111, one per phase. - Tasks per phase with files, interfaces, failing tests and commits, deploy order (Equipo before Base), native parity, and a register of every new string pending copy review.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+818
−0
docs/superpowers/plans/2026-11-25-jobs-that-keep-moving.md+818 −0
CI passed — run details
CI log
=== build === CGO_ENABLED=0 go build ./... === vet === go vet ./... === fmt-check === === staticcheck === go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 ./... === govulncheck === go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 ./... No vulnerabilities found. === gitleaks === [90m7:23PM[0m [32mINF[0m [1mUnknown SCM platform. Use --platform to include links in findings.[0m [36mhost=[0mamadan.net [90m7:23PM[0m [32mINF[0m [1m1 commits scanned.[0m [90m7:23PM[0m [32mINF[0m [1mscanned ~2461168 bytes (2.46 MB) in 585ms[0m [90m7:23PM[0m [32mINF[0m [1mno leaks found[0m === budget === go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget size budget size: 22 directories within budget === script-test === scripts/prepare-apps_test.sh ok releases lookup failure stops before ship ok app owned elsewhere stops the script ok apps listing failure stops before create ok ambiguous release dir is refused ok explicit version resolves the ambiguity ok releases match is exact, not substring ok shipped version is only promoted, existing app not created ok fresh account creates, ships, promotes to edge, enables ok failing promote stops the script ok ship is retried while uploads are rate limited all passed hack/fonts_test.sh fonts_test: ok === test === go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -count=1 ./... receipt: test step 9.568s against a 60s target (the gate's other steps are not in this figure) receipt: 16 packages ran, 0 cached, 6 without tests, 0 failed receipt: slow package 7.868s amadan.net/oficina/base/internal/webtest receipt: slow package 1.326s amadan.net/oficina/base/internal/issuer receipt: slow package 740ms amadan.net/oficina/base/internal/operations receipt: slow package 482ms amadan.net/oficina/base/internal/consumer receipt: slow package 361ms amadan.net/oficina/base/internal/e2e receipt: slow test 1.52s amadan.net/oficina/base/internal/webtest TestHomeDoesNotWaitOnAStalledSnapshot receipt: slow test 1.08s amadan.net/oficina/base/internal/webtest TestAskZoneIsToldOnce receipt: slow test 740ms amadan.net/oficina/base/internal/issuer TestAuthorizeSignsForInstalledApp receipt: slow test 560ms amadan.net/oficina/base/internal/operations TestOperationsRefusals receipt: slow test 530ms amadan.net/oficina/base/internal/issuer TestAuthorizeRefusals === native === strings: copy review's strings.json is not here (git-ignored); its comparison skipped strings: 119 in the catalog, 116 used worktree-lib_test: ok
diff --git a/docs/superpowers/plans/2026-11-25-jobs-that-keep-moving.md b/docs/superpowers/plans/2026-11-25-jobs-that-keep-moving.md| new file mode 100644 |
| index 0000000..0459822 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/2026-11-25-jobs-that-keep-moving.md |
| @@ -0,0 +1,818 @@ |
| +# Jobs That Keep Moving: Implementation Plan |
| + |
| +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. |
| + |
| +**Goal:** Every job pill in Base that waits on the person carries its decision (options, a recommendation, a link to the thing, "Something else", Try again or Drop it with a plain reason) and acts on it in one tap; the Assistant stops asking before building; a sweep keeps cards current and gives taste questions a default; a new site shows a first look within about two minutes; finished jobs fold away. |
| + |
| +**Architecture:** Equipo projects each job card with the decision in front of the person (bound to the source card, its revision and candidate) and the actions its state allows, and a new `POST /api/v1/assistant/jobs/{id}/act` runs each action through the source card's own path in one transaction. Base relays the action (`POST /ask/jobs/{id}/act`, form or JSON) and draws the pill's controls on the web and in the Mac and iPhone app. Behaviour that depends on Base being new is switched per person by a `Base-Capabilities: job_actions` request header; runner-side changes ride two new runner protocols. |
| + |
| +**Tech Stack:** Go (Base: `go 1.26`; Equipo: as its `go.mod`), chi, GORM and SQLite on the Equipo instance, vanilla JS in Base's `ask.js`, Swift/SwiftUI in `native/apple`, Rastrillo budgets in both repositories. |
| + |
| +**Spec:** `docs/superpowers/specs/2026-11-20-jobs-that-keep-moving-design.md` (this repository, branch `jobs-rulings` at `546e298`), including its addendum (every decision carries context, a link, per-option details and a recommendation). Paul's rulings of 2026-11-25: O1, O2, O4 and O5 **as proposed**; O3 and O6 stand as written (Open in Equipo for the K6 stops Base cannot clear; the K3 fallback has no option buttons). O7 and O8 are as proposed in the spec and unruled; this plan implements O8's proposal and leaves O7 to an operator. |
| + |
| +**Repositories and branches (for execution):** |
| + |
| +- **Equipo**: new worktree `/home/paulca/amadan.net/oficina/equipo-jobs-moving`, branch `jobs-moving` from `origin/main` at `927a031a`. Paths in Equipo tasks are relative to it. |
| +- **Base**: new worktree `/home/paulca/.cache/base-jobs-moving`, branch `jobs-moving` from `origin/main` at `3bcec1e`. Paths in Base tasks are relative to it. |
| +- One branch per phase per repository is fine (`jobs-moving-1`, …); each phase is reviewed and merged on its own. |
| + |
| +## What is already built (checked 2026-11-25 against Base `origin/main` 3bcec1e and Equipo `origin/main` 927a031a) |
| + |
| +| Spec item | Status | Where | |
| +|---|---|---| |
| +| Phase 0.1: staging runner forge credential for repositories it creates | **Done** | Equipo `8757df09`, merged `14496879` (11-20): owner's staging runner gets its own agent-wide credential file | |
| +| Phase 0.2: `gitleaks` in the installed runner release | **Done** | same commit: staging build copies pinned gitleaks, provenance checks it | |
| +| (related) new job repositories start with `main` | **Done** | Equipo `c8c4b82d` (11-20): runner pushes an empty-commit `main` into a repository it created | |
| +| (related) preview refusals reach the step (`preview_headers`) | **Done** | Equipo `8dc096b4` (11-21): runner reads carlos's stderr | |
| +| (related) carry on after connecting Oficina | **Done** | Equipo `9f7e04a6` (11-19); Base `f42602f` | |
| +| (related) local merge refusals become final with a no-access reason | **In flight elsewhere** | Equipo branch `honest-merge-refusals` (no commits beyond main yet). Not planned here; Task 2.3 consumes its reason | |
| +| (related) stopped-jobs audit | **Not landed** | report expected at `.superpowers/sdd/2026-11-13-assistant-jobs/stopped-jobs-audit-2026-11-25.md`; placeholder Task 0.2 | |
| +| Addendum: decision cards carry context, link, recommendation, option detail (Equipo) | **Partly** | Equipo branch `decision-cards-context` `cf0614ec`, **not merged**; based on `c8c4b82d`, 154 commits behind; its protocol 29 and migration `0095` both collide with main (see PD1, PD2); its 34 strings are marked `COPY REVIEW PENDING`, which the release copy check does not catch. Landed by Task 1.1 | |
| +| Addendum: Base renders the decision parts | Not started | Tasks 1.18 to 1.21 | |
| +| K1 job card fields, decision identity, receipts | Not started | | |
| +| K2 act endpoint | Not started | Pattern to copy: Carry on now (Equipo `dce7c015`, `31cdb35d`: `Store.CarryOn`, a `handoffActionRecord` ledger per card and key, 409 `AssistantConflict` with the card; Base `02e4f8d` relay `POST /ask/cards/{id}/carry_on`) | |
| +| K3 `team_ask`, K4 words mode, K5 person-acted block | Not started | | |
| +| K6 stops with reasons and actions | Not started | Related, done: Base draws `stopped` as a square (`02e4f8d`, `64742a1`); a job waiting for an offline runner already reads `paused` with approved words (Equipo `dce7c015`, PD6) | |
| +| K7 decision binding, placement refusal, basis, `team_add` | Not started | | |
| +| K8.1 re-project stale cards | **Partly** | Equipo `refreshJobs` (`dce7c015`, isolated per card in `a1f8706a`) re-projects every `working` and `paused` job card each housekeeping minute. Missing: `asking`, `stopped`, `ready` cards, a projection version, `checked_at`, a batch cap, the decision identity in the comparison. Task 1.14 extends it | |
| +| K8.2 to K8.4 sweep (preview retries, taste defaults, caps) | Not started | Person time zones now exist (Equipo `0104_person_zones`), so quiet hours read the person's zone | |
| +| K9 dismiss, drop, settle; fold rows; 7-day pin | Not started | Related, done: answered cards move from under the pill into the job view (Base `fdea76a`); the Mac panel already counts waiting jobs (`WaitingJobs`, `64742a1`) | |
| +| K10 replace, K11 direction on the pill and preview hold, K13 build first, K14 first look | Not started | `previewHeld` holds only for an open Publish today | |
| +| K15 new outcome lines, K16 notes and opening | Not started | Name clash: `noteUnanswered` already exists in Equipo (`tools.go`, failed turns). See PD8 | |
| +| Capability gate | Not started | Precedent: `job_states=paused` query opt-in (Base `02e4f8d`, Equipo `dce7c015`) | |
| +| Base native app (Mac, iPhone) | Not in the spec | Exists since `64742a1`/`3e9af0b`; consumes `/ask/*` (`docs/api/base-native-v1.md`). Added as parity tasks (PD10) | |
| + |
| +## Plan decisions |
| + |
| +- **PD1 Protocol numbers.** Main has `ProtocolPinnedRelease = Protocol29 = ProtocolCurrent` (paused work). So: `ProtocolDecisions = Protocol30` (Task 1.1), `ProtocolJobsMoving = Protocol31` (phase 2: `ask_person` `open`/`about`/`default`, merge fault reasons), `ProtocolFirstLook = Protocol32` (phase 3: `record_task` `first_look`, review mode, Engineering's first-look note). The spec's single "protocol 29" is split so phases 2 and 3 can ship in either order; whichever merges first takes the lower number, and `TestSpokenIs*` in `internal/wire` pins the result. |
| +- **PD2 Migration numbers.** Main's newest is `0106_release_connection.sql` (`0102` is unused; leave it). The spec's single `0095_jobs_moving.sql` is split per phase, each taking the next free number when its branch is rebased for merge: decision cards `0107_decision_cards.sql`, phase 1 `0108_jobs_act.sql`, phase 2 `0109_jobs_sweep.sql`, phase 3 `0110_first_look.sql`, phase 4 `0111_jobs_replace.sql`. `schema.sql` follows each; `make migration-check` passes. |
| +- **PD3 Decision cards land first** (Task 1.1), rebased, renumbered (PD1, PD2) and with their strings marked `COPY REVIEW REQUIRED` (the marker `make copy-release-check` refuses), so the job ask can carry the same parts. |
| +- **PD4 Where the addendum's parts sit on a job card.** A job card with an `ask` uses the top-level `context`, `link` and `recommended` fields that decision cards add to `wire.AssistantCard`, and each `options[i].detail`; Base has one renderer for outcome and job cards. For a direction ask, `recommended.option` names an action (`build`, `again`, `drop`); otherwise an option value. Every part shown in Base is instance copy or the Assistant's words (K3), never the Coordinator's or Review's prose: a direction's context and why are instance copy keyed by Review's recommendation. |
| +- **PD5 The act request** follows Carry on now: `idempotency_key` in the body (required, at most 128 bytes) and the `Idempotency-Key` header every Base mutation already sends; replay of a key answers the card as it is now. The 409 codes are `card_stale` and `decision_gone`. |
| +- **PD6 Offline runners read paused.** K6's `NeedsRunnerOffline` and `NeedsMachineRemoved` rows: to a client that asked for `job_states=paused` (Base since `02e4f8d`), the job shows as `paused` with the approved offline words (`assistant.job.detail.paused_offline`); to any other, the K6 row. No new copy for an offline runner. |
| +- **PD7 Per-request stripping and per-person capability.** Equipo strips `ask`, job `options`, `actions`, `receipts`, `hidden`, `updated_at` and job-card decision parts from any snapshot or event read without the header (like `olderJobCard` for paused), and separately records the newest header value per person in `chat_assistant_hosts.capabilities` to switch the Assistant's notes and `team_reply` rules (spec's legacy mode). Every relayed call comes from Base's server, so one person's value is stable. |
| +- **PD8 Note names.** The spec's `noteUnanswered` becomes `noteTasteUnanswered` (the name is taken). Notes are gated by mode and by a compiled constant `jobsMovingPhase` (1 to 4), bumped by the task that completes each phase. |
| +- **PD9 Copy goes through copy review before code.** Each phase starts with a copy task that runs the `copy-review` skill over that phase's pending strings (the register at the end). Code tasks write only approved wording; tests assert copy keys, not wording, except where a key's approved text is pinned. Equipo strings carry `// COPY REVIEW REQUIRED` until approved; Base strings get rows in `docs/copy-pending.md`; native strings go in `Localizable.xcstrings` with the same approved text. |
| +- **PD10 Native parity.** Not in the spec (which predates the app). Each Base phase that changes what a pill offers gets a native task, as paused work did (`64742a1`). The native gate (`make native-check`) needs a Mac with Xcode; if the executor has none, the native task is handed to whoever has one and the phase's web half still ships. |
| +- **PD11 Merge faults and honest refusals.** If `honest-merge-refusals` lands first, its final no-access reason *is* `merge_identity` (Task 2.3 maps it instead of adding a second code). Try again stays the person's single explicit Merge (one tap, one `MergeTask`), never automatic, so it is not the "endless try again" that branch removes. Flagged for Paul at handoff. |
| +- **PD12 K8 step 4 is drawing.** "Stops nobody acts on fold into Waiting on you after 3 days" needs no sweep: Base folds by `state` and `updated_at` (sent from phase 1), so it ships with the fold rows in Task 4.4, not in phase 2. Nothing is dropped automatically (O4 as proposed). |
| +- **PD13 "Open in Equipo" is never new visible text.** The K6 rows that say "Open in Equipo" use the job view's existing title link (approved, review 8). No new string names Equipo, a runner, a task, a branch, a merge or a repository. |
| + |
| +## Global Constraints |
| + |
| +- One voice: the Coordinator never speaks in Base; the pill shows instance copy or the Assistant's words only (spec "Rules this design keeps"). |
| +- Outcomes, not machinery: no Equipo, team, Coordinator, runner, task, branch, merge, check or repository in any Base-visible string; the job view's title link is the one exception and already exists. |
| +- The person's decisions stay theirs: going live, dropping or replacing work, granting access, spending, and (until O1's grant in phase 2) placement are never made by the Assistant or the instance, enforced by the instance. |
| +- Housekeeping never merges and never cancels (`hkForbid`). No automatic merge retry, ever. |
| +- No dead ends (T1): a job card in `asking` or `stopped` offers an action whose path succeeds in that state, or says it is retrying, or is a K6 Open in Equipo row. |
| +- Every Equipo API change is additive; an older Base keeps working (T13). |
| +- Bounds (Base `CleanAt`): option value at most 16 of `[a-z0-9]`, label at most 200; ask text at most 500; receipts at most 5, text at most 300; context at most 600; why at most 200; option detail at most 160; links http(s) only. |
| +- Caps (K8 table): Assistant nudges 2 per job; preview fault retries 3 per failed preview step at 2, 10, 30 min; merge retries by the instance none; sweep `team_update` turns 1 `noteWordIt` and 1 `noteTasteUnanswered` per question, at most 6 per person per rolling 24 h, none in quiet hours; instance defaults 1 per question at 24 h, `taste` with a `default` only; person actions 1 per decision and revision; tells one per hand-off per note digest and none within 5 s of one with the same digest. |
| +- Sweep: every minute, at most 200 job cards per tick, oldest check first; an unchanged card re-checked after 10 min; claims lease 5 min. |
| +- Folding: done jobs full for 24 h; asking or stopped jobs untouched 3 days fold into "Waiting on you"; finished pinned in the snapshot 7 days; Undo shown 8 s. |
| +- Direction Try again note: required, at most 1000 characters (`MaxDirectionNote`). Team ask text at most 140, labels at most 40 each. |
| +- First look within 2 min of the person's message (O1 granted from phase 2; from the placement tap before that); pill working within 5 s; the job view names what is being made within 30 s. |
| +- Equipo: `make ci` green (including `copy-release-check`, `migration-check`, `budget`); Base: `make ci` and `make browser` green; budgets updated in `.rastrillo/budgets.txt` in the commit that grows a file. |
| +- Shared machine: servers bind `127.0.0.1`; scratch under `$TMPDIR`; default `GOCACHE`; targeted `go test -run` while iterating, full suites once per task before commit. |
| +- Commit subjects under 80 characters, body after a blank line, ending `Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>`. |
| + |
| +## Review Focus |
| + |
| +1. **The same tap twice, or from two places** (double click, a retry after a dropped connection, the web and the phone at once): one action, one receipt; the second answers with the card as it is now, never a second answer or a 500. Test: `TestJobActReplayAndRace` (Task 1.7). |
| +2. **Machinery words in the Assistant's wording** ("I'll ask the Equipo team…", a label naming a runner): a reasonable person expects Base never to name them. `team_ask` refuses text or labels containing Equipo, Coordinator, runner or Amadan (whole word, any case) with `machinery_words`. Test: `TestTeamAskRefusesMachineryWords` (Task 1.10). |
| +3. **Hostile or odd words in "Something else" and notes** (HTML, a Markdown link, only spaces, 1001 characters, NUL, right-to-left text): refused with 422 where invalid; otherwise shown as plain text in the receipt and the pill, never as markup. Tests: `TestJobActWordsBounds` (Task 1.7), `TestAskJobWordsShownAsText` (Task 1.20). |
| +4. **A stale page without scripts** (the person taps an option on a page loaded before the question changed): the form post is answered 303 to `/ask` with the pill redrawn, never an error page; with scripts the 409 redraws in place and says "That changed while you were looking." only when the redraw doesn't show it. Tests: `TestAskJobActStaleScriptsOff` (Task 1.17), `TestAskJobActConflictRedraws` (Task 1.20). |
| +5. **Quiet hours and the daily cap in the person's own zone** (Madrid, across a DST change, a person who changes zone): no sweep turn inside quiet hours as the person reckons them; the rolling 24 h cap counts the same either side of DST. Test: `TestSweepTasteQuietHoursInZone` (Task 2.8). |
| + |
| +## Deploy order and protocols |
| + |
| +| Step | What | Why this order | |
| +|---|---|---| |
| +| 1.a | Equipo instance with decision cards (protocol 30), then runners (`upgrade-thin.sh`) | `Encode` downgrades per peer, but the instance must know protocol 30 before a runner speaks it | |
| +| 1.b | Equipo instance, phase 1 (act endpoint, capability gate, notes); runner release with the mode-independent opening (Task 1.13) | Base's controls are drawn only from fields Equipo sends; an older Base ignores them (T13) | |
| +| 1.c | Base web, phase 1; then native build | Base new + Equipo old is safe (header ignored, no `ask` to draw), but useless; deploy after 1.b | |
| +| 2 | Equipo instance (protocol 31 known), then runners | No Base change in phase 2 beyond tests | |
| +| 3 | Equipo instance (protocol 32 known), then runners; T12 on staging | Base already draws `first_look` links from phase 1 | |
| +| 4 | Equipo instance, then Base web and native | Base's fold rows read `updated_at`, sent since phase 1 | |
| + |
| +Each step goes to staging (`*.oncarlos.com`) first, then production (`*.oficina.works`) after Paul's live check. Planning only: nothing here is deployed by the planner. |
| + |
| +--- |
| + |
| +## Phase 0. Operations |
| + |
| +### Task 0.1: Confirm phase 0 holds on staging |
| + |
| +Verification only; the fixes are merged (table above). |
| + |
| +- [ ] **Step 1:** On staging, read the six jobs' steps (Equipo task pages). Expected: job 5 and job 6 previews no longer fail with `preview_scanner`; a merge into a repository the runner created no longer fails "merge refused by validation". |
| +- [ ] **Step 2:** Record the result, with commit ids, under a new "Jobs that keep moving" heading in `docs/live-check.md` (Base). Commit: `Live check: phase 0 of jobs that keep moving holds on staging`. |
| + |
| +### Task 0.2: Fold in the stopped-jobs audit's top fixes |
| + |
| +The audit was not at `/home/paulca/amadan.net/carlos/base/.superpowers/sdd/2026-11-13-assistant-jobs/stopped-jobs-audit-2026-11-25.md` when this plan was written. |
| + |
| +- [ ] **Step 1:** When it lands, read its top fixes and add each as a Phase 0 task here (repository, files, failing test, fix), unless a task below already covers it (then note which). |
| +- [ ] **Step 2:** Commit the plan change on the branch carrying this plan. |
| + |
| +--- |
| + |
| +## Phase 1. Act from Base |
| + |
| +### Task 1.0: Copy review, phase 1 |
| + |
| +- [ ] **Step 1:** Run the `copy-review` skill over every string in the register under "Phase 1" (Equipo instance copy, Base and native strings) and the 34 decision-card strings of `cf0614ec` (`decision.*`, `assistant.decision.*`). |
| +- [ ] **Step 2:** Write the approved wording into the register in this plan (replacing DRAFT), and the review id. No code task in phase 1 writes a string before this step. |
| + |
| +### Task 1.1 (Equipo): Land decision cards |
| + |
| +**Files:** rebase `decision-cards-context` (`cf0614ec`) onto `origin/main`; rename `internal/equipo/migrations/0095_decision_cards.sql` → `0107_decision_cards.sql`; `internal/wire/runners.go`, `internal/wire/assistant_test.go`; `internal/equipo/copy.go`; `.rastrillo/budgets.txt`. |
| + |
| +**Interfaces:** |
| +- Produces: `wire.ProtocolDecisions = Protocol30` (`ProtocolCurrent`); `wire.AssistantCard.{Context string, Link *DecisionLink, Recommended *Recommendation}`; `wire.CardOption.Detail`; `wire.DecisionLink{URL, Label, State, Note}` with states `ready|starting|failed|off`; `(t *txn) assistantDecision(...)`; `(t *txn) taskDecisionLink(task string, always bool) (*wire.DecisionLink, error)`; `(t *txn) directionDecision(p progress) (context, recommended, why string, details []wire.OptionDetail)`. |
| + |
| +- [ ] **Step 1:** Rebase; resolve against paused work (`jobView` now returns `carryOn`; `mirrorCard`'s `Select` list gains the decision columns beside `carry_on`). |
| +- [ ] **Step 2:** Renumber: protocol 30 below `ProtocolPinnedRelease`; `TestSpokenIs24` expects `Spoken(99) == 30` and `ProtocolCurrent == ProtocolDecisions`; migration file renamed and `schema.sql` regenerated. |
| +- [ ] **Step 3:** Replace every `// COPY REVIEW PENDING` with the Task 1.0 approved text and no marker; any string not approved keeps `// COPY REVIEW REQUIRED`. |
| +- [ ] **Step 4:** Run `go test ./internal/wire ./internal/equipo/chat ./internal/runner/thin -run 'Decision|Direction|Spoken|Judge' -count=1`, then `make ci`. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Decision cards on main: protocol 30, migration 0107, reviewed copy`. |
| + |
| +### Task 1.2 (Equipo): Job card wire contract |
| + |
| +**Files:** `internal/wire/assistant.go`, `internal/wire/assistant_test.go`, `docs/api/equipo-v1.md` ("Talk to the Assistant"), `docs/api/equipo-v1.openapi.json`. |
| + |
| +**Interfaces (Produces):** |
| +```go |
| +type JobAsk struct { |
| + Kind string `json:"kind"` // AskQuestion | AskDirection | AskApproval | AskReplace |
| + Decision string `json:"decision"` // opaque, decisionID |
| + Text string `json:"text"` |
| + Words bool `json:"words,omitempty"` |
| + Note string `json:"note,omitempty"` // direction: Try again's field label |
| +} |
| +type JobReceipt struct { At time.Time `json:"at"`; Text string `json:"text"` } |
| +// AssistantCard gains: Ask *JobAsk `ask,omitempty`; Actions []CardOption `actions,omitempty`; |
| +// Receipts []JobReceipt `receipts,omitempty`; UpdatedAt *time.Time `updated_at,omitempty`; Hidden bool `hidden,omitempty`. |
| +const ( ActAnswer = "answer"; ActBuild = "build"; ActAgain = "again"; ActDrop = "drop"; ActRetry = "retry"; |
| + ActReplace = "replace"; ActKeep = "keep"; ActDismiss = "dismiss"; ActRestore = "restore" ) |
| +var JobActions = []string{...all nine...} |
| +type JobAct struct { |
| + Action, Decision, Choice, Words, Note string |
| + Revision int64 `json:"revision"` |
| + IdempotencyKey string `json:"idempotency_key"` |
| +} |
| +type AssistantJobActed struct { Card AssistantCard `json:"card"` } |
| +const HeaderBaseCapabilities = "Base-Capabilities"; const CapJobActions = "job_actions" |
| +const LinkFirstLook = "first_look" |
| +``` |
| + |
| +- [ ] **Step 1: Failing tests** `TestAssistantJobCardJSON`: a zero `AssistantCard` marshals exactly today's keys (no `ask`, `actions`, `receipts`, `updated_at`, `hidden`); a job card with all set round-trips; `TestJobActStrict`: `wire.Strict` refuses an unknown field in `JobAct`. |
| +- [ ] **Step 2:** Run `go test ./internal/wire -run 'AssistantJobCard|JobActStrict' -count=1`. Expected: FAIL (undefined). |
| +- [ ] **Step 3:** Add the types; document the route, fields, 200/409/422/403/404 and the header in `equipo-v1.md` and the OpenAPI file. |
| +- [ ] **Step 4:** Run the tests. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Job card contract: ask, actions, receipts, act request`. |
| + |
| +### Task 1.3 (Equipo): Phase 1 storage |
| + |
| +**Files:** `internal/equipo/migrations/0108_jobs_act.sql`, `schema.sql`, `internal/equipo/chat/store.go` (records), `internal/equipo/chat/receipts.go` (new). |
| + |
| +```sql |
| +ALTER TABLE chat_cards ADD COLUMN dismissed_at datetime; |
| +ALTER TABLE chat_cards ADD COLUMN projected integer NOT NULL DEFAULT 0; |
| +ALTER TABLE chat_cards ADD COLUMN checked_at datetime; |
| +ALTER TABLE chat_cards ADD COLUMN decision_card text; |
| +ALTER TABLE chat_cards ADD COLUMN decision_rev integer; |
| +ALTER TABLE chat_cards ADD COLUMN decision_cand text; |
| +ALTER TABLE chat_cards ADD COLUMN ask_text text; |
| +ALTER TABLE chat_cards ADD COLUMN ask_labels text; |
| +ALTER TABLE chat_cards ADD COLUMN ask_parts text; -- team_ask's context, recommended, why, details (JSON) |
| +ALTER TABLE chat_cards ADD COLUMN open_words boolean; -- question card (filled from phase 2) |
| +ALTER TABLE chat_handoffs ADD COLUMN dismiss_pending boolean; |
| +ALTER TABLE chat_assistant_hosts ADD COLUMN capabilities text; |
| +CREATE TABLE chat_job_receipts (id text PRIMARY KEY, handoff_id text NOT NULL, person text NOT NULL, at datetime NOT NULL, copy_key text NOT NULL, arg text); |
| +CREATE INDEX chat_job_receipt_handoff ON chat_job_receipts(handoff_id, at); |
| +CREATE INDEX chat_card_job_sweep ON chat_cards(kind, lane, dismissed_at, checked_at); |
| +``` |
| +`ask_parts` is beyond the spec's migration: it stores the addendum's parts in the Assistant's words (PD4). |
| + |
| +**Interfaces (Produces):** `receiptRecord{ID, HandoffID, Person string; At time.Time; CopyKey, Arg string}`; `(t *txn) addReceipt(h handoffRecord, key, arg string) error`; `(t *txn) jobReceipts(h handoffRecord) ([]wire.JobReceipt, error)` (newest five, oldest first, text `fmt.Sprintf(t.copy(key), arg)`). |
| + |
| +- [ ] **Step 1: Failing test** `TestJobReceiptsNewestFive` (store test): seven receipts → five returned, oldest first, rendered from copy keys. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run TestJobReceiptsNewestFive -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Migration, `schema.sql`, records and functions. |
| +- [ ] **Step 4:** Run the test and `make migration-check`. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Jobs storage: decision identity, receipts, dismissal, capabilities`. |
| + |
| +### Task 1.4 (Equipo): Capability gate |
| + |
| +**Files:** `internal/equipo/chat/assistant_http.go`, `internal/equipo/chat/capability.go` (new), `internal/thintest/assistant_capability_contract_test.go` (new). |
| + |
| +**Interfaces (Produces):** `(h *HTTP) noteCapabilities(r *http.Request, p personapi.PersonPrincipal)` called first in every `MountAssistant` route; `(s *Store) SetCapabilities(ctx, person, value string) error` (upserts `chat_assistant_hosts`, writes only on change); `(t *txn) capable(person string) (bool, error)`; `knowsJobActions(r *http.Request) bool`; `legacyJobCard(c wire.AssistantCard) wire.AssistantCard` (strips per PD7), applied to snapshot cards and `card` events like `olderJobCard`. |
| + |
| +- [ ] **Step 1: Failing tests** `TestAssistantCapabilityGate` (thintest, T13's Equipo half): without the header a job card asking a question has no `ask`, `options`, `actions`; with it, they are present; a person registered before this release (row with no `capabilities`) becomes capable on the next snapshot carrying the header, with no `PUT host`; `PUT host` with today's body still succeeds (strict decoder untouched). |
| +- [ ] **Step 2:** Run `go test ./internal/thintest -run TestAssistantCapabilityGate -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement. |
| +- [ ] **Step 4:** Run. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Base-Capabilities header: record per person, strip job actions without it`. |
| + |
| +### Task 1.5 (Equipo): The decision on the card |
| + |
| +**Files:** `internal/equipo/chat/jobs.go`, `internal/equipo/chat/job_ask.go` (new), `internal/equipo/chat/job_ask_test.go` (new). |
| + |
| +**Interfaces:** |
| +- Consumes: `openQuestion`, `blockingCard`, `questionOptions`, `directionDecision`, `taskDecisionLink`, placement card choices (`placement_card.go`). |
| +- Produces: |
| +```go |
| +func decisionID(card string, rev int64, cand string) string // "d_" + 20 lower base32 chars of sha256(card \x00 rev \x00 cand) |
| +type jobDecision struct { Card string; Rev int64; Cand string; Kind string /* wire.Ask* */ } |
| +func (t *txn) jobAsk(h handoffRecord, state string) (*wire.JobAsk, []wire.CardOption, *jobDecision, error) |
| +func optionToken(i int) string // "o1", "o2", … |
| +func (t *txn) optionChoice(d jobDecision, token string) (choice string, ok bool, err error) |
| +const jobViewVersion = 1 // bumped whenever jobState or jobView change meaning |
| +``` |
| +`jobView` returns a `jobCardParts` struct instead of its growing tuple: `{State, Result, Detail, CarryOn string; Links []wire.CardLink; Ask *wire.JobAsk; Options []wire.CardOption; Actions []wire.CardOption; Decision *jobDecision; Context string; Link *wire.DecisionLink; Recommended *wire.Recommendation}`. `jobCardView` fills `UpdatedAt` from the card's `updated_at` and `Receipts` from `jobReceipts`. `projectJob` writes `decision_card/rev/cand`, `projected = jobViewVersion`, and moves the revision when any visible field **or** the decision identity changed (finding 1). |
| + |
| +Ask by kind (phase 1): a question in the job lane → `AskQuestion`, text and labels from `ask_text`/`ask_labels` when `team_ask` worded this exact decision, else no ask yet (K3 step 3, Task 1.11), `Words` false; a placement question → instance text and labels "Add to {project}" / "A new site" from the project display name; an open direction card → `AskDirection` per K11's four preview cases (`taskPreview`, preview step state, `ExpiresAt`), no buttons while the preview is queued or running; an approval kind → no ask, the K6 row (Task 1.6). Context, link and recommendation per PD4. |
| + |
| +- [ ] **Step 1: Failing tests:** |
| + - `TestJobAskQuestionWorded`: after `team_ask` storage for decision D, the card's ask has D, the Assistant's text, labels with values `o1..oN`, and `recommended.option` a token. |
| + - `TestJobAskSameWordsNewDecision`: a new question with identical words moves the card's revision and decision. |
| + - `TestJobAskPlacement`: labels are `Add to <display name>` and `A new site`, never a repository path. |
| + - `TestJobAskDirectionCases`: deployed → status key `first_look_ready`, ask present, link rel `first_look`; queued → `making_first_look`, no ask; failed/declined → `ready_to_decide` with the can't-be-shown text; expired → `ready_to_decide` with the expired text. |
| + - `TestJobAskNoCoordinatorWords`: the Coordinator's question text and option labels appear nowhere in the marshalled card. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestJobAsk' -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement. |
| +- [ ] **Step 4:** Run, then `go test ./internal/equipo/chat -count=1`. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Job cards carry the decision in front of the person`. |
| + |
| +**Pending copy:** placement labels; K11 statuses and ask texts; direction context/why/details; "See the first look". |
| + |
| +### Task 1.6 (Equipo): Stops with a reason and a next step (K6, phase 1 rows) |
| + |
| +**Files:** `internal/equipo/chat/job_stop.go` (new), `internal/equipo/chat/jobs.go`, `internal/equipo/chat/job_stop_test.go` (new). |
| + |
| +**Interfaces (Produces):** |
| +```go |
| +type retryPath string // retryFailedStep | retryResend | retryMerge | retryNone |
| +type stopRow struct { State, Key string; Actions []string; Retry retryPath; OpenInEquipo bool; Retrying bool } |
| +func (t *txn) stopView(h handoffRecord, reason, cause string) (stopRow, error) |
| +func mergeUncertainText(reason string) bool // step reason text says "merge outcome unknown" |
| +``` |
| +Rows: every K6 row of phase 1 (`stopFailed` with nudges used/left, `stopNoWork`, `causeGoingLive` merge failed / publish failed with and without an open Publish, every `blocksWork` kind, every `Needs*` need, dropped, stopping, `stopCancelled`). `NeedsRunnerOffline`/`NeedsMachineRemoved` per PD6. A merge failure whose step reason says "merge outcome unknown" (jobs 1, 5, 6, from older runners) is the `merge_uncertain` row (Try again → `retryMerge`). `CardHome` is an Open-in-Equipo row until Task 2.10. Copy keys `assistant.job.stop.<key>` and `assistant.job.stop.<key>.detail`. |
| + |
| +- [ ] **Step 1: Failing test** `TestStopViewEveryCause`: table over every `jobStop` reason/cause and every kind `blocksWork` knows; asserts state, key, actions and retry path per K6; an unknown future `Needs*` falls back to `stopped` + Open in Equipo + Drop it. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run TestStopViewEveryCause -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement; `jobView` uses it for `stopped` and for the stopping/retrying `working` lines. |
| +- [ ] **Step 4:** Run. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Stopped jobs say why and what can be done`. |
| + |
| +**Pending copy:** every K6 phase 1 status and detail. |
| + |
| +### Task 1.7 (Equipo): The act endpoint, and answering |
| + |
| +**Files:** `internal/equipo/chat/job_act.go` (new), `internal/equipo/chat/assistant_http.go` (route), `internal/equipo/chat/projects.go` (`answerQuestionOrigin` words mode), `internal/equipo/chat/job_act_test.go` (new). |
| + |
| +**Interfaces:** |
| +- Consumes: Tasks 1.2 to 1.6. |
| +- Produces: |
| +```go |
| +var ErrDecisionGone = errors.New("chat: the decision changed") |
| +func (s *Store) ActOnJob(ctx context.Context, person, cardID string, in wire.JobAct) (wire.AssistantCard, error) |
| +// ErrCardConflict → 409 card_stale; ErrDecisionGone → 409 decision_gone; ErrInvalid → 422; ErrForbidden → 403; ErrNotFound → 404 |
| +func (h *HTTP) jobAct(w http.ResponseWriter, r *http.Request, p personapi.PersonPrincipal) // POST /jobs/{id}/act |
| +func (t *txn) actDone(h handoffRecord, person, action string) error // audit assistant.job.<action>, handoffActionRecord kind person_<action>, cancel a queued undispatched team_update of h, clear h's digest |
| +``` |
| +One transaction: ledger key `act:<card>:<key>` replay → card as now; project afresh; revision check; decision check (presented `decision` equals `decisionID` of the stored identity and the source card is still open at that revision and candidate); action offered now; then the path. `answer` with `choice` → `optionChoice` → `answerQuestion` in the job lane at the decision's revision (placement through `validatePlacementAnswer`); `answer` with `words` → words mode (K4): allowed only when the card's ask has `Words` (phase 1: the K3 fallback for that exact decision), never for placement; origin stays `originComposer`. Receipt `chose` (with the label shown) or `answered` (with the words). |
| + |
| +- [ ] **Step 1: Failing tests:** |
| + - `TestJobActAnswer` (T2): an option answer reaches `answerQuestion` at the decision's revision; card goes `working` with a receipt naming the shown label; a queued `team_update` is cancelled; stale revision → `ErrCardConflict` with the card; withdrawn decision or a new question with identical words → `ErrDecisionGone`; `words` when `ask.words` is false → `ErrInvalid`. |
| + - `TestJobActPlacement` (T3, phase 1 half): a placement tap passes `validatePlacementAnswer` and `create_project` makes exactly that repository. |
| + - `TestJobActReplayAndRace` (Review Focus 1): same key twice → one answer, one receipt, same card; two keys racing on one revision → one 200, one `card_stale`. |
| + - `TestJobActWordsBounds` (Review Focus 3): empty, whitespace, over `wire.MaxMessageBytes`, NUL, invalid UTF-8 → `ErrInvalid`; HTML is stored as given. |
| + - `TestFreeWordsMode` (T17): words against a question with options only for the bound fallback decision, never placement, origin `originComposer`. |
| + - `TestJobActHTTP`: route codes 200/409/422/403/404; 409 body is `AssistantConflict` with the card. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestJobAct|TestFreeWordsMode' -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement. |
| +- [ ] **Step 4:** Run. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Act on a job from Base: answer, bound to the decision seen`. |
| + |
| +**Pending copy:** receipts "You chose “{option}”.", "You answered: “{words}”." |
| + |
| +### Task 1.8 (Equipo): Direction from the pill, and the first look held through the build (K11) |
| + |
| +**Files:** `internal/equipo/chat/job_act.go`, `internal/equipo/chat/publish.go` (`previewHeld`), `internal/equipo/chat/explore.go`, `internal/equipo/chat/questions.go` (`forgetTask`), `internal/equipo/chat/job_act_direction_test.go` (new). |
| + |
| +**Interfaces:** `build`, `again` (note required, at most `MaxDirectionNote`), `drop` → `answerDirection` with `ChoiceBuild`/`ChoiceAgain`/`ChoiceDrop`; `previewHeld` also returns true for an exploration whose `BuiltAs` task has no deployed preview yet, until that preview deploys, the job is dropped, or `ExpiresAt` passes; `forgetTask` sends `KeepPreview: true` while held; `releasePreview` when the hold ends (on the built task's preview deploy in `touchDecisions`, on drop, on expiry in `expirePreviews`). While building, the job card carries the first look's link (rel `first_look`, label "See the first look"). |
| + |
| +- [ ] **Step 1: Failing test** `TestJobActDirection` (T4): build/again/drop reach `answerDirection`; build's task is followed by the hand-off; `again` without a note or over 1000 → `ErrInvalid`; the first look stays on the card until the build's preview deploys, through a runner reconnect and a store reopen; a non-creator gets `ErrForbidden`. Receipts `build_chosen`, `again_asked` with the note. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run TestJobActDirection -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement. |
| +- [ ] **Step 4:** Run, then `go test ./internal/equipo/chat -run 'Preview|Explore|Publish' -count=1`. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Build it, Try again, Drop it from the pill; first look stays up`. |
| + |
| +**Pending copy:** "Building it" / "Building the full version from your first look."; receipts "You chose to build it.", "You asked for another try: “{note}”." |
| + |
| +### Task 1.9 (Equipo): Try again, drop, dismiss, restore (K6, K9) |
| + |
| +**Files:** `internal/equipo/chat/job_act.go`, `internal/equipo/chat/handoff.go` (`teamCancel` body moved), `internal/equipo/chat/job_drop.go` (new), `internal/equipo/chat/lane.go` (snapshot excludes dismissed), `internal/equipo/chat/job_drop_test.go` (new). |
| + |
| +**Interfaces (Produces):** |
| +```go |
| +func (t *txn) dropJob(person string, h handoffRecord, dismiss bool) error // teamCancel's body; dismiss sets dismiss_pending |
| +func (t *txn) jobSettled(h handoffRecord) (bool, error) // no followed task CancelRequested with unterminated steps, no merge under way, no job-lane Coordinator turn in flight |
| +func (t *txn) settleDismiss(h handoffRecord) error // called where a termination, a merge end or a turn end is recorded; sets dismissed_at and sends the card with hidden:true |
| +``` |
| +`retry` by the card's `stopRow.Retry`: `retryFailedStep` → `retryFailed(h)` as the person; `retryResend` → the hand-off's words sent again as `teamNudge`'s send; `retryMerge` → `MergeTask` (its `authorizeMerge`; `MergeBranch` records an already-merged candidate as merged). `drop` → `dropJob(…, false)`, receipt `dropped`. `dismiss` is offered in every job view and on finished pills: on a finished job (done, dropped, stopped with nothing running) it sets `dismissed_at` and hides at once; on unfinished work it is `dropJob(…, true)` (drop, then hide once settled). The "Drop this job too?" confirm is Base's, before it sends `dismiss` (O2 as proposed). `restore` clears `dismissed_at` and `dismiss_pending`, never undoes a drop. A dismissed card and the cards attached to it leave the snapshot; nothing is deleted. |
| + |
| +- [ ] **Step 1: Failing tests:** |
| + - `TestJobActRetry` (T5): each K6 Try again runs its path; Try again after `merge_uncertain` where the candidate already reached the default branch records it merged and makes no merge call. |
| + - `TestJobDropDismiss` (T6): drop cancels created tasks only; restore brings back visibility, never the work; a dismissed card is absent from the snapshot and sent once with `hidden: true`. |
| + - `TestDropSettles` (T16): a drop-and-dismiss during a running Engineering step, during a merge, and with the runner disconnected keeps the card visible as Stopping until termination is proven; then hidden; restore after that restores visibility only; `dismiss_pending` survives a store reopen. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestJobActRetry|TestJobDropDismiss|TestDropSettles' -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement; `teamCancel` calls `dropJob` after its tool-call checks. |
| +- [ ] **Step 4:** Run, then `go test ./internal/equipo/chat -run 'Cancel|Handoff' -count=1`. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Try again, drop and dismiss a job; hide only once it has stopped`. |
| + |
| +**Pending copy:** "Stopping" / "Stopping what's already under way."; "Dropped" / "You dropped this."; receipt "Tried again." |
| + |
| +### Task 1.10 (Equipo): `team_ask`, and every write names its decision (K3, K7) |
| + |
| +**Files:** `internal/equipo/chat/handoff.go` (`teamReply`, team ops list, `updateWrites`), `internal/equipo/chat/team_ask.go` (new), `internal/equipo/chat/assistant_tools.go` (descriptions), `internal/equipo/chat/team_ask_test.go` (new). |
| + |
| +**Interfaces (Produces):** |
| +- `opTeamAsk = "team_ask"`, input `{request, decision, text, labels []string, context?, recommended?, why?, details? []string}`: text at most 140, one label per option at most 40, context at most 600 and why at most 200 (PD4), `recommended` one of the labels' tokens; stores `ask_text`, `ask_labels`, `ask_parts` on the job card for that decision and re-projects. Refusals: `stale_decision`, `person_only` (placement, approvals), `machinery_words`, `invalid_input`. `updateWrites = {team_reply, team_nudge, team_ask}`. |
| +- `team_reply` gains `decision` (required for a capable person in every turn kind; optional in legacy mode) and refuses `stale_decision` when it is not the open one, and `person_only` on a placement card for a capable person (legacy mode keeps today's relay, T13). |
| +- `team_status` and `openQuestionsNote` lines carry each question's `decision`. |
| + |
| +- [ ] **Step 1: Failing tests:** |
| + - `TestTeamAsk` (T10): rewording keeps values; a label count different from the options → `invalid_input`; a recommended token not offered → `invalid_input`. |
| + - `TestTeamAskRefusesMachineryWords` (Review Focus 2): "Equipo", "coordinator", "Runner", "Amadan" in text or a label → `machinery_words`; "running shoes" passes. |
| + - `TestTeamReplyGuards` (T10, phase 1 half): `stale_decision` from a turn that started before the person answered; placement `person_only` for a capable person, relayed for a legacy one. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestTeamAsk|TestTeamReplyGuards' -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement. |
| +- [ ] **Step 4:** Run, then `go test ./internal/thintest -run 'Assistant.*Reply' -count=1`. Expected: PASS. |
| +- [ ] **Step 5:** Commit `team_ask, and team_reply bound to the decision it answers`. |
| + |
| +### Task 1.11 (Equipo): The Assistant hears what the person did; phase 1 notes (K3 step 3, K5, K16) |
| + |
| +**Files:** `internal/equipo/chat/tools.go` (note constants), `internal/equipo/chat/handoff.go` (`jobNote`, `openQuestionsNote`), `internal/equipo/chat/jobs.go` (`updateEnded`), `internal/equipo/chat/store.go` (person turn assembly), `internal/equipo/chat/notes_test.go` (new). |
| + |
| +**Interfaces (Produces):** `const jobsMovingPhase = 1`; `(t *txn) jobNoteFor(h handoffRecord, capable bool) (string, error)` (legacy: today's text word for word); new notes `noteWordIt`, `noteDirection` (phase 1: without the build clause), `notePersonActed`; `noteAnswerIt` phase 1 (no default clause; names `decision`); `noteBlocked` for an Open-in-Equipo row ends "they can see what's needed on the job"; `(t *txn) personActedNote(person string, since time.Time) (string, error)` → the K5 block after the open-questions block, each `person_<action>` once. On `updateEnded`: when the job's open question has no Assistant answer and no `team_ask` for its decision, queue one `team_update` with `noteWordIt` (ledger key `wordit:<decision>`); when that one also ends without either, the card shows the K3 fallback ask (`Words: true`, no options, text key `assistant.job.ask.fallback`). |
| + |
| +- [ ] **Step 1: Failing tests:** |
| + - `TestNotesByModeAndPhase` (T15): legacy notes equal today's strings; capable phase 1 notes name only `team_reply`, `team_ask`, `team_nudge` with `decision`; no note mentions `team_add`, `basis`, `replaces`. |
| + - `TestPersonActedBlock` (K5): two actions since the last turn → two lines, once each; the next turn carries none. |
| + - `TestWordItThenFallback`: first quiet turn → one `noteWordIt` turn; second → fallback ask with `Words` and no options; a `team_ask` in between prevents the fallback. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestNotesByModeAndPhase|TestPersonActedBlock|TestWordItThenFallback' -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement (model-facing notes are not copy; the spec's wording is used). |
| +- [ ] **Step 4:** Run, then `go test ./internal/thintest -run Assistant -count=1`. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Notes by mode and phase; the Assistant hears what the person did`. |
| + |
| +**Pending copy:** "One question for you" (approved) with detail "One question about this job." (fallback). |
| + |
| +### Task 1.12 (Equipo): No dead ends (T1) |
| + |
| +**Files:** `internal/equipo/chat/dead_ends_test.go` (new); fixes wherever it fails. |
| + |
| +- [ ] **Step 1: Test** `TestJobNeverDeadEnds`: for every `jobStop` reason and cause and every `blocksWork` kind, build the state, project the card; if `asking` or `stopped`, either `Retrying`, or an Open-in-Equipo row, or for **each** offered action call `ActOnJob` and assert success. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run TestJobNeverDeadEnds -count=1`. Fix any row that fails in its owning file. |
| +- [ ] **Step 3:** Commit `No job card is a dead end`. |
| + |
| +### Task 1.13 (Equipo, runner): The opening's mode-independent rules (K16) |
| + |
| +**Files:** `internal/runner/thin/assistant.go` (`assistantOpening`), `internal/runner/thin/assistant_test.go`. |
| + |
| +- [ ] **Step 1: Failing test:** extend `TestAssistantOpening`: rules 5 and 6 are exactly "When a job has a question or stops, follow the job's note; never repeat a job's question in your reply; never drop or cancel a job unless the person asks."; no rule names `team_ask`, `team_add`, `basis` or `replaces`. |
| +- [ ] **Step 2:** Run `go test ./internal/runner/thin -run TestAssistantOpening -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Change the opening. |
| +- [ ] **Step 4:** Run, then `make runner-host`. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Assistant opening: follow the job's note, never repeat its question`. |
| + |
| +### Task 1.14 (Equipo): Keep every card current (K8 step 1) |
| + |
| +**Files:** `internal/equipo/chat/job_paused.go` (`refreshJobs` → move to `internal/equipo/chat/job_sweep.go`), `internal/equipo/chat/job_sweep_test.go` (new). |
| + |
| +**Interfaces:** `(s *Store) refreshJobs(ctx)` selects job cards not dismissed whose `projected < jobViewVersion`, or whose `checked_at` is null or older than 10 min with the hand-off `open` or `stopping`, or which are `working`/`paused` (today's rule, kept for the clock-driven paused words); oldest `checked_at` first; at most 200; each in its own transaction; sets `checked_at` either way. The migration's `projected` default 0 makes the first ticks after deploy re-project every card. |
| + |
| +- [ ] **Step 1: Failing test** `TestSweepReprojects` (T7): the job 1 data (merge failed at Ready to merge with "merge outcome unknown", card `working/finishing`) shows "Didn't go live" with Try again after one tick; an unchanged `stopped` card is re-checked only after 10 minutes (fake clock); 250 due cards → 200 in one tick, the rest next tick; a failing card is logged and skipped. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestSweepReprojects|Paused' -count=1`. Expected: FAIL on the new test. |
| +- [ ] **Step 3:** Implement. |
| +- [ ] **Step 4:** Run. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Sweep re-projects every stale job card, 200 a minute`. |
| + |
| +### Task 1.15 (Base): Equipo client: new card fields, Clean, capability header, Act |
| + |
| +**Files:** `internal/equipo/chat.go`, `internal/equipo/equipo.go` (`call`), `internal/equipo/equipo_test.go`. |
| + |
| +**Interfaces (Produces):** |
| +```go |
| +type Ask struct { Kind, Decision, Text string; Words bool; Note string } // json as wire.JobAsk |
| +type Receipt struct { At time.Time; Text string } |
| +type DecisionLink struct { URL, Label, State, Note string } |
| +type Recommendation struct { Option, Why string } |
| +// Card gains: Ask *Ask; Actions []Option; Receipts []Receipt; UpdatedAt *time.Time; Hidden bool; |
| +// Context string; Link *DecisionLink; Recommended *Recommendation |
| +// Option gains: Detail string |
| +const LinkFirstLook = "first_look"; const Capabilities = "job_actions" |
| +var AskKinds = []string{"question", "direction", "approval", "replace"} |
| +var JobActions = []string{"answer","build","again","drop","retry","replace","keep","dismiss","restore"} |
| +func (c *Client) Act(ctx context.Context, token, id string, in Act) (Card, error) // POST assistant/jobs/{id}/act |
| +type Act struct { Action, Decision, Choice, Words, Note string; Revision int64; Key string } |
| +func (c Card) FirstLook() (Link, bool) |
| +``` |
| +`call` sets `Base-Capabilities: job_actions` on every request to `/api/v1/assistant/*`. `CleanAt` keeps job options, `ask`, actions, receipts, decision parts and `first_look` links within the Global Constraints' bounds; drops unknown kinds, actions and non-http(s) links; `Recommended` kept only when it names a kept option value (or, for a direction, a kept action). |
| + |
| +- [ ] **Step 1: Failing tests** `TestCleanJobAsk`, `TestCleanJobBounds` (each bound at limit and limit+1), `TestCleanDropsUnknownActions`, `TestCleanFirstLookLink` (javascript: dropped), `TestCapabilityHeaderOnEveryCall` (snapshot, events, messages, answer, carry_on, act, time-zone; `RegisterHost` body unchanged), `TestActConflictReturnsCard`. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement. |
| +- [ ] **Step 4:** Run. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Equipo client: job asks, actions, receipts; capability header`. |
| + |
| +### Task 1.16 (Base): Fake Equipo learns the act contract |
| + |
| +**Files:** `internal/equipo/equipotest/chat.go`. |
| + |
| +**Interfaces (Produces):** `(f *Fake) AskJobQuestion(job, decision, text string, options []equipo.Option, words bool)`; `(f *Fake) AskJobDirection(job, decision string, firstLook equipo.Link)`; `(f *Fake) StopJob(job, result, detail string, actions ...string)`; `(f *Fake) FinishJob(job string, at time.Time)`; `(f *Fake) ActCalls() []Call`; `(f *Fake) RefuseAct(status int, code string)`; act replays by card and key as Equipo does; the fake records the `Base-Capabilities` header of each call and strips job asks without it. |
| + |
| +- [ ] **Step 1:** Implement with a self-test `TestFakeActReplaysByKey` in `internal/webtest`. |
| +- [ ] **Step 2:** Run `go test ./internal/webtest -run TestFakeActReplaysByKey -count=1`. Expected: PASS. |
| +- [ ] **Step 3:** Commit `Fake Equipo: job asks, stops and the act route`. |
| + |
| +### Task 1.17 (Base): `POST /ask/jobs/{id}/act` relay |
| + |
| +**Files:** `internal/web/ask.go` (route), `internal/web/ask_relay.go` (`askAct`), `internal/webtest/ask_test.go`, `docs/api/base-native-v1.md`. |
| + |
| +**Interfaces (Produces):** `func (a *app) askAct(w http.ResponseWriter, r *http.Request)`: form fields `action`, `decision`, `choice`, `words`, `note`, `revision`, `key`; JSON `{card}` to scripts (`wantsJSON`), 303 `/ask` without; Equipo's 409 → JSON 409 `{card}` (redraw) or 303; a 404 or `{card: null}` → reload; a retryable failure → JSON 502 `{error: "retry"}` for the script's message; the card through `CleanAt`. Contract section added to `base-native-v1.md`. |
| + |
| +- [ ] **Step 1: Failing tests:** `TestAskJobActRelaysEachAction` (bearer, key, decision, every action), `TestAskJobActConflictPassesCard`, `TestAskJobActStaleScriptsOff` (Review Focus 4: 303 to `/ask`, no error page, pill shows the new state), `TestAskCapabilityHeaderForOldMember` (a member whose host was registered before this release). |
| +- [ ] **Step 2:** Run `go test ./internal/webtest -run 'TestAskJobAct|TestAskCapability' -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement. |
| +- [ ] **Step 4:** Run. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Relay a job action from the pill, with or without scripts`. |
| + |
| +### Task 1.18 (Base): Server-drawn pill and job view controls |
| + |
| +**Files:** `internal/web/templates/partials/chat.html` (`ask-job`, `ask-jobview`, new `ask-jobask`, `ask-receipts`), `internal/web/ask.go` (view helpers), `internal/look/static/app.css`, `internal/webtest/ask_test.go`. |
| + |
| +What it draws (no scripts needed): while `asking`, the ask strip under the pill title: context line, the link to the thing (or its note when not ready) **before** the options, one form button per option (detail under it when set), the recommended option marked with "Recommended" and its why, and "Something else" as a nested `<details>` with a one-line field "Tell me what you'd like" and "Send" when `ask.words`; a direction's Build it / Try again (a `<details>` with "What should change?", required, maxlength 1000) / Drop it (a `<details>` confirm). While `stopped`, the detail line and its actions (Try again, Drop it, Dismiss). The job view: the same, plus receipts, Dismiss on finished jobs, and for unfinished work Drop it's confirm "Drop this job too?" with "Drop it" / "Keep it" when reached from Dismiss. Look: option buttons are the ghost buttons; Try again and Build it the solid frost primary; Drop it and Dismiss quiet text buttons; the first-look link accent teal; reduced motion respected. |
| + |
| +- [ ] **Step 1: Failing tests (webtest):** `TestAskJobAskDrawn` (option forms carry `decision`, `choice`, `revision`, `key`; link before options; recommended marked), `TestAskJobStopDrawn`, `TestAskJobReceiptsDrawn`, `TestAskJobNoActionsWithoutAsk` (an older Equipo: nothing new drawn). |
| +- [ ] **Step 2:** Run `go test ./internal/webtest -run 'TestAskJob(Ask|Stop|Receipts|NoActions)' -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement with approved copy (Task 1.0); add rows to `docs/copy-pending.md`. |
| +- [ ] **Step 4:** Run. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Pill and job view carry the decision, drawn by the server`. |
| + |
| +**Pending copy (Base):** "Something else", "Tell me what you'd like", "Send", "Build it", "Try again", "What should change?", "Drop it", "Drop this job?", "Drop this job too?", "Keep it", "Dismiss", "Recommended". |
| + |
| +### Task 1.19 (Base): `ask.js` draws and acts |
| + |
| +**Files:** `internal/look/static/ask.js` (`addJob`, `jobView`, new `jobAsk`, `act`), `internal/look/static/app.css`. |
| + |
| +Behaviour: `addJob` draws Task 1.18's markup from the card; a tap posts `/ask/jobs/{id}/act` with a fresh key kept until an answer settles it (as Carry on now); 200 redraws the pill in place; 409 redraws and announces "That changed while you were looking." only when the redrawn pill has the same state and no ask change; a retryable failure says "Couldn't do that just now. Try again." in the job view's one live region; a job whose state becomes `asking`, `stopped` or `ready` moves to the end of the thread (no slide with reduced motion); `hidden: true` removes the pill and shows "Dismissed. Undo" for 8 s (Undo posts `restore`); Something else expands a field inside the pill, focused, Escape closes it and returns focus; the focus-twins list gains the new controls. |
| + |
| +- [ ] **Step 1:** No unit harness for `ask.js`; its tests are Task 1.20's browser tests. Implement. |
| +- [ ] **Step 2:** Run `go test ./internal/webtest -count=1` (pinned `ask.js` strings, if any). Expected: PASS. |
| +- [ ] **Step 3:** Commit `ask.js: answer, build, try again, drop and dismiss from the pill`. |
| + |
| +**Pending copy (Base):** "That changed while you were looking.", "Couldn't do that just now. Try again.", "Dismissed.", "Undo". |
| + |
| +### Task 1.20 (Base): Browser tests, phase 1 |
| + |
| +**Files:** `internal/browsertest/jobs_act_test.go` (new). |
| + |
| +- [ ] **Step 1: Tests:** `TestAskJobAnswerFromPill` (options, keyboard only), `TestAskJobSomethingElse` (field focus, Escape, send), `TestAskJobWordsShownAsText` (Review Focus 3: `<b>` and a Markdown link in words show literally in the receipt), `TestAskJobBuildTryAgainDrop` (note required; drop confirm), `TestAskJobDismissUndo` (8 s, fake clock), `TestAskJobStoppingStaysVisible`, `TestAskJobMovesToEnd`, `TestAskJobReceiptsAfterReload`, `TestAskJobFirstLookLinkOnWorkingPill`, `TestAskJobActConflictRedraws` (Review Focus 4), `TestAskJobPhoneSheet`, `TestAskJobScriptsOffEveryAction`, plus light and dark screenshots of asking, stopped and the job view. |
| +- [ ] **Step 2:** Run `go test -tags browser ./internal/browsertest -run 'TestAskJob' -timeout 20m -count=1`. Expected: PASS. |
| +- [ ] **Step 3:** Commit `Browser tests for acting on a job from the pill`. |
| + |
| +### Task 1.21 (Base, native): Pill actions in the Mac and iPhone app (PD10) |
| + |
| +**Files:** `native/apple/Sources/BaseKit/API/Models.swift` (`AskCard` gains ask, actions, receipts, decision parts, hidden, updatedAt), `API/Client.swift` (`act`), `Ask/AskModel.swift` (`act(card:action:…)`, key kept per revision until settled, 409 reloads `/ask/state`), `Ask/Pill.swift`, the job view, `Resources/Localizable.xcstrings`, `Tests/BaseKitTests/AskModelTests.swift`, `Tests/BaseSnapshots/AskSnapshots.swift`. |
| + |
| +- [ ] **Step 1: Failing tests:** `testActKeepsKeyUntilSettled`, `testActConflictReloads`, `testHiddenRemovesPillAndOffersUndo`, `testUnknownActionNotDrawn`. |
| +- [ ] **Step 2:** Run `make native-check`. Expected: FAIL on the new tests. |
| +- [ ] **Step 3:** Implement with the approved strings (same text as the web). |
| +- [ ] **Step 4:** Run `make native-check`; record snapshots asking, stopped, job view (Mac, iPhone, light, dark, AX3). Expected: PASS. |
| +- [ ] **Step 5:** Commit `Native: act on a job from the pill`. |
| + |
| +### Task 1.22 (Base): End to end, and phase 1 gates |
| + |
| +**Files:** `internal/e2e/handoff_test.go`. |
| + |
| +- [ ] **Step 1: Tests:** a question answered from Base goes on to work; an exploration answered Build it from Base makes the build; T13 Base half: Base new + Equipo old (fake without the act route and ignoring the header) keeps a working question path, placement included. |
| +- [ ] **Step 2:** Run `go test ./internal/e2e -count=1`, then Base `make ci` and `make browser`, Equipo `make ci`. Expected: PASS. |
| +- [ ] **Step 3:** Commit `Phase 1 of jobs that keep moving: end-to-end tests`. |
| + |
| +--- |
| + |
| +## Phase 2. Keep moving on its own |
| + |
| +### Task 2.0: Copy review, phase 2 |
| + |
| +- [ ] **Step 1:** Run `copy-review` over the register's "Phase 2" strings; write the approved text into the register. |
| + |
| +### Task 2.1 (Equipo): Protocol 31 for questions and merges |
| + |
| +**Files:** `internal/wire/runners.go`, `internal/wire/jobs_moving.go` (new: `downgradeJobsMoving`), `internal/wire/tasks.go` (reasons), `internal/wire/runners_test.go`. |
| + |
| +**Interfaces (Produces):** `ProtocolJobsMoving = Protocol31`; `ask_person` input gains `Open bool`, `About string` (`AboutTaste`|`AboutDecision`), `Default string` (one of the options); step reasons `ReasonMergeIdentity = "merge_identity"`, `ReasonMergeUncertain = "merge_uncertain"`; below 31, `Encode` drops `open`, `about`, `default` and says both reasons as `merge_failed`. |
| + |
| +- [ ] **Step 1: Failing tests:** `TestDowngradeJobsMoving`; `TestSpokenIs31`. |
| +- [ ] **Step 2:** Run `go test ./internal/wire -run 'JobsMoving|Spoken' -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement. |
| +- [ ] **Step 4:** Run. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Protocol 31: question kinds and merge fault reasons`. |
| + |
| +### Task 2.2 (Equipo, runner): `ask_person` fields from the Coordinator |
| + |
| +**Files:** `internal/runner/thin/mcp.go` (`ask_person` schema), `internal/runner/thin/claude.go` (job-lane guidance: mark taste questions, offer a default), `internal/equipo/chat/tools.go` (store `about`, `default_option`, `open_words` on the question card), `internal/equipo/migrations/0109_jobs_sweep.sql` (adds `chat_cards.about`, `chat_cards.default_option`, and Task 2.7's sweep table). |
| + |
| +- [ ] **Step 1: Failing tests:** `TestAskPersonAboutDefault` (instance: a `default` not among the options is refused; missing `about` is `decision`); runner `TestAskPersonSchemaJobsMoving`. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo/chat ./internal/runner/thin -run 'AskPerson' -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement. |
| +- [ ] **Step 4:** Run. Expected: PASS. |
| +- [ ] **Step 5:** Commit `ask_person says taste or decision, a default, and open words`. |
| + |
| +### Task 2.3 (Equipo, runner): Merge faults reported as such (PD11) |
| + |
| +**Files:** `internal/runner/thin/mergestep.go`, `internal/runner/thin/mergestep_test.go`, `internal/equipo/chat/job_stop.go`. |
| + |
| +`forge.ErrMergeRefused` before contacting the hub → `ReasonMergeIdentity` (or, if `honest-merge-refusals` has landed, its no-access reason, mapped to the same row); `ErrMergeUncertain` after the runner's retries → `ReasonMergeUncertain`. `stopView` adds `stopFault` rows: `merge_identity` and `merge_uncertain` → "Didn't go live", Try again (`retryMerge`), Drop it. |
| + |
| +- [ ] **Step 1: Failing tests:** runner `TestMergeStepFaultReasons`; instance `TestStopViewMergeFaults`. |
| +- [ ] **Step 2:** Run `go test ./internal/runner/thin ./internal/equipo/chat -run 'MergeStepFault|StopViewMergeFaults' -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement. |
| +- [ ] **Step 4:** Run. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Merge faults say whose they are; the person's Try again stays safe`. |
| + |
| +### Task 2.4 (Equipo): Taste gets a default; explore to build (K7) |
| + |
| +**Files:** `internal/equipo/chat/handoff.go` (`teamReply`), `internal/equipo/chat/team_reply_test.go`. |
| + |
| +`team_reply` gains `basis` (`conversation` | `default`); `default` refused `person_only` unless the question's `about` is `taste`; `team_reply` answers an open direction with `build`, or `again` with a note, bound to `decision`; `drop` refused; approvals `person_only`. Receipt for a default: "Went ahead with “{option}”."; for build: "Building it from the first look." |
| + |
| +- [ ] **Step 1: Failing test** `TestTeamReplyGuards` (T10, phase 2 half): `default` on `decision` refused; direction `build` and `again` accepted, `drop` refused; approvals refused. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run TestTeamReplyGuards -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement. |
| +- [ ] **Step 4:** Run. Expected: PASS. |
| +- [ ] **Step 5:** Commit `team_reply: defaults for taste, build from a first look`. |
| + |
| +### Task 2.5 (Equipo): `team_add` |
| + |
| +**Files:** `internal/equipo/chat/team_add.go` (new), `internal/equipo/chat/handoff.go` (ops list), `internal/equipo/chat/team_add_test.go`. |
| + |
| +`team_add{request, words, context}` posts the person's words (quoted from their Assistant messages, `team_request`'s check) into the job's thread; refused for a cancelled or stopping job. |
| + |
| +- [ ] **Step 1: Failing test** `TestTeamAdd` (T10): quotes this turn's words; refuses a cancelled job; refuses words the person never said. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run TestTeamAdd -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement. |
| +- [ ] **Step 4:** Run. Expected: PASS. |
| +- [ ] **Step 5:** Commit `team_add: follow-ups join their job`. |
| + |
| +### Task 2.6 (Equipo): Faults on our side, and the operator alert (K6, O8) |
| + |
| +**Files:** `internal/equipo/chat/job_stop.go`, `internal/equipo/chat/operator_alert.go` (new), `internal/equipo/chat/housekeeping_control.go` (owner digest line), tests in `job_stop_test.go`. |
| + |
| +Rows: `preview_scanner` with retries left → `working` "Retrying shortly"; retries used → `stopped`, Try again (`retryPreview`), Drop it. `merge_identity` and `preview_scanner` raise an operator alert: one operator log line (`operator alert`, kind, task id) and one line in the instance owner's next daily digest, once per task and kind. |
| + |
| +- [ ] **Step 1: Failing tests:** `TestStopViewPreviewFault`, `TestOperatorAlertOncePerTask`. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'PreviewFault|OperatorAlert' -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement. |
| +- [ ] **Step 4:** Run. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Faults on our side: retrying, then Try again; the owner hears once`. |
| + |
| +### Task 2.7 (Equipo): Sweep state and preview retries (K8 step 2) |
| + |
| +**Files:** `0109_jobs_sweep.sql` (`chat_job_sweeps` as the spec), `internal/equipo/chat/job_sweep.go`, `internal/equipo/chat/preview.go` (`retryPreview`), `internal/equipo/chat/job_sweep_test.go`. |
| + |
| +**Interfaces (Produces):** `func (t *txn) claimSweep(kind, id string, attempt int64, lease time.Duration) (sweepRow, bool, error)`; `func (t *txn) retryPreview(k *taskRecord, step stepRecord, attempt int64) error` (the same preview step's next attempt for its candidate, through `authorizePreview`, `previewRefusal` and the export digest); tries at 2, 10, 30 min; a newer candidate withdraws the retry. |
| + |
| +- [ ] **Step 1: Failing test** `TestSweepPreviewRetries` (T8): job 6's data (failed `preview_scanner`, then failed merge) gets the same preview step's next attempt at 2, 10, 30 minutes through `previewRefusal`; a newer candidate withdraws; the sweep never merges (`hkForbid("merge")` asserted); two overlapping ticks act once. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run TestSweepPreviewRetries -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement. |
| +- [ ] **Step 4:** Run. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Sweep retries a failed preview step, three times, never a merge`. |
| + |
| +### Task 2.8 (Equipo): Unanswered taste (K8 step 3) |
| + |
| +**Files:** `internal/equipo/chat/job_sweep.go`, `internal/equipo/chat/handoff.go` (`tellAssistant` exception), `internal/equipo/chat/tools.go` (`noteTasteUnanswered`), `internal/equipo/chat/job_sweep_test.go`. |
| + |
| +A `taste` question asking 2 h with no person action → one `team_update` with `noteTasteUnanswered` (claimed, capped: per question once; per person 6 per rolling 24 h counted from `assistant.job.sweep` audits; none in quiet hours in the person's zone). Still open at 24 h with a `default_option` → instance answers through `answerQuestion` at the decision's revision (`originGenerated`, audit `assistant.job.default`, receipt `went_ahead`). Never for `decision` questions or placement. `tellAssistant`'s housekeeping guard admits only `noteWordIt` and `noteTasteUnanswered` turns from the sweep. |
| + |
| +- [ ] **Step 1: Failing tests:** `TestSweepTaste` (T9): one turn at 2 h and none after; daily cap across ticks and a store reopen; 24 h default for `taste` with a default only; two overlapping ticks act once. `TestSweepTasteQuietHoursInZone` (Review Focus 5): person in Europe/Madrid with quiet 22–07; nothing at 23:00 local; cap identical across the March DST change. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestSweepTaste' -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement. |
| +- [ ] **Step 4:** Run. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Unanswered taste questions get a default, within caps and quiet hours`. |
| + |
| +### Task 2.9 (Equipo): Tell once (K8 table) |
| + |
| +**Files:** `internal/equipo/chat/handoff.go` (`tellAssistant`), `internal/equipo/chat/handoff_test.go`. |
| + |
| +- [ ] **Step 1: Failing test** `TestTellOnce` (T11): two changes in the same instant start one `team_update`; a second with the same digest within 5 s is not dispatched. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run TestTellOnce -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement. |
| +- [ ] **Step 4:** Run. Expected: PASS. |
| +- [ ] **Step 5:** Commit `One team update per change, not two`. |
| + |
| +### Task 2.10 (Equipo): `CardHome` on the pill |
| + |
| +**Files:** `internal/equipo/chat/job_ask.go`, `internal/equipo/chat/job_act.go`, `internal/equipo/chat/job_stop.go`. |
| + |
| +`CardHome` becomes an `AskApproval`-kind ask answered through `answerHome` (labels from project display names, instance context and recommendation); its K6 row leaves the Open-in-Equipo set. Other approvals stay on Equipo's pages. |
| + |
| +- [ ] **Step 1: Failing test** `TestJobActHome`; `TestJobNeverDeadEnds` updated. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestJobActHome|TestJobNeverDeadEnds' -count=1`. Expected: FAIL. |
| +- [ ] **Step 3:** Implement. |
| +- [ ] **Step 4:** Run. Expected: PASS. |
| +- [ ] **Step 5:** Commit `Where new work lives, answered from the pill`. |
| + |
| +### Task 2.11 (Equipo): O1, a new site from Base without "Where should this go?" |
| + |
| +**Files:** `internal/equipo/chat/placement_consent.go` (`createConsent`), `internal/equipo/chat/placement_test.go`. |
| + |
| +`createConsent` also accepts a hand-off's first message when it is the person's own words in the Assistant lane (`originComposer`, `team_request`'s quote check), named no existing project, and the proposed repository is the placement card's `new_repo`. |
| + |
| +- [ ] **Step 1: Failing test** `TestCreateConsentFromHandoff` (T3 extended): allowed in exactly that case; refused when the words name an existing project, when the repository differs, or when the words were not the person's. |
| +- [ ] **Step 2:** Run `go test ./internal/equipo/chat -run 'TestCreateConsent|Placement' -count=1`. Expected: FAIL on the new test. |
| +- [ ] **Step 3:** Implement. |
| +- [ ] **Step 4:** Run. Expected: PASS. |
| +- [ ] **Step 5:** Commit `O1: a new site from Base starts without asking where it goes`. |
| + |
| +### Task 2.12 (Equipo): Phase 2 notes |
| + |
| +**Files:** `internal/equipo/chat/tools.go`, `internal/equipo/chat/handoff.go`, `internal/equipo/chat/notes_test.go`. |
| + |
| +`jobsMovingPhase = 2`: `noteAnswerIt` gains the default clause, `noteDirection` the build clause, plus `noteFault`, `noteTasteUnanswered` and a `team_add` line. |
| + |
| +- [ ] **Step 1:** Extend `TestNotesByModeAndPhase` (T15) for phase 2; legacy unchanged. |
| +- [ ] **Step 2:** Run, implement, run. Expected: PASS. |
| +- [ ] **Step 3:** Equipo `make ci`. Commit `Phase 2 notes: defaults, build from a first look, faults`. |
| + |
| +--- |
| + |
| +## Phase 3. Something to see within two minutes |
| + |
| +### Task 3.0: Copy review, phase 3 |
| + |
| +- [ ] **Step 1:** Run `copy-review` over the register's "Phase 3" strings. |
| + |
| +### Task 3.1 (Equipo): Protocol 32 for the first look |
| + |
| +**Files:** `internal/wire/runners.go`, `internal/wire/first_look.go` (new), `internal/wire/runners_test.go`. |
| + |
| +`ProtocolFirstLook = Protocol32`: `record_task` gains `FirstLook bool`; a review dispatch gains `Mode string` (`"first_look"`); an Engineering dispatch gains `FirstLookNote string`. Below 32, `Encode` drops all three (`downgradeFirstLook`). |
| + |
| +- [ ] **Step 1–5:** `TestDowngradeFirstLook`, `TestSpokenIs32`; run `go test ./internal/wire -count=1`; implement; commit `Protocol 32: first look, its review mode and Engineering's note`. |
| + |
| +### Task 3.2 (Equipo): First look on the instance |
| + |
| +**Files:** `0110_first_look.sql` (`chat_tasks.first_look`), `internal/equipo/chat/tasks.go` (`record_task`), `internal/equipo/chat/review.go` (dispatch mode), `internal/equipo/chat/preview.go` (`schedulePreview` on first-look approval), `internal/equipo/chat/preview_security_test.go`. |
| + |
| +`first_look` honoured only in a job lane (instance-assigned marker); Engineering's dispatch gets the limits as `FirstLookNote` (one static page, plain HTML and CSS, no build step, one pass), never in the brief; review dispatched with mode `first_look`; `schedulePreview` runs on that approval; `buildThisOne`'s brief carries no first-look limits. |
| + |
| +- [ ] **Step 1: Failing test** `TestFirstLookReview` (T14): `preview_security_test.go`'s cases run under both review modes (changed candidate, revoked owner, public-host consent, unsafe-preview grant, digest mismatch, scanner failure); `first_look` set only by `record_task` in a job lane; the build's brief has no limits. |
| +- [ ] **Step 2–5:** Run `go test ./internal/equipo/chat -run 'TestFirstLookReview|PreviewSecurity' -count=1` (FAIL), implement, run (PASS), commit `First looks: short safety review, preview first, limits off the brief`. |
| + |
| +### Task 3.3 (Equipo, runner): Review mode and the Coordinator's job-lane rules (K13) |
| + |
| +**Files:** `internal/runner/thin/judge.go` (Review: safety only in `first_look` mode, no quality findings, no fix rounds), `internal/runner/thin/claude.go` (job lanes only: start a new site as `record_task` kind `explore` with `first_look: true`; never ask what sort of site first; mark later questions `about: taste`), `internal/runner/thin/claude_test.go`. |
| + |
| +- [ ] **Step 1: Failing tests:** `TestReviewFirstLookMode`; `TestJobLaneFirstLookLines` (job threads get the lines, Equipo's own conversations do not). |
| +- [ ] **Step 2–5:** Run `go test ./internal/runner/thin -run 'FirstLook' -count=1` (FAIL), implement, run (PASS), `make runner-host`, commit `Coordinator builds first in job threads; Review checks first looks for safety`. |
| + |
| +### Task 3.4 (Equipo): The first look on a working pill (K14) |
| + |
| +**Files:** `internal/equipo/chat/jobs.go` (`jobState`/`jobView`), `internal/equipo/chat/jobs.go` (`expirePreviews` covers `first_look` links on any state), tests. |
| + |
| +A followed exploration's live or held preview is attached to a `working` or `asking` card with rel `first_look`; the job view's detail names what is being made from `record_task`'s title ("Making a first look at {what}."). |
| + |
| +- [ ] **Step 1–5:** `TestFirstLookOnWorkingPill`, `TestFirstLookExpires`; run (FAIL), implement, run (PASS), commit `A first look shows on the pill while the work goes on`. |
| + |
| +### Task 3.5 (Base): First look drawn while working |
| + |
| +**Files:** `internal/browsertest/jobs_act_test.go`. |
| + |
| +Base keeps `first_look` links since Task 1.15; this task only proves the drawing on a working pill and in the job view, light and dark. |
| + |
| +- [ ] **Step 1–3:** `TestAskJobFirstLookWhileMaking`; run `go test -tags browser ./internal/browsertest -run TestAskJobFirstLook -timeout 20m -count=1`; commit. |
| + |
| +### Task 3.6: Two minutes on staging (T12) |
| + |
| +- [ ] **Step 1:** After deploy step 3, five runs of "make me a website about …" from Base on staging; time from message to a first look the person can open; each under 2 minutes. |
| +- [ ] **Step 2:** Record the five times, commits and dates in `docs/live-check.md`; commit `Live check: first look within two minutes, five runs`. |
| + |
| +--- |
| + |
| +## Phase 4. Tidy |
| + |
| +### Task 4.0: Copy review, phase 4 |
| + |
| +- [ ] **Step 1:** Run `copy-review` over the register's "Phase 4" strings. |
| + |
| +### Task 4.1 (Equipo): Finished jobs pinned for a week |
| + |
| +**Files:** `internal/equipo/chat/lane.go` (`withActiveJobs`), `internal/equipo/chat/lane_test.go`. |
| + |
| +`withActiveJobs` also pins `done` and dropped job cards whose `updated_at` is within 7 days, not dismissed. |
| + |
| +- [ ] **Step 1–5:** `TestFinishedPinnedSevenDays` (60 newer cards; the 6-day-old done job stays, the 8-day-old leaves); run, implement, run, commit `Finished jobs stay in the snapshot for a week`. |
| + |
| +### Task 4.2 (Equipo): Replace a repeated request (K10) |
| + |
| +**Files:** `0111_jobs_replace.sql` (`chat_handoffs.replaced_by`), `internal/equipo/chat/handoff.go` (`teamRequest`: `replaces` in, `similar` out), `internal/equipo/chat/job_ask.go` (`AskReplace`), `internal/equipo/chat/job_act.go` (`replace`, `keep`), tests. |
| + |
| +`replaces` allowed only while the old job is the person's, open, no followed task beyond `investigated` and no step dispatched or running; else `replaces_busy`. `replace` drops the old job (`dropJob`) and hides its card in one transaction bound to the old card's revision; `keep` clears the ask. Receipts `replaced_by` on the old, `replaces` on the new. `similar`: the person's open jobs whose titles read alike (same normalised words, at least half shared). |
| + |
| +- [ ] **Step 1: Failing test** `TestTeamRequestReplaces` (T10): offers the ask; drops only on the person's tap; `replaces_busy` past building; `keep` leaves both. |
| +- [ ] **Step 2–5:** run `go test ./internal/equipo/chat -run TestTeamRequestReplaces -count=1` (FAIL), implement, run (PASS), commit `Repeated requests offer to replace the earlier one`. |
| + |
| +### Task 4.3 (Equipo): Phase 4 notes |
| + |
| +`jobsMovingPhase = 4`: notes gain `replaces`. Extend `TestNotesByModeAndPhase`; Equipo `make ci`; commit `Phase 4 notes: replace a repeat`. |
| + |
| +### Task 4.4 (Base): Finished and Waiting on you rows |
| + |
| +**Files:** `internal/web/templates/partials/chat.html` (new `ask-fold`), `internal/web/ask.go`, `internal/look/static/ask.js`, `internal/look/static/app.css`, `internal/browsertest/jobs_fold_test.go` (new). |
| + |
| +A `done` job is a full pill for 24 h after `updated_at`, then drawn in the Finished row ("{n} finished", opening to them); `asking` or `stopped` jobs untouched 3 days fold into "Waiting on you ({n})", drawn above Finished and open when it has something new; the replace ask's actions "Replace it" / "Keep both". |
| + |
| +- [ ] **Step 1: Failing tests:** `TestAskJobFoldsFinished` (fake clock 24 h), `TestAskJobWaitingOnYou` (3 days), `TestAskJobReplaceAsk`, scripts-off variants. |
| +- [ ] **Step 2–5:** run `go test -tags browser ./internal/browsertest -run 'TestAskJob(Folds|Waiting|Replace)' -timeout 20m -count=1` (FAIL), implement, run (PASS), commit `Finished and waiting jobs fold into rows`. |
| + |
| +### Task 4.5 (Base, native): Fold rows in the app |
| + |
| +Mirror Task 4.4 in `Thread.swift`/`Pill.swift` and the Mac panel's `WaitingJobs` (count folded waiting jobs); snapshots; `make native-check`; commit `Native: finished and waiting rows`. |
| + |
| +### Task 4.6: Hand-off |
| + |
| +- [ ] **Step 1:** Full gates once: Equipo `make ci`; Base `make ci`, `make browser`, `make native-check`. |
| +- [ ] **Step 2:** Write the handoff (the `handoff` skill): what shipped per phase, deploy steps taken or pending, open points (PD11, O7, approvals in Base follow-up design). |
| + |
| +--- |
| + |
| +## Pending copy register |
| + |
| +DRAFT wording from the spec, for copy review before any code writes it. Keys are Equipo's for instance copy (shown in Base), or Base's file for Base strings; native uses the Base strings' approved text. |
| + |
| +### Phase 1 |
| + |
| +**Addendum (Equipo, already drafted on `cf0614ec`):** the 34 `decision.*` and `assistant.decision.*` strings in that commit's `internal/equipo/copy.go`, marked `COPY REVIEW PENDING` there. |
| + |
| +**Equipo instance copy, job asks (Tasks 1.5, 1.8, 1.11):** |
| +- `assistant.job.ask.place_existing` "Add to {project}" |
| +- `assistant.job.ask.place_new` "A new site" |
| +- `assistant.job.ask.place_context` "This is new work, so it needs a home." |
| +- `assistant.job.ask.place_why_new` "Nothing you have fits it." |
| +- `assistant.job.ask.place_why_existing` "It fits with {project}." |
| +- `assistant.job.status.first_look_ready` "First look ready"; ask "Here's a first look. What next?" |
| +- `assistant.job.status.making_first_look` "Making a first look" |
| +- `assistant.job.status.ready_to_decide` "Ready to decide"; ask "The first look can't be shown here. Build it anyway?"; ask (expired) "The first look has expired. Build it, or try again for a fresh one?" |
| +- `assistant.job.status.building_it` "Building it"; detail "Building the full version from your first look." |
| +- `assistant.job.link.first_look` "See the first look" |
| +- `assistant.decision.direction_context` "A first look at {title} is ready." |
| +- `assistant.decision.direction.why_build` "It looks right, so the full version can start." |
| +- `assistant.decision.direction.why_again` "There are changes worth another try." |
| +- `assistant.decision.direction.detail_build` "Makes the full version from this first look." |
| +- `assistant.decision.direction.detail_again` "Makes another first look from your note." |
| +- `assistant.decision.direction.detail_drop` "Stops here. Nothing more is made." |
| +- `assistant.job.ask.fallback` "One question about this job." |
| + |
| +**Equipo instance copy, stops (Task 1.6, 1.9):** |
| +- failed: "Stopped" / "Something went wrong while making it." |
| +- no_work: "Stopped" / "It didn't get started." |
| +- going_live merge: "Didn't go live" / "It's ready, but couldn't go live." |
| +- merge_uncertain (old rows): "Didn't go live" / "It's ready, but didn't go live. Trying again is safe." |
| +- publish_failed, no Publish open: "Didn't go live" / "It's finished, but the site didn't go live." |
| +- home (phase 1): "One question for you" / "Where should new work like this live?" |
| +- specialist: "Needs your OK" / "It needs your OK to bring in extra help." |
| +- research: "Needs your OK" / "It needs your OK to look things up first." |
| +- merge policy: "One question for you" / "It needs you to say how changes go live." |
| +- access: "Needs access" / "It needs access to where the work lives." |
| +- held: "Waiting" / "It's waiting on something before it can run." |
| +- conflict: "Stopped" / "Someone else changed the same thing." |
| +- review blocked, fix rounds: "Stopped" / "It couldn't be finished as it stands." |
| +- runner offline, machine removed (non-paused clients only, PD6): "Waiting for your computer" / "It carries on once your computer is back online." |
| +- mac sandbox: "Needs your Mac" / "It needs your OK to test it on your Mac." |
| +- dropped: "Dropped" / "You dropped this." |
| +- stopping: "Stopping" / "Stopping what's already under way." |
| +- cancelled, not by the person: "Stopped" / "It was stopped before it was finished." |
| + |
| +**Equipo receipts (Tasks 1.7 to 1.9):** "You chose “{option}”.", "You answered: “{words}”.", "You asked for another try: “{note}”.", "You chose to build it.", "Tried again.", "You dropped this." |
| + |
| +**Base (web and native) (Tasks 1.18, 1.19, 1.21):** "Something else", "Tell me what you'd like", "Send", "Build it", "Try again", "What should change?", "Drop it", "Drop this job?", "Drop this job too?", "Keep it", "Dismiss", "Dismissed.", "Undo", "Recommended", "That changed while you were looking.", "Couldn't do that just now. Try again." |
| + |
| +### Phase 2 |
| + |
| +- Equipo stops: preview fault retrying "Retrying shortly" / "Held up on our side. Trying again in a few minutes."; retries used "Stopped" / "Held up on our side. We've let the people who run Base know."; merge faults "Didn't go live" / "It's ready, but didn't go live. Trying again is safe." |
| +- Equipo receipts: "Went ahead with “{option}”.", "Building it from the first look." |
| +- Equipo `CardHome` context and why (Task 2.10): "Work like this needs a home." / "{project} is where similar work lives." |
| +- Equipo owner digest (O8, owner-facing in Equipo): "A job couldn't go live: no access to {repository}." and "Previews can't be checked on {computer}: the secret scanner is missing." |
| + |
| +### Phase 3 |
| + |
| +- Equipo: `assistant.job.detail.making_first_look` "Making a first look at {what}." (status "Making a first look" from phase 1). |
| + |
| +### Phase 4 |
| + |
| +- Equipo: replace ask "Replace your earlier request, “{title}”?"; receipts "Replaced by a newer request.", "Replaces an earlier request." |
| +- Base (web and native): "Replace it", "Keep both", "{n} finished", "Waiting on you ({n})". |