carlos / platform Public

plan: implement stateless replicas in four stages

Define the shared contract and 15 tasks for stateless runtime, fleet
placement, hub routing, coordinated deploys and the two-box dev drill.
Keep 75 copy rows pending review and replicas behind their release floor.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 52db25964f9a979dc83696f76614c96e9164253b parent 1e8ddc5
6 files changed, +678 −0
  • docs/superpowers/plans/2026-11-01-stateless-replicas-0-index.md +131 −0
  • docs/superpowers/plans/2026-11-01-stateless-replicas-1-runtime.md +114 −0
  • docs/superpowers/plans/2026-11-01-stateless-replicas-2-placement.md +94 −0
  • docs/superpowers/plans/2026-11-01-stateless-replicas-3-routing.md +92 −0
  • docs/superpowers/plans/2026-11-01-stateless-replicas-4-deploy-and-drill.md +137 −0
  • docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md +110 −0

CI passed — run details

Intent

Human

Go ahead.

Human

Is something working?

Attributed to this commit: 91.7 g CO₂e (11,642,561 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-stateless-replicas, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/docs/superpowers/plans/2026-11-01-stateless-replicas-0-index.md b/docs/superpowers/plans/2026-11-01-stateless-replicas-0-index.md
new file mode 100644
index 000000000..b7793b4d2
--- /dev/null
+++ b/docs/superpowers/plans/2026-11-01-stateless-replicas-0-index.md
@@ -0,0 +1,131 @@
+# Stateless replicas: series and shared contract Implementation Plan
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** Run explicitly stateless fleet apps on distinct boxes and survive losing one fleet box.
+
+**Architecture:** Keep one instance record and a set of assigned boxes. Separate serving from coordination, probe copies through existing tunnels, and authorize one box swap at a time.
+
+**Tech Stack:** Go, existing release.Store compare-and-swap, console API, reverse HTTP/2 tunnels, systemd and cgroups on Linux.
+
+**Spec:** `docs/superpowers/specs/2026-11-01-stateless-replicas-design.md` (rev 2, approved 2026-11-01).
+
+## Global Constraints
+
+- Copy: use the series copy deck, ids `SR-<plan>-C<nn>`, pending until Paul's copy review; apply edits verbatim before building strings. No em dashes; neutral shop/example.com names.
+- Census in every root-scope task: `make census-card`, CLAIMS, `make census-propose NAME=<branch> CLAIMS=<file>`, independent reviewer on amadan #280. Maintain the separate record-write census.
+- Verification: at most 10 mutations per task, only refusal/security/termination/lifecycle paths, each with targeted `-run`. Local tests once with `-count=1`, one touched-package `-race` run per plan; CI runs the full suite. Smoke real dev as soon as end-to-end behavior works.
+- Cross-compile: `GOOS=darwin go build ./...`, `GOOS=windows go build ./...`, `GOOS=linux GOARCH=arm64 go build ./...`. Linux code in `_linux.go`; default Go cache, disk scratch, cleanup.
+- Requests: no new per-box/per-copy bucket polling. Use the index's existing reads/reports; one coordinator renewal per instance, zero bucket calls on requests/probes.
+- Provider-neutral core: no AWS assumptions outside adapters.
+- Floors: copies default 1; above 1 requires every fleet box and console at StatelessReplicasFloor. Unreadable evidence refuses. Do not release that floor before Plan 4 passes. Stateless launches require StatelessRuntimeFloor.
+- Dev first: two-box dev fleet; the first user's fleet is outside scope. AGENTS.md scoped approval precedes shared-account infrastructure/machine changes, including the drill and cleanup.
+- Read the index/spec rev 2. Additive wire fields; one host record, one copy per box; web/workers independent of coordination. Carry review history and stopping rules from AGENTS.md; land each plan only through reviewed, green amadan CI. This session commits plans without pushing.
+
+## Review Focus
+
+1. Old readers and absent fields retain copies=1 and local database behavior: Plan 1 Task 1 `TestStatelessManifestCompatibility`.
+2. A stale coordinator cannot publish success or stop serving copies: Plan 1 Task 2 `TestCoordinatorTermFencesLateResults`.
+3. Two independently edited instance records receive the same app-level count without sharing a coordinator: Plan 2 Task 1 `TestCopiesApplyToEveryInstance`.
+4. A tunnel can remain connected after its app dies: Plan 3 Task 1 `TestReplicaProbeFailureWithoutTunnelLoss`.
+5. An offline copy returns after release success and must not run migrations again: Plan 4 Task 2 `TestReplicaReturnsAfterDeploy`.
+
+---
+
+## Build order and finish lines
+
+| Order | Plan | Tasks | Working result at its merge |
+|---|---|---:|---|
+| 1 | `2026-11-01-stateless-replicas-1-runtime.md` | 4 | Ship and run a stateless rootfs or binary app with one copy, including workers, release, secrets and commands; no dummy SQLite or serving lease. Smoke it on dev immediately. |
+| 2 | `2026-11-01-stateless-replicas-2-placement.md` | 3 | Set/read copies=1, deterministic set placement and shortfall convergence, with multi-copy admission tested behind the unreleased floor. |
+| 3 | `2026-11-01-stateless-replicas-3-routing.md` | 3 | Live copy health and tunnel selection work for one assigned copy; local two-copy tunnel tests prove spread and safe retry. |
+| 4 | `2026-11-01-stateless-replicas-4-deploy-and-drill.md` | 5 | Release once, ordered overlap swaps, per-copy visibility and targeting, fleet sizes, then the two-box dev drill; only now cut the replicas floor release and set copies=2. |
+
+Do not implement a later plan against an unmerged predecessor. The first user's delivery is the final plan's dev completion, followed by a separately authorized operator rollout. The brief explicitly permits the intermediate merges to remain at copies=1. Do not merge unused scaffolding ahead of Plan 1's visible stateless slice.
+
+These documents define no new HA, claim, machine-provisioning or managed-fleets-phase-2 interface. This series owns the stateless extension of `fleetView`, the replica health table, and replica forwarding. Existing 1b owns fleet roster, readiness and draining; existing region HA remains single-writer and cannot combine with copies. Before implementation, compare the current amadan descriptions for those two areas and record their owners' agreement on these boundaries. This planning session has not obtained that agreement. If another design is still changing the same interface, execution waits for its merge under AGENTS.md rule 4; do not adapt to an unmerged API.
+
+## Ground truth checked in this worktree
+
+| Anchor | Consequence |
+|---|---|
+| `internal/release/release.go:47` | Manifest is schema 1 with additive optional fields. Add `stateless`, independent of rootfs processes. |
+| `internal/activator/activator.go:2588` | Acquire precedes Restore and spawning. A stateless branch must split before it, after normal admission and build verification. |
+| `internal/activator/activator.go:2701` | Rootfs first boot otherwise writes a placeholder and a first-boot marker. Skip both only for a verified stateless build. |
+| `internal/activator/backend_exec.go:2489` | Binary launch passes `--db`; removing CARLOS_DB alone is insufficient. |
+| `internal/activator/escrow.go:261` | Mint/publication authority is a concrete execLease today. Replace that dependency with an explicit coordination authority for stateless builds. |
+| `internal/activator/rootfsrelease.go:842` | Existing releasePass is in memory and scoped to one attempt. It is not a durable fleet-wide success record. |
+| `internal/activator/rootfs_service.go:591` | Proactive residency currently requires a runtime, so binary stateless always-on instances need inclusion. |
+| `internal/console/fleetbox.go:157` | `movable` excludes always-on binaries. Extend it only for verified stateless managed binaries. |
+| `internal/provision/reconcile.go:535` | Ownership currently compares one FleetBox. Both admission and removal must use set membership. |
+| `internal/edge/edge.go:3519` | Labelled fleet forwarding has no fallback. Add a distinct replica arm; preserve existing single-writer semantics. |
+| `internal/edge/prober.go:207` | Fixed-address probes start live and require an exact status. Reuse the approach, not that initial state or predicate. |
+| `internal/status/fleet.go:120` | Bucket heartbeats are five minutes apart. They cannot establish live copy health or drive fast swaps. |
+| `internal/console/policysize.go:262` | The quarter-memory comparison currently applies to every known size, including small and standard; the spec's above-standard wording describes the extra unknown-total refusal, not the full comparison. |
+| `internal/cgroup/gen.go:65` | Parent overlap limits are sums of named sizes; extend the named table and keep this validator, rather than accepting arbitrary limits from agents. |
+| `internal/host/runs.go:169` | All assigned boxes will see a queued run. Target selection must precede pickup. |
+
+## Shared types and wire fields
+
+New package `internal/replicas` contains provider-neutral values and pure decisions. It imports neither activator nor edge nor provision. Release types stay in release. Plan numbers below identify the producer; later plans consume these exact names. Lower-case snake-case JSON keys are the field names shown here; all additions are `omitempty`. Omitted fields mean legacy operation.
+
+| Producer | Owner and addition | Contract |
+|---|---|---|
+| 1.1 | `release.Manifest.Stateless bool` / `stateless`; ship metadata and rootfs check options likewise | `--stateless` on binary and rootfs only. False/absent means current SQLite behavior. No process-file key. |
+| 1.1 | `release.StatelessRuntimeFloor = "v0.34.0"`; `release.StatelessReplicasFloor = "v0.35.0"` | Reserved first releases, pinned in tests. Do not use an intermediate version to enable replicas. |
+| 1.2 | `replicas.Identity{Account, App, Host, Incarnation string}` | Incarnation is `provision.Incarnation`, derived from CreatedAt, never just host or PID. |
+| 1.2 | `replicas.Coordinator{Term, Box, BootID string; ExpiresAt time.Time}` | Record field `Coordinator *replicas.Coordinator` / `coordinator`; random 128-bit term, one per instance lifetime, unrelated to the serving lease. |
+| 1.2 | `replicas.Authority` | Methods `Err() error`, `Lost() <-chan struct{}`, `SafeUntil() (time.Time,error)`, `Release(context.Context) error`. No Replicate method. |
+| 1.2 | `replicas.CoordinatorChange{Op, Term, Box, BootID string}` | Ops acquire, renew, release. Caller identity is authenticated; not taken from the payload. |
+| 1.2 | `replicas.CoordinatorReply{Lease Coordinator; RemainingMS int64}` and `replicas.CoordinatorHeldError{RetryAt time.Time}` | API reply and bounded contention error; client never guesses the retry cadence. |
+| 1.2 | `replicas.Build{Version, Digest string}`; `replicas.Deploy{ID, Incarnation string; Target, Previous Build; Phase, Term string; Order, Completed []string; ActiveBox string; Revision uint64}` | Record field `ReplicaDeploy *replicas.Deploy` / `replica_deploy`. Phases pending, releasing, released, swapping, done, failed, unknown. Build.Digest is SHA-256 of canonical manifest bytes, shared across architectures. Each launch separately verifies its platform artifact digest against StagedIdentity. |
+| 1.2 | `replicas.ReleaseChange{Op, ID, Term string; Revision uint64; Target Build}` | One-copy release API operations begin, releasing, released, failed, unknown. Plan 4 extends these transitions for box permits. |
+| 1.3 | `activator.Gen.Stateless bool`, entry launch mode; `registry.Route.Stateless bool` / `stateless` | Generation mode comes from its own verified release; the route is a projection, never sufficient authority to skip a database. |
+| 2.1 | `appconfig.Manifest.Copies int` / `copies` | Default bundle only; 0/absent resolves to 1, explicit values below 1 refused. No named-environment override. |
+| 2.1 | `replicas.Assignment{Revision uint64; Desired int; Boxes, Retiring []string}` | Record `ReplicaAssignment *replicas.Assignment` / `replica_assignment`. Boxes sorted, distinct, at most Desired; empty allowed while short. Retiring keeps removed boxes until local termination proof; revision increases on each change. |
+| 2.1 | `replicas.Expect{Incarnation, Region string; Revision, RecordSeq uint64}` | Assignment CAS validates lifetime, region, RecordSeq and assignment revision inside the retry; deploy CAS validates its own revision and lifetime. Ordinary writers preserve all replica fields. |
+| 2.2 | `registry.Route.FleetBoxes string` / `fleet_boxes`, `.Copies int` / `copies`, `.ReplicaRevision uint64` / `replica_revision`, `.ReplicaIncarnation string` / `replica_incarnation` | JSON array of labels in SQLite string column, canonical sorted encoding; empty means legacy. Forward rows explicitly classify these declarative fields and Stateless; the same lifetime/revision must reach probes. |
+| 3.1 | `replicas.Copy{Box, BootID, Incarnation, Version, Digest, State string; AssignmentRevision uint64; Healthy bool; ObservedAt time.Time; WorkersRunning, WorkersDeclared int}` | Live tunnel probe result. State is starting, running, down, failed, or unknown. Identity/build come from platform launch state, never app headers. |
+| 3.1 | `replicas.Snapshot{Host, Incarnation string; Revision uint64; Desired int; Copies []Copy}` | Hub-owned in-memory snapshot, joined only to the current account/host/lifetime/assignment. |
+| 4.1 | `replicas.DeployChange{Op, ID, Term, Box string; Revision uint64; Target Build; Order []string}` | Ops begin, releasing, released, failed, unknown, permit, ack, done. Console validates the legal edge and authenticates the reporting box. |
+| 4.3 | `instanceListRecord.Copies []replicas.Copy` / `copies`; `.DesiredCopies int` / `desired_copies` | Additive API join; underlying list still has one record per host. CLI expands it into copy rows. Never substitute stale metrics for live health. |
+| 4.3 | `runs.Request.TargetBox string` / `target_box`; `interactive.Open.Box string` / `box`; `interactive.Grant.Box string` / `box`; corresponding record run/session target | Optional `--box <label>` on run, run -it, console. Target is picked before admission, signed into grants, checked at pickup and attach. |
+
+## Coordination and rollout invariants
+
+The coordinator lease is a conditional record field, renewed through the console by the single coordinator, not a SQLite serving lease. This avoids new fleet IAM and a second bucket read loop. Console adapter `POST /api/fleet/replicas/{account}/{app}/{host}/coordinator` uses existing `fleetIdentityOK` authentication and `withRecordLock`, then the typed provision writer. Non-fleet single-copy adapters use the same typed writer with their existing trusted store access; they do not enable replicas.
+
+Lease TTL is 15 minutes, renew at 5 minutes, safety margin 30 seconds. Console time determines expiry. Client safety deadline is local monotonic request-start + returned remaining duration - 30 seconds; reject replies received beyond that deadline. A term is never renewed after expiry; renew and release compare term, boot, box and lifetime. CAS retries rejudge expiry. Never early-take based on a box restart. Renewals do not bump `control/serial`; changed authority, assignment and deploy phases do. Releasing/expired authority stops and proves only its release/escrow work, never web or workers. A follower reads/restores published secrets but cannot mint or publish; a cold launch with no published trio waits for initialization. An already-serving follower keeps serving through coordinator loss.
+
+Plan 1 persists release phase before invoking a command. `releasing` left by a dead term becomes `unknown`, then terminal failure for that deploy ID. It must never be automatically executed again. An explicit deploy retry creates a new ID, reuses the build if requested, and may run its idempotent release again. A response lost after committed `released` is reread and accepted for the same ID, target, lifetime and term. Existing good-build inference is insufficient for replicas. A release-free build records released without launching a command. Plan 1 uses this with one copy; Plan 4 extends it to a fleet sequence.
+
+A successful release authorizes the target only for that instance lifetime and deploy ID. Target build is fixed during the attempt. Console grants at most one `ActiveBox` and never grants the next while it is outstanding. The active box ACKs only after new web health, worker handover and proof that the old generation stopped. If an active swap loses contact, halt that deploy rather than issue another permit into uncertainty. A box already down before scheduling is omitted from Order; a deploy with one survivor swaps that survivor. A returning box not in Retiring, with no active permit, may cold-start the last committed successful target, with no release rerun, after older local processes are proven stopped. A failed/unknown release permits no target start, including on a returning box.
+
+For stateful/stateless changes at copies=1, do a proven stop followed by a fresh start, never overlap modes. Leave old local DB, markers and replica bytes untouched while stateless. Above 1, every ship/promote/deploy/rollback/channel or hold change that could select a stateful or hibernating build is refused; setting copies above 1 checks every instance's serving and selected build. Back-to-stateful requires copies=1 and completed removal/proof of the other copies before publication. Removed boxes ACK termination against lifetime/assignment revision; a missing ACK keeps a retirement obligation even after detach. A down box is not termination proof. No silent conversion or database deletion.
+
+## Request and visibility budget
+
+| State | Existing carrier | Additional work allowed |
+|---|---|---|
+| Declaration and launch mode | canonical release read during staging/planning; staged identity verification before exec | Parse the added field; never GET a manifest on each request. |
+| App desired count | default config read already used by the app's policy/reconcile pass | Parse Copies; preserve the other fields on every writer. |
+| Assignment, release phase and swap ACK | instance Record reads in serial-triggered reconcile; fleetInventory's ETag-based record inventory | Transition writes and serial bumps, no new per-copy record scan/timer. |
+| Coordinator authority | same record, API requests only from the chosen coordinator | One renew per instance per five minutes. Failed acquisition uses the returned expiry as retry time on the existing agent tick; followers do not contend every tick. |
+| Live readiness/build/workers | private probe over the already-connected tunnel | Per-copy HTTP probes, zero bucket reads. A new private Unix snapshot endpoint supplies console views, with no new bucket cadence. |
+| Box capacity/readiness/floor | loadFleetView and sizeBoxes' existing roster, status and edges reads | Reuse one complete view for each mutation/pass. |
+| Historical copy logs/metrics | existing per-box log batches and status snapshots | Add box/lifetime tags and a per-copy metrics map; no faster status bucket interval. |
+| Binding | existing per-host fleet binding object and existing bindings pass | Coordinator writes one set on assignment/deploy changes; old binding writers skip replica rows. No object per copy and no extra binding listing. |
+
+## Self-review record
+
+Completed 2026-11-01 against spec rev 2 and this worktree's source.
+
+| Check | Result |
+|---|---|
+| Spec coverage | Sections 1-9 map to the four plans; Plan 4 ends in the two-box dev drill and excludes the first user's production fleet. |
+| Step scan | Each task names files, interfaces, test names/assertions, red/green commands, census and commit. No implementation function bodies. |
+| Type consistency | Shared names, manifest versus artifact digest, assignment lifetime/revision, release API and command targets checked across producer/consumer tasks. |
+| Review Focus | Five lines per document; every named test occurs in its owning task. |
+| Proportion | Four independently mergeable plans, 15 tasks; decisions and assertion contracts replace implementation bodies. Shared wire types have one home; only mandatory constraints repeat. |
+
+This was author self-review, not an independent review. Ownership agreement for placement/health/forwarding remains the explicit execution preflight above; it has not been claimed as obtained. No earlier independent plan-review findings were supplied, so this series does not invent a review-round number.
diff --git a/docs/superpowers/plans/2026-11-01-stateless-replicas-1-runtime.md b/docs/superpowers/plans/2026-11-01-stateless-replicas-1-runtime.md
new file mode 100644
index 000000000..796bd54a9
--- /dev/null
+++ b/docs/superpowers/plans/2026-11-01-stateless-replicas-1-runtime.md
@@ -0,0 +1,114 @@
+# Stateless replicas: single-copy runtime Implementation Plan
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** Ship a stateless app and run one copy with its workers, release hook and existing commands.
+
+**Architecture:** Resolve storage mode from each chosen release identity. Keep coordination in an explicit lease that never owns serving processes, and retain all single-writer paths for stateful releases.
+
+**Tech Stack:** Go, existing release.Store compare-and-swap, console API, reverse HTTP/2 tunnels, systemd and cgroups on Linux.
+
+**Spec:** `docs/superpowers/specs/2026-11-01-stateless-replicas-design.md` (rev 2, approved 2026-11-01).
+
+## Global Constraints
+
+- Copy: use the series copy deck, ids `SR-<plan>-C<nn>`, pending until Paul's copy review; apply edits verbatim before building strings. No em dashes; neutral shop/example.com names.
+- Census in every root-scope task: `make census-card`, CLAIMS, `make census-propose NAME=<branch> CLAIMS=<file>`, independent reviewer on amadan #280. Maintain the separate record-write census.
+- Verification: at most 10 mutations per task, only refusal/security/termination/lifecycle paths, each with targeted `-run`. Local tests once with `-count=1`, one touched-package `-race` run per plan; CI runs the full suite. Smoke real dev as soon as end-to-end behavior works.
+- Cross-compile: `GOOS=darwin go build ./...`, `GOOS=windows go build ./...`, `GOOS=linux GOARCH=arm64 go build ./...`. Linux code in `_linux.go`; default Go cache, disk scratch, cleanup.
+- Requests: no new per-box/per-copy bucket polling. Use the index's existing reads/reports; one coordinator renewal per instance, zero bucket calls on requests/probes.
+- Provider-neutral core: no AWS assumptions outside adapters.
+- Floors: copies default 1; above 1 requires every fleet box and console at StatelessReplicasFloor. Unreadable evidence refuses. Do not release that floor before Plan 4 passes. Stateless launches require StatelessRuntimeFloor.
+- Dev first: two-box dev fleet; the first user's fleet is outside scope. AGENTS.md scoped approval precedes shared-account infrastructure/machine changes, including the drill and cleanup.
+- Read the index/spec rev 2. Additive wire fields; one host record, one copy per box; web/workers independent of coordination. Carry review history and stopping rules from AGENTS.md; land each plan only through reviewed, green amadan CI. This session commits plans without pushing.
+
+## Review Focus
+
+1. An old manifest or re-ship must remain byte-compatible: Task 1 `TestStatelessManifestCompatibility`.
+2. Coordinator loss during result publication must fence the old term: Task 2 `TestCoordinatorTermFencesLateResults`.
+3. A stateless fallback must not inherit the failed target's mode: Task 3 `TestStatelessFallbackUsesOwnManifest`.
+4. Escrow unavailable on a follower must not cause a fresh key mint: Task 3 `TestStatelessFollowerNeverMints`.
+5. A binary resident must restart without requiring request traffic: Task 4 `TestStatelessBinaryResidentRestarts`.
+
+---
+
+### Task 1: Ship a storage declaration that survives every manifest reader
+
+**Files:** Modify `internal/release/release.go`, `internal/release/rootfs.go`, `internal/release/rootfs_ship.go`, `internal/release/layoutintent.go`, `cli.go`, `ship_rootfs.go`, `ship_check.go`, `internal/console/apicli.go`, `internal/console/apiship_rootfs.go`, `docs/site/cli.md`; create `internal/release/stateless.go`, `ship_stateless.go`, `approved_stateless_replicas_copy_test.go`; test `internal/release/stateless_test.go`, `ship_stateless_test.go`, `internal/console/stateless_ship_test.go`.
+
+**Interfaces:** Consumes `release.Manifest`, `release.StagedIdentity`, existing ship APIs. Produces `Manifest.Stateless`, the two floor constants from the index, `release.ValidateStateless(m *Manifest) error`, `release.CanonicalStateless(ctx context.Context, s Store, acct, app string, id StagedIdentity) (bool, error)`, and `shipStatelessRefusal(kind string, stateless bool) error`, and `release.CanonicalManifestDigest(ctx context.Context,s Store,acct,app,version string) (string,error)`.
+
+- [ ] Write `TestStatelessManifestCompatibility`: `legacy.Stateless == false`; legacy marshal bytes unchanged; stateless survives Get/Ship/re-ship/stage/resign/rollback decoding; same-version re-ship with changed storage declaration conflicts. `TestShipStatelessKinds` asserts binary/rootfs accepted and static refused. `TestStatelessCheckEnvironment` asserts check's web, release and workers lack CARLOS_DB and its placeholder volume/file, including a user-supplied CARLOS_DB. Pin both floor strings in `TestStatelessFloorsArePinned`.
+ Assertion contract over fixture outputs for `TestStatelessManifestCompatibility`:
+ ```go
+ // TestStatelessManifestCompatibility
+ if legacy.Stateless || !bytes.Equal(oldJSON, legacyJSON) { t.Fatal("legacy manifest changed") }
+ ```
+- [ ] Run `go test ./internal/release ./internal/console . -run 'Test(StatelessManifestCompatibility|ShipStatelessKinds|StatelessCheckEnvironment|StatelessFloorsArePinned)$' -count=1`; expect FAIL for absent field/behavior.
+- [ ] Implement the interfaces above. Pass `--stateless` through binary and rootfs direct/API ship, API echo, immutable manifest comparison and rootfs --check. Add `stateless bool` to rootfsShipOpts/builtRootfs and rootfsCheck's captured options. `CanonicalStateless` verifies the identity and canonical digest, as CanonicalDemand does; unreadable or mismatched bytes refuse, never default to stateful. Both hibernate combinations may ship at copies=1; multi-copy refusal belongs to Plan 2. Static releases cannot declare stateless.
+- [ ] Add the copy gate using the existing rootfs deck parser pattern. `TestStatelessReplicaBuiltCopyIsApproved` requires every built SR id approved; `TestStatelessReplicaCopyIsApplied` checks exact file text; `TestStatelessReplicaCopyHasNoEmDash` covers the entire deck. Review SR-1 rows before adding any string; update CLI docs through that same review. Document that externally stored data and repeat-safe migrations are the app's responsibility.
+- [ ] Re-run the targeted command; expect PASS.
+- [ ] Run census-card/proposal for these root-scope edits and update any record-write census entries affected by the ship publication.
+- [ ] Commit with subject `feat: declare stateless binary and rootfs releases` and a body. This commit is part of the Plan 1 branch, not a separately landed scaffold.
+
+### Task 2: Give non-serving work its own fenced lease and durable release result
+
+**Files:** Create `internal/replicas/types.go`, `internal/replicas/coordinator.go`, `internal/provision/replicacoordinator.go`, `internal/provision/replicadeploy.go`, `internal/console/replicacoordinator.go`, `internal/activator/coordinator.go`, `internal/host/replicacoordinator.go`; modify `internal/provision/provision.go`, `internal/console/authcli.go`, `internal/console/apiinteractivebox.go`, `internal/activator/rootfsrelease.go`, `internal/host/agent.go`, `internal/rollout/manager.go`, `internal/rollout/wakeplan.go`; test `internal/replicas/coordinator_test.go`, `internal/provision/replicacoordinator_test.go`, `internal/provision/replicadeploy_test.go`, `internal/console/replicacoordinator_test.go`, `internal/activator/coordinator_test.go`, `internal/host/replicacoordinator_test.go`, `internal/rollout/stateless_test.go`, and new `internal/provision/stateless_replicas_census_test.go`.
+
+**Interfaces:** Produces index Identity, Build, Coordinator, CoordinatorReply, CoordinatorHeldError, Authority, CoordinatorChange, ReleaseChange and Deploy types; `provision.SetRecordCoordinator(ctx context.Context, s release.Store, id replicas.Identity, change replicas.CoordinatorChange, now time.Time) (*Record,error)`; `provision.SetRecordReplicaRelease(ctx context.Context, s release.Store, id replicas.Identity, expectedRevision uint64, next replicas.Deploy) (*Record,error)`; `(*Server).handleReplicaCoordinator(w http.ResponseWriter,r *http.Request)`; `activator.CoordinatorClient` with `Acquire(context.Context, replicas.Identity) (replicas.Authority,error)` and `ReleaseState(context.Context,replicas.Identity,replicas.ReleaseChange) (replicas.Deploy,error)`; `(*Server).handleReplicaRelease(w http.ResponseWriter,r *http.Request)` at `POST /api/fleet/replicas/{account}/{app}/{host}/release`; `(*Service).PrepareStatelessRelease(ctx context.Context, rt registry.Route, id release.StagedIdentity, deployID string) error`. Host's `newCoordinatorClient(store release.Store, consoleURL, fleet, box, token string) activator.CoordinatorClient` chooses trusted store or fleet API adapter.
+
+- [ ] Write `TestCoordinatorTermFencesLateResults` with this assertion contract (test doubles supply the clock and two clients):
+ ```go
+ // A has expired; B acquired another term on the same lifetime.
+ if oldTerm == newTerm || lateSuccessErr == nil || lateRenewErr == nil { t.Fatal("expired term remained authoritative") }
+ if webStops != 0 || workerStops != 0 { t.Fatal("coordination stopped serving") }
+ ```
+ `TestCoordinatorCASRechecksLifetimeAndExpiry` asserts renew/release after recreate or boot change write nothing and a CAS retry cannot revive expiry. `TestReplicaReleaseUnknownStopsDeploy` asserts releasing persisted before exec; coordinator death leaves old build, zero automatic reruns; explicit new deploy ID runs again. `TestReplicaReleaseLostSuccessReply` asserts committed released is recovered without a second command. `TestReplicaCoordinatorFleetIsolation` rejects another fleet/account/box, an unassigned box, revoked tokens, malformed ids and payload identity spoofing with identical unauthorized responses. `TestReplicaReleaseFleetAPI` drives a complete one-copy release through the fleet API adapter and asserts zero direct fleet record-bucket writes.
+- [ ] Run `go test ./internal/replicas ./internal/provision ./internal/console ./internal/activator ./internal/host -run 'Test(Coordinator.*|ReplicaRelease.*|ReplicaCoordinatorFleetIsolation)$' -count=1`; expect FAIL.
+- [ ] Implement the exact index lease timing and API path. Use existing fleetIdentityOK, fleet credential headers and owner gates; register outside the human CLI routes. Keep typed writers under withRecordLock and the lifetime judge. Use `release.WithAppMutation` for trusted store writes. Validate every field preserved by unrelated writers; acquisition requires current assignment (legacy FleetBox for this plan). Authorize release transitions only for the current term and pinned target. Return remaining TTL, never accept client-supplied expiry. Renew only the coordinator; use returned expiry to suppress follower attempts on the existing agent tick. Close/release clients on shutdown. The release API uses this same fleet authentication/current-term gate and calls SetRecordReplicaRelease under the record lock; fleet clients never write the record bucket directly.
+- [ ] Implement PrepareStatelessRelease through existing `runRelease` and its stop/proof machinery, replacing its serving-lease dependency with Authority. Persist pending/releasing before exec; publish released only after exit zero AND proof of termination while authority remains valid. Lost/failed/unknown never authorizes a target. Commandless binary/rootfs builds record released directly. The one-copy scheduler creates/reuses a durable deploy ID on a new selected build or explicit retry, including first wake; restarts reuse it. Wire this in `internal/rollout/manager.go` and `wakeplan.go` now, so this plan works without Plan 4. Existing released evidence returns before acquiring coordination; followers and serving requests never wait for that lease. Preserve stateful `releaseInWake` and `releaseBeforeSwap`. Bound a hook by existing process timeout and safety deadline; an unproven command retains its obligation and prevents a fresh release through expiry. Do not retry unknown automatically.
+- [ ] Re-run the targeted tests; expect PASS.
+- [ ] Mutation-check term comparison, lifetime comparison, releasing-before-exec, proof-before-success and the loss-stop gate (5 checks, each using its named test).
+- [ ] Produce the census card/CLAIMS/proposal, add record-write census witnesses for both typed writers and API callsites, obtain the independent verdict on #280.
+- [ ] Commit `feat: coordinate stateless release and secret work` with a body.
+
+### Task 3: Run without SQLite and share the existing escrow safely
+
+**Files:** Create `internal/activator/stateless.go`, `internal/activator/escrow_authority.go`; modify `internal/activator/activator.go`, `internal/activator/backend_exec.go`, `internal/activator/backend_rootfs.go`, `internal/activator/rootfs.go`, `internal/activator/rootfsenv.go`, `internal/activator/rootfs_service.go`, `internal/activator/rootfsworkers.go`, `internal/activator/startrule.go`, `internal/activator/escrow.go`, `internal/activator/generations.go`, `internal/registry/registry.go`, `internal/registry/remote.go`, `internal/registry/forward.go`, `internal/provision/reconcile.go`, `internal/host/fleetbind.go`, `internal/ops/litestream.go`; tests `internal/activator/stateless_test.go`, `internal/activator/stateless_escrow_test.go`, `internal/host/stateless_binding_test.go`, `internal/ops/stateless_test.go`.
+
+**Interfaces:** Consumes Task 1 canonical declaration and Task 2 coordination. Produces `(*Service).doStatelessWake(ctx context.Context,e *actEntry,id release.StagedIdentity) (*wokenInstance,error)`; `(*ExecBackend).statelessLaunchEnv(ctx context.Context,rt registry.Route,id release.StagedIdentity) (map[string]string,instancekey.Layer,error)`; `(*ExecBackend).coordinationAuthority(host string) replicas.Authority`; `(*ExecBackend).statelessArgv(rt registry.Route,exe,sock string) []string`; `(*Service).statelessCurrent(ctx context.Context,rt registry.Route) error`; `Gen.Stateless` and the route projection in the index. Add the registry migration, scans, remote RPC encoding and forward-field classification for Stateless together.
+
+- [ ] Write `TestStatelessWakeHasNoDatabaseWork` using the normal wake harness: `acquireCalls == 0`, `restoreCalls == 0`, `seedCalls == 0`, `replicateCalls == 0`, no placeholder, marker, assignment marker or DB file writes; web and every declared worker run. `TestStatelessFallbackUsesOwnManifest` covers both fallback directions and requires the fallback's own declaration, not the target's. `TestStatelessBinaryArguments` asserts socket retained and `--db` absent. `TestStatelessMovedBeforeSpawn` changes the record while coordination/release waits and asserts zero starts on the old box. `TestStatelessEveryEnvironment` checks web/release/worker/run/TTY and file-env overrides for absence of CARLOS_DB. `TestStatelessModeTransitionPreservesDatabase` snapshots DB/WAL/SHM/markers/replica bytes and asserts unchanged, with old mode stopped/proven before new start.
+- [ ] Write `TestStatelessFollowerNeverMints`: absent secrets + absent escrow refuses cold start; existing escrow restores the identical trio and launch env; divergent local secret refuses; failed read refuses; failed publish holds first launch. `TestStatelessEscrowAuthorityLoss` asserts no publish/mint after Lost and no web/worker stop. `TestStatelessBindingOnlyCoordinator` asserts the single coordinator writes the existing binding key while OnWake/startup non-coordinators write nothing. `TestStatelessExcludedFromBoxLitestream` asserts no stateless DB enters generated box-wide replication config or database maintenance.
+ Assertion contract over fixture outputs for `TestStatelessWakeHasNoDatabaseWork`:
+ ```go
+ // TestStatelessWakeHasNoDatabaseWork
+ if acquireCalls != 0 || restoreCalls != 0 || seedCalls != 0 || replicateCalls != 0 { t.Fatal("stateless wake used database machinery") }
+ ```
+- [ ] Run `go test ./internal/activator ./internal/registry ./internal/provision ./internal/host ./internal/ops -run 'TestStateless.*' -count=1`; expect FAIL for SQLite calls/environment/lease ownership.
+- [ ] Branch only after chosen identity, normal config/layout/fence/admission checks and staged verification, before serving Acquire. statelessCurrent reuses the current-record recheck from routeCurrentUnderLease immediately before launch, without taking a serving lease; a changed lifetime/label/config refuses. Carry storage mode on the actual generation and failed-wake cleanup, including fallback/pin/hold/respawn; no fake successful Lease or Rep. Separate local lifecycle watch from lease watch so workers, cmd/TTY ownership, swaps, stop obligations and cgroup proof remain enforced without a serving lease. Stateless skips replica-missing, placeholder, first-boot/assignment markers and restore/seed paths. Remove CARLOS_DB after all user env merges, not by assigning it empty. Binary argv omits --db. Find every reader of DBPath, replication status and the new route fields; prevent ops/maintenance from treating an unused old DB as active.
+- [ ] Make escrow publish/mint consult the explicit authority only for stateless, with read-only follower restore. Keep all Durability 3a conflict, bucket-knowledge, keyless and first-launch protections. Coordinator binding publication reuses the existing key/read pass; startup and OnWake skip stateless rows. State changes signal existing reconcile, not another poll loop.
+- [ ] Re-run targeted tests; expect PASS.
+- [ ] Mutation-check only mode-source verification, no-database branching, escrow authority and stopped-before-transition (4 checks).
+- [ ] Census-card/CLAIMS/proposal for all root-scope edits, record-write inventory if changed, independent #280 verdict.
+- [ ] Commit `feat: run stateless instances without a serving lease` with a body.
+
+### Task 4: Finish the single-copy slice on a dev box
+
+**Files:** Modify `internal/activator/rootfs_service.go`, `internal/activator/cmd.go`, `internal/activator/cmdunit.go`, `internal/host/runs.go`, `internal/host/interactive.go`, `internal/console/rootfs.go`; test `internal/activator/stateless_resident_test.go`, `internal/host/stateless_singlecopy_test.go`; create `docs/superpowers/notes/stateless-replicas-runtime-dev.md` as reviewed operator evidence during execution.
+
+**Interfaces:** Consumes Task 3 mode and lifecycle ownership. Produces `statelessResident(rt registry.Route) bool`, used by existing residency/admission paths; existing public `Service.HoldsAwake(host string) bool`, command/session and worker interfaces keep their signatures.
+
+- [ ] Write `TestStatelessBinaryResidentRestarts`: managed always-on binary is started proactively, exits, backs off and restarts with no request and no serving lease; hibernating binary stays asleep. `TestStatelessRunAndInteractive` asserts one run and one session execute, stop on local retirement/shutdown and retain existing authorization; coordinator loss does not terminate them. `TestStatelessWorkersFollowSwap` asserts workers run after web readiness, switch once and old workers are proven stopped. `TestStatefulLeasePathsUnchanged` asserts stateful still acquires/restores/replicates and stops on lease loss.
+ Assertion contract over fixture outputs for `TestStatelessBinaryResidentRestarts`:
+ ```go
+ // TestStatelessBinaryResidentRestarts
+ if starts != 2 || acquireCalls != 0 || requests != 0 { t.Fatal("binary residency required traffic or a lease") }
+ ```
+- [ ] Run `go test ./internal/activator ./internal/host ./internal/console -run 'Test(StatelessBinaryResidentRestarts|StatelessRunAndInteractive|StatelessWorkersFollowSwap|StatefulLeasePathsUnchanged)$' -count=1`; expect FAIL.
+- [ ] Integrate stateless binary residency and lifecycle checks into the exact existing methods above. Remove no root admission, credential, quota, shutdown or proof gate. Keep hibernate allowed only at one copy and never wake it through probes.
+- [ ] Re-run targeted tests; expect PASS. Run one touched-package race gate for the whole Plan 1 diff: `go test -race ./internal/replicas ./internal/activator ./internal/provision ./internal/registry ./internal/release ./internal/host ./internal/console ./internal/ops . -run 'Test(Stateless.*|Coordinator.*|ReplicaRelease.*|ReplicaCoordinator.*|StatefulLeasePathsUnchanged)$' -count=1`.
+- [ ] Cross-compile all three targets; expect clean builds. Complete census and independent review for this task. Full gate runs in amadan CI, once per final tip.
+- [ ] On an existing authorized dev box at v0.34.0, build with this branch's binary, ship `shop --stateless`, deploy and verify its exact version via GET. Exercise one Rails worker, one run, an interactive session, restart and a failed release. Demonstrate no DB file/CARLOS_DB/Litestream or serving lock, plus preserved old stateful bytes on a one-copy transition. Record command/version/result evidence. If the dev scope is not already authorized, prepare its exact resource/traffic/cost/cleanup scope for approval before live work.
+- [ ]
+- [ ] Commit `feat: complete single-copy stateless lifecycle` with a body, describe and review the complete branch, then land through green amadan CI. Finish line: the one-copy stateless app works on dev. Keep copies above 1 refused until v0.35.0.
diff --git a/docs/superpowers/plans/2026-11-01-stateless-replicas-2-placement.md b/docs/superpowers/plans/2026-11-01-stateless-replicas-2-placement.md
new file mode 100644
index 000000000..cde26587a
--- /dev/null
+++ b/docs/superpowers/plans/2026-11-01-stateless-replicas-2-placement.md
@@ -0,0 +1,94 @@
+# Stateless replicas: fleet placement Implementation Plan
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** Set an app-wide copy count and assign each instance to distinct eligible fleet boxes.
+
+**Architecture:** Extend the existing fleet inventory and relabel pass with a set assignment. Default to the existing single box; compile and test multi-copy placement while its release floor remains unreleased.
+
+**Tech Stack:** Go, existing release.Store compare-and-swap, console API, reverse HTTP/2 tunnels, systemd and cgroups on Linux.
+
+**Spec:** `docs/superpowers/specs/2026-11-01-stateless-replicas-design.md` (rev 2, approved 2026-11-01).
+
+## Global Constraints
+
+- Copy: use the series copy deck, ids `SR-<plan>-C<nn>`, pending until Paul's copy review; apply edits verbatim before building strings. No em dashes; neutral shop/example.com names.
+- Census in every root-scope task: `make census-card`, CLAIMS, `make census-propose NAME=<branch> CLAIMS=<file>`, independent reviewer on amadan #280. Maintain the separate record-write census.
+- Verification: at most 10 mutations per task, only refusal/security/termination/lifecycle paths, each with targeted `-run`. Local tests once with `-count=1`, one touched-package `-race` run per plan; CI runs the full suite. Smoke real dev as soon as end-to-end behavior works.
+- Cross-compile: `GOOS=darwin go build ./...`, `GOOS=windows go build ./...`, `GOOS=linux GOARCH=arm64 go build ./...`. Linux code in `_linux.go`; default Go cache, disk scratch, cleanup.
+- Requests: no new per-box/per-copy bucket polling. Use the index's existing reads/reports; one coordinator renewal per instance, zero bucket calls on requests/probes.
+- Provider-neutral core: no AWS assumptions outside adapters.
+- Floors: copies default 1; above 1 requires every fleet box and console at StatelessReplicasFloor. Unreadable evidence refuses. Do not release that floor before Plan 4 passes. Stateless launches require StatelessRuntimeFloor.
+- Dev first: two-box dev fleet; the first user's fleet is outside scope. AGENTS.md scoped approval precedes shared-account infrastructure/machine changes, including the drill and cleanup.
+- Read the index/spec rev 2. Additive wire fields; one host record, one copy per box; web/workers independent of coordination. Carry review history and stopping rules from AGENTS.md; land each plan only through reviewed, green amadan CI. This session commits plans without pushing.
+
+## Review Focus
+
+1. App instances can use different channels/builds: Task 1 `TestCopiesApplyToEveryInstance`.
+2. Concurrent create, channel change and copies edits must not evade validation: Task 1 `TestCopiesAdmissionSerializesAppMutations`.
+3. A recreated host must reject an old assignment CAS: Task 2 `TestReplicaAssignmentRejectsOldLifetime`.
+4. Removing a copy must not give another reconciliation pass deletion authority: Task 2 `TestReplicaRemovalOnlyOwnsItsKindAndLifetime`.
+5. A drained or detached fleet can become smaller than its desired count: Task 3 `TestReplicaDetachPreservesDesiredShortfall`.
+
+---
+
+### Task 1: Expose copies with one validation gate for every instance
+
+**Files:** Create `internal/appconfig/copies.go`, `internal/console/appcopies.go`, `apps_copies.go`; modify `internal/appconfig/appconfig.go`, `internal/console/authcli.go`, `internal/console/apiinstances.go`, `internal/console/apicli.go`, `internal/console/apiship_rootfs.go`, `internal/console/rootfs.go`, `apps_swap.go`, `apimode.go`, `docs/site/cli.md`; test `internal/appconfig/copies_test.go`, `internal/console/appcopies_test.go`, `apps_copies_test.go`.
+
+**Interfaces:** Consumes Plan 1 canonical storage mode and floors. Produces `appconfig.CopiesOf(m *Manifest) int`, `appconfig.SetCopies(ctx context.Context,s release.Store,acct,app string,n int) (int,error)`; `(*Server).handleAPICopies(w http.ResponseWriter,r *http.Request)` at `PUT /api/cli/apps/{account}/{app}/copies`, body `{copies: N}`, reply `{copies: N}`; `(*Server).copiesRefusal(ctx context.Context,acct *Account,app string,n int,target *release.Manifest) *doorRefusal`; `(*fleetView).replicasActive(consoleRelease string) bool`. Add AtReplicaFloor to fleetBoxView, derived from the same heartbeat join.
+
+- [ ] Write `TestCopiesApplyToEveryInstance`: two host records on two channels both resolve `CopiesOf(default)==2`; each needs a verified stateless always-on serving/selected release, and one stateful host refuses the entire edit with zero config writes. A hold-policy or hold-demand build also refuses copies above 1 before any assignment changes. `TestCopiesDefaultsAndBounds`: no manifest/zero means 1; -1, 0, fractional JSON and overflow refused; 3 with two eligible boxes refused; a shared-region, HA, static, sidecar, service, external Addr/Addrs, in-flight import or move refuses copies>1. `TestCopiesReleaseFloorComplete` asserts an old, missing, unparseable, stale or unreadable box/console floor refuses, including a draining box still in the fleet roster. `TestCopiesAdmissionSerializesAppMutations` races create, channel/hold/rollback/ship and count edits; no committed count>1 may select a stateful or hibernating build. Concurrent app trash/recreate must reject the old admission.
+ Assertion contract over fixture outputs for `TestCopiesApplyToEveryInstance`:
+ ```go
+ // TestCopiesApplyToEveryInstance
+ if hostACopies != 2 || hostBCopies != 2 || statefulAdmissionWrites != 0 { t.Fatal("app count or admission was not applied to every host") }
+ ```
+- [ ] Run `go test ./internal/appconfig ./internal/console . -run 'TestCopies.*' -count=1`; expect FAIL.
+- [ ] Implement the exact interfaces in their listed files. `carlos apps set shop --copies 2` uses API mode, supports its existing mutation-message flags, checks the echoed count, and never falls back to box/AWS access. Register with the same account/role permissions as apps set. Store only the count in the DEFAULT config bundle through the existing CAS path, preserving vars/secrets/swap/interactive. Serialize validation and publication with existing app locks/app mutation boundaries; use complete inventory, canonical manifests and one loadFleetView. Do not hold a new mutex while calling a helper that reacquires the same app lock.
+- [ ] Put the same copiesRefusal at every actual publication door: ship a hibernating build while count>1 refuses; stateful ship may be retained as an artifact but cannot be selected by promote/deploy/rollback/hold/channel changes. Fresh instances inherit and validate the app count before record creation. Count increase checks eligible destinations, all fleet box versions and console version. Count decrease reports requested state while excess copies retire. Stateful/hibernate publication also checks each stored assignment: more than one Box or any Retiring entry blocks it even if app Copies is already 1. Switching storage modes requires count=1 and removal completion. SR-2 rows and the amended apps-set usage/help/doc examples pass copy review before writing.
+- [ ] Re-run targeted tests; expect PASS.
+- [ ] Mutation-check fleet floor, canonical manifest check and app serialization (3 checks).
+- [ ] Make census-card/CLAIMS/proposal for appconfig/CLI/release/provision callers in root scope, update the record-write census where applicable, get #280 approval.
+- [ ] Commit `feat: set app copy counts with fleet release gates` and a body. Real dev smoke: `--copies 1` succeeds and `--copies 2` refuses the unreleased floor, with no assignment change.
+
+### Task 2: Store and reconcile one set assignment per instance
+
+**Files:** Create `internal/replicas/placement.go`, `internal/provision/replicaassignment.go`, `internal/registry/replicas.go`; modify `internal/provision/provision.go`, `internal/provision/reconcile.go`, `internal/provision/forward.go`, `internal/provision/fleetbox.go`, `internal/registry/registry.go`, `internal/registry/forward.go`, `internal/registry/remote.go`, `internal/registry/remote_dispatch.go`, `internal/activator/wakeidentity.go`, `internal/activator/startrule.go`, `internal/host/fleetidentity.go`; tests `internal/replicas/placement_test.go`, `internal/provision/replicaassignment_test.go`, `internal/provision/replicas_test.go`, `internal/registry/replicas_test.go`, `internal/activator/stateless_assignment_test.go`.
+
+**Interfaces:** Produces index Assignment and Expect; `provision.SetRecordReplicaAssignment(ctx context.Context,s release.Store,id replicas.Identity,want replicas.Expect,next replicas.Assignment) (*Record,error)`; `(*replicas.Assignment).Contains(box string) bool`; `replicas.ValidateAssignment(a Assignment) error`; `(*registry.Registry).SetReplicaAssignment(host,incarnation string,assignment replicas.Assignment,stateless bool) error`; `provision.RecordReplicaRetired(ctx context.Context,s release.Store,id replicas.Identity,revision uint64,box string) (*Record,error)`. Uses existing RouteFor/Reconcile signatures and lifetime judging. Add `replicas.Candidate{Label string; Load int; Eligible bool}` and `replicas.Place(current Assignment,candidates []Candidate) (Assignment,error)`.
+
+- [ ] Write `TestReplicaAssignmentCASAndShape`: sorted unique labels accepted; duplicates, too many labels, bad names, nonpositive Desired, unknown schema/state or revision rollback refused; same payload is a no-op. `TestReplicaAssignmentRejectsOldLifetime` races region movement, RecordSeq changes and delete/recreate; old expectation writes nothing after each CAS retry; Expect includes Region and RecordSeq, so an unchanged assignment revision cannot hide a region/channel edit. `TestReplicaReconcileMembership` asserts boxes A/B each mint one route from one record, C mints none; removed B retires only B's copy; a short assignment never duplicates A. `TestReplicaRemovalOnlyOwnsItsKindAndLifetime` retains sidecars, platform/canary rows and unrelated/recreated records. `TestReplicaScaleDownRequiresStopProof` keeps Retiring after lost/down reports, rejects stale proof and blocks a stateful publication until every removed box ACKs root termination proof. `TestReplicaForwardRemainsInert` exercises SQL migration, remote RPC roundtrip, PutForward, ForwardColumns/forbidden schema, inert checks and SetFleetBoxIf: replica set fields survive but no socket/DB/exec authority appears; binding stamps cannot collapse a set to one box.
+ Assertion contract over fixture outputs for `TestReplicaAssignmentRejectsOldLifetime`:
+ ```go
+ // TestReplicaAssignmentRejectsOldLifetime
+ if err == nil || !bytes.Equal(beforeRecord, afterRecord) { t.Fatal("stale assignment changed the recreated host") }
+ ```
+- [ ] Run `go test ./internal/replicas ./internal/provision ./internal/registry ./internal/activator ./internal/host -run 'TestReplica(Assignment.*|Reconcile.*|Removal.*|Forward.*)$' -count=1`; expect FAIL.
+- [ ] Implement set membership on BOTH admission and removal in Reconcile. Assignment nil keeps the old FleetBox branch. Non-nil assignment is valid only for verified stateless managed fleet instances; protect malformed/unreadable observations rather than treating them as deletion evidence. SetRecordFleetBox and SetRecordRegion refuse incompatible single-label mutation of an active set; app placement changes must first converge copies to 1. Carry desired count/set/mode through SQL migrations, all row scanners, registry remote requests, RouteFor, convergeOwned and forwardRowFor/forwardCurrent. Classified declarative forward fields must be explicit, with all unrelated forbidden columns still zero.
+- [ ] Recheck current set membership and lifetime immediately before local spawn/command pickup using the existing wake record recheck. Stateless generations bypass only the SQLite assignment/set-aside rule; a stale nonmember starts nothing. Preserve local DBs, workers' stop proofs, account/owner/refusal/sidecar gates and legacy empty-start protections. Do not make another box's route deletion authoritative.
+- [ ] Re-run targeted tests; expect PASS.
+- [ ] Mutation-check membership on admission/removal, lifetime CAS, current-row recheck and inert-forward validation (5 checks).
+- [ ] Run census-card/CLAIMS/proposal and root review, extend record-write census for the typed writer and changed region/label writers, record #280 verdict.
+- [ ] Commit `feat: reconcile stateless instance box sets` with a body.
+
+### Task 3: Place, drain and replace copies without changing the requested count
+
+**Files:** Create `internal/console/replicaplacement.go`; modify `internal/console/replicacoordinator.go`, `internal/provision/replicaassignment.go`, `internal/console/fleetbox.go`, `internal/console/fleetrelabel.go`, `internal/console/fleets.go`, `internal/host/fleetbind.go`; test `internal/console/replicaplacement_test.go`, `internal/host/replica_request_budget_test.go`.
+
+**Interfaces:** Consumes Task 2 Place/SetRecordReplicaAssignment and Task 1 CopiesOf/gates. Produces `(*Server).placeReplicaRecord(ctx context.Context,rec provision.Record,v fleetView,n int) error` and `(*Server).reconcileReplicaFleet(ctx context.Context,fleet string,v fleetView,now time.Time) error`. Extend the coordinator API with the authenticated retired operation, validating Retiring membership and forwarding the proof to RecordReplicaRetired. Extend `host.FleetBinding` additively with `Boxes []string` / `boxes`, `Incarnation string` / `incarnation`, `AssignmentRevision uint64` / `assignment_revision`; one object per host. Legacy Box/BoundAt remain readable.
+
+- [ ] Write `TestReplicaPlacementStableAndDistinct`: retain eligible assignments, add lowest-load eligible boxes with label tie-break, count load per copy, no rebalance while members remain eligible; reversed map/list ordering gives identical output. `TestReplicaPlacementLostAndReturning`: a failed/draining box is replaced by a distinct spare, otherwise removed from the live assignment and Desired stays 2; on return fill shortfall without intervention; no duplicate placement. `TestReplicaDetachPreservesDesiredShortfall` asserts explicit detach is allowed to leave desired=2 with one box, with a warning and truthful shortfall; no clamping. A new request to set copies=2 with only one eligible box still refuses. `TestReplicaIncompleteViewWritesNothing` covers missing pages, failed record GET, unknown floor and sidecar gate. `TestReplicaRequestBudget` compares first/steady/changed pass call traces to 1b: no extra periodic List/Get per copy, no binding object per copy and no noncoordinator write.
+ Assertion contract over fixture outputs for `TestReplicaDetachPreservesDesiredShortfall`:
+ ```go
+ // TestReplicaDetachPreservesDesiredShortfall
+ if desired != 2 || available != 1 || duplicateBoxes != 0 { t.Fatal("detach clamped or duplicated copies") }
+ ```
+- [ ] Run `go test ./internal/replicas ./internal/console ./internal/host -run 'TestReplica(Placement.*|Detach.*|IncompleteView.*|RequestBudget)$' -count=1`; expect FAIL.
+- [ ] Implement the exact place/reconcile interfaces under the existing fleet lock, using fleetInventory's cached records and the current heartbeat/roster read. Reuse destinationFor's freshness, non-draining, label and rootfs floor/readiness checks, plus the existing named-size capacity check. Use StatelessRuntimeFloor for one copy and StatelessReplicasFloor for more than one; do not take the one-copy app down waiting for the future floor. Plan 4 replaces the fleet size bound. Count assigned copies in Load. Make movable accept stateless always-on binary managed instances; never unverified binaries, external processes, stateful always-on binaries or HA. Replica records bypass the single-label relabel loop. Reconcile only changed config/assignment records and retry incomplete writes on the existing pass; app count can commit before every record converges, and no new copy may start above the latest desired count. Existing excess copies are reported as stopping until proof completes.
+- [ ] During scale-down, remove selected boxes from assignment first, retain them in Retiring, report existing removal/proof through the coordinator API, call RecordReplicaRetired only after proof, then mark convergence complete; retain the coordinator's box where eligible, otherwise transfer after its old authority ends. Freeze membership changes during an active swap; a loss halts that deploy and placement repairs afterward. The coordinator publishes the single set binding on membership change; hub reader validates key/lifetime/revision/current fleet ownership and ignores legacy single-box stamps for a set. Existing startup/OnWake paths still skip replica writes. Show shortfall/warning only through SR-2 reviewed rows.
+- [ ] Re-run targeted tests; expect PASS.
+- [ ] Run `go test -race ./internal/appconfig ./internal/console ./internal/provision ./internal/registry ./internal/replicas ./internal/activator ./internal/host . -run 'Test(Copies.*|Replica.*)$' -count=1`; expect PASS.
+- [ ] Cross-compile all three targets; expect clean builds.
+- [ ] Census-card/CLAIMS/proposal plus record-write inventory and independent #280 verdict.
+- [ ] Commit `feat: converge replica placement and fleet drains` with a body; describe/review/land the branch only on green CI. Dev smoke remains copies=1, including drain/replacement and API readback. Do not cut v0.35.0 or bypass the floor for the smoke.
diff --git a/docs/superpowers/plans/2026-11-01-stateless-replicas-3-routing.md b/docs/superpowers/plans/2026-11-01-stateless-replicas-3-routing.md
new file mode 100644
index 000000000..e7417b229
--- /dev/null
+++ b/docs/superpowers/plans/2026-11-01-stateless-replicas-3-routing.md
@@ -0,0 +1,92 @@
+# Stateless replicas: hub routing Implementation Plan
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** Spread requests over healthy assigned copies and retry only requests that are safe to repeat.
+
+**Architecture:** Maintain a live hub health table from authenticated tunnel probes. Select a healthy box per request and keep the existing single-writer forwarding arm unchanged for legacy/stateful routes.
+
+**Tech Stack:** Go, existing release.Store compare-and-swap, console API, reverse HTTP/2 tunnels, systemd and cgroups on Linux.
+
+**Spec:** `docs/superpowers/specs/2026-11-01-stateless-replicas-design.md` (rev 2, approved 2026-11-01).
+
+## Global Constraints
+
+- Copy: use the series copy deck, ids `SR-<plan>-C<nn>`, pending until Paul's copy review; apply edits verbatim before building strings. No em dashes; neutral shop/example.com names.
+- Census in every root-scope task: `make census-card`, CLAIMS, `make census-propose NAME=<branch> CLAIMS=<file>`, independent reviewer on amadan #280. Maintain the separate record-write census.
+- Verification: at most 10 mutations per task, only refusal/security/termination/lifecycle paths, each with targeted `-run`. Local tests once with `-count=1`, one touched-package `-race` run per plan; CI runs the full suite. Smoke real dev as soon as end-to-end behavior works.
+- Cross-compile: `GOOS=darwin go build ./...`, `GOOS=windows go build ./...`, `GOOS=linux GOARCH=arm64 go build ./...`. Linux code in `_linux.go`; default Go cache, disk scratch, cleanup.
+- Requests: no new per-box/per-copy bucket polling. Use the index's existing reads/reports; one coordinator renewal per instance, zero bucket calls on requests/probes.
+- Provider-neutral core: no AWS assumptions outside adapters.
+- Floors: copies default 1; above 1 requires every fleet box and console at StatelessReplicasFloor. Unreadable evidence refuses. Do not release that floor before Plan 4 passes. Stateless launches require StatelessRuntimeFloor.
+- Dev first: two-box dev fleet; the first user's fleet is outside scope. AGENTS.md scoped approval precedes shared-account infrastructure/machine changes, including the drill and cleanup.
+- Read the index/spec rev 2. Additive wire fields; one host record, one copy per box; web/workers independent of coordination. Carry review history and stopping rules from AGENTS.md; land each plan only through reviewed, green amadan CI. This session commits plans without pushing.
+
+## Review Focus
+
+1. App failure without tunnel failure must eject the copy: Task 1 `TestReplicaProbeFailureWithoutTunnelLoss`.
+2. Replacing an assignment or reconnecting must not reuse a healthy answer from the old lifetime: Task 1 `TestReplicaProbeRejectsOldIdentity`.
+3. A POST may have reached the app even if no headers returned: Task 2 `TestReplicaPostIsNotReplayedAfterDispatch`.
+4. A streaming response and a websocket cannot be replayed after output starts: Task 2 `TestReplicaStreamingAndUpgradeLoss`.
+5. Reload, aliases and stale bindings must retain the same owner/set gates: Task 3 `TestReplicaAliasesPreserveSetAuthority`.
+
+---
+
+### Task 1: Measure copy health through the tunnel without waking it
+
+**Files:** Create `internal/edge/replicaprober.go`, `internal/edge/replicaprobe.go`, `internal/replicas/health.go`; modify `internal/edge/edge.go`, `internal/edge/tunnel.go`, `internal/activator/activator.go`, `internal/host/agent.go`, `internal/tunnelclient/tunnelclient.go`; create `internal/host/replicahealth_linux.go`, `internal/host/replicahealth_other.go`; tests `internal/edge/replicaprober_test.go`, `internal/activator/replicaprobe_test.go`.
+
+**Interfaces:** Produces index Copy and Snapshot; `edge.ReplicaHealth` interface with `Snapshot(host string) replicas.Snapshot`; private `replicaProber.Sync(routes []registry.Route)`, `.Live(host string) []replicas.Copy`, `.Eject(host,box string)`, `.Stop()`; `(*activator.Service).ProbeCopy(ctx context.Context,host string) (replicas.Copy,error)`; `replicas.HealthyStatus(code int) bool`. `(*Edge).ReplicaSnapshots() map[string]replicas.Snapshot` supplies the local snapshot server. Edge's injectable `ReplicaProbe func(context.Context,string,string) (replicas.Copy,error)` takes channel and host; production adapter uses the existing tunnel transport.
+
+- [ ] Write `TestReplicaProbeFailureWithoutTunnelLoss`: GET / returns 500 with channel connected; two failures eject, then two consecutive below-500 responses rejoin. `TestReplicaProbeNeverWakes` asserts zero Begin/Acquire/Spawn on asleep/down/hibernating rows. `TestReplicaProbeRejectsOldIdentity` rejects wrong lifetime, box, boot, revision/build evidence and late results from retired jobs; reconnect starts unknown. `TestReplicaProbeConcurrentBound` uses fake clock/blocked transports, 64 copies, and asserts one probe in flight per copy, 1-second cadence, 1-second timeout, ejection within 3 seconds independent of N, rise within 3 seconds; a closed tunnel removes immediately. `TestReplicaProbeStatusRange` accepts 200/302/404/499, refuses 500/503/invalid; redirects are not followed. Client cancellation or job replacement must not eject a healthy copy.
+ Assertion contract over fixture outputs for `TestReplicaProbeFailureWithoutTunnelLoss`:
+ ```go
+ // TestReplicaProbeFailureWithoutTunnelLoss
+ if !tunnelConnected || healthyAfterTwoFailures || !healthyAfterTwoPasses { t.Fatal("probe state did not follow app health") }
+ ```
+- [ ] Run `go test ./internal/edge ./internal/activator -run 'TestReplicaProbe.*' -count=1`; expect FAIL.
+- [ ] Implement the listed methods with one cancellable job per assigned copy, bounded independently; do not modify fixed-address routes' default status/initial health. Start copies unknown and exclude them until two passes. Preserve unchanged jobs across Reload, cancel replaced jobs, and check tunnel connection generation before accepting a result. Fresh assignment alone never implies healthy. Use the actual serving generation's socket and platform build/worker state, perform GET / with a one-second bound, drain at most 4 KiB, close body, never follow redirects and never invoke activator Begin. Return running only for an already-awake current assigned copy. A healthy response is not inferred from the console login/gate page or a cached app response.
+- [ ] Add a private landing path `/__carlos/replica-probe` handled before normal host gates/cache/metering only with `tunnelclient.FromTunnel` and the private `X-Carlos-Replica-Probe: 1` marker. Refuse this reserved path on public/door/backhaul ingress and strip the marker from every public request before forwarding; the tunnel mark alone also marks ordinary visitor requests and is insufficient. Verify local box/fleet/account/lifetime and assignment. Test valid-looking forged headers and the reserved URL through the public hub, not only direct box ingress. Keep tokens/env out of responses. Add a new read-only Unix snapshot service at `/run/carlos/.replicas/health.sock`, GET `/replica-health`, mode 0600 in an agent-owned 0700 directory outside tenant mounts. Implement `serveReplicaHealth(ctx context.Context,path string,read func() map[string]replicas.Snapshot) error` in host Linux code, wire Edge.ReplicaSnapshots in agent startup, cancel/join/remove it at shutdown; other systems return unsupported. Console uses that fixed socket with a one-second timeout. No existing edge administration socket is assumed. Test tenant namespace denial and that public/app-door requests cannot reach the snapshot. Probe interval/fail/rise constants are 1s/2/2, timeout 1s; these are builder decisions under spec §8.
+- [ ] Re-run targeted tests; expect PASS.
+- [ ] Mutation-check private landing authentication, assigned lifetime check and no-wake gate (3 checks).
+- [ ] Complete census-card/CLAIMS/proposal and independent #280 review; commit `feat: probe assigned copies over fleet tunnels` with a body.
+
+### Task 2: Balance traffic and bound retry at the dispatch boundary
+
+**Files:** Create `internal/edge/replicaproxy.go`; modify `internal/edge/edge.go`, `internal/edge/tunnel.go`, `internal/edge/reqrecords.go`; tests `internal/edge/replicaproxy_test.go`, `internal/edge/replica_retry_test.go`.
+
+**Interfaces:** Consumes ReplicaHealth and the prober Live/Eject table. Produces `replicaProxy(host,fleet string,p *replicaProber,hub *TunnelHub) *httputil.ReverseProxy`; `replicas.RetryAllowed(method string,dispatched,responseStarted bool) bool`; `(*TunnelHub).replicaRoundTrip(channel string,req *http.Request) (*http.Response,bool,error)` returning whether dispatch may have occurred. Unknown transport errors return dispatched=true. Keep transportFor and legacy fleetChannelFor signatures.
+
+- [ ] Write `TestReplicaRoundRobinAndEjection`: 1,000 requests across A/B differ by at most one with persistent client connections; A ejects, all later requests reach B, cursor and integer wrap do not panic. `TestReplicaGetRetryBeforeHeaders` kills selected transport after dispatch but before headers: GET/HEAD retry once per untried healthy copy, at most size of captured live set, no body replay without GetBody; context cancellation stops. `TestReplicaPostIsNotReplayedAfterDispatch`: app increments then transport dies, `increments==1` and response is error. Pre-dispatch disconnected channel retries POST without consuming body. Idempotency-Key does not make POST retryable. `TestReplicaStreamingAndUpgradeLoss` asserts after first response byte or 101 there is zero replay and connection closes; reconnect chooses a healthy copy. An HTTP 500 response is returned once, not retried as a transport failure. `TestReplicaNoHealthyCopies` gives reviewed 503 plus Retry-After: 2.
+ Assertion contract over fixture outputs for `TestReplicaPostIsNotReplayedAfterDispatch`:
+ ```go
+ // TestReplicaPostIsNotReplayedAfterDispatch
+ if increments != 1 || attempts != 1 || proxyErr == nil { t.Fatal("ambiguous POST was repeated") }
+ ```
+- [ ] Run `go test ./internal/edge ./internal/replicas -run 'TestReplica(RoundRobin.*|GetRetry.*|Post.*|Streaming.*|NoHealthy.*)$' -count=1`; expect FAIL.
+- [ ] Implement round-robin per host over assigned live boxes only. Reuse tunnel header/geo/purge/upgrade discipline; channel transports retain per-box connection pools, so client or h2 keepalive cannot pin selection. Do not use Route.Addrs, hibernation/provision.Health, or fleetChannelFor fallback as a replica list. A typed pre-dispatch failure is emitted only before touching a body or invoking h2 RoundTrip. Once h2 owns a request, assume dispatch occurred; audit stdlib internal retry behavior and wrap one-shot bodies so it cannot replay a POST based on Idempotency-Key or a stale stream. GET/HEAD retries need a reproducible body (normally none); cap at one pass through untried copies, each attempt at most 3 seconds before headers, with request cancellation respected.
+- [ ] Do not buffer responses for failover. The ReverseProxy must receive the final response once; headers/output/101 transfer end retry authority. Close failed bodies and reservations, keep existing websocket admission/caps on every newly selected channel, and use the current healthy copy on reconnect. Tag request records with selected box and attempt count; meter the client response once and retain existing hub-versus-box billing rules. Probe traffic is excluded. New visitor/log/error strings use SR-3 rows.
+- [ ] Re-run targeted tests; expect PASS.
+- [ ] Mutation-check dispatched-default, POST retry refusal, response-started refusal and upgrade reservation cleanup (4 checks).
+- [ ] Census-card/CLAIMS/proposal and independent #280 verdict; commit `feat: balance replica requests with safe failover` with a body.
+
+### Task 3: Integrate replica routing with every hub gate and reload path
+
+**Files:** Modify `internal/edge/fleetforward.go`, `internal/edge/edge.go`, `internal/host/fleetbind.go`, `internal/provision/forward.go`, `internal/status/snapshot.go`, `internal/console/apiinstances.go`; tests `internal/edge/replicaforward_test.go`, `internal/host/replica_tunnel_e2e_test.go`, `internal/host/replica_request_budget_test.go`.
+
+**Interfaces:** Consumes Plan 2 set rows and Task 1 Snapshot/Task 2 replicaProxy. Produces replica-aware selection inside existing `FleetArmVerdict`, `DispatchArm` and Reload signatures, and `BoxMetrics.ReplicaCopies map[string][]replicas.Copy` / `replica_copies` for historical snapshots. Hub live snapshot remains authoritative for current health.
+
+- [ ] Write `TestReplicaAliasesPreserveSetAuthority`: custom domains, platform aliases and wildcard parents resolve to the source's same set and account; wrong fleet owner, non-hub forward row, sidecar, conflicting platform row or forbidden forward column serves nothing, with no fallback into socket/static arms. `TestReplicaReloadAndBindingRace` races set shrink, stale single binding, tunnel reconnect and Reload; no removed box is dialled and no probe job leaks. `TestReplicaTwoBoxTunnelFailover` uses real reverse h2 tunnels and two app handlers: balanced reads, hard connection cut, healthy survivor, return/re-admission and worker metadata, all with zero bucket requests during probes or forwarding. Keep labelled stateful 503/no-fallback and unlabelled legacy fallback assertions in `TestLegacyFleetRoutingUnchanged`.
+ Assertion contract over fixture outputs for `TestReplicaAliasesPreserveSetAuthority`:
+ ```go
+ // TestReplicaAliasesPreserveSetAuthority
+ if sourceSet != aliasSet || wrongOwnerDials != 0 || sidecarDials != 0 { t.Fatal("alias or dispatch escaped set authority") }
+ ```
+- [ ] Run `go test ./internal/edge ./internal/host ./internal/provision ./internal/console ./internal/status -run 'Test(Replica(Aliases.*|Reload.*|TwoBox.*|RequestBudget)|LegacyFleetRoutingUnchanged)$' -count=1`; expect FAIL.
+- [ ] Wire the new path only for validated stateless set rows. Keep FleetArmVerdict the authority shared by routing, edges files and alias folds; never bypass its owner, kind or inert-row checks. Distinguish same host across lifetimes when replacing health jobs. ReconcileFleetBindings consumes the set only for a current validated assignment and cannot overwrite it from legacy Box. Add historical copy data to the existing five-minute status report, with a fresh copy of maps under locks, and console's live local snapshot join for one-copy state. Do not speed up the bucket heartbeat.
+- [ ] Re-run targeted tests; expect PASS.
+- [ ] Run `go test -race ./internal/edge ./internal/activator ./internal/host ./internal/provision ./internal/console ./internal/status ./internal/reqrec ./internal/replicas ./internal/tunnelclient -run 'Test(Replica.*|LegacyFleetRoutingUnchanged)$' -count=1`; expect PASS.
+- [ ] Cross-compile all three targets; expect clean builds.
+- [ ] Complete task census and independent root/forwarding review on #280.
+- [ ] Commit `feat: integrate replica routing across hub views` with a body, describe/review/land on green amadan CI.
+- [ ] Smoke the branch's exact binary on an authorized dev hub and one assigned stateless app: live health, public GET/version header, hard app stop with tunnel still connected, automatic restart/re-admission and run/worker readback. Keep copies=1 in live records until Plan 4's floor release. The two-copy spread claim at this stage is a local integration result, not a completed live drill.
diff --git a/docs/superpowers/plans/2026-11-01-stateless-replicas-4-deploy-and-drill.md b/docs/superpowers/plans/2026-11-01-stateless-replicas-4-deploy-and-drill.md
new file mode 100644
index 000000000..ca8ee5133
--- /dev/null
+++ b/docs/superpowers/plans/2026-11-01-stateless-replicas-4-deploy-and-drill.md
@@ -0,0 +1,137 @@
+# Stateless replicas: deploys, visibility and dev drill Implementation Plan
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** Release once per instance/build attempt, swap copies in order, and prove two-box availability on dev.
+
+**Architecture:** Extend the one-copy durable release result with a single outstanding box permit. Join the hub live table into copy views, target commands to one copy, and activate replicas only in the final floor release.
+
+**Tech Stack:** Go, existing release.Store compare-and-swap, console API, reverse HTTP/2 tunnels, systemd and cgroups on Linux.
+
+**Spec:** `docs/superpowers/specs/2026-11-01-stateless-replicas-design.md` (rev 2, approved 2026-11-01).
+
+## Global Constraints
+
+- Copy: use the series copy deck, ids `SR-<plan>-C<nn>`, pending until Paul's copy review; apply edits verbatim before building strings. No em dashes; neutral shop/example.com names.
+- Census in every root-scope task: `make census-card`, CLAIMS, `make census-propose NAME=<branch> CLAIMS=<file>`, independent reviewer on amadan #280. Maintain the separate record-write census.
+- Verification: at most 10 mutations per task, only refusal/security/termination/lifecycle paths, each with targeted `-run`. Local tests once with `-count=1`, one touched-package `-race` run per plan; CI runs the full suite. Smoke real dev as soon as end-to-end behavior works.
+- Cross-compile: `GOOS=darwin go build ./...`, `GOOS=windows go build ./...`, `GOOS=linux GOARCH=arm64 go build ./...`. Linux code in `_linux.go`; default Go cache, disk scratch, cleanup.
+- Requests: no new per-box/per-copy bucket polling. Use the index's existing reads/reports; one coordinator renewal per instance, zero bucket calls on requests/probes.
+- Provider-neutral core: no AWS assumptions outside adapters.
+- Floors: copies default 1; above 1 requires every fleet box and console at StatelessReplicasFloor. Unreadable evidence refuses. Do not release that floor before Plan 4 passes. Stateless launches require StatelessRuntimeFloor.
+- Dev first: two-box dev fleet; the first user's fleet is outside scope. AGENTS.md scoped approval precedes shared-account infrastructure/machine changes, including the drill and cleanup.
+- Read the index/spec rev 2. Additive wire fields; one host record, one copy per box; web/workers independent of coordination. Carry review history and stopping rules from AGENTS.md; land each plan only through reviewed, green amadan CI. This session commits plans without pushing.
+
+## Review Focus
+
+1. A coordinator can die after migrations commit but before success records: Task 1 `TestReplicaReleaseCoordinatorDiesBeforeCommit`.
+2. A box absent during deploy can return on an obsolete build: Task 2 `TestReplicaReturnsAfterDeploy`.
+3. A command or terminal must not start on every assigned box: Task 3 `TestReplicaRunAndTTYTargetOneBox`.
+4. A live health answer and an old five-minute status report can disagree: Task 3 `TestReplicaVisibilityPrefersLiveHealth`.
+5. A larger copy can make overlap exceed physical memory: Task 4 `TestFleetLargeSwapReservesHeadroom`.
+
+---
+
+### Task 1: Persist one release run and one outstanding swap permission
+
+**Files:** Create `internal/replicas/deploy.go`, `internal/console/replicadeploy.go`, `internal/host/replicadeploy.go`; modify `internal/provision/replicadeploy.go`, `internal/console/authcli.go`, `internal/console/apicli.go`, `internal/console/confirm.go`, `internal/console/ladder.go`, `internal/console/deployments.go`, `internal/activator/coordinator.go`, `deploywatch.go`, `instances_cli.go`; test `internal/replicas/deploy_test.go`, `internal/provision/replicadeploy_test.go`, `internal/console/replicadeploy_test.go`, `internal/host/replicadeploy_test.go`.
+
+**Interfaces:** Consumes Plans 1-3's release record, coordinator and current health. Produces index DeployChange and `replicas.NextDeploy(cur Deploy,change DeployChange,coordinator Coordinator,now time.Time) (Deploy,error)`; `provision.SetRecordReplicaDeploy(ctx context.Context,s release.Store,id replicas.Identity,change replicas.DeployChange,now time.Time) (*Record,error)`; `(*Server).handleReplicaDeploy(w http.ResponseWriter,r *http.Request)` at `POST /api/fleet/replicas/{account}/{app}/{host}/deploy`; `(*Server).beginReplicaDeploy(ctx context.Context,rec provision.Record,target replicas.Build,retry bool) (*provision.Record,error)`. Host defines `replicaDeployClient` with `Transition(context.Context,replicas.Identity,replicas.DeployChange) (provision.Record,error)` and `newReplicaDeployWorker(client replicaDeployClient,box string,svc *activator.Service) *replicaDeployWorker`. Its `(*replicaDeployWorker).Note(rec provision.Record)` and `.Pass(ctx context.Context)` use the existing record observation/tick, not their own poller.
+
+- [ ] Write `TestReplicaReleaseCoordinatorDiesBeforeCommit`: persist releasing, execute migration side effect, lose term before success CAS; old copies keep old build, phase unknown is terminal, command does not restart on another box; explicit retry creates another ID and may repeat. `TestReplicaReleaseOncePerInstanceBuild` asserts two instances have two independent runs, two copies of one instance have one run, duplicate notification has zero extra runs, release-free binary has zero commands. `TestReplicaDeployTransitionCAS` rejects wrong id, target digest, term, lifetime, box, revision, illegal edge and late success; retry rereads all guards. `TestReplicaOnlyOneOutstandingPermit` randomizes duplicate/reordered/lost messages and crashes: `len(activePermits)<=1`, release not released implies `targetStarts==0`; only matching ACK clears ActiveBox. `TestReplicaDeployFailedRelease` asserts every copy remains old on nonzero exit, timeout, unreadable result or unproven stop.
+ Assertion contract over fixture outputs for `TestReplicaReleaseCoordinatorDiesBeforeCommit`:
+ ```go
+ // TestReplicaReleaseCoordinatorDiesBeforeCommit
+ if phase != "unknown" || automaticRuns != 1 || targetStarts != 0 { t.Fatal("unknown release was treated as success or retried") }
+ ```
+- [ ] Run `go test ./internal/replicas ./internal/provision ./internal/console ./internal/host -run 'TestReplica(Release.*|Deploy.*|OnlyOne.*)$' -count=1`; expect FAIL.
+- [ ] Implement the typed transition table in the listed files. Use Coordinator's existing owner/auth/lifetime gate for releasing/released/failure/permit/done. A box ACK is authenticated as ActiveBox and matches the deploy revision; it cannot grant itself another permit or success. Store writes remain console-side under app/record locking, through typed provision methods; fleet workers report events through existing authenticated console transport. No new fleet bucket write permission is needed. Failed CAS responses are reconciled by idempotent reads of that same event, not by launching the command twice.
+- [ ] Join promotion, rollback, first deployment, retry, web UI and direct-bucket observation to beginReplicaDeploy. New pointer/build creates a new ID once per host/lifetime; a duplicate pointer and ordinary restart do not. A retry of failed/unknown needs the existing explicit deploy/instances-retry action, which allocates a new ID even for the same build. Persist intent before serial notification and resume a committed intent whose notification failed. Pin target to canonical manifest digest; never derive success from GoodVersion or HTTP version alone. The coordinator uses current healthy assigned copies for sorted Order, omits already-down boxes and includes itself in normal label order. An attempt with no healthy copy may bootstrap its first copy only after the release passed; it is never reported as an availability-preserving rollout.
+- [ ] Re-run targeted tests; expect PASS.
+- [ ] Mutation-check phase-before-command, term/lifetime, digest, ACK ownership and active-permit exclusivity (5 checks).
+- [ ] Census-card/CLAIMS/proposal, extend the record-write census and API lock witnesses, get independent #280 verdict.
+- [ ] Commit `feat: coordinate fleet release and ordered copy swaps` with a body. All new status/retry/refusal text uses SR-4 rows.
+
+### Task 2: Make every launch honor the release result and its box permission
+
+**Files:** Create `internal/rollout/replicas.go`, `internal/activator/replicadeploy.go`; modify `internal/replicas/deploy.go`, `internal/rollout/manager.go`, `internal/rollout/scheduler.go`, `internal/rollout/wakeplan.go`, `internal/activator/swap.go`, `internal/activator/activator.go`, `internal/activator/rootfsrelease.go`, `internal/activator/rootfsworkers.go`, `internal/host/agent.go`, `internal/host/replicadeploy.go`; test `internal/rollout/replicas_test.go`, `internal/activator/replicadeploy_test.go`, `internal/host/replica_deploy_e2e_test.go`.
+
+**Interfaces:** Consumes Task 1 committed Deploy and coordinator. Produces `(*replicas.Deploy).Allows(box,incarnation,manifestDigest string) bool`; `(*rollout.Manager).NoteReplicaDeploy(rec provision.Record)`; `(*activator.Service).SetReplicaDeploy(host string,deploy replicas.Deploy,box string)`; `(*activator.Service).ReplicaSwap(ctx context.Context,at activator.Attempt,deploy replicas.Deploy,box string,newest func(string) uint64) activator.SwapResult` (inside activator the types are unqualified). SetReplicaDeploy is an observed policy update, not a grant that substitutes for the root's existing launch gates.
+
+- [ ] Write `TestReplicaOrderedOverlap`: A swaps, remains healthy on target through existing settle window, completes worker handover and proves old stopped, then B begins; no second release command. `TestReplicaReturnsAfterDeploy` crashes B before scheduling, deploys on A, returns B with stale installed/good state and asserts B cold-starts the committed target, zero extra migrations, no old+new local generation left running. `TestReplicaReturnDuringFailedRelease` keeps B on Previous and never target. `TestReplicaSwapUnknownHalts` drops an ACK or loses the active box during swap; no next permit until that exact success is recovered, otherwise halt and leave other serving copies. `TestReplicaOneSurvivorDeploy` switches that survivor alone; `TestReplicaWakeAndAdoptCannotBypassRelease` exercises planned/fallback/pinned/restart/held/recovery/ConvergeAdopted and cold-wake paths against absent, failed and unknown release state.
+ Assertion contract over fixture outputs for `TestReplicaReturnsAfterDeploy`:
+ ```go
+ // TestReplicaReturnsAfterDeploy
+ if returnedVersion != targetVersion || extraReleaseRuns != 0 || staleProcesses != 0 { t.Fatal("returning copy did not join committed target") }
+ ```
+- [ ] Run `go test ./internal/rollout ./internal/activator ./internal/host -run 'TestReplica(Ordered.*|Returns.*|ReturnDuring.*|Swap.*|OneSurvivor.*|WakeAndAdopt.*)$' -count=1`; expect FAIL.
+- [ ] Implement the exact methods. Every path onto the target checks the committed release/deploy/lifetime and this box's permit; installing a pointer or repointing a symlink alone does not cycle the process. Suppress the local scheduler's ordinary parallel canary/cohort execution for set assignments, while preserving its generation gates, staged verification, first-wake outcome/failure book and stop proofs. ReplicaSwap uses existing overlap, never stop-then-start to force progress; incompatible release hold demand or app hold policy is refused before a replicated rollout. For a permitted target, suppress per-copy releaseInWake/releaseBeforeSwap only after matching the durable release success, not on Stateless alone.
+- [ ] Only acknowledge after new web GET / health, normal settle window, worker handover and old generation proof. Failed successor keeps its incumbent and halts further permits. If a holder disappears during an active swap, preserve its outstanding step; do not infer termination from tunnel loss. A returning copy with a successful target but no scheduled active step must prove stale local generations stopped, then join that target; it cannot trigger another overlap/release. A deploy interrupted after some successful swaps resumes from durable Completed or halts, without rolling healthy targets back automatically. Existing copies keep serving through coordinator loss. A new deploy request waits for the previous active step to settle; superseding a pointer never creates two active steps.
+- [ ] Re-run targeted tests; expect PASS.
+- [ ] Mutation-check target gate at wake and swap, no per-copy release, ACK-after-proof, and uncertain-step retention (5 checks).
+- [ ] Finish census-card/CLAIMS/proposal and independent root/termination review on #280.
+- [ ] Commit `feat: enforce replica rollout permissions at launch` with a body. Smoke an authorized dev one-copy release success/failure with the exact binary now, before adding visibility.
+
+### Task 3: Show each copy and target commands to one of them
+
+**Files:** Create `internal/console/replicaview.go`, `instances_copies.go`; modify `internal/console/apiinstances.go`, `internal/console/apiinteractive.go`, `internal/console/apiinteractivebox.go`, `internal/console/apiruns.go`, `internal/console/templates/app_overview.html`, `internal/console/instances.go`, `internal/host/runs.go`, `internal/host/interactive.go`, `internal/host/runrelay.go`, `internal/host/logship.go`, `internal/host/metrics_probes.go`, `internal/interactive/interactive.go`, `internal/interactive/grant.go`, `internal/runs/runs.go`, `internal/provision/run.go`, `internal/provision/interactive.go`, `apimode.go`, `instances_cli.go`, `instances_rootfs.go`, `run.go`, `logs.go`, `docs/site/cli.md`; test `internal/console/replicaview_test.go`, `internal/host/replica_target_test.go`, `internal/interactive/replica_target_test.go`, `instances_copies_test.go`.
+
+**Interfaces:** Produces `(*Server).replicaViews(ctx context.Context,recs []provision.Record) (map[string]replicas.Snapshot,error)`; `(*Server).chooseReplicaBox(ctx context.Context,rec provision.Record,want string) (string,*doorRefusal)`; `copyRows(rec apiInstanceRecord) []apiInstanceRecord` for printing only; add client `Box string` with `json:"-"` for rendered rows and `Copies []replicas.Copy` with `json:"copies,omitempty"` on the decoded host object. TargetBox on runs, Box on Open/Grant and record run/session target are added together. Existing run/session idempotency, permissions and audit interfaces retain their signatures; their typed transition payloads gain the target.
+
+- [ ] Write `TestReplicaVisibilityPrefersLiveHealth`: status says two running, live hub says B down, both API and app show one of two; no hub reading gives unknown, never two healthy. Absent assignment slots appear as missing copy rows, not invented box labels; copies=1 legacy output keeps RUNTIME/WORKERS. `TestReplicaCopyListHasOneRowPerBox` asserts A and B rows have their own build/state/health/workers, API still has one host object and filters do not duplicate mutations. `TestReplicaRunAndTTYTargetOneBox` asserts automatic healthy selection executes once, --box selects that healthy assigned box, wrong fleet/nonmember/down target refuses, a move between selection and pickup refuses or expires rather than running elsewhere. `TestReplicaSignedTargetCannotChange` rejects altered grant targets and attach from another box; empty old grants remain single-copy-compatible. `TestReplicaLogsAndMetricsCarryBox` distinguishes matching process names on A/B and excludes another account's copies.
+ Assertion contract over fixture outputs for `TestReplicaRunAndTTYTargetOneBox`:
+ ```go
+ // TestReplicaRunAndTTYTargetOneBox
+ if runStarts != 1 || ttyStarts != 1 || executorBox != selectedBox { t.Fatal("command targeting was not exclusive") }
+ ```
+- [ ] Run `go test ./internal/console ./internal/host ./internal/interactive ./internal/runs ./internal/provision . -run 'TestReplica(Visibility.*|CopyList.*|RunAndTTY.*|SignedTarget.*|LogsAndMetrics.*)$' -count=1`; expect FAIL.
+- [ ] Implement these interfaces on API reads using Plan 3's private Unix snapshot socket. Join by account/app/host/lifetime and assignment revision; no new bucket cadence. CLI expands Copies only for rendering, preserving host-based set/delete semantics and existing RUNTIME/WORKERS columns. App running count uses Desired minus the missing/unhealthy entries, not `len(Boxes)`. Logs/metrics use authenticated physical box label plus lifetime, never tenant-supplied process metadata. Keep normal historical batch/status paths.
+- [ ] Add --box to carlos run, carlos run -it and carlos console. Pick a healthy copy when omitted (first sorted healthy label), persist the target before pickup and include it in signed session/run grants. Every assigned box sees the same record, but only the selected one can pick up/attach; RunState.Box still records the actual executor. Do not retry an accepted command on another box after ambiguous execution. Preserve CSRF/owner/fresh-auth ordering for UI, team/service scope, interactive opt-in, run key dedupe, quotas and pickup/expiry cleanup. New fields must survive ordinary record writers and participate in grant validation. Review SR-4 labels/help/status/docs before insertion.
+- [ ] Re-run targeted tests; expect PASS.
+- [ ] Mutation-check target signature/attach, pickup membership and account join (3 checks).
+- [ ] Complete census-card/CLAIMS/proposal plus record-write inventory/lock witnesses for changed run/session transitions and independent #280 verdict.
+- [ ] Commit `feat: expose replica health and command targeting` with a body. Dev smoke exact CLI/API binary for copy=1 list/run/-it/console/logs, before full two-copy activation.
+
+### Task 4: Let a fleet copy use most of a box without weakening root limits
+
+**Files:** Create `internal/console/replicasize.go`; modify `internal/replicas/placement.go`, `internal/console/replicaplacement.go`, `internal/cgroup/sizes.go`, `internal/cgroup/gen.go`, `internal/cgroup/strict_gen_linux.go`, `internal/apppolicy/apppolicy.go`, `internal/console/policysize.go`, `internal/console/apipolicy.go`, `internal/activator/size.go`, `internal/activator/swap.go`, `internal/host/headroom.go`, `internal/instancectl/gen.go`, `internal/instancectl/size.go`, `apps_policy.go`, `instances_cli.go`, `docs/site/cli.md`; test `internal/cgroup/sizes_test.go`, `internal/console/replicasize_test.go`, `internal/activator/replicasize_test.go`, `internal/host/replicasize_test.go`.
+
+**Interfaces:** Produces `cgroup.FleetSize(name string) bool`; `fleetSizeRefusal(boxes []sizeBox,complete bool,size cgroup.Size) *doorRefusal`; `replicas.FleetMemoryBudget(totalBytes int64) int64`; `(*Service).fleetOverlapFits(ctx context.Context,rt registry.Route,next cgroup.Limit) error`; `(*instancectl.Server).fleetSizeAllowed(ctx context.Context,host string,size cgroup.Size) error` in `internal/instancectl/size.go`. Existing Sizes, SizeByName, SizedLimit, apppolicy validation and root named-limit contracts retain their signatures.
+
+- [ ] Write `TestFleetSizeBounds`: add literal named sizes 6g=6 GiB, 12g=12 GiB, 24g=24 GiB, 48g=48 GiB, 96g=96 GiB and 192g=192 GiB; reserve max(1 GiB,total/8). An 8 GiB owned fleet box accepts 6g, refuses a limit above 7 GiB; exact boundary is allowed, one byte over refused, unknown/incomplete total fails closed. Mixed-size fleet checks the smallest eligible destination including spare boxes. New tiers and the relaxed bound require StatelessReplicasFloor on every destination and the console; v0.34.0 does not know these tiers. `TestSharedSizeQuarterUnchanged` keeps the existing quarter rule and refuses new fleet-only tiers on shared/platform/external routes. `TestFleetSizeRootValidator` accepts only named rows or sums for an authorized fleet instance, rejects arbitrary/overflowed agent memory numbers and fleet tiers on shared rows.
+- [ ] Write `TestFleetLargeSwapReservesHeadroom`: two apps race an overlap on one box; atomically reserve additional physical headroom before spawning, at most one succeeds, refusal leaves incumbent serving and releases no else's reservation. A failed/new candidate OOM is contained to its generation. Test worker/release memory counted, total reserve retained, and reservations released only after termination proof; no live memory growth is attempted. `TestFleetLargePlacementFit` rejects a smaller spare for which this app's configured size does not fit and reports shortfall rather than shrinking the copy.
+ Assertion contract over fixture outputs for `TestFleetLargeSwapReservesHeadroom`:
+ ```go
+ // TestFleetLargeSwapReservesHeadroom
+ if admittedOverlaps != 1 || incumbentStops != 0 || reservedBytesAfterProof != 0 { t.Fatal("memory reservation escaped overlap lifecycle") }
+ ```
+- [ ] Run `go test ./internal/cgroup ./internal/apppolicy ./internal/console ./internal/activator ./internal/host -run 'Test(Fleet(Size.*|Large.*)|SharedSizeQuarterUnchanged)$' -count=1`; expect FAIL.
+- [ ] Implement named rows only: CPUQuotaPercent is 1200, 2400, 4800, 9600, 19200 and 38400 respectively (xlarge's existing 200 percent per GiB); CPUWeight=200 and IOWeight=200 for each; memory is the literal tier value. Keep the table ordered and existing names/numbers unchanged. FleetMemoryBudget returns max(0,total-max(1GiB,total/8)); apply this instead of quarter only when every possible record placement is a known owned managed fleet. No records, mixed destinations or unresolved scope use the existing conservative rule and reject fleet-only names. Size increases remain next-start/next-swap memory changes, as today; CPU/IO behavior remains existing behavior.
+- [ ] Carry the same size-fit predicate into Plan 2 placement and create/size/default-size doors, including every existing instance of an app. At root, derive fleet eligibility from the existing verified record/launch binding, not a request boolean. The named-table sum validator alone must not authorize fleet limits on shared boxes. Use existing box memory-pressure samples and one local reservation lock shared with ordinary overlap starts; reserve the successor's configured memory plus required release/worker budget before raising the parent. If insufficient physical headroom, leave the old build and report blocked, never force a hold swap. Keep reservations through unproven stops. No new bucket reads or unbounded root inputs.
+- [ ] Re-run targeted tests; expect PASS.
+- [ ] Mutation-check fleet eligibility, budget boundary, reservation-before-spawn and root named-limit gate (4 checks).
+- [ ] Census-card/CLAIMS/proposal and independent root/resource review on #280.
+- [ ] Commit `feat: add larger sizes for owned fleet copies` with a body. On authorized dev hardware with sufficient spare memory, smoke a next-swap size change and read back applied memory through API; a capacity refusal is evidence of the gate, not a successful large-size smoke.
+
+### Task 5: Activate the release floor and run the two-box dev drill
+
+**Files:** Modify `internal/console/rootfsfloor.go`, `internal/host/systemapply.go`, `internal/release/layoutintent.go`, `internal/console/appcopies.go`; test `internal/console/replicafloor_test.go`, `internal/host/replica_floor_test.go`; modify `docs/site/nav.json`; create `scripts/stateless-replicas-drill/main.go`, `scripts/stateless-replicas-drill/accounting_test.go`, `docs/superpowers/notes/stateless-replicas-dev-drill.md` during execution, plus reviewed `docs/site/stateless-replicas.md` and its navigation entry.
+
+**Interfaces:** Consumes the complete series. Produces `(*Server).replicaFloorJudge(ctx context.Context,channel,target string) error`, invoked at final system publication under existing floor locking; root backstop `replicaFloorAllows(installed,candidate string,active bool) bool`. Drill `runDrill(ctx context.Context,cfg drillConfig) (drillReport,error)` is isolated tooling, never imported by root. Define `drillConfig{Console, Account, App, Host, Fleet, BoxA, BoxB, OutputDir string; Duration time.Duration; Rate int}` and `drillReport{Tip string; Samples, PreHeaderFailures, StreamCuts, ReleaseRuns int; ByBox map[string]int; MaxReconnect time.Duration; Ordered, Passed bool}` in its main.go. It reads authenticated CLI/API state and request records, and accepts an explicit operator action at hard-stop/return points rather than embedding provider credentials.
+
+- [ ] Write `TestReplicaFloorCannotDowngradeActiveCopies`: copies>1 anywhere refuses a system target below v0.35.0, including first publish/downgrade race, copies=1 with multiple assigned or retiring boxes, and unreadable inventory; root refuses the same crossing. No generic override silently permits it. `TestReplicaFloorEnablesOnlyCompleteFleet` asserts old/missing/stale box or console refuses, every complete v0.35.0 box allows 2; count=1 changes no existing app. `TestReplicaDrillAccounting` checks deterministic sample data: pre-header failure is a failure, truncated stream is a separately reported cut, probe/warm-up traffic excluded and per-box/hub counts reconcile. Table errors cannot turn a missing sample into a pass.
+ Assertion contract over fixture outputs for `TestReplicaDrillAccounting`:
+ ```go
+ // TestReplicaDrillAccounting
+ if preHeaderFailures != 1 || streamCuts != 1 || probeRequests != 0 { t.Fatal("drill hid failures or counted probe traffic") }
+ ```
+- [ ] Run `go test ./internal/console ./internal/host ./scripts/stateless-replicas-drill -run 'TestReplica(Floor.*|DrillAccounting)$' -count=1`; expect FAIL.
+- [ ] Implement floor enforcement and the drill contract. Audit system promote/rollback/update publication and root application, not only apps set. Preserve existing floor locks and ordering; under the same lock, active-copy creation and a below-floor publication cannot both pass. Add the docs page and CLI cross-links through copy review, covering external data, repeated migrations after unknown release result, per-instance release scope, no hub HA, one-copy hibernate, websocket reconnects, size headroom, and streamed-response cuts. Never tell the user to use a box command to complete a CLI operation.
+- [ ] Re-run targeted tests; expect PASS.
+- [ ] Run `go test -race ./internal/replicas ./internal/provision ./internal/console ./internal/host ./internal/activator ./internal/rollout ./internal/interactive ./internal/runs ./internal/apppolicy ./internal/cgroup ./internal/instancectl ./internal/release . ./scripts/stateless-replicas-drill -run 'Test(Replica.*|Fleet.*|SharedSizeQuarterUnchanged)$' -count=1`; expect PASS, including the root size validator. Run `go test ./internal/docsite -count=1` for the changed page/navigation; expect PASS.
+- [ ] Cross-compile all three targets; expect clean builds. Complete this task's census proposal, record #280 review and the complete branch review under the same round budget. Use amadan's full build/vet/test/gofmt gate on the final tip; no repeated local full suite.
+- [ ] Commit `feat: gate replica activation and add the dev drill` with a body. Keep the Plan 4 branch open through the dev drill; no production infra changes are authorized.
+- [ ] Prepare a concrete dev scope before live work: existing two dev boxes in separate availability zones, hub, account/region/domain, app/database/Redis and egress, exact hard-stop/start operations, expected traffic/cost/duration, credentials/permissions, restoration and cleanup. If no such sandbox scope was already authorized, get Paul's approval now. Use neutral shop/example.com fixture names; no tenant workloads. Stage a small Rails fixture with external Postgres/Redis, a worker that records heartbeats, repeat-safe release counter and Redis-backed websocket client. Do not create IAM/DNS/machines or databases without that explicit scope. Build an untagged dev candidate of the complete branch using reserved version v0.35.0, with its full git tip and artifact hash recorded separately. Install only within the approved dev scope using the existing deployment workflow; verify that exact candidate on hub/console and every dev fleet box, then set `carlos apps set shop --copies 2`.
+- [ ] Run the actual drill for 10 minutes at 20 GET/s after readiness, bypassing cache with unique request ids. Spread must be 45%-55% to each box over at least 2,000 successes, corroborated by hub selected-box and box request records. Hard-stop one machine outright through the approved operator action; among requests with no response started, require zero failed reads after bounded retry, independently count every truncated stream. Live view must show 1 of 2 within 3 seconds, survivor worker heartbeats continue, websockets reconnect within 5 seconds, and no duplicate local copy appears. Restore the machine; require automatic readiness/traffic recovery within 180 seconds of its agent/tunnel becoming available and repeat the 45%-55% window. Also exercise one distinct spare box locally in integration tests; the live drill itself stays two boxes.
+- [ ] Deploy a successful new build under load: release counter increments once per instance, per-box generation events prove strictly ordered overlap and no failed pre-header reads. Deploy a failing release: all copies keep old builds and target web never runs. Kill the coordinator during a release once: terminal unknown/failure, old builds serve, ordinary redeploy repeats safely with a new ID. Check run/TTY --box and automatic choice, per-copy list/build/workers and logs, plus scale-down to 1 and refusal of stateful/hibernate at 2. Save timestamped measurements, exact binary/build ids, API responses and all failures in the drill report. A failed assertion leaves activation acceptance incomplete; do not call the drill passed.
+- [ ] Restore every stopped dev machine, return requested copy counts/settings to the approved scope's baseline, remove only this drill's fixture/data/scratch and stop load clients/watchers. Record any intentionally retained dev app per the approved scope. Commit reviewed evidence on this same branch with subject `test: record the two-box stateless replica drill` and a body. Describe the complete branch, include the census/independent verdict and drill, push to amadan, check green CI on its full tip, and squash-merge once with -expect. Read main CI. Only then cut the public v0.35.0 release through the existing workflow. Finish line: this plan merged with a passing drill and cleanup complete; the first user's production fleet stays outside scope.
diff --git a/docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md b/docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md
new file mode 100644
index 000000000..47ae497a9
--- /dev/null
+++ b/docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md
@@ -0,0 +1,110 @@
+# Stateless replicas: copy deck (pending)
+
+Drafts for plans 1-4. Every row is pending Paul's copy review. This planning
+commit does not approve these words or authorize building them into software.
+Use the rootfs copy deck's id/file/text/status format. Placeholders name runtime
+values, not approved literal tenant names. No em dashes. Examples use shop and
+example.com. Reuse existing approved strings where behavior is unchanged.
+
+Before implementing a task, review its rows with copy-review, apply Paul's
+edits verbatim here and in the implementation, and mark only those rows approved.
+Add any newly discovered string to this deck before implementing it. The copy
+gate inventories built ids separately, so later pending rows do not block an
+earlier plan whose own built rows are approved. Status and column labels are
+copy too. Internal wire enums are not an excuse to expose unreviewed text.
+
+## Plan 1: storage mode and coordination
+
+| id | file | text | status |
+|---|---|---|---|
+| SR-1-C01 | ship_stateless.go | this release keeps no local database. CARLOS_DB, SQLite restore and Litestream are off | pending |
+| SR-1-C02 | internal/release/stateless.go | --stateless is available for binary and rootfs releases only | pending |
+| SR-1-C03 | internal/release/stateless.go | this version was already shipped with a different storage declaration. ship a new version | pending |
+| SR-1-C04 | internal/console/replicacoordinator.go | the instance's coordinator changed before this operation finished. the app keeps serving | pending |
+| SR-1-C05 | internal/activator/coordinator.go | the release command's result is unknown, so the deploy stopped and the previous build keeps serving. deploy again to retry the command | pending |
+| SR-1-C06 | internal/activator/stateless.go | the new copy is waiting for the instance's shared secrets. existing copies keep serving | pending |
+| SR-1-C07 | internal/activator/stateless.go | could not verify this build's storage declaration, so it was not started | pending |
+| SR-1-C08 | internal/console/rootfs.go | this box needs platform <floor> or later to run a stateless release. update the box and try again | pending |
+| SR-1-C09 | ship_stateless.go | the console did not confirm the stateless declaration, so the ship could not be verified | pending |
+| SR-1-C10 | docs/site/cli.md | Add --stateless when your app keeps its data outside its box. The release gets no local database, CARLOS_DB or Litestream. You provide and operate its database and other data services. | pending |
+| SR-1-C11 | docs/site/cli.md | A stateless release can run more than one copy on a fleet after every fleet box and the console support replicas. Apps keep one copy until you set --copies. | pending |
+| SR-1-C12 | internal/console/replicacoordinator.go | this instance changed while coordination was being updated. try again | pending |
+
+## Plan 2: count and placement
+
+| id | file | text | status |
+|---|---|---|---|
+| SR-2-C01 | apps_copies.go | number of copies of each instance, on distinct boxes of the app's fleet (default 1) | pending |
+| SR-2-C02 | internal/console/appcopies.go | copies must be a whole number of at least 1 | pending |
+| SR-2-C03 | internal/console/appcopies.go | <n> copies need <n> eligible boxes. this fleet has <available> | pending |
+| SR-2-C04 | internal/console/appcopies.go | more than one copy requires a stateless, always-on release on every instance. set --copies 1 before selecting this release | pending |
+| SR-2-C05 | internal/console/appcopies.go | copies above 1 need every fleet box and the console on <floor> or later. update them and try again | pending |
+| SR-2-C06 | internal/console/appcopies.go | could not check every instance, release and fleet box, so the copy count was left unchanged. try again | pending |
+| SR-2-C07 | internal/console/appcopies.go | more than one copy is available for platform-managed instances on an owned fleet only | pending |
+| SR-2-C08 | apps_copies.go | <app>: <n> copies requested for each instance | pending |
+| SR-2-C09 | apps_copies.go | the console did not confirm <n> copies, so the change could not be verified | pending |
+| SR-2-C10 | internal/console/replicaplacement.go | detaching <box> leaves <running> of <desired> copies available. the requested count stays <desired> | pending |
+| SR-2-C11 | internal/console/appcopies.go | copies are still stopping on other boxes. wait for that to finish before selecting a release with a local database | pending |
+| SR-2-C12 | internal/console/appcopies.go | this instance has an import or move in progress. finish it before changing the copy count | pending |
+| SR-2-C13 | apps_swap.go | usage: carlos apps set <app> [--copies <n>] [--swap overlap\|hold] [--swap-concurrency <n>] [--interactive on\|off] [--account <sqid\|name>] [--account-id <sqid>] [--console <origin>] [--egress-allow <ip,...>] [--size <size>] | pending |
+| SR-2-C14 | docs/site/cli.md | Set the count with carlos apps set shop --copies 2. Each instance of shop gets two copies on different eligible fleet boxes. The command refuses a count larger than the eligible fleet. | pending |
+| SR-2-C15 | docs/site/cli.md | If a box is lost or detached, the requested count stays the same. The platform uses a distinct spare when one is available, otherwise the app runs short until a suitable box returns. | pending |
+| SR-2-C16 | internal/console/appcopies.go | more than one copy requires overlap deploys. select an overlap-compatible release and app policy first | pending |
+
+| SR-2-C17 | apps_swap.go | apps set: nothing to set. Pass --copies, --swap, --swap-concurrency, --egress-allow, --size or --interactive | pending |
+
+## Plan 3: routing and health
+
+| id | file | text | status |
+|---|---|---|---|
+| SR-3-C01 | internal/edge/replicaproxy.go | no healthy copy is available. try again shortly | pending |
+| SR-3-C02 | internal/edge/replicaproxy.go | the connection to this copy ended before it answered. this request was not repeated | pending |
+| SR-3-C03 | internal/edge/replicaprober.go | this copy did not pass its health check | pending |
+| SR-3-C04 | internal/edge/replicaprober.go | this box's tunnel is disconnected | pending |
+| SR-3-C05 | internal/edge/replicaprober.go | waiting for this copy to pass its health check | pending |
+| SR-3-C06 | internal/edge/replicaprober.go | this health answer belongs to an earlier instance or assignment | pending |
+| SR-3-C07 | internal/host/replicahealth_other.go | live replica health is unavailable on this system | pending |
+| SR-3-C08 | internal/console/replicaview.go | live copy health is unavailable | pending |
+
+## Plan 4: deployment and copy views
+
+| id | file | text | status |
+|---|---|---|---|
+| SR-4-C01 | internal/console/templates/app_overview.html | <running> of <desired> copies running | pending |
+| SR-4-C02 | instances_copies.go | BOX | pending |
+| SR-4-C03 | instances_copies.go | BUILD | pending |
+| SR-4-C04 | instances_copies.go | STATE | pending |
+| SR-4-C05 | instances_copies.go | HEALTH | pending |
+| SR-4-C06 | instances_copies.go | starting | pending |
+| SR-4-C07 | instances_copies.go | running | pending |
+| SR-4-C08 | instances_copies.go | down | pending |
+| SR-4-C09 | instances_copies.go | failed | pending |
+| SR-4-C10 | instances_copies.go | unknown | pending |
+| SR-4-C11 | instances_copies.go | missing | pending |
+| SR-4-C12 | run.go | run on this healthy assigned copy's box; otherwise choose a healthy copy | pending |
+| SR-4-C13 | internal/console/replicaview.go | <box> is not a healthy assigned copy of this instance | pending |
+| SR-4-C14 | internal/console/replicaview.go | no healthy copy is available for this command. try again after a copy is running | pending |
+| SR-4-C15 | internal/console/replicadeploy.go | the release command failed, so no copy switched to the new build | pending |
+| SR-4-C16 | internal/console/replicadeploy.go | this copy's switch has not been confirmed. other copies keep serving and the deploy is stopped | pending |
+| SR-4-C17 | internal/console/replicadeploy.go | switching <box> to <build> | pending |
+| SR-4-C18 | internal/console/replicadeploy.go | release complete; copies are switching one box at a time | pending |
+| SR-4-C19 | internal/console/replicasize.go | <size> leaves too little memory for the box on <box>. choose a smaller size | pending |
+| SR-4-C20 | internal/console/replicasize.go | this fleet size needs a complete memory report and a supported platform release on every possible destination. update the boxes and try again | pending |
+| SR-4-C21 | internal/console/replicasize.go | <size> is available on owned fleet boxes only | pending |
+| SR-4-C22 | internal/activator/replicadeploy.go | this box has too little free memory for an overlap swap. the current copy keeps serving | pending |
+| SR-4-C23 | internal/console/rootfsfloor.go | copies above 1 are in use, so the platform cannot move below <floor>. reduce the copy count and wait for other copies to stop first | pending |
+| SR-4-C24 | docs/site/stateless-replicas.md | Copies survive the loss of a fleet box. Traffic still enters through one hub, so this version does not survive losing that hub. | pending |
+| SR-4-C25 | docs/site/stateless-replicas.md | A deploy runs the release command once per instance, then switches its copies one box at a time. Your migrations must allow old and new code to serve together. Each copy runs every declared worker. | pending |
+| SR-4-C26 | docs/site/stateless-replicas.md | If the coordinator disappears during the release command, its result may be unknown. The deploy stops and the previous build keeps serving. Deploying again runs the command again, so release commands must be safe to repeat. Rails migrations record completed migrations in schema_migrations. | pending |
+| SR-4-C27 | docs/site/stateless-replicas.md | Reads can retry on another copy before a response starts. A response already streaming when its box dies is cut. Websockets disconnect and their clients reconnect to a healthy copy. | pending |
+| SR-4-C28 | docs/site/stateless-replicas.md | carlos instances list prints one row per copy with its box, build, state, health and workers. carlos run and carlos console choose a healthy copy; add --box <label> to choose one. An accepted command is not repeated on another box after a lost connection. | pending |
+| SR-4-C29 | docs/site/stateless-replicas.md | Fleet sizes add 6g, 12g, 24g, 48g, 96g and 192g, measured in GiB. Each copy leaves at least 1 GiB or one eighth of its box's memory for the box, whichever is larger. An overlap also needs room for the new generation. | pending |
+| SR-4-C30 | docs/site/stateless-replicas.md | More than one copy needs an always-on release. Set --copies 1 and wait for removed copies to stop before selecting a hibernating release or one with a local database. Switching to stateless leaves the old database and replica untouched. | pending |
+| SR-4-C31 | internal/console/replicadeploy.go | another deploy is still finishing a copy's switch. wait for it to finish before deploying again | pending |
+| SR-4-C32 | scripts/stateless-replicas-drill/main.go | spread: <a_percent>% on <box_a>, <b_percent>% on <box_b>; failed reads before headers: <failures>; cut streams: <cuts>; websocket reconnect: <seconds>s | pending |
+| SR-4-C33 | scripts/stateless-replicas-drill/main.go | the dev drill did not pass: <reason>. restore the stopped box and complete cleanup before closing this session | pending |
+| SR-4-C34 | docs/site/stateless-replicas.md | Stateless replicas | pending |
+| SR-4-C35 | internal/console/replicadeploy.go | release pending | pending |
+| SR-4-C36 | internal/console/replicadeploy.go | release running | pending |
+| SR-4-C37 | internal/console/replicadeploy.go | deploy complete | pending |
+| SR-4-C38 | internal/console/replicadeploy.go | release result unknown | pending |