oficina / equipo Public

Plan 3: round 2 fixes (Astra); ready to build

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 4ebd0572e25e0ee394e141610a8f230dbf5f92e6 parent 7529fc5
1 file changed, +100 −151
  • docs/superpowers/plans/2026-11-04-equipo-plan-3-coordinator.md +100 −151

CI failed — run details

diff --git a/docs/superpowers/plans/2026-11-04-equipo-plan-3-coordinator.md b/docs/superpowers/plans/2026-11-04-equipo-plan-3-coordinator.md
index 6cffbf77..649e2151 100644
--- a/docs/superpowers/plans/2026-11-04-equipo-plan-3-coordinator.md
+++ b/docs/superpowers/plans/2026-11-04-equipo-plan-3-coordinator.md
@@ -1,14 +1,14 @@
# Equipo coordinator and conversation Implementation Plan
-> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. The dispatch brief takes precedence over generic execution workflows. This planning session authorizes no implementation, agents, provider runs, commits or pushes.
+> **For implementation:** Use superpowers:executing-plans task-by-task, subject to the dispatch brief. This planning session authorizes only plan edits.
-**Goal:** Let a person talk to their own coordinator, run a bug fix or feature through an editable plan, receive a sourced recommendation, and set up their own accounts, specialists and playbooks.
+**Goal:** Give each person a coordinator for editable bug/feature plans, sourced recommendations, and account/specialist/playbook setup.
-**Architecture:** The instance owns conversations, plans, authority and delivery. For each coordinator turn, the person's enrolled runner opens a fresh provider session seeded from the instance's bounded stored context and exposes only a scoped Equipo tool server. Conversation continuity belongs to the instance. Specialists, checks and publication continue through the fenced execution store, durable runner journal and Amadan publisher; HTML and the versioned person API call the same application operations.
+**Architecture:** The instance owns conversations, plans, authority and delivery. Each coordinator turn uses a fresh provider session with bounded instance context and scoped Equipo tools. Specialists, checks and publication use the fenced execution store, durable runner journal and Amadan publisher. HTML and the person API share application operations.
**Tech Stack:** Go 1.26.0 floor, gate toolchain go1.26.10, Rastrillo v0.30.1 from the pinned module cache, SQLite/GORM/chi, existing direct-launch provider adapters and bubblewrap 0.11.0. The current release targets Linux/amd64 runners and Linux/arm64 instances; provider pins are Claude Code 2.1.312 and Codex 0.165.0, subject to the completed Plan 2b review.
-**Spec:** `docs/superpowers/specs/2026-11-01-equipo-design.md`, revision 3, especially §§3–7 and 13; `docs/superpowers/plans/CODEX-BRIEF-plan-3.md`, as revised by `CODEX-BRIEF-plan-3-fixes-R1.md`; `docs/superpowers/plans/2026-11-01-equipo-roadmap.md`; `docs/mockups/README.md` and the seven mockups named in the brief.
+**Spec:** `docs/superpowers/specs/2026-11-01-equipo-design.md`, revision 3, especially §§3–7 and 13; `docs/superpowers/plans/CODEX-BRIEF-plan-3.md`, as revised by `CODEX-BRIEF-plan-3-fixes-R1.md` and `CODEX-BRIEF-plan-3-fixes-R2.md`; `docs/superpowers/plans/2026-11-01-equipo-roadmap.md`; `docs/mockups/README.md` and the seven mockups named in the brief.
## Global Constraints
@@ -24,30 +24,30 @@
- Use the day theme and sidebar shell. Link tokens.css and theme.css. Keep vendored static files byte-identical and put app styling in equipo.css. Use attribute grammar, token colors, scriptless forms and phone index navigation. No split screen, initials, coloured left-border accents or authentication bypass. Values and badges never wrap; secondary text truncates.
- An unknown count must remain unknown. Never turn a query error into zero. Unknown allowance, usage, delivery and containment remain unknown too.
- Builds use `CGO_ENABLED=0`. Keep host Go caches at their defaults, scratch under on-disk `$TMPDIR`, servers on `127.0.0.1`, and stop processes/remove scratch created by the task. No sudo. Provider calls and external publication are absent from ordinary tests.
-- Every implementation task runs its named tests red before implementation, green afterwards, then breaks each new guard separately, observes failure and restores it. Record commands, exit status, failed assertions and restoration in `docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md`. Commit only when the later implementation dispatch authorizes it; use the task's subject, fewer than 80 characters. No such commits occur while writing this plan.
+- Every implementation task runs its named tests red, implements, repeats the same command to PASS, then breaks each new guard separately, observes failure and restores it. Record commands, exit status, failed assertions and restoration in `docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md`. Commit only when the later implementation dispatch authorizes it; use the task's subject, fewer than 80 characters. No such commits occur while writing this plan.
## Review Focus
-1. Two tabs or a delayed phone answer race a plan edit, project correction or claim: only the current revision may change work, and started work keeps its identity (Tasks 2, 9, 10).
-2. A runner dies after a prompt/tool effect but before its acknowledgement: replay delivers recorded results once, never resends an uncertain prompt or grants new authority (Tasks 5–7).
-3. A teammate can see shared work but guesses another person's message, preference, login or notification ID: private data and credentials remain private, including live subscriptions (Tasks 1, 8–10, 17, 19).
-4. A template or model suggestion smuggles a shell tool, weaker review, new account or inferred preference into a plan: the same server-side constraints apply to all inputs (Tasks 3, 6, 12–14).
-5. Setup is interrupted, a provider has no supported device flow, or a remembered team is unreachable: show the actual pending/unavailable state without invented success, credentials on the instance or zero counts (Tasks 16–18).
+1. Plan edits, answers and claims race: current revisions govern changes; started work retains its identity (Tasks 2, 9, 10).
+2. Runner crashes replay recorded effects once; uncertain prompts are never resent automatically (Tasks 5–7).
+3. Private conversations, credentials and subscriptions remain private, while task threads stay shared (Tasks 1, 8–10, 17, 19).
+4. Model suggestions and templates cannot weaken tools, review, account consent or authority (Tasks 3, 6, 12–14).
+5. Interrupted setup, unsupported login and unreachable teams retain truthful pending/unavailable/unknown states (Tasks 16–18).
---
## Order, usable stops and dependencies
-There are **21 tasks**. Build **Plan 3a, Tasks 1–11**, then **Plan 3b, Tasks 12–21**, in this file. Each part has its own acceptance gate. In 3b, implement Tasks 12–18, then Task 20's device credentials and API operations, Task 19's device-bound subscriptions, and Task 21's complete contract/acceptance gate. Task 20 checks its own route set; Task 19 extends the contract test to notification routes. Task 21 requires coverage of the entire v1 contract.
+Build **Plan 3a, Tasks 1–11**, then **Plan 3b, Tasks 12–18, 20, 19, 21**. Each part has an acceptance gate. Task 20 supplies credentials before Task 19’s device-bound subscriptions; Task 21 requires the complete v1 contract.
-- **3a:** Paul, with an already enrolled and certified runner, can use the live conversation for a bug, a feature or a sourced recommendation; edit and approve plans; answer questions; follow task threads; inspect preferences; and use the first person API endpoints through the browser session. Native device credentials arrive in 3b, Task 20. Existing default specialists and manual connection setup suffice.
-- **3b:** Paul can accept an invite, pair a supported own-machine runner, connect accounts, choose templates, edit specialists/playbooks, navigate remembered teams and use the complete API and notification feed. The web app remains the usable client; no native app code or delivery through Apple/Google push services is included.
+- **3a:** With an enrolled, certified runner and manual connections, Paul can request bugs/features/recommendations, edit/approve plans, answer questions, follow threads and inspect preferences through web and browser-session API. Default specialists suffice.
+- **3b:** Add invites, runner/account setup, templates, editable specialists/playbooks, remembered teams, complete API and notifications. The client remains web; native apps and Apple/Google push delivery are excluded.
-The roadmap's row 4 remains later: coordinator settlement/deadlock, routing to other people's coordinators, the product-view Now/Next/Later ranking surface and CARLOS signals (platform #514). This brief brings sourced recommendations, model picks with reasons, templates and onboarding into row 3. Recommendations use project material and people's requests, not invented CARLOS telemetry. Hosted runners and provider cloud agents remain unavailable options.
+Later work remains coordinator settlement/deadlock and cross-person routing, product-view Now/Next/Later, CARLOS signals (platform #514), hosted runners and provider cloud agents. Plan 3 includes sourced recommendations from project material/requests, model picks with reasons, templates and onboarding.
### Baseline and Plan 2b review dependencies
-Original inspection used `a446956`; round 1 rechecked branch `plan-3` at `86852f1`, containing direct-launch work through `9cd5910` and design revision 3. These are existing interfaces, not proposed replacements:
+Reuse these existing interfaces:
| Existing seam | Reuse and change in Plan 3 |
| --- | --- |
@@ -60,18 +60,19 @@ Original inspection used `a446956`; round 1 rechecked branch `plan-3` at `86852f
| `forge.DescriptionTransport` and `NewDescriptionTransport` | Preserve production description write/readback and four-channel length-prefixed content hash; publication stays incomplete until exact head and description are confirmed. |
| `live.New`, `live.Hub`, `JobNotifier`, `observeWrite` | Extend post-commit invalidation to private conversation/preferences and recipient notifications. Preserve job topics and current membership checks. |
-Before Task 1 implementation, compare the completed Plan 2b branch with these seams and record changed signatures in the controller report. In particular, its final review may change native permission handling, tool provenance, session resume, account refresh, evidence attestation and release policy identity. Adapt the consumers, never resurrect retired trial or unconfined paths.
+Before Task 1, compare completed Plan 2b interfaces and record changes to permissions, provenance, sessions, account refresh, attestation and release policy identity in the controller report. Adapt consumers without restoring retired trial or unconfined paths.
-At this baseline `internal/release/manifest.json` has no certified tuples, and Plan 2b Task 11b's report says the live exercise driver is incomplete and describes an embedded-manifest/binary policy-digest cycle. These are **upstream live-use blockers**, not proof that the runner is certified. Offline Plan 3 implementation can proceed with fixtures. Both usable live stops require the completed Plan 2b release gate and certification of Plan 3's new coordinator/tool policies. Do not copy old certificates to changed policies.
+Plan 2b has upstream live-use blockers: empty release certificates, an incomplete live exercise driver and an embedded-manifest/binary policy-digest cycle. Offline work may use fixtures. Both live stops require the completed 2b release gate and new coordinator/tool-policy certification; old certificates cannot cover changed policies.
-Two further boundaries are explicit. Bubblewrap does not provide a Mac runner; this plan's executable install lane targets the current Linux/amd64 release. A Mac containment implementation needs a separate design and certification, not a shell fallback. Installed `codex login --help` advertises `--device-auth`; installed `claude auth login --help` advertises browser/subscription/console/SSO options, without a device-code switch. That observation is not a supported Claude device protocol. The controller has settled both choices: Linux first, Mac runner shown as "coming later", and Claude official browser sign-in into a dedicated home. On a headless runner the person pastes the returned code at that runner's terminal; the code never passes through the instance. Tasks 17 and 21 require this path and its tests. A missing official login capability still fails closed.
+**Supported setup ruling:** The executable runner lane is Linux/amd64; Mac runner is shown as "coming later" without a launch action. A Mac client may use a Linux runner. Mac containment needs separate design and certification. Codex uses supported device auth; Claude uses official browser sign-in into a dedicated Equipo home. On a headless runner the person opens the official link on another device and pastes the returned code only at the runner terminal, never through the instance. Missing official login capability fails closed. Tasks 16, 17 and 21 implement and test this ruling.
## File structure and shared contracts
-Put new features in the named packages below. Existing `internal/equipo` methods remain thin composition adapters; the interface names in the tasks describe that application facade, not permission to put their implementations in the root package. Feature packages must not import `equipo`: inject narrow transaction-bound roster, authority, audit, copy-key lookup and execution callbacks. The root owns the database and HTTP shell. Each write, including replay, rechecks current authority and passes the same transaction to feature operations and the core. No second database, scheduler or budget ledger is introduced.
+Use the packages below; `internal/equipo` remains the database/HTTP composition root with thin facade methods. Features cannot import `equipo`; inject transaction-bound roster, authority, audit, copy-key and execution callbacks. Every write, including replay, rechecks authority and shares one transaction with the core. No second database, scheduler or budget ledger.
| Responsibility | Files introduced or extended |
| --- | --- |
+| Shared application types and mutation contract | `internal/equipo/kernel/{types,mutation,budget_test}.go`; root aliases preserve existing facade signatures |
| Conversation, cards, threads, preferences, coordinator records | `internal/equipo/conversation/{models,store,threads,views,handlers,preferences,live,coordinator,tools,context}.go`; app-owned templates `conversation.html`, `thread.html`, `conversation_card.html`, `preferences.html` |
| Plans, selections and evidence | `internal/taskplan/{types,validate,evidence}.go` for pure rules; `internal/equipo/planning/{plans,dispatch,handlers,approval_settings,rendered_approval,execution,selection}.go` for application operations; minimal transaction/graph/evidence hooks in existing `team` files |
| Coordinator and runner workflow | `internal/coordinator/{types,runtime,tools,recovery}.go`; `internal/runner/planflow/{types,workflow,prompt}.go` with injected runner services and no import of `runner`; `internal/runnerproto/coordinator.go`; thin wiring in runner runtime/service and existing journal, proxy and provider policy files |
@@ -81,40 +82,19 @@ Put new features in the named packages below. Existing `internal/equipo` methods
| Notification preparation | `internal/equipo/notifications/{models,outbox,api}.go`; recipient feed, expiring subscription records and acknowledgements; no external push adapter |
| New integration, browser and acceptance tests | `internal/plan3test/*_test.go`, with its own fixture harness, budget `TestMain` and time budget; existing `internal/equipotest` remains the regression suite |
-Every new Go package gets `budget_test.go` with `budget.Main`. Add these literal records to `.rastrillo/budgets.txt` as each package is introduced; source/test ceilings are lines per directory. The 10s limits retain the default. The 300s integration ceiling matches the existing integration allowance as an initial cap, to be measured at Tasks 11 and 21. Do not raise existing ceilings to fit new features.
+Every new Go package gets `budget_test.go` with `budget.Main`. Rastrillo rejects records that restate defaults: new packages inherit 5,000 source lines, 8,000 test lines and 10s without entries. Add only this integration exception, measuring it at Tasks 11 and 21:
```text
-size internal/taskplan 5000 8000 Pure plan and evidence validation, Task 2.
-time internal/taskplan 10s Bounded pure validation tests.
-size internal/coordinator 5000 8000 Coordinator orchestration and tools, Tasks 6-7.
-time internal/coordinator 10s Bounded orchestration tests with injected IO.
-size internal/equipo/conversation 5000 8000 Conversations, preferences and coordinator records, Tasks 1 and 5-9.
-time internal/equipo/conversation 10s Feature unit tests; integration is in plan3test.
-size internal/equipo/planning 5000 8000 Plan operations and selection, Tasks 2-4 and 14.
-time internal/equipo/planning 10s Feature unit tests; integration is in plan3test.
-size internal/equipo/library 5000 8000 Specialists, templates and playbooks, Tasks 12-13.
-time internal/equipo/library 10s Feature unit tests; integration is in plan3test.
-size internal/equipo/setup 5000 8000 Invitations, onboarding and Teams links, Tasks 15-18.
-time internal/equipo/setup 10s Feature unit tests; integration is in plan3test.
-size internal/equipo/personapi 5000 8000 Versioned person projections, auth and routes, Tasks 10 and 20.
-time internal/equipo/personapi 10s Contract unit tests; HTTP integration is in plan3test.
-size internal/equipo/notifications 5000 8000 Recipient outbox and subscriptions, Task 19.
-time internal/equipo/notifications 10s Feature unit tests; integration is in plan3test.
-size internal/runner/planflow 5000 8000 Persisted-plan workflow with injected runner services, Task 4.
-time internal/runner/planflow 10s Workflow unit tests; Git and process integration is in plan3test.
-size internal/runner/setup 5000 8000 User install and local login drivers, Tasks 16-17.
-time internal/runner/setup 10s Setup unit tests; process integration is in plan3test.
-size internal/plan3test 5000 8000 New HTTP, browser, runner and acceptance fixtures for Plan 3.
time internal/plan3test 300s Initial cap for combined browser and runner acceptance; measure at both usable stops.
```
-Task 1 establishes the integration harness. Tasks 2–5 run `make budget` after adding their core hooks; if the existing `team`, `equipo` or `runner` package would exceed its current ceiling, move pure validation/workflow logic into the named packages first and retain only transaction-sensitive primitives in the core. Check the complete directory counts, not just each new file. Browser tests in Tasks 9/18 and acceptance tests in Tasks 11/21 belong to `internal/plan3test`; fixture-backed real launcher continuity tests also run there under its time allowance.
+Task 1 establishes the integration harness. Tasks 2–5 run `make budget` after core hooks. Keep pure validation/workflow in the named packages and count whole directories. Allow measured raises for `internal/runner` and `internal/equipo/team`: expected new source totals are about 8,500 and 9,500 lines respectively, planning estimates rather than measurements. Update existing exception records in their current style with actual source/test totals, measured test time where relevant, the new ceiling and reasons for retained journal/proxy or transaction/schema hooks. Do not add default-valued records. Keep `internal/equipo` within its existing ceiling through extraction. Browser tests in Tasks 9/18, acceptance in Tasks 11/21 and real-launcher fixture continuity belong in `internal/plan3test`.
Migrations follow implementation order: 0019 conversation (Task 1), 0020 plans (2), 0021 coordinator (5), 0022 preferences (8), 0023 person API request metadata (10), 0024 specialist library (12), 0025 playbooks (13), 0026 connection modes (14), 0027 invitations (15), 0028 onboarding (16), 0029 team links (18), 0030 person device credentials (20), 0031 notifications (19). Register feature-owned model lists in the root `Models` and update `migrations/schema.sql` and upgrade tests. Framework session/auth/proof tables stay in `BootSchema`; person-device rows here are application-owned. Re-number only if the final 2b review adds migrations.
For 0021, app-owned `coordinator_bindings`, `coordinator_turns` and `coordinator_questions` belong to `conversation`, `Models` and the app migration. Versioned `coordinator_limits` belong to the execution core: declare them in `team/store.go`'s schema and ordered upgrade chain (baseline `SchemaVersion = 7`; assign the next version after Task 2/3 core changes), mirror them in `execution_models.go`, and include identical DDL in 0021 and the schema snapshot. Test both standalone core upgrade and app upgrade followed by core open/reopen. The core period queries read these limits in the existing reservation transaction. No duplicate app limit table or second counter. Apply the same schema ownership rule to any new core graph/evidence columns; JSON-only fields do not change the core schema version.
-The following contracts are shared, and each is implemented by its named task:
+Shared contracts by implementing task:
- Task 1: `Mutation{RequestID string; Revision int64}`. Revisions start at 1. IDs are opaque strings; timestamps are UTC. A repeated request ID with identical canonical input returns its saved result; changed input conflicts. Key scope includes authenticated principal, operation and resource. Authorization is rechecked even on replay.
- Task 1: `Message{ID, ConversationID, ThreadID, AuthorKind, AuthorID, Body string; Sequence, Revision int64; CreatedAt time.Time}`, `Card{ID, Kind, ResourceID string; Revision int64}`, and `ConversationPage{Messages []Message; Cards []Card; NextCursor string; Revision int64}`. Cards reference authoritative resources; they never contain permission authority.
@@ -125,14 +105,16 @@ The following contracts are shared, and each is implemented by its named task:
### Task 1: Persist the private conversation and shared task threads
-**Files:** Create `internal/equipo/conversation/{models,store,threads,budget_test}.go`, `internal/plan3test/{harness,budget}_test.go`, `internal/plan3test/conversation_test.go`, migration `0019_conversation.sql`; modify models, schema snapshot and migration tests.
+**Files:** Create `internal/equipo/kernel/{types,mutation,budget_test}.go`, `internal/equipo/conversation/{models,store,threads,budget_test}.go`, `internal/plan3test/{harness,budget}_test.go`, `internal/plan3test/conversation_test.go`, migration `0019_conversation.sql`; modify models, schema snapshot and migration tests.
+
+**Shared kernel:** Task 1 defines `Actor` and `Mutation` in `internal/equipo/kernel`, with root aliases for compatibility. Feature packages import this package for shared types and receive transaction-bound authority/audit callbacks; the kernel imports no feature or root `equipo` package and owns no database.
**Interfaces:** `Store.Conversation(ctx context.Context, actor Actor, cursor string, limit int) (ConversationPage,error)`; `Store.SendMessage(ctx context.Context, actor Actor, threadID, body string, m Mutation) (Message,error)`; `Store.TaskThread(ctx context.Context, actor Actor, taskID string, cursor string, limit int) (ConversationPage,error)`. Main conversation is unique by team/person; task thread is unique by task. Messages use monotonic per-conversation/thread sequences and explicit `person`, `coordinator`, `system` attribution. `RouteMessage(ctx context.Context, actor Actor, messageID, taskID string, m Mutation) (Message,error)` atomically places the reply in its task thread and leaves a reference notice in the main conversation.
- [ ] **Tests first:** `TestConversationPrivateAndThreadShared` denies another member's main conversation, source messages and IDs, while allowing active members to read a team's task thread. `TestConversationMessageReplay` asserts one message/outbox entry for duplicate sends, conflict for changed body and rollback on audit failure. `TestConversationRouteOnce` asserts one automatic thread, one routed reply and one main notice after retry; an unrelated task/team or already-routed different target conflicts. `TestConversationPageBounds` checks 1–100 items, stable cursor order during concurrent inserts, escaped HTML, valid UTF-8 and 16 KiB body limit.
- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test -run '^TestConversation' -count=1`; expect missing operations or failed assertions.
- [ ] **Implement:** Main conversation and preferences are person-private even from other team owners. Task threads are shared team records; routing deliberately copies only the selected message into shared work, never the person's history. Keep source provenance private. Create the thread with each task, including a lazy idempotent backfill for old tasks. Messages about existing tasks require current task visibility and the sender's own coordinator; another person's active task cannot receive new execution instructions in Plan 3. Distinguish ordinary thread discussion from commands that change a task.
-- [ ] **Green and guard mutations:** Repeat the command; require PASS. Bypass person scope, replay hash, audit transaction or route uniqueness independently; observe failures and restore. Run `make migration-check`.
+- [ ] **Green and guard mutations:** Bypass person scope, replay hash, audit transaction or route uniqueness independently; observe failures and restore. Run `make migration-check`.
- [ ] **Implementation commit:** `feat: persist conversations and automatic task threads`.
### Task 2: Add revisioned plans, approval settings and atomic graph edits
@@ -144,9 +126,9 @@ The following contracts are shared, and each is implemented by its named task:
Core adds `PlanChange{Append, Replace []StepSpec; Cancel []string; Order []string}` and `team.Store.EditUnstarted(ctx context.Context, scope Scope, expectedRevision int64, change PlanChange) (Job,error)`. `ApprovalMode` is `immediate` or `required`; `Store.SetProjectApproval(ctx context.Context, actor Actor, projectID int64, mode ApprovalMode, m Mutation) error` is owner-only, and `Store.SetApprovalOverride(ctx context.Context, actor Actor, projectID int64, mode *ApprovalMode, m Mutation) error` changes only the person's override. Nil inherits. Default is immediate; precedence is person override, project, immediate.
- [ ] **Tests first:** `TestPlanRequiredSteps` rejects deletion/renaming/substitution of review, checks or final person, duplicate keys, cycles and publication before evidence. `TestPlanEditClaimRace` makes an edit and claim race; exactly one revision wins, with no partial core/card/audit change. `TestPlanStartedImmutable` rejects reorder, instruction/model/account changes to started or finished steps and changes to their dependencies. `TestPlanApprovalPrecedence` covers defaults, inheritance, two tabs and switching to required before dispatch. `TestPlanProjectCorrection` rebinds an unstarted task and clears picks/preparation/approval; after any execution starts, keeps the old target, cancels safely and offers an explicitly linked replacement rather than retargeting a workspace.
-- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/taskplan ./internal/equipo/team ./internal/plan3test -run '^TestPlan' -count=1`; expect failure.
+- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/taskplan ./internal/equipo/team ./internal/plan3test -run '^TestPlan' -count=1`.
- [ ] **Implement:** For a new proposal, accept an empty task ID and revision 0, allocate the task/thread/card IDs on the server and return revision 1; every edit requires the current positive revision. Create the task, plan, thread, card and dispatch-outbox entry atomically. Store an append-only revision history with actor and changed step keys. Validate and mutate app/core rows through `Execution.atomic`; `EditUnstarted` uses the bound core transaction and current grant. Cancellation marks unstarted steps cancelled, never erases evidence. Recompute pending dependencies and guard review/checks after every candidate-producing step. Keep final person outside runner execution; publication produces a review branch and a human wait. Require current work authority, model constraints and budgets when approving and dispatching. An automatic start is the person's configured policy acting on a validated proposal, not a coordinator approval. Investigation starts with bounded read-only scope and a person checkpoint; any later publication is a new validated revision with all three mandatory steps. Plans retain the existing `team.MaxSteps = 16` limit, including hidden execution steps. Add/replace/reorder may affect only unstarted steps; instruction-only edits still increment the app and core revision in the same transaction. Persist task kind, current plan revision and approval revision, rather than deriving them from displayed text.
-- [ ] **Green and guard mutations:** Repeat; expect PASS. Remove each invariant, revision fence and approval recheck separately; require a failing named test. Test upgrade from existing bug tasks using `BugPlan` as the history-preserving seed; run `make migration-check`.
+- [ ] **Green and guard mutations:** Remove each invariant, revision fence and approval recheck separately; require a failing named test. Test upgrade from existing bug tasks using `BugPlan` as the history-preserving seed; run `make migration-check`.
- [ ] **Implementation commit:** `feat: add guarded plan revisions and approval settings`.
### Task 3: Define feature, rendered-change and read-only completion contracts
@@ -158,9 +140,9 @@ Core adds `PlanChange{Append, Replace []StepSpec; Cancel []string; Order []strin
For read-only research add `TargetProjectRead` with project repository/base but no write ref; an empty evidence predicate is valid **only** for that target with research steps, and `CompleteReadWork(ctx context.Context, scope Scope, h Handle, answer ArtifactSpec) error` records the bounded sourced answer. There is no fabricated recommendation evidence predicate. Task 4 makes delivery to the conversation part of completion.
- [ ] **Tests first:** `TestFeatureFreezeBeforeBuild` requires acceptance from the scope attempt frozen by hash before candidate work, rejects replacement and late freeze, and denies build admission before freezing/base failure. `TestFeatureExactCandidateEvidence` requires trusted base-fail/candidate-pass acceptance, nonzero test counts, repository checks and distinct-family review on the exact candidate. `TestRenderedChangeApproval` requires checks, review and the current project copy/design decision owner's approval bound to the exact candidate and base-to-candidate diff, with a trusted render as a review aid. Deny a requester, unrelated member or team owner who does not hold that decision; reject a forged render, wrong candidate/diff, changed ownership or stale decision revision. `TestRenderedChangeEditAfterApproval` edits the candidate after review, checks and rendered approval, then proves publication is blocked until fresh independent review, checks, executor render and owner approval all bind to the new candidate/diff. Replaying any old evidence must fail even when the resulting pixels are identical. `TestReadWorkNoPublication` allows sourced answers with one provider, rejects missing/forged source refs and all publish/edit operations. `TestEvidenceKindsPreserveBug` retains frozen bug and historical reconciliation behavior.
-- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/equipo/team ./internal/plan3test -run 'TestFeature|TestRenderedChange|TestReadWork|TestEvidenceKinds' -count=1`; expect failure.
+- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/equipo/team ./internal/plan3test -run 'TestFeature|TestRenderedChange|TestReadWork|TestEvidenceKinds' -count=1`.
- [ ] **Implement:** Reuse trusted check attestations and immutable blob storage, never model-reported pass/fail. Keep acceptance tests outside workspaces and pass them by hash to the executor. All contributing builder families must differ from Review; if that is impossible, wait for a person to revise the plan. Read-only grants allow current members to inspect shared projects, but cannot authorize code changes through `bugAuthority` or forge publication. Recommendations and investigation checkpoints are delivery contracts; they do not require review/checks/merge or a second family. The trusted executor checks out the exact immutable candidate and renders it under the check containment policy. It records an attestation binding repository/base, candidate hash, diff hash, render hash and rendering recipe/environment. A specialist may request rendering but cannot supply a trusted screenshot or attest it. The approval UI presents the candidate diff and its attested render; the owner approves the candidate diff, using the render as an aid. Copy/design publication requires the decision-owner approval described above; Plan 4 routing is not needed to display a shared pending approval.
-- [ ] **Green and guard mutations:** Repeat; require PASS. Mutate freeze timing/hash, executor provenance, candidate subject, family comparison, decision-owner checks, render provenance and read-only target restrictions independently. For `TestRenderedChangeEditAfterApproval`, separately retain stale review, stale checks and stale rendered approval and observe each guard fail before restoring it.
+- [ ] **Green and guard mutations:** Mutate freeze timing/hash, executor provenance, candidate subject, family comparison, decision-owner checks, render provenance and read-only target restrictions independently. For `TestRenderedChangeEditAfterApproval`, separately retain stale review, stale checks and stale rendered approval and observe each guard fail before restoring it.
- [ ] **Implementation commit:** `feat: add feature evidence and sourced read-only results`.
### Task 4: Execute the persisted plan through the current runner
@@ -169,26 +151,26 @@ For read-only research add `TargetProjectRead` with project repository/base but
**Interfaces:** `PlanJobSpec(task Task, project Project, p taskplan.Plan, policy team.Policy) (team.JobSpec,error)`; `runnerproto.StepBrief{PlanRevision int64; StepKey, SpecialistKey, Action string; SpecialistRevision int64; ArtifactHashes []string}` carried by `RunnerBrief`; `runner.NewPlanWorkflow(c BugWorkflowConfig) (*PlanWorkflow,error)` and `PlanWorkflow.Run(ctx context.Context, s *Supervisor, claim RunClaim) error`. Preserve `NewBugWorkflow` as a compatibility wrapper. Add scoped specialist tools `submit_acceptance`, `submit_answer`, `submit_render`, with strict payloads from Task 3 and no publication/check attestation verbs. `submit_render` requests trusted executor rendering for a captured candidate; any model-supplied render bytes or claimed attestation are refused.
-- [ ] **Tests first:** `TestPlanWorkflowFeature` runs scope, frozen base failure, build, review, checks, publication/readback and human wait with fake providers and real local Git/checks. `TestPlanWorkflowRecommendation` delivers answer and sources once, creates no ref or mutable checkout and invokes neither publisher nor checks. `TestPlanWorkflowInvestigation` stops at its checkpoint and requires an explicit new plan revision to build. `TestPlanWorkflowSpecialistOrder` runs Copy/Design/Engineering/custom-compatible actions in persisted order with real step progress and actual selections. `TestPlanWorkflowConnectionPreference` proves a different eligible personal connection is chosen when available, and with only the coordinator connection eligible the specialist and coordinator never overlap the home lease, the coordinator displays waiting, and it continues after release without redispatching either turn. `TestPlanWorkflowNoMidStepSwitch` rejects account, policy or plan changes after dispatch; cancellation waits for namespace proofs. `TestPlanWorkflowProviderPolicies` exercises both real policy constructors and launchers with recorded process/RPC fixtures for scope, research, candidate building, Copy, Design and Review; assert the exact native/MCP inventory, action mapping, read-only constraints, unknown-action refusal and broker validation before approval. No live providers run in this test.
-- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/runner/... ./internal/plan3test -run '^TestPlanWorkflow' -count=1`; expect failure.
-- [ ] **Implement:** Replace `specialistFor` and `runtime_direct.go`'s reproduce/implement/review map with immutable step action/capability snapshots. In `claude/launcher.go`, change `nativeTools` and the hard-coded MCP allowlist for the new actions; in `codex/launcher.go`, change the corresponding MCP allowlist and action-specific filesystem/tool/thread/turn policy. Keep both permission brokers bound to the exact permitted tool name and arguments. Map scope to acceptance submission, research to answer submission, builders to candidate submission and Review to review submission; candidate builders may request trusted rendering. Research and scope read project material without a writable checkout; Copy/Design building gets only its certified candidate-writing profile. Unknown actions fail closed. Keep coordinator inventories separate in Task 6. Hash every new effective policy and add certification cases for both providers; offline fixtures establish construction, while Task 11's separately authorized release certification must cover each new executable profile before dispatch is enabled. Compose additional candidate-producing stages with captured immutable candidate artifacts; Review sees candidate material, never builder dialogue. Preserve the same-runner evidence/workspace requirement until an explicit cross-runner artifact transport exists. Split builder and reviewer selection so one-family recommendations can start, while publication waits for an eligible independent reviewer. A queued feature can scope with one family; it cannot claim review or advertise publish readiness without the second. Capture source snapshots by hash from the read-only checkout at its exact revision and from authorized project/request records; register those snapshots before accepting `SourceRef` values. A URL supplied by the model is not an observed source. No CARLOS data fetch is added. Record answer delivery/card/thread changes atomically with read-work completion; a crash between artifact upload and delivery replays the delivery, not the provider turn. Preserve production Amadan readback after a lost write reply.
-- [ ] **Green and guard mutations:** Repeat; expect PASS. Break action mapping, frozen artifact handoff, answer-delivery uniqueness, immutable selection and no-publish research; observe failure. Run existing `TestDirectBugWorkflow` and `TestPublishDescriptionRecovery` with `-count=1` in their original runner/forge packages as regression guards. Run `make budget`; do not silently inherit an old policy certificate for a changed inventory.
+- [ ] **Tests first:** `TestPlanWorkflowFeature` runs scope, frozen base failure, build, review, checks, publication/readback and human wait with fake providers and real local Git/checks. `TestPlanWorkflowRecommendation` delivers answer and sources once, creates no ref or mutable checkout and invokes neither publisher nor checks. `TestPlanWorkflowInvestigation` stops at its checkpoint and requires an explicit new plan revision to build. `TestPlanWorkflowSpecialistOrder` runs Copy/Design/Engineering/custom-compatible actions in persisted order with real step progress and actual selections. `TestPlanWorkflowConnectionPreference` proves a different eligible personal connection is chosen when available. Shared-home coordinator waiting is tested in Task 7, after its runtime exists. `TestPlanWorkflowNoMidStepSwitch` rejects account, policy or plan changes after dispatch; cancellation waits for namespace proofs. `TestPlanWorkflowProviderPolicies` exercises both real policy constructors and launchers with recorded process/RPC fixtures for scope, research, candidate building, Copy, Design and Review; assert the exact native/MCP inventory, action mapping, read-only constraints, unknown-action refusal and broker validation before approval. No live providers run in this test.
+- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/runner/... ./internal/plan3test -run '^TestPlanWorkflow' -count=1`.
+- [ ] **Implement:** Replace `specialistFor` and `runtime_direct.go`'s reproduce/implement/review map with immutable step action/capability snapshots. In `claude/launcher.go`, change `nativeTools` and the hard-coded MCP allowlist for the new actions; in `codex/launcher.go`, change the corresponding MCP allowlist and action-specific filesystem/tool/thread/turn policy. Keep both permission brokers bound to the exact permitted tool name and arguments. Map scope to acceptance submission, research to answer submission, builders to candidate submission and Review to review submission; candidate builders may request trusted rendering. Research and scope read project material without a writable checkout; Copy/Design building gets only its certified candidate-writing profile. Unknown actions fail closed. Keep coordinator inventories separate in Task 6. Hash each new policy and add both providers’ certification cases. Task 11’s authorized live certification must cover every new executable profile before dispatch. Compose additional candidate-producing stages with captured immutable candidate artifacts; Review sees candidate material, never builder dialogue. Preserve the same-runner evidence/workspace requirement until an explicit cross-runner artifact transport exists. Select builders/reviewers separately: recommendations and feature scope can start with one family; review and publish readiness require an eligible independent reviewer. Register hashed source snapshots from the exact read-only checkout revision or authorized project/request records before accepting `SourceRef`. Model URLs cannot attest sources; no CARLOS fetch. Record answer delivery/card/thread changes atomically with read-work completion; a crash between artifact upload and delivery replays the delivery, not the provider turn. Preserve production Amadan readback after a lost write reply.
+- [ ] **Green and guard mutations:** Break action mapping, frozen artifact handoff, answer-delivery uniqueness, immutable selection and no-publish research; observe failure. Run existing `TestDirectBugWorkflow` and `TestPublishDescriptionRecovery` with `-count=1` in their original runner/forge packages as regression guards. Run `make budget`; do not silently inherit an old policy certificate for a changed inventory.
- [ ] **Implementation commit:** `feat: execute revisioned plans with the direct runner`.
### Task 5: Give coordinator turns fenced authority and accounted admission
**Files:** Create `internal/equipo/conversation/{coordinator,coordinator_api}.go`, `internal/runnerproto/coordinator.go`, core admission/period-budget hooks in the existing `team` files, tests, `0021_coordinator.sql`; modify runner API routing, core budget/period queries, authority, policy and model/schema mirrors.
-**Interfaces:** `CoordinatorBinding{ID, Person, RunnerID, ConnectionID string; Revision, Generation int64}`; `CoordinatorTurn{ID, MessageID, RequestID, ProviderSessionID, ContextHash string; Generation, Revision int64; State string}`; `CoordinatorClaim{Binding CoordinatorBinding; Turn CoordinatorTurn; Scope team.Scope; Handle team.Handle; Brief runnerproto.RunnerBrief}`. Add `Execution.ClaimCoordinator(ctx context.Context, p RunnerPrincipal, turnID string, revision int64) (CoordinatorClaim,error)` and `Execution.CompleteCoordinator(ctx context.Context, p RunnerPrincipal, claim CoordinatorClaim, event runnerproto.Event) error`. Runner protocol exposes separate coordinator poll/claim/renew/event/containment operations under `/api/runner/v2/coordinator`, with capability negotiation; old v2 runners cannot receive them.
+**Interfaces:** `CoordinatorBinding{ID, Person, RunnerID, ConnectionID string; Revision, Generation int64}`; `CoordinatorTurn{ID, MessageID, RequestID, ProviderSessionID, ContextHash string; Generation, Revision int64; State string}`; `CoordinatorClaim{Binding CoordinatorBinding; Turn CoordinatorTurn; Scope team.Scope; Handle team.Handle; Brief runnerproto.RunnerBrief; Context CoordinatorContext}`. Add `Execution.ClaimCoordinator(ctx context.Context, p RunnerPrincipal, turnID string, revision int64) (CoordinatorClaim,error)` and `Execution.CompleteCoordinator(ctx context.Context, p RunnerPrincipal, claim CoordinatorClaim, event runnerproto.Event) error`. Runner protocol exposes separate coordinator poll/claim/renew/event/containment operations under `/api/runner/v2/coordinator`, with capability negotiation; old v2 runners cannot receive them.
-Declare these three structures in `internal/runnerproto/coordinator.go`; Equipo aliases them rather than making the runner import the application. Add `Store.SaveCoordinatorBinding(ctx context.Context, actor Actor, runnerID, connectionID string, m Mutation) (CoordinatorBinding,error)`, `Store.ResetCoordinator(ctx context.Context, actor Actor, m Mutation) (CoordinatorBinding,error)` and `Store.RetryCoordinatorTurn(ctx context.Context, actor Actor, turnID string, m Mutation) (CoordinatorTurn,error)`. No submitted person or session ID is accepted. Reset/rebind first fences and contains active work, then increments generation; retry creates a new admitted turn only after uncertainty and containment are recorded. A process-completed event alone cannot prove all tool effects/delivery committed.
+Declare these structures and Task 7’s `CoordinatorContext` wire types in `internal/runnerproto/coordinator.go`; Equipo aliases them rather than making the runner import the application. Add `Store.SaveCoordinatorBinding(ctx context.Context, actor Actor, runnerID, connectionID string, m Mutation) (CoordinatorBinding,error)`, `Store.ResetCoordinator(ctx context.Context, actor Actor, m Mutation) (CoordinatorBinding,error)` and `Store.RetryCoordinatorTurn(ctx context.Context, actor Actor, turnID string, m Mutation) (CoordinatorTurn,error)`. No submitted person or session ID is accepted. Reset/rebind first fences and contains active work, then increments generation; retry creates a new admitted turn only after uncertainty and containment are recorded. A process-completed event alone cannot prove all tool effects/delivery committed.
Core adds `TargetConversation`, `CapCoordinate`, and `CoordinatorGrantRef(person string) string`. This target accepts an empty evidence predicate only with coordinate steps and no repository/ref; completion means the admitted turn and its recorded results were durably delivered, never completion of the lifelong conversation. These are team-only model-call authority, never repository authority. A coordinator turn uses an ordinary fenced job/attempt with `Project=0` only for this target. Extend core budget accounting so its reservation, call/time/token usage and unknown exposure count against the **same team ceiling** and a configured per-person coordinator limit. Normal project jobs still require `Project>0` and a configured project budget. Add the core-owned versioned coordinator-limit rows and their app model/schema mirror in 0021 as assigned in the schema ownership section; include them in the same period reservation/exposure queries as team work, with no default grant of unlimited budget. `Store.SetCoordinatorLimits(ctx context.Context, actor Actor, person string, limits team.Limits, m Mutation) error` is owner-only; absent limits deny dispatch.
- [ ] **Tests first:** `TestCoordinatorSingleWriter` races two runners/tabs and admits one turn per person/team, preserving message order. `TestCoordinatorAuthorityRevoked` covers roster removal, role/connection change, generation mismatch, failed lookup and revoked runner before claim/renew/tool use. `TestCoordinatorBudgetSharesTeam` races project and coordinator admission against the last reservation and permits only one; uncertain/cancelled turns remain charged. `TestCoordinatorNoProjectBudgetBypass` refuses `Project=0` for ordinary jobs and refuses forge operations under conversation authority. `TestCoordinatorTurnReplay` returns one admission for duplicate request and rejects changed message/binding.
-- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/equipo/team ./internal/plan3test -run '^TestCoordinator(Single|Authority|Budget|NoProject|Turn)' -count=1`; expect failure.
-- [ ] **Implement:** Reuse the core ledger, admission and period-budget transaction; do not add a separate accounting counter that can overspend concurrently. Serialize queued messages, pause when no personal connection/runner is available and never borrow another person's subscription. A project-specific turn also checks that project's provider restrictions before any project material enters the prompt; general turns receive only permitted project labels, not restricted repository context. The coordinator's connection is explicitly selected by its person. Task 4 applies Task 14's connection preference rule from the 3a stop: choose a different eligible personal connection for a specialist step when allowed by the current explicit pin/ask choice; otherwise serialize the shared home and persist the coordinator turn's visible waiting state. Do not hold a coordinator lease while waiting for specialist completion. Audit coordinator effects as `coordinator:<binding ID>`, with a separate delegating person field, not as a person write.
-- [ ] **Green and guard mutations:** Repeat; expect PASS. Break uniqueness, generation/fence, current membership, shared budget reservation and target restriction independently; test period rollover, overflow and unknown usage. Run `make migration-check`.
+- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/equipo/team ./internal/plan3test -run '^TestCoordinator(Single|Authority|Budget|NoProject|Turn)' -count=1`.
+- [ ] **Implement:** Reuse the core ledger, admission and period-budget transaction; do not add a separate accounting counter that can overspend concurrently. Serialize queued messages, pause when no personal connection/runner is available and never borrow another person's subscription. A project-specific turn also checks that project's provider restrictions before any project material enters the prompt; general turns receive only permitted project labels, not restricted repository context. The coordinator's connection is explicitly selected by its person. Task 4 applies Task 14's connection preference rule from the 3a stop: choose a different eligible personal connection for a specialist step when allowed by the current explicit pin/ask choice; otherwise Task 7 serializes the shared home and persists the coordinator turn’s visible waiting state. Do not hold a coordinator lease while waiting for specialist completion. Audit coordinator effects as `coordinator:<binding ID>`, with a separate delegating person field, not as a person write.
+- [ ] **Green and guard mutations:** Break uniqueness, generation/fence, current membership, shared budget reservation and target restriction independently; test period rollover, overflow and unknown usage. Run `make migration-check`.
- [ ] **Implementation commit:** `feat: admit coordinator turns with person-bound authority`.
### Task 6: Expose only structured coordinator tools
@@ -204,24 +186,24 @@ Exact tools: `read_project(project_id)`, `read_task(task_id)`, `propose_plan(mes
Define `ClarificationQuestion{ID, MessageID, TurnID, Prompt, State string; Options []QuestionOption; Revision, Generation int64; ExpiresAt time.Time}` and `QuestionOption{ID, Label string}` in the coordinator wire types; store them in 0021’s coordinator question table. `Store.AnswerClarification(ctx context.Context, actor Actor, id, optionID, text string, m Mutation) error` accepts one declared option or bounded free text, once. A clarification may outlive a cleanly completed coordinator turn: its answer queues a new admitted turn. It is invalid after reset, replacement or its 24-hour expiry. It does not reuse runner-native permission authority or keep an idle model process alive.
- [ ] **Tests first:** `TestCoordinatorToolAllowlist` denies shell, arbitrary file/network, create-specialist/playbook, publication, approval, account selection changes and settlement tools; prose resembling a tool call has no effect. `TestCoordinatorToolScope` rejects other-person messages, unauthorized project content, wrong turn/fence and replay with changed arguments. `TestCoordinatorProjectInference` accepts a valid inferred project with visible attribution; ambiguity creates one question and no task, and correction uses Task 2's guarded path. `TestCoordinatorSuggestionOnly` proves suggestion tools create no specialist/playbook/preference confirmation. `TestCoordinatorToolCommitCrash` replays the original result after lost acknowledgement, including task, card, thread and audit IDs.
-- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/coordinator ./internal/runner ./internal/plan3test -run '^TestCoordinator(Tool|Project|Suggestion)' -count=1`; expect failure.
+- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/coordinator ./internal/runner ./internal/plan3test -run '^TestCoordinator(Tool|Project|Suggestion)' -count=1`.
- [ ] **Implement:** Separate coordinator endpoint capabilities from task-attempt tools. Claude's coordinator has an empty built-in tool inventory and only Equipo MCP tools; Codex likewise has no shell/file/search/browser tools for this policy. Hash the exact inventory and certify it. No repository checkout is mounted into a coordinator. Validate a proposal's project/work authority and policy using the current delegated person inside the transaction, and retain the coordinator attribution. Never interpret natural-language output as a plan, answer, preference or action. Provider assistant text may be displayed as escaped commentary, but success/cards depend on tools and trusted events. Scope read results and redaction before they leave the instance.
-- [ ] **Green and guard mutations:** Repeat; require PASS. Remove allowlist/schema/scope/replay guards and enable prose parsing separately; observe failure. Recheck both providers' broker-validation-before-approval tests.
+- [ ] **Green and guard mutations:** Remove allowlist/schema/scope/replay guards and enable prose parsing separately; observe failure. Recheck both providers' broker-validation-before-approval tests.
- [ ] **Implementation commit:** `feat: add the scoped coordinator tool server`.
### Task 7: Start fresh coordinator turns from durable conversation context
-**Files:** Create `internal/coordinator/{runtime,recovery,runtime_test,recovery_test}.go`, `internal/equipo/conversation/context.go`, `internal/plan3test/coordinator_continuity_test.go`; modify runner `service.go`, `runtime_direct.go`, journal/capture/recovery files and provider fixture tests.
+**Files:** Create `internal/coordinator/{runtime,recovery,runtime_test,recovery_test}.go`, `internal/equipo/conversation/context.go`, `internal/plan3test/coordinator_continuity_test.go`; modify runner `service.go`, `runtime_direct.go`, journal/capture/recovery files, `turn_prompt.go` for purpose-specific prompt validation, and provider fixture tests.
-**Interfaces:** `coordinator.Config{Launcher provider.Launcher; Tools ToolClient; OpenLaunch func(context.Context, runnerproto.CoordinatorClaim) (provider.Launch,error); Record func(context.Context, provider.Event) error}`; `coordinator.New(Config) (*Runtime,error)`; `Runtime.RunTurn(context.Context, runnerproto.CoordinatorClaim) error`; `Runtime.Stop(context.Context) error`. Add `CoordinatorContext{ConversationID, Hash string; Revision int64; Recent []MessageRef; ConfirmedDecisions, ConfirmedPreferences []ContextRef; Retrieved []ContextRef}` to the neutral wire types. `Store.CoordinatorContext(ctx context.Context, claim CoordinatorClaim) (CoordinatorContext,error)` builds an authorized snapshot inside the claim path. Define `MessageRef{ID, AuthorKind, Body string; Sequence, Revision int64}` and `ContextRef{Source SourceRef; Text string}` in the wire contract; retrieved text uses `[]ContextRef` as well. Source hashes/revisions bind all text to the instance snapshot. Confirmed decisions come from explicit person approvals/answers and confirmed preference records, never an unconfirmed model summary. Task 8 supplies persisted confirmed preferences; until then the production list is empty, never inferred. Task 7 tests context assembly with a fixture instance context source; Task 8 reruns continuity using the real preference operations so Task 7 does not depend on an unimplemented table.
+**Interfaces:** `coordinator.Config{Launcher provider.Launcher; Tools ToolClient; OpenLaunch func(context.Context, runnerproto.CoordinatorClaim) (provider.Launch,error); Record func(context.Context, provider.Event) error}`; `coordinator.New(Config) (*Runtime,error)`; `Runtime.RunTurn(context.Context, runnerproto.CoordinatorClaim) error`; `Runtime.Stop(context.Context) error`. Use Task 5’s declared `CoordinatorContext{ConversationID, Hash string; Revision int64; Recent []MessageRef; ConfirmedDecisions, ConfirmedPreferences []ContextRef; Retrieved []ContextRef}` in the neutral wire types. `Store.CoordinatorContext(ctx context.Context, claim CoordinatorClaim) (CoordinatorContext,error)` builds an authorized snapshot inside the claim path and returns it in `CoordinatorClaim.Context`; `Turn.ContextHash` must match that snapshot. Define `MessageRef{ID, AuthorKind, Body string; Sequence, Revision int64}` and `ContextRef{Source SourceRef; Text string}` in the wire contract; retrieved text uses `[]ContextRef` as well. Source hashes/revisions bind all text to the instance snapshot. Confirmed decisions come from explicit person approvals/answers and confirmed preference records, never an unconfirmed model summary. Task 8 supplies persisted confirmed preferences; until then the production list is empty, never inferred. Task 7 tests context assembly with a fixture instance context source; Task 8 reruns continuity using the real preference operations so Task 7 does not depend on an unimplemented table.
-The runner supplies namespace ownership, admission, capture and account leases. Hold the per-home lease for a whole active turn, including token refresh and containment, then release it. Task 14 prefers another eligible personal connection for specialist work. When the shared home is occupied, persist and display the coordinator's waiting state before acquiring the lease; no provider call starts while waiting.
+The runner supplies namespace ownership, admission, capture and account leases. Hold the per-home lease for a whole active turn, including token refresh and containment, then release it. Task 14 prefers another eligible personal connection for specialist work. When the shared home is occupied, persist the blocking task ID and display `waiting for <task>` on the coordinator card, linked to that task, before acquiring the lease. This is pending copy; no provider call starts while waiting.
-- [ ] **Tests first:** `TestCoordinatorSessionContinuity` uses the real `claude.Launcher` and `codex.Launcher` with recorded process/RPC fixtures through the runner service. Complete turn one, close its namespace and `AccountLease`, assert the lease runtime/config directories are gone, close/reopen the journal and restart the runner with new launcher instances and empty session maps. Turn two has a new provider session ID and empty `ResumeSessionID`, while keeping the same instance conversation ID. Assert Claude uses `--session-id` without `--resume`, and Codex opens a new `thread/start`; no resume of the previous turn's thread is requested. The second prompt contains the bounded recent window, current confirmed decisions/preferences and scoped source refs from the instance. Change the fixture context between turns to remove a preference and revoke source access, and prove the stale material is absent. Task 8 repeats this through real preference edit/delete operations. `TestCoordinatorContextBounds` checks message-count/text limits, source scope and deterministic context hashes. `TestCoordinatorCrashNeverRedispatches` crashes before/after durable intent, stdin, tool commit, frame commit and server ACK; only completed results replay, uncertain turns wait for the person. `TestCoordinatorFreshTurnRevalidates` denies changed identity, policy, provider/model or revoked connection; same-identity credential refresh requires fresh preflight. `TestCoordinatorStopContains` waits for every namespace and endpoint, retains unknown usage and rejects late answers. `TestCoordinatorUsageOnce` covers per-session accounting, duplicate final events and missing usage across fresh sessions and runner restarts.
-- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/coordinator ./internal/runner ./internal/runner/provider/... ./internal/plan3test -run '^TestCoordinator(Session|Context|Crash|Fresh|Stop|Usage)' -count=1`; expect failure.
-- [ ] **Implement:** Each admitted coordinator turn opens a fresh provider session with `ResumeSessionID` empty. Seed it from the instance's stored conversation: at most the latest 50 messages within 32 KiB, plus current person-confirmed decisions/preferences and scoped retrieval within a total 64 KiB context envelope. Preserve source IDs/revisions and record the context hash before prompting. If required instructions exceed the envelope, return a visible unavailable/context-limit state instead of dropping rules or widening authority. Retrieve only records the current person and selected provider may see; respect team rules and project provider restrictions. Prior assistant text is attributed history, never a confirmed decision. The binding identifies the person and conversation; session IDs are per-turn observations only. No dependency on lease-local session files, launcher session maps or provider history survives a turn boundary. Do not preserve disposable runtime homes to manufacture continuity.
+- [ ] **Tests first:** `TestCoordinatorSessionContinuity` drives real Claude/Codex launchers with recorded fixtures through the runner service. After turn one, close its namespace/lease, assert runtime/config removal, reopen the journal and restart with new launchers and empty session maps. Turn two retains the conversation ID but has a fresh provider ID and empty `ResumeSessionID`: Claude uses `--session-id` without `--resume`; Codex uses `thread/start`. Assert the next prompt contains bounded recent history, current confirmed decisions/preferences and scoped sources. Remove a fixture preference and revoke source access between turns; neither survives. Task 8 repeats with real preference edits/deletes. `TestCoordinatorContextBounds` checks the claim snapshot/hash, deterministic trimming, source scope, message-count limits, and raw/JSON-escaped prompt sizes at the cap and frame boundary. A long conversation of 16 KiB messages still produces turns by trimming older history; required instructions and confirmed decisions remain. Only oversized required content yields context-limit. `TestCoordinatorConnectionWaiting` owns the shared-home half of Task 4’s connection test: with only the coordinator connection eligible, specialist and coordinator never overlap the lease, the waiting card names/links the blocking task, and the coordinator continues after release without redispatching either turn. `TestCoordinatorCrashNeverRedispatches` crashes before/after durable intent, stdin, tool commit, frame commit and server ACK; only completed results replay, uncertain turns wait for the person. `TestCoordinatorFreshTurnRevalidates` denies changed identity, policy, provider/model or revoked connection; same-identity credential refresh requires fresh preflight. `TestCoordinatorStopContains` waits for every namespace and endpoint, retains unknown usage and rejects late answers. `TestCoordinatorUsageOnce` covers per-session accounting, duplicate final events and missing usage across fresh sessions and runner restarts.
+- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/coordinator ./internal/runner ./internal/runner/provider/... ./internal/plan3test -run '^TestCoordinator(Session|Context|ConnectionWaiting|Crash|Fresh|Stop|Usage)' -count=1`.
+- [ ] **Implement:** Each admitted coordinator turn opens a fresh provider session with `ResumeSessionID` empty. Seed it from `claim.Context`. Give coordinator prompts their own `maxCoordinatorPromptBytes = 48 << 10` cap, separate from the specialist 24 KiB cap. For the complete prompt, including instructions and context framing, require both `len(prompt) <= maxCoordinatorPromptBytes` and `len(json.Marshal(prompt)) + 8192 < provider.MaxFrameBytes`, using the turn-intent path’s 8 KiB margin. Apply the coordinator-specific check at context assembly, durable intent and dispatch; do not pass it through the specialist-only cap. Required instructions include team rules and confirmed preferences; retain them and confirmed decisions intact. Bound the recent window to 50 messages/32 KiB, drop optional retrieval as needed, then trim recent messages oldest-first until both serialized limits fit. Return context-limit only if required instructions and confirmed decisions alone exceed either limit. Preserve source IDs/revisions and hash the final trimmed snapshot before prompting. Retrieve only records the current person and selected provider may see; respect team rules and project provider restrictions. Prior assistant text is attributed history, never a confirmed decision. Bindings identify person/conversation; provider IDs are per-turn observations. Never preserve disposable homes or depend on launcher maps/provider history across turns.
- [ ] Attach events before `StartTurn`; each turn gets a new bounded attempt and namespace. After a clean boundary, close and contain the process before closing the account lease. Runner death or incomplete output never automatically resends the uncertain turn, even into a fresh session. Reconcile recorded effects and retain the unknown charge; an explicit retry creates a new admission and new context snapshot. Reset or connection change fences old work and increments generation before any new turn. Keep task-provider resume behavior unchanged where independently supported; this fresh-session requirement applies to coordinators.
-- [ ] **Green and guard mutations:** Repeat; expect PASS. Substitute a prior session ID, depend on deleted lease files or old launcher state, include a deleted/unconfirmed preference, bypass source scope, move durable barriers, resend uncertain prompts, ignore generation or reuse another session's usage baseline separately; require named failures and restore. Add journal upgrade/reopen tests without provider runs. Codex may revalidate its newly created thread within a turn using its existing RPC contract; that is not cross-turn coordinator resume.
+- [ ] **Green and guard mutations:** Substitute a prior session ID, depend on deleted lease files or old launcher state, include a deleted/unconfirmed preference, bypass source scope or prompt/frame caps, disable oldest-first trimming or shared-home waiting, move durable barriers, resend uncertain prompts, ignore generation or reuse another session's usage baseline separately; require named failures and restore. Add journal upgrade/reopen tests without provider runs. Codex may revalidate its newly created thread within a turn using its existing RPC contract; that is not cross-turn coordinator resume.
- [ ] **Implementation commit:** `feat: seed fresh coordinator turns from stored conversation context`.
### Task 8: Make preferences inspectable and non-authoritative
@@ -233,9 +215,9 @@ The runner supplies namespace ownership, admission, capture and account leases.
Also add typed `PersonalSettings{Landing string; Revision int64}` and `Store.SavePersonalSettings(ctx context.Context, actor Actor, in PersonalSettings, m Mutation) (PersonalSettings,error)`. Landing allows `conversation` or `work`, defaults to `conversation`, and is stored separately from learned prose preferences in 0022. A model cannot change it by inferring a preference.
- [ ] **Tests first:** `TestPreferencesConfirmedOnly` verifies prompts/plan decisions use confirmed entries only, and an inference cannot turn itself into confirmation. `TestPreferencesSourcePrivacy` denies cross-person source links, guesses and coordinator-supplied confirmation. `TestPreferencesCorrectionAndDelete` checks revisions, tombstone provenance, deletion from future prompts and invalidation of cached context. Rerun `TestCoordinatorSessionContinuity` with the persisted preference source, editing/deleting a preference between runner restarts and proving it is absent from the next fresh session prompt. `TestPreferencesCannotGrantAuthority` tries to approve, spend, select another person's account or override team rules with preference text; each fails.
-- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test ./internal/coordinator -run '^TestPreferences|^TestCoordinatorSessionContinuity$' -count=1`; expect failure.
+- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test ./internal/coordinator -run '^TestPreferences|^TestCoordinatorSessionContinuity$' -count=1`.
- [ ] **Implement:** Show status, source and correct/delete/confirm forms. A direct personal edit is confirmed; a coordinator suggestion remains inferred until a person confirms it. Rebuild instruction context on the next turn and include source IDs/revisions; do not allow a stale session memory to drive decisions after deletion. All effectful operations recheck current policy independent of prompt content. Do not rewrite historical task instructions that already ran.
-- [ ] **Green and guard mutations:** Repeat; require PASS. Break source scope, confirmation origin, deletion refresh and policy precedence separately; run `make migration-check`.
+- [ ] **Green and guard mutations:** Break source scope, confirmation origin, deletion refresh and policy precedence separately; run `make migration-check`.
- [ ] **Implementation commit:** `feat: add sourced and correctable personal preferences`.
### Task 9: Build the live conversation, plan editor and question cards
@@ -247,22 +229,22 @@ Also add typed `PersonalSettings{Landing string; Revision int64}` and `Store.Sav
Add GET/POST `/settings/coordinator` for Task 5’s own binding/reset and owner-only coordinator limits; expose missing budget configuration as a setup state. Add POST `/conversation/questions/{id}/answer` for Task 6 clarification cards. The plan page has project approval and personal override forms backed by Task 2; these settings are usable in 3a, before the complete 3b settings API.
- [ ] **Tests first:** `TestConversationScriptless` posts a message, edits/reorders only unstarted steps, corrects a project and answers a card without JavaScript. `TestConversationNoProjectPicker` checks the composer lacks a project selector, chosen project is on the card, and ambiguity has one-tap options. `TestConversationLivePrivacy` denies another person's subscription, stops access after roster removal and emits nothing on rollback. `TestConversationQuestionRace` sends stale, expired, cancelled and duplicate answers and proves only one current answer can reach the original provider request. `TestConversationLayout` uses existing chromedp fixtures at phone/desktop widths and enlarged text: no split screen, initials, coloured left accents, wrapping values or lost keyboard focus.
-- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test -run '^TestConversation(Scriptless|NoProject|Live|Question|Layout)' -count=1`; expect failure.
-- [ ] **Implement:** Use Rastrillo v0.30.1 `live.New` topics, `live.Hub` notifications and existing fragment rendering. Continue scriptless POST/redirect/get; live updates invalidate card regions after commit, never replace a composer draft or move focus. Preserve the hibernating/no-hub fallback and serve initial snapshots correctly before any event. Cards show plan revision, project correction action, playbook when present, picks/reasons, actual step progress and current approval state. Route task replies with a short reference line. Coordinator clarification questions have their own persisted card lifetime; runner permissions keep the existing attempt/fence/expiry rules and original request. Free text never substitutes for a native permission response. Add a thread link from task, Journey and specialist pages.
-- [ ] **Green and guard mutations:** Repeat; require PASS. Break private topic authorization, post-commit ordering, revision checks and layout constraints; restore. Run existing vendored-assets and live-gate tests.
+- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test -run '^TestConversation(Scriptless|NoProject|Live|Question|Layout)' -count=1`.
+- [ ] **Implement:** Use Rastrillo v0.30.1 `live.New` topics, `live.Hub` notifications and existing fragment rendering. Continue scriptless POST/redirect/get; live updates invalidate card regions after commit, never replace a composer draft or move focus. Preserve the hibernating/no-hub fallback and serve initial snapshots correctly before any event. Cards show plan revision, project correction action, playbook, picks/reasons, actual step progress and approval state. The coordinator waiting card names and links Task 7’s blocking task; test this in `TestConversationScriptless`. Route task replies with a short reference line. Coordinator clarification questions have their own persisted card lifetime; runner permissions keep the existing attempt/fence/expiry rules and original request. Free text never substitutes for a native permission response. Add a thread link from task, Journey and specialist pages.
+- [ ] **Green and guard mutations:** Break private topic authorization, post-commit ordering, revision checks and layout constraints; restore. Run existing vendored-assets and live-gate tests.
- [ ] **Implementation commit:** `feat: add live conversation cards and task discussions`.
### Task 10: Establish the versioned person API and explicit CSRF dispatcher
**Files:** Create `internal/equipo/personapi/{types,validate,validate_test,budget_test,handler,auth,conversation}.go`, `internal/plan3test/person_api_test.go`, `docs/api/equipo-v1.openapi.json`, `0023_person_api_requests.sql`; modify `app.go`, auth/session revocation integration and copy keys. Reuse Plan 2b's CSRF dispatcher if its fix lands first; otherwise this task owns it.
-**Interfaces:** `Store.PersonAPIHandler() http.Handler` mounted at `/api/v1`; `PersonPrincipal{Address, CredentialID string; SessionEpoch int64}` comes only from a verified identity. In 3a, person requests use the browser session. Define an injectable `VerifyPersonBearer(context.Context, string) (PersonPrincipal,error)` seam for Task 20; the production 3a implementation denies all native tokens. Device challenge creation, approval, exchange and credential storage are owned by Task 20 in 3b. Task 10 tests the native lane with a deterministic verifier fixture, without claiming that 3a ships native sign-in.
+**Interfaces:** `Store.PersonAPIHandler() http.Handler` mounted at `/api/v1`; `PersonPrincipal{Address, CredentialID string; SessionEpoch int64}` comes only from a verified identity. In 3a, person requests use the browser session. Define injectable `VerifyPersonBearer(context.Context, string) (PersonPrincipal,error)`: 3a production denies native tokens; tests use a deterministic verifier. Task 20 owns production native credentials and their challenge/approval/exchange flow.
- [ ] **Tests first:** `TestPersonAPIAuthAudiences` rejects runner, cleanup, coordinator and other-instance tokens, mixed cookie/bearer auth and forged person fields. `TestPersonAPIBrowserCSRF` uses the real app constructor and outer HTTP handler, not only `RunnerHandler` or `PersonAPIHandler`. Valid runner bearer POSTs and fixture-verified native person bearer POSTs reach their mutations without Origin, Referer or Fetch Metadata; cross-origin cookie POSTs fail before any write. Same-origin cookie writes succeed. Missing/invalid bearer and cookie-plus-bearer fail even when the request supplies same-origin headers; bearer on a cookie-only route also fails. Exercise registered runner cleanup credentials only on their existing cleanup lane. `TestPersonAPIRevisionReplay` asserts required `If-Match`, conflict on stale revision, duplicate result replay and changed-body conflict across browser/API. `TestPersonAPIConversationParity` checks private reads, task-thread visibility, cards and answers match HTML operations. `TestPersonAPIPeopleReadOnly` gives active members safe roster projections and denies writes or inactive-member reads.
-- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/equipo/personapi ./internal/plan3test -run '^TestPersonAPI' -count=1`; expect failure.
+- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/equipo/personapi ./internal/plan3test -run '^TestPersonAPI' -count=1`.
- [ ] **Implement:** Replace `app.go`'s global `a.Use(csrf.Protect(...))` with an explicit route/auth dispatcher. Cookie routes, including person API browser requests, pass through `csrf.Protect`/`csrf.SameOrigin`. Registered runner APIs go directly to their existing credential validators with cookies rejected; registered native person API routes require Task 20's person verifier and reject cookies before bypassing CSRF. Neither bearer lane passes through an outer browser-only CSRF wrapper. Public runner enrolment creation/token exchange retain their narrowly registered proof/rate-limited handlers; Task 20 adds separate person challenge/exchange handlers later. Never exempt all `/api` or trust the mere presence of an Authorization header. Keep framework sign-in/session handling and deny credentialed cross-origin access. API failures return JSON, not sign-in HTML.
- [ ] Implement the 3a API rows using shared application operations, including read-only `GET /people` for current members. Return address/display identity, active state and team role only, with no preferences, connection secrets or credential fields. Store API request/replay metadata in 0023 using Task 1's canonical mutation rules. Owner roster/budget mutation endpoints arrive in Task 20.
-- [ ] **Green and guard mutations:** Repeat; expect PASS. Restore the old global wrapper to prove the real-handler bearer tests fail; remove cookie protection to prove cross-origin writes fail the test; bypass audience, mixed-auth, current-roster and revision checks separately. Validate implemented 3a OpenAPI operations against route tests and run `make migration-check`. When depending on the upstream fix, record its revision and run these same app-level regressions here.
+- [ ] **Green and guard mutations:** Restore the old global wrapper to prove the real-handler bearer tests fail; remove cookie protection to prove cross-origin writes fail the test; bypass audience, mixed-auth, current-roster and revision checks separately. Validate implemented 3a OpenAPI operations against route tests and run `make migration-check`. When depending on the upstream fix, record its revision and run these same app-level regressions here.
- [ ] **Implementation commit:** `feat: expose person API v1 through explicit auth and CSRF lanes`.
### Task 11: Prove and package the 3a usable stop
@@ -288,9 +270,9 @@ Add GET/POST `/settings/coordinator` for Task 5’s own binding/reset and owner-
Define `TemplateDiff{From, To TemplateRef; CurrentRevision int64; Old, Current, Suggested map[string]json.RawMessage}`. Applying it requires the current specialist/playbook revision and explicit selected fields; later catalog changes cannot silently alter the accepted diff.
- [ ] **Tests first:** `TestSpecialistLibraryCopies` installs two independent editable copies with template origin/version; changing a shipped template does not mutate either. `TestSpecialistRequiredDefaults` refuses Engineering/Review deletion or conversion away from their required roles. `TestSpecialistToolPolicy` refuses arbitrary commands, provider tools outside the certified catalog and a claimed tool set broader than project/team permission. `TestSpecialistScopeAndPermissions` allows active people to create team specialists, restricts edits/deletion to creator or owner, rejects other teams and preserves started snapshots. `TestSpecialistTemplateGroups` asserts all named templates and blank template exist with icon/name display.
-- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test ./internal/runner/provider/... -run '^TestSpecialist(Library|Required|Tool|Scope|Template)' -count=1`; expect failure.
+- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test ./internal/runner/provider/... -run '^TestSpecialist(Library|Required|Tool|Scope|Template)' -count=1`.
- [ ] **Implement:** Preserve owner control of team rules and existing defaults. Add stable opaque keys, creator, archive state, icon catalog ID, allowed-model/tool/project sets and template provenance. Archiving a referenced specialist hides it from new plans but preserves historical cards; reject removal used by an unstarted plan until the person revises that plan. Offer template updates as field diffs accepted explicitly under revision checks. Ship Quality: QA and testing, Accessibility, Performance; Safety: Security, Privacy; Running things: Ops, Data, Support; Words and reach: Docs, Localisation, SEO; plus blank. Ops/Data templates grant no infrastructure or money authority. Ship catalog labels, descriptions and standing instruction text through individually pending `copy.go` entries, with catalog records referring to keys. On installation, copy approved values into the team-owned record; person-authored changes remain attributed content. All executable tool profiles must be certified; an unavailable combination remains unavailable.
-- [ ] **Green and guard mutations:** Repeat; require PASS. Break copy isolation, required-role protection, tool subset and edit authority independently; run `make migration-check` and size budgets.
+- [ ] **Green and guard mutations:** Break copy isolation, required-role protection, tool subset and edit authority independently; run `make migration-check` and size budgets.
- [ ] **Implementation commit:** `feat: add custom specialists and template copies`.
### Task 13: Add playbooks, defaults and explicit template updates
@@ -300,9 +282,9 @@ Define `TemplateDiff{From, To TemplateRef; CurrentRevision int64; Old, Current,
**Interfaces:** `PlaybookInput{ID, Name string; Kind taskplan.Kind; Steps []taskplan.Step; ProjectIDs []int64; Template TemplateRef}`; `Store.SavePlaybook(ctx context.Context, actor Actor, in PlaybookInput, m Mutation) (Playbook,error)`; `Store.DeletePlaybook(ctx context.Context, actor Actor, id string, m Mutation) error`; `Store.SetPlaybookDefault(ctx context.Context, actor Actor, projectID int64, kind taskplan.Kind, playbookID string, m Mutation) error`; `Store.InstantiatePlaybook(ctx context.Context, actor Actor, id string, taskID string) (taskplan.Plan,error)`. Provide a blank playbook template with the required review/checks/person tail already present. Define `Playbook` as persisted input plus creator/revision/archive fields; use Task 12's `TemplateDiff` for offered updates. A template install/update is explicit and revisioned; define `Store.InstallPlaybookTemplate(ctx context.Context, actor Actor, ref TemplateRef, m Mutation) (Playbook,error)` and `Store.PlaybookTemplateDiff(ctx context.Context, actor Actor, id string, target TemplateRef) (TemplateDiff,error)` alongside the specialist equivalents.
- [ ] **Tests first:** `TestPlaybookMandatorySteps` rejects removing review/checks/person from every saved playbook, including template copies. `TestPlaybookDefaultPrecedence` resolves project+kind, project-wide, kind-wide, then shipped kind template; only one default at each specificity. `TestPlaybookSnapshot` proves a later edit cannot change a task's instantiated revision. `TestPlaybookSuggestionNeedsPerson` creates only a suggestion until a verified-person save. `TestPlaybookTemplates` covers Bug, Website change, Infra change and Investigation, missing/archived specialists and deliberate update acceptance.
-- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/taskplan ./internal/plan3test -run '^TestPlaybook' -count=1`; expect failure.
+- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/taskplan ./internal/plan3test -run '^TestPlaybook' -count=1`.
- [ ] **Implement:** Reuse Task 2 validation. Active members create; creator/owner edits, owner controls project defaults; all changes are audited. Show the chosen playbook and any task-specific changes on the plan. Saved Investigation playbooks retain the mandatory tail but start at an explicit research/person checkpoint; later publishing requires new validation/admission, never an automatic leap past the checkpoint. Pure recommendations use Task 3's no-publication exception without instantiating a publishing playbook. Infra change is limited to repository changes, not production operations. Team continues to mean people.
-- [ ] **Green and guard mutations:** Repeat; require PASS. Break required tail, precedence, immutable snapshot and person-save checks; run `make migration-check`.
+- [ ] **Green and guard mutations:** Break required tail, precedence, immutable snapshot and person-save checks; run `make migration-check`.
- [ ] **Implementation commit:** `feat: add editable playbooks and project defaults`.
### Task 14: Complete personal connection choices and model reasons
@@ -312,9 +294,9 @@ Define `TemplateDiff{From, To TemplateRef; CurrentRevision int64; Old, Current,
**Interfaces:** Extend existing `ConnectionChoice` input and `connectionChoiceRecord` with `Mode` values `best_fit`, `pinned`, `ask`; retain project/person ticked connection IDs and pin. `Store.SelectPlanStep(ctx context.Context, actor Actor, taskID, stepKey string, m Mutation) (Selection,error)`; `Store.ConfirmPlanSelection(ctx context.Context, actor Actor, taskID, stepKey, connectionID, model string, m Mutation) (Selection,error)`. Selection retains current connection, choice and specialist revisions, reason, family, runner and allowance-known fields. Create `0026_connection_modes.sql`, add `Mode` with default `best_fit` to `connection_choices`, update models/schema and preserve every existing personal tick/pin. Unchanged historical choices therefore retain their current behavior.
- [ ] **Tests first:** `TestPlanModelChoiceOwnAccounts` covers two Claude and one Codex connections, person isolation, project ticks and provider/family rules. `TestPlanModelChoiceModes` verifies pinned behavior, explicit ask confirmation and deterministic best-fit within eligible choices, including unknown headroom. `TestPlanModelChoiceReviewFamily` blocks same-family Review regardless of pin/custom specialist. `TestPlanModelChoiceImmutableStep` preserves actual account/model/reason after a later settings change and never switches active work. `TestPlanModelChoiceUnavailable` keeps allowance/count unknown and reports the missing second family without borrowing accounts. `TestPlanModelChoiceCoordinatorConnection` covers an eligible alternative, all alternatives excluded by family/pin/ask restrictions, and no alternative: prefer the eligible non-coordinator connection; otherwise keep the selected shared connection and display the coordinator turn waiting for its lease. Assert a queued coordinator makes no provider call and resumes admission/dispatch only after the active specialist releases the lease.
-- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test -run '^TestPlanModelChoice' -count=1`; expect failure.
+- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test -run '^TestPlanModelChoice' -count=1`.
- [ ] **Implement:** Treat model-proposed fit/reason as a proposal within server-validated choices. Use known headroom only when supplied by a supported observation; otherwise label counted usage and unknown allowance. Plan approval and ask-each-pick are separate gates. Recheck current choice/specialist/connection revisions at claim and every turn. Pinning never defeats independent review. For best-fit selection, prefer an eligible connection other than the coordinator's before comparing fit/headroom. Eligibility includes provider/family rules, project ticks, pin and any explicit ask confirmation; never override the person's selection. If none is eligible, queue the coordinator while the specialist holds that shared home and show its waiting state in the conversation and status API. Release the lease at a clean turn boundary so neither side waits while holding it. Implement the preference and wait behavior in Task 4 for 3a, and extend it to these modes here. A later step may use another personal account with its own recorded reason; no mid-step failover. Keep source credential paths out of every person API response.
-- [ ] **Green and guard mutations:** Repeat; require PASS. Mutate person filter, allowed-family intersection, pin exception, unknown handling and actual-selection immutability separately; run `make migration-check`.
+- [ ] **Green and guard mutations:** Mutate person filter, allowed-family intersection, pin exception, unknown handling and actual-selection immutability separately; run `make migration-check`.
- [ ] **Implementation commit:** `feat: show and guard per-step personal model choices`.
### Task 15: Accept invitations through verified person identity
@@ -324,23 +306,23 @@ Define `TemplateDiff{From, To TemplateRef; CurrentRevision int64; Old, Current,
**Interfaces:** `Invitation{ID, Address, Role string; ExpiresAt time.Time; Revision int64; State string}`; `Store.CreateInvitation(ctx context.Context, actor Actor, address string, role Role, m Mutation) (Invitation,error)`; `Store.AcceptInvitation(ctx context.Context, actor Actor, id, secret string, m Mutation) (Member,error)`; `Store.RevokeInvitation(ctx context.Context, actor Actor, id string, m Mutation) error`. Issue a random single-use secret, store its keyed hash and a seven-day expiry; expose the link only to the inviting owner for deliberate sharing. No automatic email send is required.
- [ ] **Tests first:** `TestInviteVerifiedAddress` rejects a valid invite with the wrong/unverified keymail identity and does not create an active member on GET. `TestInviteReplayAndExpiry` covers identical retries, token reuse by another identity, expiry and revocation. `TestInviteCurrentAuthority` denies a removed inviter/owner's stale issuance action, protects the last owner and audits acceptance atomically. `TestInviteSignInPendingMember` allows verification of the invited identity before acceptance while denying every team resource until acceptance commits.
-- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test -run '^TestInvite' -count=1`; expect failure.
+- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test -run '^TestInvite' -count=1`.
- [ ] **Implement:** Integrate with existing keymail verification rather than an invitation authentication bypass. Extend `NewAuth`’s current active-member-only `Authorize` callback to allow identity verification for an address with an unexpired, unrevoked invitation. The resulting session still fails `requireMember` until acceptance commits; a narrow verified-session invite handler does not use team-resource authorization. The acceptance page may read only safe invitation metadata after token validation; current membership is still mandatory elsewhere. Keep invitation secrets out of logs/audit/referrers. A verified sign-in can accept only the intended address and reviewed role. Record acceptance as the onboarding entry point. Task 16 initializes onboarding state from it without overwriting an existing person’s setup; this task does not depend on the later onboarding table.
-- [ ] **Green and guard mutations:** Repeat; require PASS. Break verified-address, single-use, expiry, roster and audit checks; run `make migration-check`.
+- [ ] **Green and guard mutations:** Break verified-address, single-use, expiry, roster and audit checks; run `make migration-check`.
- [ ] **Implementation commit:** `feat: accept team invitations with verified identity`.
### Task 16: Install and pair the supported own-machine runner
-**Files:** Create `internal/runner/setup/{install,install_test,budget_test}.go`, `internal/equipo/setup/{onboarding,onboarding_handlers}.go`, `templates/onboarding.html`, `0028_onboarding.sql`; modify `docs/mockups/onboarding.html` for the agreed pairing direction, `cmd/equipo-runner/main.go`, existing enrolment/config/packaging/release tests; create a versioned installer asset and `internal/plan3test/onboarding_install_test.go`.
+**Files:** Create `internal/runner/setup/{install,install_test,budget_test}.go`, `internal/equipo/setup/{onboarding,onboarding_handlers}.go`, `templates/onboarding.html`, `0028_onboarding.sql`; modify `docs/mockups/onboarding.html` for the agreed pairing direction only after the later copy pass, `cmd/equipo-runner/main.go`, `internal/runner/enrol.go` and existing enrolment/config/packaging/release tests; create a versioned installer asset and `internal/plan3test/onboarding_install_test.go`.
**Interfaces:** `runnersetup.InstallUser(ctx context.Context, opts InstallOptions) (InstallResult,error)` with `InstallOptions{Release, Root, InstanceOrigin string; EnableService bool}` and `InstallResult{Version, BinaryPath, ServicePath, State string; Missing []string; LingeringEnabled bool}`; `Store.Onboarding(ctx context.Context, actor Actor) (OnboardingState,error)`; `Store.AdvanceOnboarding(ctx context.Context, actor Actor, step string, m Mutation) (OnboardingState,error)`. State records completed prerequisites independently, so resume does not rerun login or install.
-Define `OnboardingState{Revision int64; CurrentStep, ProviderChoice, RunnerID, AccountSetupID string; Completed map[string]bool}`. Allowed step keys are `welcome`, `account`, `runner`, `specialists`, `first_task`; advancement checks persisted prerequisites, not a submitted completed flag. The account-choice stage may be complete while actual login remains pending on the runner stage. Reuse `BeginEnrolmentRequest`, machine public key, challenge proof, browser approval and runner credential audiences. The runner begins enrolment and prints the returned short code and verification address; the person types that code into the signed-in browser. The approval page shows the runner label and request creation time and requires explicit confirmation after code entry. Do not prefill a code from a link or approve on GET. `docs/mockups/onboarding.html` will be updated during Task 16 implementation to match this direction; this planning revision does not edit it.
+Define `OnboardingState{Revision int64; CurrentStep, ProviderChoice, RunnerID, AccountSetupID string; Completed map[string]bool}`. Allowed step keys are `welcome`, `account`, `runner`, `specialists`, `first_task`; advancement checks persisted prerequisites, not a submitted completed flag. The account-choice stage may be complete while actual login remains pending on the runner stage. Reuse `BeginEnrolmentRequest`, machine public key, challenge proof, browser approval and runner credential audiences. The runner begins enrolment and prints the returned short code and verification address; the person types that code into the signed-in browser. Replace `internal/runner/enrol.go`’s hard-coded `Label: "equipo-runner"` with the actual machine label, defaulted from the hostname and editable by the person before enrolment. Carry it through `BeginEnrolmentRequest.Label`; show that same label and server request creation time on the approval page, requiring explicit confirmation after code entry. Do not prefill a code from a link or approve on GET. Route changed onboarding mockup wording through the same later copy pass as runtime strings, then apply approved words verbatim during Task 16. This revision changes only the plan.
-- [ ] **Tests first:** `TestOnboardingInstallVersioned` verifies version/checksum, user-writable destination, no sudo, no global config edits, no shell interpolation of origin/path and refusal of unsupported OS/arch or uncertified release. `TestOnboardingPairingBound` asserts the runner prints the code, the browser requires typed entry and displays label/time, rejects replay/expiry/wrong machine or a link-only approval, and pairs only after the intended person's verified browser approval. `TestOnboardingContainmentPreflight` covers missing/wrong bubblewrap version, disabled unprivileged user namespaces, the Ubuntu 24.04 AppArmor restriction and a successful namespace/pidfd probe. Each failure leaves install unavailable with the missing prerequisite and no service enabled. `TestOnboardingServiceLogout` reports "runner stops at logout" when user lingering is off; it does not enable lingering itself. `TestOnboardingInstallResume` retries partial install/pairing without duplicate service/runner and cleans only owned scratch. `TestOnboardingHostedUnavailable` shows Hosted by Equipo as later with no working launch route.
-- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/runner/setup ./cmd/equipo-runner ./internal/plan3test -run '^TestOnboarding(Install|Pairing|Containment|Service|Hosted)' -count=1`; expect failure.
-- [ ] **Implement:** Generate a one-line install command from the configured HTTPS instance origin and immutable release version. Download to private on-disk scratch, verify against the authenticated versioned manifest, then run the install-time containment preflight before enabling a user service or accepting runnable work. Require bubblewrap 0.11.0, working unprivileged user namespaces and pidfds using the release's actual namespace policy. On Ubuntu 24.04 detect/report the AppArmor unprivileged-user-namespace restriction; an executable version check alone is insufficient. Return `State=unavailable` with the missing/denied prerequisite and a reviewed diagnostic. Never run sudo, change sysctls or disable AppArmor. After preflight, start runner enrolment and print the code for typed browser approval as above. Handle absent user-service support as an explicit setup failure; do not invoke sudo. Pairing code is expiring, throttled and machine-key bound. The runner dials outbound only. Testing never enables a persistent service. Production service installation is the explicit install action. Inspect user lingering without changing it: when disabled, report "runner stops at logout" and do not claim unattended persistence across logout. Mac runner is shown as "coming later"; unsupported Linux architectures remain unavailable pending certified packaging. The Mac may be a client of a Linux runner. No unconfined fallback.
-- [ ] **Green and guard mutations:** Repeat; require PASS. Break manifest verification, code binding/typed entry, containment preflight, logout-state reporting, OS gate, user-only destination and retry uniqueness; run `make migration-check` and release packaging tests with fixtures.
+- [ ] **Tests first:** `TestOnboardingInstallVersioned` verifies version/checksum, user-writable destination, no sudo, no global config edits, no shell interpolation of origin/path and refusal of unsupported OS/arch or uncertified release. `TestOnboardingPairingBound` asserts the runner prints the code, the browser requires typed entry and displays the real machine label/time, including a person-edited label rather than the fixed literal, rejects replay/expiry/wrong machine or a link-only approval, and pairs only after the intended person's verified browser approval. `TestOnboardingContainmentPreflight` covers missing/wrong bubblewrap version, disabled unprivileged user namespaces, the Ubuntu 24.04 AppArmor restriction and a successful namespace/pidfd probe. Each failure leaves install unavailable with the missing prerequisite and no service enabled. `TestOnboardingServiceLogout` reports "runner stops at logout" when user lingering is off; it does not enable lingering itself. `TestOnboardingInstallResume` retries partial install/pairing without duplicate service/runner and cleans only owned scratch. `TestOnboardingHostedUnavailable` shows Hosted by Equipo as later with no working launch route.
+- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/runner/setup ./cmd/equipo-runner ./internal/plan3test -run '^TestOnboarding(Install|Pairing|Containment|Service|Hosted)' -count=1`.
+- [ ] **Implement:** Generate a one-line install command from the configured HTTPS instance origin and immutable release version. Download to private on-disk scratch, verify against the authenticated versioned manifest, then run the install-time containment preflight before enabling a user service or accepting runnable work. Require bubblewrap 0.11.0, working unprivileged user namespaces and pidfds using the release's actual namespace policy. On Ubuntu 24.04 detect/report the AppArmor unprivileged-user-namespace restriction; an executable version check alone is insufficient. Return `State=unavailable` with the missing/denied prerequisite and a reviewed diagnostic. Never run sudo, change sysctls or disable AppArmor. After preflight, start runner enrolment and print the code for typed browser approval as above. Handle absent user-service support as an explicit setup failure; do not invoke sudo. Pairing code is expiring, throttled and machine-key bound. The runner dials outbound only. Testing never enables a persistent service. Production service installation is the explicit install action. Inspect user lingering without changing it: when disabled, report "runner stops at logout" and do not claim unattended persistence across logout. Apply the supported setup ruling above; unsupported architectures remain unavailable pending certified packaging. No unconfined fallback.
+- [ ] **Green and guard mutations:** Break manifest verification, code binding/typed entry, containment preflight, logout-state reporting, OS gate, user-only destination and retry uniqueness; run `make migration-check` and release packaging tests with fixtures.
- [ ] **Implementation commit:** `feat: add versioned user runner installation and pairing`.
### Task 17: Connect dedicated accounts and finish safe onboarding
@@ -349,12 +331,12 @@ Define `OnboardingState{Revision int64; CurrentStep, ProviderChoice, RunnerID, A
**Interfaces:** `provider.LoginDriver` exposes `Begin(ctx context.Context, providerName, credentialHome string) (LoginChallenge,error)`, `Poll(ctx context.Context, challengeID string) (LoginResult,error)`, `Cancel(ctx context.Context, challengeID string) error`; `LoginChallenge{ID, VerificationURI, UserCode, Mode string; ExpiresAt time.Time}` and `LoginResult{State string; Identity provider.Identity}`. This driver runs only on the person's runner and invokes supported, unmodified CLI login. `Store.RequestAccountSetup(ctx context.Context, actor Actor, runnerID, providerName, label string, m Mutation) (AccountSetup,error)` returns a setup ID/status and allowlisted display metadata. Provider `LoginChallenge` is runner-local and is never serialized directly into an instance response. Home paths, provider device secrets and Claude browser-return codes stay runner-local.
-Define `AccountSetup{ID, RunnerID, Provider, Label, State, Mode string; Challenge *LoginDisplay; ConnectionID string; Revision int64}` with states `waiting_runner`, `pending`, `connected`, `expired`, `denied`, `cancelled`, `unavailable`. Define `LoginDisplay{VerificationURI, UserCode string; ExpiresAt time.Time}` as an explicit safe projection for supported device authorization only. Claude browser mode has no instance challenge payload; the person follows the official link and enters any return code locally at the runner terminal. Do not include a challenge ID that doubles as the provider's secret polling credential. Correlate setup results with runner/person/generation and recheck the current roster before exposing or accepting them.
+Define `AccountSetup{ID, RunnerID, Provider, Label, State, Mode string; Challenge *LoginDisplay; ConnectionID string; Revision int64}` with states `waiting_runner`, `pending`, `connected`, `expired`, `denied`, `cancelled`, `unavailable`. Define `LoginDisplay{VerificationURI, UserCode string; ExpiresAt time.Time}` as an explicit safe projection for supported device authorization only. Claude browser mode has no instance challenge payload. Show its setup ID beside the pending `AccountSetup` so the person can run `equipo-runner account login --setup <id>` on that machine. Do not include a challenge ID that doubles as the provider's secret polling credential. The interactive subcommand matches the ID against a pending setup for this enrolled runner/person/generation, allocates the dedicated home, invokes the official CLI login on its terminal and reports sanitized status plus verified identity back through the authenticated runner channel. Refuse missing, wrong-runner, stale or cancelled setup IDs. Recheck the current roster before exposing or accepting results; the service never waits for terminal input.
-- [ ] **Tests first:** `TestOnboardingAccountDedicatedHome` creates distinct private homes for two same-provider accounts, refuses interactive/shared homes, checks identity after login and proves no secret leaves the runner in HTTP, logs or journal events. `TestOnboardingDeviceFlow` uses fake supported CLI responses for approval, pending, expiry, denial, cancel and restart; no login success before identity readback. `TestOnboardingClaudeHeadlessBrowserLogin` drives the official CLI protocol with recorded login fixtures in a dedicated home: open the displayed official browser link on another device, paste the returned code only at the runner terminal, verify identity locally, and report only sanitized status to the instance. Assert the code is absent from instance requests/responses, browser forms, logs, journals and audit events; cover cancellation, expiry and restart without a false connected state. `TestOnboardingNoDeviceCapability` chooses Claude's official browser flow when device auth is absent and returns unavailable only when no supported login flow exists; never invent a verification URL or scrape private OAuth endpoints. `TestOnboardingSafeFirstTask` starts a read-only sourced recommendation with one family and no branch/edit/publish; a change request asks for the second family before review. `TestOnboardingSpecialists` defaults the five specialists, keeps Engineering/Review required and installs selected library copies through Task 12.
-- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/runner/... ./internal/plan3test -run '^TestOnboarding(Account|Device|Claude|NoDevice|Safe|Specialists)' -count=1`; expect failure.
-- [ ] **Implement:** Present the five conceptual stages: welcome, account choice, own-machine setup, specialists, safe first task. On a new machine, account choice can be saved at stage 2, but login waits until stage 3 has paired the local runner; the instance never temporarily hosts a subscription credential. Reuse `provider.OpenAccount` and same-identity refresh rules after login. Use verified local CLI contracts, with `codex login --device-auth` only for a compatible pinned CLI. Use Claude's official browser sign-in into the dedicated Equipo home as the accepted alternative to device auth. On a headless machine, the runner terminal displays the official sign-in link and accepts the returned code locally through terminal input, never argv. The person may open that link on another device; the instance has no code-entry, code-forwarding or OAuth callback role. Keep the Mac runner option visible as "coming later", with a Linux runner usable by a Mac client. Any browser callback listener binds loopback and is owned/closed by the setup process. Persist safe setup correlation, not provider secrets, across reconnects. Show multiple labeled connections and observed allowance/unknown state. A new account never replaces an existing credential home silently.
-- [ ] **Green and guard mutations:** Repeat; require PASS. Break dedicated-home enforcement, identity readback, secret filtering, safe-first-task permissions and family gate; require failures. Live sign-in and any provider execution require Paul's later explicit action with dedicated accounts.
+- [ ] **Tests first:** `TestOnboardingAccountDedicatedHome` creates distinct private homes for two same-provider accounts, refuses interactive/shared homes, checks identity after login and proves no secret leaves the runner in HTTP, logs or journal events. `TestOnboardingDeviceFlow` uses fake supported CLI responses for approval, pending, expiry, denial, cancel and restart; no login success before identity readback. `TestOnboardingClaudeHeadlessBrowserLogin` drives `equipo-runner account login --setup <id>` through a terminal fixture and recorded official CLI login in a dedicated home. Assert the instance displays the matching pending setup ID, reject wrong/stale IDs, exercise the supported setup ruling’s browser/code exchange, verify identity locally and report sanitized status to that setup. Assert the code is absent from instance requests/responses, browser forms, logs, journals and audit events; cover cancellation, expiry and restart without a false connected state. `TestOnboardingNoDeviceCapability` chooses Claude's official browser flow when device auth is absent and returns unavailable only when no supported login flow exists; never invent a verification URL or scrape private OAuth endpoints. `TestOnboardingSafeFirstTask` starts a read-only sourced recommendation with one family and no branch/edit/publish; a change request asks for the second family before review. `TestOnboardingSpecialists` defaults the five specialists, keeps Engineering/Review required and installs selected library copies through Task 12.
+- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/runner/... ./internal/plan3test -run '^TestOnboarding(Account|Device|Claude|NoDevice|Safe|Specialists)' -count=1`.
+- [ ] **Implement:** Present the five conceptual stages: welcome, account choice, own-machine setup, specialists, safe first task. On a new machine, account choice can be saved at stage 2, but login waits until stage 3 has paired the local runner; the instance never temporarily hosts a subscription credential. Reuse `provider.OpenAccount` and same-identity refresh rules after login. Implement the supported setup ruling with verified CLI contracts, including `codex login --device-auth` for the compatible pin and the interactive Claude subcommand above. Its return code is terminal input, never argv; the instance has no code-entry, code-forwarding or OAuth callback role. Any browser callback listener binds loopback and is owned/closed by the setup process. Persist safe setup correlation, not provider secrets, across reconnects. Show multiple labeled connections and observed allowance/unknown state. A new account never replaces an existing credential home silently.
+- [ ] **Green and guard mutations:** Break dedicated-home enforcement, identity readback, secret filtering, safe-first-task permissions and family gate; require failures. Live sign-in and any provider execution require Paul's later explicit action with dedicated accounts.
- [ ] **Implementation commit:** `feat: onboard personal accounts and a safe first task`.
### Task 18: Put Teams above the team on web and phone
@@ -364,9 +346,9 @@ Define `AccountSetup{ID, RunnerID, Provider, Label, State, Mode string; Challeng
**Interfaces:** `TeamLink{ID, Origin, Name string; LastSignedInAt *time.Time; Revision int64}`; `Store.TeamLinks(ctx context.Context, actor Actor) ([]TeamLink,error)`; `Store.RememberTeam(ctx context.Context, actor Actor, in TeamLink, m Mutation) (TeamLink,error)`; `ForgetTeam(ctx context.Context, actor Actor, id string, m Mutation) error`. GET `/teams` is a link directory, GET `/work` is the current team index. `Landing` preference is `conversation` (default) or `work` and is changed only by the person.
- [ ] **Tests first:** `TestTeamsHierarchy` checks desktop Teams link and phone Teams → team → page → task/thread back links with scripts disabled. `TestTeamsDirectoryPrivacy` scopes links to the person and rejects credentials, script URLs, fragments, userinfo and non-HTTPS remote origins. `TestTeamsNoFederatedAuthority` proves remembering a link creates no remote membership, credential sharing or server fetch. `TestTeamsUnavailableCounts` keeps remote counts absent/unknown and renders current-team errors as unknown. `TestTeamsLandingPreference` covers default, override and stable task deep links after sign-in.
-- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test -run '^TestTeams' -count=1`; expect failure.
+- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test -run '^TestTeams' -count=1`.
- [ ] **Implement:** Remember the current instance after successful sign-in. Provide an explicit person-managed add/forget link form for other instances they have signed in to; make clear that this is their remembered directory, not a federation roster. Independent origins cannot automatically discover each other's browser sessions. Never trust a submitted `LastSignedInAt` as verified. This meets the brief's links-only web boundary; automatic cross-origin discovery and aggregated remote Needs you need a separate authenticated directory/client design. Native clients can later remember their own signed-in instances. Include Preferences, Playbooks and dynamic specialists in the current team's navigation; preserve phone landing preference and icon-plus-name display.
-- [ ] **Green and guard mutations:** Repeat; require PASS. Break URL validation, private scope, back-link hierarchy and unknown count handling; run `make migration-check` and layout/vendored tests.
+- [ ] **Green and guard mutations:** Break URL validation, private scope, back-link hierarchy and unknown count handling; run `make migration-check` and layout/vendored tests.
- [ ] **Implementation commit:** `feat: add the Teams directory and web navigation hierarchy`.
### Task 19: Add the durable notification outbox and subscription feed
@@ -378,9 +360,9 @@ Define `AccountSetup{ID, RunnerID, Provider, Label, State, Mode string; Challeng
Define `NotificationSubscription{ID, DeviceID, Cursor string; Revision int64; Active bool; ExpiresAt time.Time}`; the recipient comes from the verified actor and is never a submitted field. Subscriptions expire at the earlier of 30 days from creation and the bound device credential's expiry. No implicit renewal on poll or ACK; a new authenticated subscribe action creates a replacement after expiry. Every feed read, live authorization and ACK checks expiry, current roster and device revocation. Revoking a device disables all its subscriptions in the same transaction. ACK requires a notification actually delivered on that subscription, and advances only a contiguous cursor; an out-of-order ACK cannot skip an earlier event.
- [ ] **Tests first:** `TestNotificationOutboxAtomic` commits question/task-ready/card changes and one recipient event together, emits nothing on rollback and deduplicates replay. `TestNotificationRecipientIsolation` denies other people and removed members, including stale live subscriptions. `TestNotificationReconnect` retries after lost acknowledgement, advances only the specified device cursor and preserves unread state across another device's ACK. `TestNotificationStaleAnswer` invalidates superseded question notifications and requires a fresh GET plus Task 10's revisioned person answer; no push payload grants authority. `TestNotificationSubscriptionExpiry` uses a fake clock at the exact deadline, verifies device expiry/revocation terminates access and live delivery, rejects later ACKs, and allows explicit re-subscription without losing unread questions. `TestNotificationNoExternalDelivery` registers no APNs/FCM/network sender and stores no provider secrets or arbitrary callback URL.
-- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test -run '^TestNotification' -count=1`; expect failure.
+- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test -run '^TestNotification' -count=1`.
- [ ] **Implement:** Insert outbox rows in the effect's existing transaction, unique by recipient/event/resource revision. Feed delivery is at least once; clients deduplicate by notification ID. Keep task/question content private by default: the notification contains type, ID, revision and an instance-relative deep link; the authenticated client fetches current card/options. Support resumable GET polling and private Rastrillo invalidation for web; external mobile push is a later adapter over these records. Mark obsolete events superseded. Keep 30 days of acknowledged entries; a cursor older than retained history returns `410 cursor_expired` and a fresh-snapshot instruction, never silently skips pending questions. Unacknowledged current questions remain discoverable in Needs you. Plan 3 recipients are the requesting person and existing explicit human decision owners, not coordinator-to-coordinator routing.
-- [ ] **Green and guard mutations:** Repeat; require PASS. Break commit atomicity, recipient scope, deduplication, independent cursor, expiry/device-revocation and stale-resource checks; run `make migration-check`.
+- [ ] **Green and guard mutations:** Break commit atomicity, recipient scope, deduplication, independent cursor, expiry/device-revocation and stale-resource checks; run `make migration-check`.
- [ ] **Implementation commit:** `feat: add a person-scoped notification outbox`.
### Task 20: Complete and document the native-facing JSON API
@@ -396,9 +378,9 @@ Define `PersonDeviceChallenge{ID, DeviceSecret, UserCode, Challenge, Verificatio
**Owner operations:** Add `GET /people` in Task 10; add owner-only `GET /roster`, `PUT /roster/{address}`, `GET /budgets` and `PUT /budgets` here. The roster mutation calls `SetMember` with explicit role/active/revision input and preserves last-owner and decision-owner assignment checks. Budget updates call `SaveBudgets` with `BudgetConfig` and current revision; reads wrap `Budgets` with current-owner authorization. Add idempotency through the same transaction as the existing operations, not a handler-side check followed by an unrelated write. Ordinary members can read the safe people projection but cannot mutate roster or read/change owner budget configuration. Coordinator limits remain the separately named owner operation from Task 5.
- [ ] **Tests first:** `TestPersonAPIContractCoverage` compares the current phase's implemented methods/routes/schemas with OpenAPI and fails for missing/undocumented operations. Task 19 extends its expected inventory to all notification routes; Task 21 permits no missing v1 operation. `TestPersonAPISharedOperations` runs specialist/playbook/project/connection/onboarding actions by HTML and JSON and compares authority, revisions, audits and results. `TestPersonAPIDeviceApproval` covers verified browser identity, typed code, visible label/time, matching key/nonce, current roster, throttling, expiry, single-use and lost-response replay; wrong audiences, link-only approval and revoked/session-epoch credentials fail. Repeat Task 10's real-handler CSRF test with actual Task 20 person credentials. `TestPersonAPIOwnerRosterBudgets` denies member/stale-owner mutations, preserves last owner and decision owners, checks revision/idempotency/audit rollback and proves lowered budgets affect subsequent admission. `TestPersonAPINativeAnswers` answers a question through a device credential, rejects stale/cancelled/other-recipient answers and never accepts an OS notification action as authentication. `TestPersonAPIPaginationUnknown` covers interleaved inserts, invalid cursors, bounded limits, null counts and private-field omission. `TestPersonAPISchemaCompatibility` reads fixed v1 fixtures and rejects unknown mutation fields/duplicate keys without silently binding models.
-- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/equipo/personapi ./internal/plan3test -run '^TestPersonAPI(Contract|Shared|Native|Pagination|Schema|Device|Owner|BrowserCSRF|AuthAudiences)' -count=1`; expect failure.
+- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/equipo/personapi ./internal/plan3test -run '^TestPersonAPI(Contract|Shared|Native|Pagination|Schema|Device|Owner|BrowserCSRF|AuthAudiences)' -count=1`.
- [ ] **Implement:** Finish the endpoint/DTO/error inventory below and add request/response examples as contract fixtures. Document sign-in, credential revocation, browser CSRF, idempotency, revisions, cursor pagination, live reconnection and notification answer flow. Use the repository’s humane-docs guidance for that implementation documentation; API prose is future reviewed copy; list its sections for review with runtime keys before release. No native client, SDK or cross-team aggregation service. Do not expose provider session files, runner credentials, raw permission secrets or other people's private conversations through convenience expansions.
-- [ ] **Green and guard mutations:** Repeat; require PASS. Remove one route/schema, bypass device key proof/typed-code approval/expiry or owner checks, bypass a shared operation, leak a private field and accept an answer without person auth; require failures. Ensure every UI action needed by native clients has an API equivalent.
+- [ ] **Green and guard mutations:** Remove one route/schema, bypass device key proof/typed-code approval/expiry or owner checks, bypass a shared operation, leak a private field and accept an answer without person auth; require failures. Ensure every UI action needed by native clients has an API equivalent.
- [ ] **Implementation commit:** `feat: complete the versioned person API contract`.
### Task 21: Verify the 3b onboarding-to-work path and release boundary
@@ -407,17 +389,17 @@ Define `PersonDeviceChallenge{ID, DeviceSecret, UserCode, Challenge, Verificatio
**Interfaces:** No new product interface. Acceptance uses HTTP/person API, fake login/provider streams, a temporary home, the runner, local Git/checks and fake Amadan.
-The controller decisions are settled: Linux/amd64 own-machine onboarding supports Codex device auth and Claude official browser sign-in into dedicated homes; a headless Claude return code is pasted only at the runner terminal. Mac runner is shown as "coming later" and has no launch action. A Mac client may connect to a Linux runner. Acceptance must cover both supported provider paths with fixtures and report their later live certification separately; it touches no real accounts, persistent services or remote repositories.
+Acceptance covers the supported setup ruling with fixtures and reports live certification separately. It touches no real accounts, persistent services or remote repositories.
-- [ ] **Tests first:** `TestCoordinatorAcceptance3B` accepts an invite, resumes interrupted setup, pairs Linux runner, creates two same-provider account homes plus a review family, installs and edits a specialist/template/playbook, chooses a default, receives a safe recommendation, starts a feature and answers through a device token. Exercise Codex device auth and headless Claude browser sign-in, verify terminal-only code handling and dedicated-home identity readback, and assert the Mac runner is shown as "coming later". Cover runner-print/browser-type pairing, failed containment preflight and lingering-off logout status. Assert all three mandatory publishing steps, correct personal accounts, no silent template updates, Teams links, one durable notification per effect and subscription expiry. `TestPlan3ReleaseBoundaries` refuses pending copy, uncertified policy/login/OS support, missing API operation, hosted runner claims and automatic merge/deploy.
-- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test -run 'TestCoordinatorAcceptance3B|TestPlan3ReleaseBoundaries' -count=1`; expect failure.
-- [ ] **Implement integration fixes:** Resolve only defects exposed by this path; update the controller report's dependency table against completed 2b review. Apply reviewed copy verbatim through the later controller's review channel. Keep Mac runner unavailable; treat a failure of the required official Claude browser path as a release blocker, not an unresolved product choice. Prepare versioned release artifacts only after branch review, copy and real policy certification; Paul installs and enables them.
+- [ ] **Tests first:** `TestCoordinatorAcceptance3B` accepts an invite, resumes interrupted setup, pairs Linux runner, creates two same-provider account homes plus a review family, installs and edits a specialist/template/playbook, chooses a default, receives a safe recommendation, starts a feature and answers through a device token. Exercise both provider paths and the unavailable runner option from that ruling, including Task 17’s interactive subcommand, terminal-only code handling and dedicated-home identity readback. Cover runner-print/browser-type pairing, failed containment preflight and lingering-off logout status. Assert all three mandatory publishing steps, correct personal accounts, no silent template updates, Teams links, one durable notification per effect and subscription expiry. `TestPlan3ReleaseBoundaries` refuses pending copy, uncertified policy/login/OS support, missing API operation, hosted runner claims and automatic merge/deploy.
+- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test -run 'TestCoordinatorAcceptance3B|TestPlan3ReleaseBoundaries' -count=1`.
+- [ ] **Implement integration fixes:** Resolve only defects exposed by this path; update the controller report's dependency table against completed 2b review. Apply reviewed copy verbatim through the later controller's review channel. Treat failure of a required login path as a release blocker. Prepare versioned release artifacts only after branch review, copy and real policy certification; Paul installs and enables them.
- [ ] **Green and gates:** Repeat targeted tests and guard mutations; run `make migration-check`, `make ci` once after final changes and the contract/namespace release checks required by the settled 2b manifest. Test upgrade of an 0018 fixture with existing active/history data, plus 3a → 3b and idempotent reopen. No live login/provider action occurs without Paul's later explicit authorization. Record remaining unsupported setup paths as such, not passed acceptance. Clean all owned scratch/processes.
- [ ] **Usable acceptance and implementation commit:** Paul follows the supported install/login path, runs the safe recommendation, then a bounded feature through review/checks to a human merge. A teammate repeats with their own accounts. No Plan 4 settlement or CARLOS signal is claimed. Subject: `test: verify onboarding and the complete person API`.
## Person API v1 contract
-Publish the contract using OpenAPI 3.1.0 with `info.version` set to `1.0.0`; additive response fields are allowed within v1, while changed meanings or required inputs need a new major API version. All resource endpoints below are under `/api/v1`, authenticated as a person, and available on the current instance only. IDs in paths never expand authority. The person-authenticated browser uses the existing secure session and same-origin protection; a native client uses its distinct revocable device bearer. No runner/coordinator credential is accepted. Public challenge creation/exchange is the narrow Task 20 (3b) exception with its own proof and throttling. The 3a person API is browser-session authenticated; native issuance and production bearer verification begin in 3b.
+Use OpenAPI 3.1.0, `info.version: 1.0.0`. Additive response fields fit v1; changed meanings or required inputs need a new major version. Routes below use `/api/v1` on this instance. Person authentication is browser session plus same-origin protection in 3a, with revocable device bearers added in 3b. Reject runner/coordinator credentials; path IDs grant no authority. Task 20’s public challenge/exchange routes require their separate proof and throttling.
GET returns explicit JSON projections and `ETag: "<revision>"`. Resource updates require `If-Match`; create/action requests require `Idempotency-Key` of 1–256 bytes. A duplicate key is checked before stale-revision rejection only after current authorization and exact canonical body comparison, so retry after a lost successful response returns the saved result. New input with a stale revision gets `409 revision_conflict`; missing precondition gets `428`; invalid input `422`; no valid identity `401`; denied current authority `403`; absent/non-visible private resources `404`; expired challenge/cursor `410`; unavailable runner/query `503`. Bodies are capped at 64 KiB, message text at 16 KiB; reject duplicate JSON keys/unknown mutation fields. Lists use opaque scope-bound cursors, limit default 50 and maximum 100. API errors contain stable codes/copy keys; prose is supplied by reviewed copy. Responses with personal data use `Cache-Control: no-store`.
@@ -450,71 +432,38 @@ GET returns explicit JSON projections and `ETag: "<revision>"`. Resource updates
| 3b | `POST /invites`; `GET /invites/{id}`; `POST /invites/{id}/accept`; `DELETE /invites/{id}` | Owner invite creation/revoke, intended verified recipient's acceptance |
| 3b | `GET /notifications`; `POST /notification-subscriptions`; `DELETE /notification-subscriptions/{id}`; `POST /notification-subscriptions/{id}/ack` | Recipient outbox, per-device expiring subscription and idempotent acknowledgement |
-Task 20 must implement missing thin application operations for API-only lifecycle actions: own connection label/revoke; coordinator reset/retry already belongs to Task 5 and subscription management to Task 19. Add `Store.RenameConnection(ctx context.Context, actor Actor, id, label string, m Mutation) error` and `Store.RevokeConnection(ctx context.Context, actor Actor, id string, m Mutation) error` in `connection_handlers.go`’s application-operation companion `connections.go`. Revocation fences dependent work and requests containment; it does not remotely erase a credential home. They use the same current-member, containment, generation and revision rules already specified; they cannot call a GORM model update directly from a handler. OpenAPI describes the question union (clarification choices/free text versus native permission), exact allowed answer shape and the original request revision. The notification feed is a wake-up hint: answering always uses `/questions/{id}/answer` with person auth and a current revision. Journey cards include specialist category/action/model/account/reason, actual status and nullable usage; no percentage estimate.
+Task 20 must implement missing thin application operations for API-only lifecycle actions: own connection label/revoke; coordinator reset/retry already belongs to Task 5 and subscription management to Task 19. Add `Store.RenameConnection(ctx context.Context, actor Actor, id, label string, m Mutation) error` and `Store.RevokeConnection(ctx context.Context, actor Actor, id string, m Mutation) error` in `connection_handlers.go`’s application-operation companion `connections.go`. Revocation fences dependent work and requests containment; it does not remotely erase a credential home. They use the same current-member, containment, generation and revision rules already specified; they cannot call a GORM model update directly from a handler. OpenAPI describes the question union (clarification choices/free text versus native permission), exact allowed answer shape and the original request revision. Notifications prompt a fetch; answers require `/questions/{id}/answer`, person auth and current revision. Journey cards include specialist category/action/model/account/reason, actual status and nullable usage; no percentage estimate.
## Copy inventory for the later review pass
-These are keys/meanings to add in `internal/equipo/copy.go`, individually pending. They are not approved strings, and this planning change adds no runtime copy. Existing reviewed labels should be reused where their meaning is unchanged. Template descriptions, installer/runner diagnostics shown to a person and API-guide prose join this review inventory; model-produced messages are attributed task content, never stored as application copy.
+Add these keys/meanings to `internal/equipo/copy.go` as individually pending entries; reuse unchanged reviewed labels. Include template descriptions, installer/runner diagnostics and API prose in review. Model messages remain attributed content. This planning revision approves no runtime copy.
| Owner task | Key groups and meanings |
| --- | --- |
| 1, 9 | `conversation.title`, `.empty`, `.composer`, `.send`, `.queued`, `.offline`, `.routed`, `.thread_link`, `.thread_reply`, `.route_confirmation`, `.private`, `.shared_thread` |
| 2, 9 | `plan.proposed`, `.edit`, `.approve`, `.immediate`, `.required`, `.inherit`, `.locked_step`, `.revision_conflict`, `.project`, `.correct_project`, `.replacement`, `.investigation_checkpoint`, `.playbook`, `.changes` |
| 3, 4 | `evidence.acceptance`, `.frozen`, `.render_approval`, `.sources`, `.answer_delivered`, `.missing_sources`, `.awaiting_person`, `.candidate_changed` |
-| 5–7 | `coordinator.connection`, `.unavailable`, `.budget_needed`, `.queued`, `.interrupted`, `.uncertain`, `.retry`, `.reset`, `.identity_changed`, `.policy_changed`, `.waiting_connection`, `.context_limit`; all coordinator MCP tool descriptions/errors |
+| 5–7 | `coordinator.connection`, `.unavailable`, `.budget_needed`, `.queued`, `.interrupted`, `.uncertain`, `.retry`, `.reset`, `.identity_changed`, `.policy_changed`, `.waiting_connection`, `.waiting_task` (`waiting for <task>` with task link), `.context_limit`; all coordinator MCP tool descriptions/errors |
| 8 | `preferences.title`, `.confirmed`, `.inferred`, `.source`, `.confirm`, `.correct`, `.delete`, `.team_rule`, `.source_unavailable` |
| 9, 10 | `question.choose`, `.reply`, `.expired`, `.answered`, `.superseded`; API validation/auth/revision/cursor errors; device labels move to Task 20 |
| 12 | `specialists.new`, `.name`, `.icon`, `.instructions`, `.models`, `.tools`, `.projects`, `.required`, `.archive`; library group/template names, descriptions, blank template and update-diff actions |
| 13 | `playbooks.title`, `.new`, `.default`, `.kind`, `.steps`, `.used`, `.suggested`, `.save_suggestion`, `.update_available`; four playbook template labels/descriptions |
| 14 | `connections.add`, `.label`, `.remaining_unknown`, `.counted_usage`, `.best_fit`, `.pinned`, `.ask`, `.reason`, `.second_family`, `.selection_changed` |
-| 15–17 | `invite.welcome`, `.accept`, `.expired`, `.wrong_person`; all five onboarding stage labels/actions; runner install/pairing/status errors, dedicated-home/device-login/pending/unsupported/cancel messages, hosted-later and Mac-coming-later labels, missing containment prerequisite, AppArmor restriction, runner-stops-at-logout status, headless browser return-code terminal instructions, pairing label/time and typed-code instructions, safe-first-task choice |
+| 15–17 | `invite.welcome`, `.accept`, `.expired`, `.wrong_person`; all five onboarding stage labels/actions; runner install/pairing/status errors, dedicated-home/device-login/pending/unsupported/cancel messages, hosted-later and Mac-coming-later labels, missing containment prerequisite, AppArmor restriction, runner-stops-at-logout status, headless browser return-code terminal instructions, actual machine label/time and typed-code instructions, pending account setup ID and interactive login command, safe-first-task choice; changed `docs/mockups/onboarding.html` wording shares this copy pass |
| 18 | `teams.title`, `.add`, `.forget`, `.remembered`, `.last_signin_unknown`, `.remote_unavailable`; phone parent labels and landing-screen settings |
| 19 | `notifications.question`, `.task_ready`, `.interrupted`, `.superseded`, `.subscribe`, `.unsubscribe`, `.cursor_expired`, `.subscription_expired`; no promise of live mobile push delivery |
| 20 | Device approval label/time, typed-code entry, expiry/revoke labels and owner roster/budget validation states |
| 11, 20, 21 | API guide sections and acceptance/setup instructions, reviewed separately from implementation identifiers; README remains untouched |
-## Self-review
-
-- Keep the 11-task 3a and 10-task 3b split. The first stop delivers browser conversation and work with existing accounts; native credential issuance belongs to Task 20. Implement Task 20 before Task 19 so subscriptions have a real credential owner. This avoids treating a fixture verifier as shipped native sign-in.
-- Use fresh provider sessions for coordinator turns. Persist conversation/context and effect receipts on the instance, and keep the runner journal for dispatch uncertainty. The current lease cleanup and in-memory launcher tables cannot support the prior cross-turn resume promise. An uncertain turn still needs reconciliation and an explicit retry.
-- Keep new application logic in the named feature packages and new integration/browser tests in `internal/plan3test`. Retain only transaction-sensitive core hooks in `team`. Existing size exceptions are not spare capacity for all 21 tasks; run the package budgets as each hook lands and extract pure rules if needed.
-- Bind rendered approval to the candidate diff and current project copy/design decision owner. The trusted render helps that person inspect the change; identical pixels cannot preserve approval after a candidate edit. Require fresh review, checks and approval on the changed candidate.
-- Replace the global CSRF wrapper at the app boundary. Audience checks in leaf handlers cannot fix an earlier browser-only rejection. Keep browser cookie routes protected and prove both authenticated machine lanes through the real outer handler, first with a native verifier fixture and then with real 3b credentials.
-- Ship the settled Linux onboarding paths: Codex device auth and official Claude browser login, including terminal-only return-code entry on headless runners. Keep the Mac runner at "coming later". An unavailable namespace/AppArmor prerequisite or lingering-off logout limit must be visible; installation never repairs the host with sudo.
-- Keep Teams as a manual link directory with automatic recording of the current instance only. Drop link import/export. Cross-origin discovery, aggregated remote counts, coordinator settlement, CARLOS signals, hosted execution and native clients remain outside this plan.
-- Treat offline tests and live certification as separate gates. The checked-in release manifest still has empty certified policy lists. Each new provider/tool policy needs the later authorized certification; this document edit supplies no live-use evidence or approved runtime copy.
-
-## Settled controller decisions
+## Verification background
-No question remains for Paul in this revision. The round 1 brief adopts the overnight Linux-first and official Claude browser-login rulings. Tasks 17 and 21 require those paths; Mac containment needs a later design and certification. The earlier provider-session-resume direction is superseded by fresh context-seeded coordinator turns.
+Prior read-only verification at `86852f1` found lease runtime cleanup and launcher-local session maps, fixed specialist action/tool inventories, an outer CSRF wrapper, existing budget exceptions, core schema version 7, runner-initiated pairing, guarded decision-owner/roster/budget operations and empty release certificates. These findings inform the tasks above; they do not establish implementation or live certification. The new context, coordinator limits and login/API flows remain planned work.
-## Round 1 dispositions
+## Round 2 dispositions
-All findings in `CODEX-BRIEF-plan-3-fixes-R1.md` are applied. These are implementation requirements, not claims that product tests or certification have passed.
-
-| Finding | Disposition and verification requirement |
-| --- | --- |
-| P1-1: coordinator continuity | Task 7 opens a fresh session each turn from bounded recent conversation, confirmed decisions/preferences and scoped retrieval. `TestCoordinatorSessionContinuity` uses both real launchers with recorded fixtures across lease closure and runner/launcher restart, with new provider IDs and no previous-session resume. |
-| P2-1: package budgets | The file map names feature packages, pure plan/coordinator packages, runner workflow/setup packages and `internal/plan3test`, with literal source/test/time budget records for each. Tasks 9/11/18/21 use the new test package; existing package ceilings stay unchanged. |
-| P2-2: CSRF dispatch | Task 10 replaces global protection with explicit cookie/runner/native lanes, or depends on the same Plan 2b fix if landed. Its real-app test admits valid bearer POSTs without browser headers and rejects cross-origin cookie POSTs; Task 20 repeats with issued native credentials. |
-| P2-3: provider policies | Task 4 names `runtime_direct.go`, Claude native/MCP inventories, Codex policy equivalents and broker/release files. New action profiles have real-launcher fixture tests and separate policy certification before live use. |
-| P2-4: rendered changes | Task 3 requires trusted executor rendering of the exact candidate; approval binds the candidate diff and render attestation. `ApproveRenderedChange` requires the current project copy/design decision owner and rechecks project revision. |
-| P2-5: post-review edits | `TestRenderedChangeEditAfterApproval` requires fresh review, checks, render and owner approval after a new candidate, even with identical pixels. Each stale-evidence guard is mutated independently. |
-| P2-6: pairing direction | Task 16 preserves `BeginEnrolmentRequest`: runner prints code, person types and approves it in the browser. The onboarding mockup update is assigned to implementation. |
-| P2-7: install containment | Task 16 probes bubblewrap 0.11.0, unprivileged namespaces, pidfds and Ubuntu 24.04 AppArmor restrictions. Missing prerequisites produce an explicit unavailable state; no sudo or host-policy repair. |
-| P2-8: overnight rulings | Tasks 17/21 require official Claude browser login into the dedicated home, headless return-code input only at the runner terminal, leakage assertions and Mac runner "coming later". No product question is reopened. |
-| P2-9: connection contention | Tasks 4/14 prefer another eligible personal connection; Tasks 5/7 persist and display coordinator waiting when the shared connection is occupied. Tests cover alternative selection and serialized shared-home use without concurrent dispatch. |
-| P2-10: API coverage | Task 10 adds read-only `GET /people`; Task 20 adds owner roster and budget endpoints using existing guarded operations. Route coverage and stale-role/revision tests are required. |
-| P3: 0021 ownership | App coordinator bindings/turns/questions belong to `conversation`; coordinator limits belong to the core schema/upgrade and are mirrored in app 0021, `execution_models.go` and the snapshot. Test standalone core and app/core reopen paths. |
-| P3: native credential phase | Device challenges, approvals, exchange and credentials move to Task 20/3b and migration 0030. Task 10 keeps browser API/auth dispatch; Task 19 follows credentials and uses migration 0031. |
-| P3: link import/export | Removed from Task 18. Add/forget remembered links remain within the brief's directory scope. |
-| P3: useful self-review | Replaced coverage assurances with explicit implementation choices, their reasons and release gates. |
-| P3: device approval | Tasks 16/20 show device label and request time and require typed code plus explicit browser approval. Link-only/prefilled approval fails tests. |
-| P3: subscription expiry | Task 19 records expiry capped by device lifetime, checks it on reads/live/ACK, disables subscriptions on device revocation and requires explicit re-subscription. Fake-clock tests cover the boundary. |
-| P3: service logout | Task 16 inspects lingering and reports "runner stops at logout" when off; Task 21 includes this state. Installation never enables lingering silently. |
-
-Round 1 code verification used `git rev-parse --short HEAD` (`86852f1`) and read-only `rg`/`sed`/`cat` inspection. `internal/runner/provider/accounts.go:639` removes lease runtime/config directories. The Claude and Codex `launcher.go` resume paths search their in-memory session maps. `internal/runner/runtime_direct.go:72` maps only reproduce/implement/review, and both provider constructors currently allow only the four existing task MCP tools. `internal/equipo/app.go:146` applies global CSRF protection before mounting the runner handler; pinned Rastrillo v0.30.1 `csrf.Protect` rejects mutating requests without browser evidence. These findings support Tasks 4, 7 and 10 directly.
-
-Also checked `.rastrillo/budgets.txt`, the budget `TestMain` harness, `team/store.go` (schema version 7), `models.go`/`execution_models.go`, `BeginEnrolmentRequest`/`BeginEnrolment`, `DecisionOwner`/`Project.Revision`, `SetMember`, `SaveBudgets`/`Budgets`, and the empty release certificates in `internal/release/manifest.json`. The new limits, context types, native credential flow and login fixtures are planned additions, not existing APIs. Ubuntu preflight and headless-login tests are requirements from the controller; no host setting or provider login was exercised here.
-
-Document checks passed: `git diff --check` (exit 0) and an in-memory structural check (exit 0) for 21 tasks, required task sections, package budget pairs, all 18 dispositions, 3b device routes and removal of superseded instructions. Only this plan file is changed. No product tests, provider runs, agents, servers, commits or pushes were performed, and no scratch files were created.
+- P2-1/P2-A: Remove default budget records; retain the integration time exception and permit measured runner/core raises with expected totals and reasons.
+- P2-B: Carry context in the claim; cap complete coordinator prompts and escaped frames, trim oldest history first, and test long 16 KiB-message conversations.
+- P2-C: Task 4 tests alternative connection selection; Task 7 tests coordinator waiting and lease release.
+- P2-D: Match the pending setup ID through `equipo-runner account login --setup <id>` and test terminal login/reporting.
+- P3s: Use the real machine label, name Task 1’s shared kernel, identify the blocking task on waiting cards, and review onboarding mockup copy before applying it.
+- Trim: Remove round 1 dispositions and self-review restatements; retain one verification paragraph and one supported setup ruling.