Plan 3: round 1 fixes (Astra)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+200
−135
docs/superpowers/plans/2026-11-04-equipo-plan-3-coordinator.md+200 −135
CI failed — run details
Intent
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 1273e018..6cffbf77 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 |
| @@ -4,11 +4,11 @@ |
| **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. |
| -**Architecture:** The instance owns conversations, plans, authority and delivery. A person's enrolled runner resumes that person's direct provider session and exposes only a scoped Equipo tool server to the coordinator. 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. 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. |
| **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`; `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`; `docs/superpowers/plans/2026-11-01-equipo-roadmap.md`; `docs/mockups/README.md` and the seven mockups named in the brief. |
| ## Global Constraints |
| @@ -38,16 +38,16 @@ |
| ## 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. |
| +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. |
| -- **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. Existing default specialists and manual connection setup suffice. |
| +- **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. |
| 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. |
| ### Baseline and Plan 2b review dependencies |
| -Inspected branch `plan-3` at `a446956`, containing direct-launch work through `9cd5910` and design revision 3. These are existing interfaces, not proposed replacements: |
| +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: |
| | Existing seam | Reuse and change in Plan 3 | |
| | --- | --- | |
| @@ -64,23 +64,55 @@ Before Task 1 implementation, compare the completed Plan 2b branch with these se |
| 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. |
| -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. Task 17 fails closed on missing provider capabilities; the two product choices are listed under Questions for Paul. |
| +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. |
| ## File structure and shared contracts |
| -Keep features beside existing `internal/equipo` operations. Put pure plan validation in new `internal/taskplan`, with no database or HTTP imports, to respect package size budgets. Put coordinator orchestration in new `internal/coordinator`, depending on neutral provider/runnerproto contracts rather than importing `equipo`. Every new Go package includes the existing budget `TestMain` pattern. Split files by responsibility rather than adding a second store or scheduler. |
| +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. |
| | Responsibility | Files introduced or extended | |
| | --- | --- | |
| -| Conversation, cards, threads | `internal/equipo/conversation_{models,store,views,handlers}.go`, `thread_store.go`, templates `conversation.html`, `thread.html`, `conversation_card.html` | |
| -| Plans and evidence | `internal/taskplan/{types,validate}.go`; `internal/equipo/{plans,plan_dispatch,plan_handlers,approval_settings}.go`; `internal/equipo/team/{plan_edit,feature_evidence,rendered_evidence,read_work}.go` | |
| -| Coordinator and tools | `internal/coordinator/{types,runtime,tools,recovery}.go`; `internal/equipo/{coordinator_store,coordinator_api,coordinator_tools}.go`; `internal/runnerproto/coordinator.go`; existing runner journal, proxy, service and provider policy files | |
| -| Preferences and live UI | `internal/equipo/preferences*.go`, `conversation_live.go`; existing live observer, navigation, task views and `static/equipo.css` | |
| -| Person API | `internal/equipo/person_api*.go`; `internal/personapi/{types,validate}.go`; `docs/api/equipo-v1.openapi.json` and later reviewed `docs/api/equipo-v1.md` | |
| -| Library and setup | `internal/equipo/{specialist_library,playbooks,templates_catalog,invites,onboarding,team_links}*.go`; `internal/runner/{install,account_login}.go`; `cmd/equipo-runner/main.go`; app-owned templates | |
| -| Push preparation | `internal/equipo/{notification_outbox,notification_api}.go`; recipient feed, subscription records and acknowledgements; no external push adapter | |
| - |
| -Migrations are assigned to the task that needs them: 0019 conversation (1), 0020 plans (2), 0021 coordinator (5), 0022 preferences (8), 0023 person API credentials (10), 0024 specialist library (12), 0025 playbooks (13), 0026 connection modes (14), 0027 invitations (15), 0028 onboarding (16), 0029 team links (18), 0030 notifications (19). Each also updates `models.go`, `migrations/schema.sql` and upgrade tests. Re-number only if the final 2b review adds migrations. Core execution schema changes also update `execution_models.go` and the core's ordered schema upgrade path; do not change a core schema version for a JSON-only field. |
| +| 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 | |
| +| Person API | `internal/equipo/personapi/{types,validate,handler,auth,conversation,devices,roster,budgets}.go`; `docs/api/equipo-v1.openapi.json` and later reviewed `docs/api/equipo-v1.md` | |
| +| Specialist and playbook library | `internal/equipo/library/{specialists,templates,playbooks,handlers,views}.go`; app-owned templates | |
| +| Invitations, onboarding, remembered teams | `internal/equipo/setup/{invites,onboarding,accounts,team_links,handlers}.go`; runner-local `internal/runner/setup/{install,account_login}.go`; `cmd/equipo-runner/main.go` wiring | |
| +| 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. |
| + |
| +```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. |
| + |
| +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: |
| @@ -93,75 +125,75 @@ 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.go`, `conversation_store.go`, `thread_store.go`, `internal/equipotest/conversation_test.go`, migration `0019_conversation.sql`; modify models, schema snapshot and migration tests. |
| +**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. |
| **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/equipotest -run '^TestConversation' -count=1`; expect missing operations or failed assertions. |
| +- [ ] **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`. |
| - [ ] **Implementation commit:** `feat: persist conversations and automatic task threads`. |
| ### Task 2: Add revisioned plans, approval settings and atomic graph edits |
| -**Files:** Create `internal/taskplan/{types,validate,validate_test,budget_test}.go`, `internal/equipo/{plans,plan_dispatch,approval_settings}.go`, `internal/equipo/team/plan_edit.go`, corresponding tests, `0020_plans.sql`; modify `tasks.go`, `task_prepare.go`, `team/{jobs,scheduler,model}.go`, schema/model mirrors. |
| +**Files:** Create `internal/taskplan/{types,validate,validate_test,budget_test}.go`, `internal/equipo/planning/{plans,dispatch,approval_settings,budget_test}.go`; add the atomic edit primitive to `team/jobs.go`, corresponding tests, `0020_plans.sql`; modify `tasks.go`, `task_prepare.go`, `team/{jobs,scheduler,model}.go`, schema/model mirrors. |
| **Interfaces:** `taskplan.Validate(p Plan) error` and `taskplan.ValidateEdit(before, after Plan, started map[string]bool) error`; `Store.ProposePlan(ctx context.Context, actor Actor, p taskplan.Plan, m Mutation) (taskplan.Plan,error)` for the verified person path; `Store.EditPlan(ctx context.Context, actor Actor, p taskplan.Plan, m Mutation) (taskplan.Plan,error)`; `Store.ApprovePlan(ctx context.Context, actor Actor, taskID string, m Mutation) (Task,error)`; `Store.CorrectTaskProject(ctx context.Context, actor Actor, taskID string, projectID int64, m Mutation) (Task,error)`. Task 6's coordinator path calls an internal transaction operation with coordinator attribution and delegated authority, never constructs a person `Actor`. |
| 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/equipotest -run '^TestPlan' -count=1`; expect failure. |
| +- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/taskplan ./internal/equipo/team ./internal/plan3test -run '^TestPlan' -count=1`; expect failure. |
| - [ ] **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`. |
| - [ ] **Implementation commit:** `feat: add guarded plan revisions and approval settings`. |
| ### Task 3: Define feature, rendered-change and read-only completion contracts |
| -**Files:** Create `internal/equipo/team/{feature_evidence,rendered_evidence,read_work}.go` and tests; modify `team/{model,evidence,git_evidence,policy,publication}.go`, `internal/equipo/{authority,runner_provenance}.go`; create `internal/equipo/rendered_approval.go`, `internal/runnerproto/types.go`. |
| +**Files:** Create `internal/taskplan/evidence.go`, `internal/equipo/planning/{evidence,rendered_approval}.go` and tests; modify `internal/equipo/team/{model,evidence,git_evidence,policy,publication}.go` only for core primitives, `internal/equipo/{authority,runner_provenance,execution_models}.go`, `internal/runnerproto/types.go`; include core evidence columns in 0020 and its core upgrade. |
| -**Interfaces:** Add `PredicateSoftwareFeature="software_feature"`, `PredicateRenderedChange="rendered_change"`; `FreezeFeatureEvidence(ctx context.Context, scope Scope, h Handle, acceptanceHash, definitionHash string) error`. Extend `EvidenceRequirement` with `FrozenAcceptanceHash` and `RenderedApprovalHash`; define `RenderedApproval{CandidateHash, RenderHash, Person string; DecisionRevision int64}` registered only through `Store.ApproveRenderedChange(ctx context.Context, actor Actor, taskID, candidateHash, renderHash string, m Mutation) error` in new `internal/equipo/rendered_approval.go`. The person field comes from that operation, never the submitted artifact. Add `CapScope`, `CapResearch`, `RoleAcceptance`, `RoleAnswer` and `AnswerResult{Body string; Sources []SourceRef}`, where `SourceRef{Kind, ID, Hash string; Revision int64}` references observed material, not an arbitrary model assertion. |
| +**Interfaces:** Add `PredicateSoftwareFeature="software_feature"`, `PredicateRenderedChange="rendered_change"`; `FreezeFeatureEvidence(ctx context.Context, scope Scope, h Handle, acceptanceHash, definitionHash string) error`. Extend `EvidenceRequirement` with `FrozenAcceptanceHash` and `RenderedApprovalHash`; define `RenderedApproval{CandidateHash, DiffHash, RenderHash, Decision, Person string; DecisionRevision int64}` registered only through `Store.ApproveRenderedChange(ctx context.Context, actor Actor, taskID, candidateHash, diffHash, renderHash, decision string, m Mutation) error` in new `internal/equipo/planning/rendered_approval.go`. The person field comes from that operation, never the submitted artifact. `decision` is `copy` or `design`; the current project `DecisionOwner` for that decision must match the verified actor in the write transaction. A requester or team owner has no implicit substitute authority. Changes affecting both decisions require both owners' approvals. `DecisionRevision` records the current `Project.Revision`, since `DecisionOwner` has no revision column today; recheck that project revision and the current decision/address before publication. Add `CapScope`, `CapResearch`, `RoleAcceptance`, `RoleAnswer` and `AnswerResult{Body string; Sources []SourceRef}`, where `SourceRef{Kind, ID, Hash string; Revision int64}` references observed material, not an arbitrary model assertion. |
| 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 owning person's approval of the exact rendered artifact; changed render/candidate invalidates approval. `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/equipotest -run 'TestFeature|TestRenderedChange|TestReadWork|TestEvidenceKinds' -count=1`; expect failure. |
| -- [ ] **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. Copy/design publication does require its owning person's rendered approval; 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, render approval and read-only target restrictions independently. |
| +- [ ] **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. |
| +- [ ] **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. |
| - [ ] **Implementation commit:** `feat: add feature evidence and sourced read-only results`. |
| ### Task 4: Execute the persisted plan through the current runner |
| -**Files:** Create `internal/equipo/plan_execution.go`, `internal/runner/plan_workflow.go`, `internal/equipotest/plan_workflow_test.go`; modify `task_prepare.go`, `runner_execution.go`, `runner_adapters.go`, `runnerproto/types.go`, runner `workflow.go`, `direct_workflow.go`, `turn_prompt.go`, `tools.go`, `witness.go`, checks and forge integration tests. |
| +**Files:** Create `internal/equipo/planning/execution.go`, `internal/runner/planflow/{types,workflow,prompt,budget_test}.go`, `internal/plan3test/plan_workflow_test.go`; modify `task_prepare.go`, `runner_execution.go`, `runner_adapters.go`, `runnerproto/types.go`, runner `workflow.go`, `direct_workflow.go`, `runtime_direct.go`, `turn_prompt.go`, `tools.go`, `tool_proxy.go`, `tool_socket.go`, `witness.go`; provider `claude/{launcher,answers}.go`, `codex/{launcher,native_approval,answers}.go`, `provider/{policy,direct_certification}.go`, their policy/launch/broker tests, `internal/release/{manifest.json,manifest.go,manifest_test.go}`, and checks/forge integration tests. |
| -**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. |
| +**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. `TestPlanWorkflowNoMidStepSwitch` rejects account, policy or plan changes after dispatch; cancellation waits for namespace proofs. |
| -- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/runner/... ./internal/equipotest -run '^TestPlanWorkflow' -count=1`; expect failure. |
| -- [ ] **Implement:** Replace `specialistFor` and fixed key-based behavior with immutable step snapshots; capability, not a display name, selects runner actions. 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` as regression guards. |
| +- [ ] **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. |
| - [ ] **Implementation commit:** `feat: execute revisioned plans with the direct runner`. |
| ### Task 5: Give coordinator turns fenced authority and accounted admission |
| -**Files:** Create `internal/equipo/{coordinator_store,coordinator_api}.go`, `internal/runnerproto/coordinator.go`, `internal/equipo/team/coordinator_admission.go`, tests, `0021_coordinator.sql`; modify runner API routing, core budget/period queries, authority, policy and model/schema mirrors. |
| +**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, SessionID string; Revision, Generation int64}`; `CoordinatorTurn{ID, MessageID, RequestID 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}`. 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. |
| -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 versioned coordinator-limit rows and their model/schema mirror in 0021; 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. |
| +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/equipotest -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; project work can select a different eligible connection for a later specialist step. Audit coordinator effects as `coordinator:<binding ID>`, with a separate delegating person field, not as a person write. |
| +- [ ] **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`. |
| - [ ] **Implementation commit:** `feat: admit coordinator turns with person-bound authority`. |
| ### Task 6: Expose only structured coordinator tools |
| -**Files:** Create `internal/coordinator/{types,tools,tools_test,budget_test}.go`, `internal/equipo/coordinator_tools.go`; modify `internal/runner/{tool_proxy,tool_socket,tools,tool_journal}.go`, provider policy constructors and runnerproto coordinator types; test `internal/equipotest/coordinator_tools_test.go`. |
| +**Files:** Create `internal/coordinator/{types,tools,tools_test,budget_test}.go`, `internal/equipo/conversation/tools.go`; modify `internal/runner/{tool_proxy,tool_socket,tools,tool_journal}.go`, provider policy constructors and runnerproto coordinator types; test `internal/plan3test/coordinator_tools_test.go`. |
| **Interfaces:** `CoordinatorToolCall{RequestID, Name string; Arguments json.RawMessage}`; `CoordinatorToolResult{ResourceID string; Revision int64; Value json.RawMessage}`; `Execution.CallCoordinatorTool(ctx context.Context, p RunnerPrincipal, claim CoordinatorClaim, call CoordinatorToolCall) (CoordinatorToolResult,error)`. `coordinator.ToolClient.Call(ctx context.Context, call CoordinatorToolCall) (CoordinatorToolResult,error)` is the runner-facing interface. The instance binds principal/session/turn/fence, never trusts them in arguments. |
| @@ -172,73 +204,75 @@ 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/equipotest -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`; expect failure. |
| - [ ] **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. |
| - [ ] **Implementation commit:** `feat: add the scoped coordinator tool server`. |
| -### Task 7: Resume the long-lived coordinator session safely |
| +### 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/runner/coordinator_runtime.go`; modify runner `service.go`, `runtime_direct.go`, journal/capture/recovery files and provider adapter 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 wire aliases consistently in `runnerproto`; the local Equipo names alias those neutral wire structures. The existing runner supplies namespace ownership, admission, capture and account lease implementations. Preserve its per-home lease across a whole active turn: a coordinator and specialist using the same account queue rather than racing token refresh. Closing the coordinator process after a clean turn releases that lease for project work. |
| +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. |
| -- [ ] **Tests first:** `TestCoordinatorSessionContinuity` sends two separately admitted turns through fake Claude/Codex adapters, resumes the same provider session after a clean boundary and retains conversation identity. `TestCoordinatorCrashNeverRedispatches` crashes before/after durable intent, stdin, tool commit, frame commit and server ACK; only completed results replay, uncertain turns wait for the person. `TestCoordinatorResumeRevalidates` 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 cumulative/provider-local accounting, duplicate final events, missing usage and resume baselines. |
| -- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/coordinator ./internal/runner ./internal/runner/provider/... -run '^TestCoordinator(Session|Crash|Resume|Stop|Usage)' -count=1`; expect failure. |
| -- [ ] **Implement:** A long-lived session is a durable provider session and person binding, not an immortal process or unbounded admission. Close and contain the process at a completed turn boundary; reopen/resume it for the next newly admitted turn on the same runner, account and policy. Preserve private session files outside disposable scratch. Each turn has a new bounded attempt and namespace, with events attached before `StartTurn`; provider session and local attempt IDs remain distinct. Runner death or incomplete output never resumes the uncertain turn automatically. Offer explicit retry as a new turn only after reconciliation, retaining the old unknown charge. Reset/switch connection increments generation and starts a new provider session from trusted stored context, not copied provider credentials or a cross-account resume. |
| -- [ ] **Green and guard mutations:** Repeat; expect PASS. Move durable barriers, resend uncertain prompts, ignore generation or reset usage baselines independently; require failures. Add journal upgrade/reopen tests without provider runs. |
| -- [ ] **Implementation commit:** `feat: run durable coordinator sessions through direct launch`. |
| +- [ ] **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. |
| +- [ ] 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. |
| +- [ ] **Implementation commit:** `feat: seed fresh coordinator turns from stored conversation context`. |
| ### Task 8: Make preferences inspectable and non-authoritative |
| -**Files:** Create `internal/equipo/{preferences,preference_handlers,preference_views}.go`, `templates/preferences.html`, `internal/equipotest/preferences_test.go`, `0022_preferences.sql`; modify coordinator prompt construction and `copy.go`. |
| +**Files:** Create `internal/equipo/conversation/{preferences,preference_handlers,preference_views}.go`, `templates/preferences.html`, `internal/plan3test/preferences_test.go`, `0022_preferences.sql`; modify coordinator prompt construction and `copy.go`. |
| **Interfaces:** `Preference{ID, Text, Status, SourceMessageID string; Revision int64}` where status is `confirmed` or `inferred`; `Store.Preferences(ctx context.Context, actor Actor) ([]Preference,error)`; `Store.SetPreference(ctx context.Context, actor Actor, p Preference, m Mutation) (Preference,error)`; `Store.DeletePreference(ctx context.Context, actor Actor, id string, m Mutation) error`; `Store.ConfirmedPreferences(ctx context.Context, actor Actor, projectID int64) ([]Preference,error)`. |
| 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. `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/equipotest ./internal/coordinator -run '^TestPreferences' -count=1`; expect failure. |
| +- [ ] **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. |
| - [ ] **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`. |
| - [ ] **Implementation commit:** `feat: add sourced and correctable personal preferences`. |
| ### Task 9: Build the live conversation, plan editor and question cards |
| -**Files:** Create conversation views/handlers/templates from the file map, `plan_handlers.go`, `templates/plan.html`, `conversation_live.go`, `internal/equipotest/conversation_browser_test.go`; modify `app.go`, live observer/changes, task/question views, navigation, `copy.go` and `static/equipo.css`. |
| +**Files:** Create conversation views/handlers/templates from the file map, `internal/equipo/planning/handlers.go`, `templates/plan.html`, `internal/equipo/conversation/live.go`, `internal/plan3test/conversation_browser_test.go`; modify `app.go`, live observer/changes, task/question views, navigation, `copy.go` and `static/equipo.css`. |
| **Interfaces:** GET/POST `/conversation`, GET/POST `/tasks/{id}/thread`, GET/POST `/tasks/{id}/plan`, POST `/tasks/{id}/plan/approve`, POST `/tasks/{id}/project`; retain question-answer and cancellation routes. `Store.ConversationCards(ctx context.Context, actor Actor) ([]Card,error)` projects current plans/tasks/questions. New private live topic keys include team, person and resource; `application.allowConversation(r *http.Request, key string) bool` checks persisted membership/ownership on every authorization. |
| 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/equipotest -run '^TestConversation(Scriptless|NoProject|Live|Question|Layout)' -count=1`; expect failure. |
| +- [ ] **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. |
| - [ ] **Implementation commit:** `feat: add live conversation cards and task discussions`. |
| -### Task 10: Establish the versioned person API and native sign-in contract |
| - |
| -**Files:** Create `internal/personapi/{types,validate,validate_test,budget_test}.go`, `internal/equipo/{person_api,person_api_auth,person_api_conversation}.go`, `internal/equipotest/person_api_test.go`, `docs/api/equipo-v1.openapi.json`, `0023_person_api.sql`; modify `app.go`, auth/session revocation integration and copy keys. |
| +### Task 10: Establish the versioned person API and explicit CSRF dispatcher |
| -**Interfaces:** `Store.PersonAPIHandler() http.Handler` mounted at `/api/v1`; `PersonPrincipal{Address, CredentialID string; SessionEpoch int64}` comes only from verified browser identity or a native person credential. `Store.BeginPersonDevice(ctx context.Context, publicKey, requestID string) (PersonDeviceChallenge,error)`; `ApprovePersonDevice(ctx context.Context, actor Actor, id string, m Mutation) error`; `ExchangePersonDevice(ctx context.Context, proof PersonDeviceProof) (PersonCredential,error)`; `RevokePersonDevice(ctx context.Context, actor Actor, id string, m Mutation) error`. Challenge/proof mirror existing runner enrollment's key-bound nonce/signature design but use distinct `equipo.person.v1` and `equipo.person.device.v1` audiences. Define a 10-minute single-use challenge, throttled polling, a 30-day revocable credential stored only as a keyed hash, and no provider credential fields. |
| +**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. |
| -`PersonDeviceChallenge{ID, DeviceSecret, UserCode, Challenge, VerificationURI string; ExpiresAt time.Time; PollIntervalSeconds int}`; `PersonDeviceProof{ID, DeviceSecret, Challenge, Nonce, Signature string}`; `PersonCredential{ID, Token, Audience, InstanceID string; ExpiresAt time.Time}`. Return device secrets only to the initiating client, and the bearer only on successful proof exchange; never return either in a device list. Limit challenge creation and failed polling by source and challenge, preserve a five-second poll interval, and consume approval/exchange atomically. For an exchange whose response is lost, allow the same signed nonce to retrieve the same short-lived encrypted exchange result; never mint a second credential or reopen an already used challenge. Delete the encrypted result after its 10-minute exchange window. |
| +**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. |
| -- [ ] **Tests first:** `TestPersonAPIAuthAudiences` rejects runner, cleanup, coordinator and other-instance tokens, mixed cookie/bearer auth and forged person fields. `TestPersonAPIBrowserCSRF` rejects cross-origin cookie writes and missing browser evidence; native writes without browser headers work only with a valid person bearer and no cookies. `TestPersonAPIRevisionReplay` asserts required `If-Match`, conflict on stale revision, duplicate result replay and changed-body conflict across browser/API. `TestPersonAPIDeviceApproval` requires verified keymail identity, matching key/nonce, current roster and single-use exchange; revocation/session epoch applies immediately. `TestPersonAPIConversationParity` checks private reads, task-thread visibility, cards and answers match HTML operations. |
| -- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/personapi ./internal/equipotest -run '^TestPersonAPI' -count=1`; expect failure. |
| -- [ ] **Implement:** Document and implement the 3a rows of the API table below. Use `csrf.SameOrigin`/`csrf.Protect` for cookie writes. The existing outer middleware would reject a native client without browser headers: dispatch `/api/v1` through an audience-validating authentication middleware before choosing native-bearer or browser-CSRF handling. Do not add a prefix-wide CSRF exemption. Validate credential before bypassing browser evidence, reject cookies on the native lane, and never enable credentialed cross-origin access. Keep current framework sign-in/session handling. Device-token exchange is the only unauthenticated person-token endpoint and requires its own signed challenge proof, expiry, rate limit and prior browser approval. Return JSON errors, not sign-in HTML, for API failures. |
| -- [ ] **Green and guard mutations:** Repeat; expect PASS. Break audience separation, CSRF branch, key proof, current roster and revision guards individually. Validate OpenAPI operations against route tests and run `make migration-check`. |
| -- [ ] **Implementation commit:** `feat: expose person-authenticated conversation API v1`. |
| +- [ ] **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. |
| +- [ ] **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. |
| +- [ ] **Implementation commit:** `feat: expose person API v1 through explicit auth and CSRF lanes`. |
| ### Task 11: Prove and package the 3a usable stop |
| -**Files:** Create `internal/equipotest/coordinator_acceptance_test.go`; modify relevant release tests/requirements, `Makefile` only for delegating targets, `copy.go`; create the 3a section in `docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md` and future reviewed `docs/plan-3-acceptance.md`. |
| +**Files:** Create `internal/plan3test/coordinator_acceptance_test.go`; modify relevant release tests/requirements, `Makefile` only for delegating targets, `copy.go`; create the 3a section in `docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md` and future reviewed `docs/plan-3-acceptance.md`. |
| **Interfaces:** No new product interface. Exercise Tasks 1–10 through real HTTP, the runner service, fake provider streams, local Git and the existing fake forge. Report separate offline pass, pending copy and pending live certification states. |
| - [ ] **Tests first:** `TestCoordinatorAcceptance3A` signs in two fixture people, starts a bug and feature from messages, gets one sourced recommendation with one family, edits a future step, answers a question, corrects an unstarted project, routes a reply, changes a preference, cancels active work and restarts mid-turn. Assert independent-family exact-candidate evidence, publication readback, human wait, isolated accounts and no duplicate task/turn/delivery. `TestCoordinatorReleaseNeedsPolicyCertification` rejects old/missing tuples and pending copy for new coordinator policies. |
| -- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/equipotest -run '^TestCoordinator(Acceptance3A|Release)' -count=1`; expect missing behavior to fail. |
| +- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test -run '^TestCoordinator(Acceptance3A|Release)' -count=1`; expect missing behavior to fail. |
| - [ ] **Implement integration fixes:** Finish wiring discovered by the acceptance test. List every new runtime key from the copy inventory; obtain review before release through the later controller's chosen review channel, without starting a copy-review server in this task. Do not mark pending entries reviewed on the strength of the mockups. Prepare bounded live acceptance inputs and certification assertions; no provider run is authorized by this plan-writing session. |
| - [ ] **Green and gates:** Repeat targeted command; mutate duplicate-delivery, early-success and release-eligibility guards. Run `CGO_ENABLED=0 go build ./cmd/equipo ./cmd/equipo-runner`, `make migration-check`, then `make ci` once on a namespace-capable machine. Preserve `.amadan/ci` and `.amadan/ci.d/` delegation. Record the relevant Plan 2b gate result, changed policy identities and any remaining blocker. No fake provider fixture can certify a production tuple. |
| - [ ] **Usable acceptance and implementation commit:** After 2b dependencies and reviewed copy, Paul authorizes a bounded certification/try-out with his dedicated homes and disposable repository. He performs the three request kinds, sees the branch/evidence, cancels and merges manually. Keep the release disabled until this gate passes. Subject: `test: verify the coordinator conversation acceptance flow`. |
| @@ -247,150 +281,159 @@ Add GET/POST `/settings/coordinator` for Task 5’s own binding/reset and owner- |
| ### Task 12: Add custom specialists and versioned specialist templates |
| -**Files:** Create `internal/equipo/{specialist_library,templates_catalog,specialist_handlers}.go`, templates `specialist_form.html`, `template_library.html`, `internal/equipotest/specialist_library_test.go`, `0024_specialist_library.sql`; modify specialists, connection selection, navigation, icons, provider policy and copy keys. |
| +**Files:** Create `internal/equipo/library/{specialists,templates,handlers,budget_test}.go`, templates `specialist_form.html`, `template_library.html`, `internal/plan3test/specialist_library_test.go`, `0024_specialist_library.sql`; modify specialists, connection selection, navigation, icons, provider policy and copy keys. |
| **Interfaces:** `SpecialistInput{Key, Name, Icon, Instructions string; AllowedModels []ModelRef; Tools []string; ProjectIDs []int64; MaxConcurrent int}` with `ModelRef{Provider, Family, Model string}`; `Store.CreateSpecialist(ctx context.Context, actor Actor, in SpecialistInput, m Mutation) (Specialist,error)`; `UpdateSpecialist` with the same signature; `DeleteSpecialist(ctx context.Context, actor Actor, key string, m Mutation) error`. `TemplateRef{ID string; Version int64}`; `InstallSpecialistTemplate(ctx context.Context, actor Actor, ref TemplateRef, m Mutation) (Specialist,error)`; `SpecialistTemplateDiff(ctx context.Context, actor Actor, key string, target TemplateRef) (TemplateDiff,error)` where diff contains old/current/suggested field values. |
| 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/equipotest ./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`; expect failure. |
| - [ ] **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. |
| - [ ] **Implementation commit:** `feat: add custom specialists and template copies`. |
| ### Task 13: Add playbooks, defaults and explicit template updates |
| -**Files:** Create `internal/equipo/{playbooks,playbook_handlers,playbook_views}.go`, templates `playbooks.html`, `playbook_form.html`, `internal/equipotest/playbooks_test.go`, `0025_playbooks.sql`; extend template catalog, plan validation/coordinator tools and copy keys. |
| +**Files:** Create `internal/equipo/library/{playbooks,playbook_handlers,views}.go`, templates `playbooks.html`, `playbook_form.html`, `internal/plan3test/playbooks_test.go`, `0025_playbooks.sql`; extend template catalog, plan validation/coordinator tools and copy keys. |
| **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/equipotest -run '^TestPlaybook' -count=1`; expect failure. |
| +- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/taskplan ./internal/plan3test -run '^TestPlaybook' -count=1`; expect failure. |
| - [ ] **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`. |
| - [ ] **Implementation commit:** `feat: add editable playbooks and project defaults`. |
| ### Task 14: Complete personal connection choices and model reasons |
| -**Files:** Modify `internal/equipo/{connections,connection_selection,connection_models,connection_handlers,connection_views,runner_execution}.go`, connection/project/plan templates and copy keys; create `internal/equipotest/plan_model_choice_test.go`. |
| +**Files:** Create `internal/equipo/planning/selection.go`; modify `internal/equipo/{connections,connection_selection,connection_models,connection_handlers,connection_views,runner_execution}.go` for delegation and existing record fields, connection/project/plan templates and copy keys; create `internal/plan3test/plan_model_choice_test.go`. |
| **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. |
| -- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/equipotest -run '^TestPlanModelChoice' -count=1`; expect failure. |
| -- [ ] **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. 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. |
| +- [ ] **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. |
| +- [ ] **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`. |
| - [ ] **Implementation commit:** `feat: show and guard per-step personal model choices`. |
| ### Task 15: Accept invitations through verified person identity |
| -**Files:** Create `internal/equipo/{invites,invite_handlers}.go`, `templates/invite.html`, `internal/equipotest/invites_test.go`, `0027_invitations.sql`; modify auth/roster routes and copy keys. |
| +**Files:** Create `internal/equipo/setup/{invites,invite_handlers,budget_test}.go`, `templates/invite.html`, `internal/plan3test/invites_test.go`, `0027_invitations.sql`; modify auth/roster routes and copy keys. |
| **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/equipotest -run '^TestInvite' -count=1`; expect failure. |
| +- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test -run '^TestInvite' -count=1`; expect failure. |
| - [ ] **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`. |
| - [ ] **Implementation commit:** `feat: accept team invitations with verified identity`. |
| ### Task 16: Install and pair the supported own-machine runner |
| -**Files:** Create `internal/runner/install.go`, `install_test.go`, `internal/equipo/{onboarding,onboarding_handlers}.go`, `templates/onboarding.html`, `0028_onboarding.sql`; modify `cmd/equipo-runner/main.go`, existing enrolment/config/packaging/release tests; create a versioned installer asset and `internal/equipotest/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, `cmd/equipo-runner/main.go`, existing enrolment/config/packaging/release tests; create a versioned installer asset and `internal/plan3test/onboarding_install_test.go`. |
| -**Interfaces:** `runner.InstallUser(ctx context.Context, opts InstallOptions) (InstallResult,error)` with `InstallOptions{Release, Root, InstanceOrigin string; EnableService bool}` and `InstallResult{Version, BinaryPath, ServicePath string}`; `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. |
| +**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; do not invent a second enrollment protocol. |
| +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. |
| -- [ ] **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` rejects replay/expiry/wrong machine and pairs only after the intended person's verified browser approval. `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 ./cmd/equipo-runner ./internal/equipotest -run '^TestOnboarding(Install|Pairing|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 install a user service and prompt for the short pairing code on the terminal, not in argv. 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 persistence is the explicit install action. Mac and unsupported Linux architectures get an accurate unavailable state pending certified containment/packaging; do not claim that compiling Go makes them supported. |
| -- [ ] **Green and guard mutations:** Repeat; require PASS. Break manifest verification, code binding, 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 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. |
| - [ ] **Implementation commit:** `feat: add versioned user runner installation and pairing`. |
| ### Task 17: Connect dedicated accounts and finish safe onboarding |
| -**Files:** Create `internal/runner/{account_login,account_login_test}.go`, `internal/runner/provider/login.go`, `internal/equipo/account_setup.go`, `internal/equipotest/onboarding_accounts_test.go`; modify runner command/config, onboarding views/routes, connection reports and copy keys. |
| +**Files:** Create `internal/runner/setup/{account_login,account_login_test}.go`, `internal/runner/provider/login.go`, `internal/equipo/setup/accounts.go`, `internal/plan3test/onboarding_accounts_test.go`; modify runner command/config, onboarding views/routes, connection reports and copy keys. |
| -**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 safe challenge metadata, never tokens. Home paths and provider device secrets stay runner-local. |
| +**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 string; Challenge *provider.LoginChallenge; ConnectionID string; Revision int64}` with states `waiting_runner`, `pending`, `connected`, `expired`, `denied`, `cancelled`, `unavailable`. 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; 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. |
| -- [ ] **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. `TestOnboardingNoDeviceCapability` returns unavailable for a missing supported flow and never invents a verification URL or scrapes 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/equipotest -run '^TestOnboarding(Account|Device|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. Claude device authentication remains unavailable until a supported flow is verified, or Paul accepts its supported browser-login alternative. 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. |
| +- [ ] **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. |
| - [ ] **Implementation commit:** `feat: onboard personal accounts and a safe first task`. |
| ### Task 18: Put Teams above the team on web and phone |
| -**Files:** Create `internal/equipo/{team_links,team_link_handlers}.go`, `templates/teams.html`, `internal/equipotest/teams_navigation_test.go`, `0029_team_links.sql`; modify navigation/chrome/index/layout, sign-in success handling, preference landing setting and copy keys. |
| +**Files:** Create `internal/equipo/setup/{team_links,team_link_handlers}.go`, `templates/teams.html`, `internal/plan3test/teams_navigation_test.go`, `0029_team_links.sql`; modify navigation/chrome/index/layout, sign-in success handling, preference landing setting and copy keys. |
| **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/equipotest -run '^TestTeams' -count=1`; expect failure. |
| -- [ ] **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. Allow import/export of nonsecret link metadata so the same list can be copied between instances; imported entries have unknown last-sign-in time. 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. |
| +- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/plan3test -run '^TestTeams' -count=1`; expect failure. |
| +- [ ] **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. |
| - [ ] **Implementation commit:** `feat: add the Teams directory and web navigation hierarchy`. |
| ### Task 19: Add the durable notification outbox and subscription feed |
| -**Files:** Create `internal/equipo/{notification_outbox,notification_api}.go`, `internal/equipotest/notifications_test.go`, `0030_notifications.sql`; modify question/conversation/plan commit hooks, API schema, current-member revocation and copy keys. |
| +**Files:** Create `internal/equipo/notifications/{models,outbox,api,budget_test}.go`, `internal/plan3test/notifications_test.go`, `0031_notifications.sql`; modify question/conversation/plan commit hooks, API schema, current-member revocation and copy keys. |
| **Interfaces:** `Notification{ID, Kind, ResourceID, DeepLink string; ResourceRevision int64; CreatedAt time.Time; State string}`; `Store.Notifications(ctx context.Context, actor Actor, cursor string, limit int) (personapi.Page[Notification],error)`; `Store.SubscribeNotifications(ctx context.Context, actor Actor, deviceID string, m Mutation) (NotificationSubscription,error)`; `Store.AcknowledgeNotification(ctx context.Context, actor Actor, subscriptionID, notificationID string, m Mutation) error`; `UnsubscribeNotifications` with the same actor/subscription/mutation pattern. Subscriptions belong to a person device credential and have independent delivery cursors. Wire responses contain no bearer or permission answer capability. |
| -Define `NotificationSubscription{ID, DeviceID, Cursor string; Revision int64; Active bool}`; the recipient comes from the verified actor and is never a submitted field. 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. |
| +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. `TestNotificationNoExternalDelivery` registers no APNs/FCM/network sender and stores no provider secrets or arbitrary callback URL. |
| -- [ ] **Red:** `CGO_ENABLED=0 go test ./internal/equipotest -run '^TestNotification' -count=1`; expect failure. |
| +- [ ] **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. |
| - [ ] **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 and stale-resource checks; run `make migration-check`. |
| +- [ ] **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`. |
| - [ ] **Implementation commit:** `feat: add a person-scoped notification outbox`. |
| ### Task 20: Complete and document the native-facing JSON API |
| -**Files:** Extend `internal/personapi` projections and `internal/equipo/person_api_*.go`; create `internal/equipotest/person_api_contract_test.go`; complete `docs/api/equipo-v1.openapi.json` and reviewed `docs/api/equipo-v1.md`; modify copy keys for exposed validation states. |
| +**Files:** Extend `internal/equipo/personapi` projections; create its `devices.go`, `roster.go`, `budgets.go`, `internal/plan3test/{person_api_contract,person_device}_test.go`, `0030_person_devices.sql`; modify app auth dispatch, model/schema mirrors and thin store adapters; complete `docs/api/equipo-v1.openapi.json` and reviewed `docs/api/equipo-v1.md`; modify copy keys for exposed validation states. |
| + |
| +**Interfaces:** Implement every 3b row below using the same store operations as HTML, including CRUD, template install/diff/apply, account choices, setup status and invitation acceptance. OpenAPI is the versioned contract, not autogenerated exposure of database models. Handler registration supplies operation IDs consumed by `TestPersonAPIContractCoverage`. Implement this task before Task 19 so subscriptions can bind real person-device credentials. Task 20 checks all non-notification routes; Task 19 adds its notification rows to the coverage test and Task 21 requires the whole contract. |
| + |
| +**Device interfaces (3b):** `Store.BeginPersonDevice(ctx context.Context, publicKey, label, requestID string) (PersonDeviceChallenge,error)`; `ApprovePersonDevice(ctx context.Context, actor Actor, id, typedCode string, m Mutation) error`; `ExchangePersonDevice(ctx context.Context, proof PersonDeviceProof) (PersonCredential,error)`; `RevokePersonDevice(ctx context.Context, actor Actor, id string, m Mutation) error`. Use separate `equipo.person.v1` and `equipo.person.device.v1` audiences, with a 10-minute single-use key-bound nonce/signature challenge and five-second throttled polling. Device label and server creation time appear on the browser approval page; the person must type the code from the initiating client. A link or prefilled code cannot approve a device. The bearer expires after 30 days, is revocable immediately, and is stored only as a keyed hash. |
| + |
| +Define `PersonDeviceChallenge{ID, DeviceSecret, UserCode, Challenge, VerificationURI string; ExpiresAt time.Time; PollIntervalSeconds int}`, `PersonDeviceProof{ID, DeviceSecret, Challenge, Nonce, Signature string}` and `PersonCredential{ID, Token, Audience, InstanceID string; ExpiresAt time.Time}`. Device secrets go only to the initiating client and the bearer only to a successful proof exchange, never to device lists. Rate-limit challenge creation and failed polls by source/challenge, consume approval and exchange atomically, and check current roster/session epoch on every use. For a lost exchange reply, permit the same signed nonce to retrieve the same encrypted result for at most 10 minutes; never mint another credential. Delete that result on expiry. Challenge creation and exchange are narrow public handlers with their own rate limits/proofs; approval remains a verified browser-session route under CSRF protection. Neither runner credentials nor provider login codes are accepted. |
| -**Interfaces:** Implement every 3b row below using the same store operations as HTML, including CRUD, template install/diff/apply, account choices, setup status and invitation acceptance. OpenAPI is the versioned contract, not autogenerated exposure of database models. Handler registration supplies operation IDs consumed by `TestPersonAPIContractCoverage`. |
| +**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 implemented methods/routes/schemas with OpenAPI and fails for missing/undocumented operations. `TestPersonAPISharedOperations` runs specialist/playbook/project/connection/onboarding actions by HTML and JSON and compares authority, revisions, audits and results. `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/personapi ./internal/equipotest -run '^TestPersonAPI(Contract|Shared|Native|Pagination|Schema)' -count=1`; expect failure. |
| +- [ ] **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. |
| - [ ] **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 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:** 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. |
| - [ ] **Implementation commit:** `feat: complete the versioned person API contract`. |
| ### Task 21: Verify the 3b onboarding-to-work path and release boundary |
| -**Files:** Create `internal/equipotest/onboarding_acceptance_test.go`; extend API contract/release tests, `copy.go`, controller report and future reviewed acceptance documentation. Preserve Make/CI delegation. |
| +**Files:** Create `internal/plan3test/onboarding_acceptance_test.go`; extend API contract/release tests, `copy.go`, controller report and future reviewed acceptance documentation. Preserve Make/CI delegation. |
| **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. |
| -Do not mark this stop fully complete if Paul requires either unsupported onboarding path in the questions below. The Linux/Codex path is independently usable; the controller must report the exact platform/provider coverage. It exercises the complete supported own-machine path without touching real accounts, services or remote repositories. |
| +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. |
| -- [ ] **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. Assert all three mandatory publishing steps, correct personal accounts, no silent template updates, Teams links and one durable notification per effect. `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/equipotest -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 unresolved Mac/Claude support accurately gated. 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 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. |
| - [ ] **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 10 exception with its own proof and throttling. |
| +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. |
| 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`. |
| | Part | Resource and operations | Result / shared operation | |
| | --- | --- | --- | |
| | 3a | `GET /me`; `GET /capabilities`; `GET /me/settings`; `PATCH /me/settings` | Person, current team, version/capabilities, typed personal settings and landing preference | |
| -| 3a | `POST /auth/devices`; `POST /auth/devices/exchange`; browser `POST /auth/devices/{id}/approve`; `GET /auth/devices`; `DELETE /auth/devices/{id}` | Person device challenge, proof exchange, explicit approval, own devices/revocation | |
| +| 3b | `POST /auth/devices`; `POST /auth/devices/exchange`; browser `POST /auth/devices/{id}/approve`; `GET /auth/devices`; `DELETE /auth/devices/{id}` | Person device challenge, proof exchange, typed-code browser approval with device label/time, own devices/revocation | |
| +| 3a | `GET /people` | Read-only current-team identity/role projection for active members; no private preferences or credentials | |
| +| 3b | `GET /roster`; `PUT /roster/{address}` | Owner-only roster administration through guarded SetMember; last-owner and decision-owner protections | |
| +| 3b | `GET /budgets`; `PUT /budgets` | Owner-only team/project BudgetConfig through guarded Budgets/SaveBudgets; revision and audit checks | |
| | 3a | `GET /conversation`; `POST /conversation/messages` | ConversationPage / SendMessage | |
| | 3a | `GET /conversation/cards`; `GET /cards/{id}` | Current task, question, proposal or suggestion projection with resource revision | |
| | 3a | `GET /tasks`; `GET /tasks/{id}`; `POST /tasks`; `POST /tasks/{id}/cancel` | Shared task list/detail; validated explicit task proposal; existing cancellation | |
| | 3a | `GET /tasks/{id}/thread`; `POST /tasks/{id}/thread/messages`; `POST /conversation/messages/{id}/route` | TaskThread, SendMessage and explicit RouteMessage | |
| | 3a | `GET /tasks/{id}/plan`; `PATCH /tasks/{id}/plan`; `POST /tasks/{id}/plan/approve`; `POST /tasks/{id}/project` | Current plan, EditPlan, ApprovePlan, CorrectTaskProject | |
| -| 3a | `GET /questions/{id}`; `POST /questions/{id}/answer`; `POST /tasks/{id}/rendered-approval`; `POST /tasks/{id}/acknowledge-merge` | Clarification/native question union, typed answer, person rendered approval and existing human merge acknowledgement; never merge itself | |
| +| 3a | `GET /questions/{id}`; `POST /questions/{id}/answer`; `POST /tasks/{id}/rendered-approval`; `POST /tasks/{id}/acknowledge-merge` | Clarification/native question union, typed answer, project copy/design decision-owner approval bound to the candidate diff and trusted render, and existing human merge acknowledgement; never merge itself | |
| | 3a | `GET /journey`; `GET /needs-you` | Real planned-step projections and current person's actionable work; nullable counts | |
| | 3a | `GET /preferences`; `POST /preferences`; `PATCH /preferences/{id}`; `DELETE /preferences/{id}` | Own inferred/confirmed preferences and guarded confirmation/correction/deletion | |
| | 3b | `GET /teams`; `POST /teams/links`; `PATCH /teams/links/{id}`; `DELETE /teams/links/{id}` | Remembered instance links; no federation access | |
| @@ -405,7 +448,7 @@ GET returns explicit JSON projections and `ETag: "<revision>"`. Resource updates |
| | 3b | `GET /runners`; `GET /runners/{id}`; `POST /runners/enrol/approve`; `DELETE /runners/{id}` | Own runners, existing pairing approval/revocation; never runner bearer material | |
| | 3b | `GET /onboarding`; `POST /onboarding/advance`; `POST /account-setups`; `GET /account-setups/{id}`; `DELETE /account-setups/{id}` | Prerequisite state, runner-local login requests and safe challenge status/cancellation | |
| | 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 subscription and idempotent acknowledgement | |
| +| 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. |
| @@ -418,38 +461,60 @@ These are keys/meanings to add in `internal/equipo/copy.go`, individually pendin |
| | 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`; all coordinator MCP tool descriptions/errors | |
| +| 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 | |
| | 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 approval/expiry/revoke labels | |
| +| 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 label, 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, pairing label/time and typed-code instructions, safe-first-task choice | |
| | 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`; no promise of live mobile push delivery | |
| +| 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 |
| -- **Spec coverage:** §§3.1/5.1/6.6 → Tasks 1, 5–8, 10; §§3.4/6.7 → 2, 4; §§4.2–4.4 and 13.4–13.5 → 1, 6, 9; §6.3's complete task-kind table → 3–4; §§6.4–6.5/13.1–13.2 → preserved 2b contracts and 4–7, 17; §7/13.12 → 5, 14, 17; §13.3 → 18; §§13.6–13.7/13.9 → 12–13; §13.8 API/push preparation → 10, 19–20; §§13.10–13.11 supported own-machine onboarding → 15–17, 21. Human project ownership and required approvals remain enforced without implementing Plan 4 coordinator routing. |
| -- **Explicit limits:** Mac containment and a supported Claude device-code flow are not established by the checkout. They are not claimed as working paths. Two questions below decide the acceptable first onboarding surface. Web Teams is a person-maintained links directory, as scoped by the brief, with automatic recording of the current instance only; cross-origin session discovery/count aggregation is not fabricated. CARLOS signals, settlement, other-person task routing, hosted execution, provider cloud agents and native app code stay later. |
| -- **Step scan:** Each task has exact files, produced/consumed contracts, named assertions, red/green commands, independent guard mutations and an implementation-only commit subject. No product function bodies or test bodies are supplied. Thin API lifecycle operations have named owners rather than being assumed to exist. |
| -- **Type consistency:** `Mutation`, `taskplan.Plan/Step/Kind`, coordinator wire structures, explicit person projections and source references have one declared meaning each. Existing `team.Scope`, `Handle`, provider session/turn/admission and runner selection types remain separate. Coordinator attribution does not become `Actor`. Empty evidence predicates are restricted to the read-only/conversation targets, never accepted for publication. The coordinator conversation target uses completion of an admitted turn and durable result delivery, the same no-publication rule as read-work; it does not mark the lifelong conversation finished. |
| -- **Review focus:** Race/revision tests → 2/9/10; uncertain dispatch/tool replay → 5–7; private conversations/preferences/tokens/notifications → 1/8/10/17/19; suggested privilege/predicate changes → 3/6/12–14; setup gaps/unknown data → 16–18. All five review-focus entries have explicit tests in owning tasks. |
| -- **Proportion:** 11 tasks in 3a and 10 in 3b. Each part ends with a usable path, subject to stated upstream live gates. Existing containment, journal, evidence, question and publication machinery is extended rather than replaced. Repeated constraints live in the global section; API endpoints and copy meanings have one inventory each. |
| -- **Planning verification:** Read the complete design, roadmap, named mockups, writing-plans skill and relevant Plan 2b plan/code/report sections. Checked current provider contracts, fixed bug graph, atomic store bridge, live/CSRF v0.30.1 APIs, Amadan readback and empty certification manifest. Ran only local inspection/help and document checks in this planning session. Product tests, provider logins/runs, servers, helper agents, commits and pushes were not performed. Future red/green and certification results are requirements, not results claimed here. |
| - |
| -## Questions for Paul |
| - |
| -1. **May 3b's first own-machine onboarding release support Linux/amd64, with Mac clearly unavailable until a separately designed and certified containment backend exists?** This matches the runner that 2b built. Requiring Mac in 3b adds a platform implementation and its own release gate; an unconfined Mac fallback would violate the chosen design. |
| -2. **If Claude still has no verified supported device-code flow at implementation time, is its supported browser sign-in on the enrolled machine acceptable, while Codex uses device code?** Otherwise keep Claude onboarding unavailable until that provider capability exists. In both cases credentials stay in a dedicated Equipo home on the person's machine. |
| - |
| -**Ruled overnight by the controller (Paul asked for progress without him; he |
| -can overrule in the morning):** |
| -1. Yes. 3b's own-machine onboarding ships Linux first. The Mac shows the |
| - runner as "coming later" until a separately designed and certified |
| - containment backend exists. The Mac app can still be a client of a Linux |
| - runner. No unconfined fallback. |
| -2. Yes. If Claude has no verified device-code flow at implementation time, |
| - its official browser sign-in on the enrolled machine is acceptable, |
| - writing only into the dedicated Equipo home; Codex uses device code. |
| +- 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 |
| + |
| +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. |
| + |
| +## Round 1 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. |