carlos / platform Public

spec: edge page cache design and slice 1 plan

Opt-in page caching at home and far edges (Carlos-Page-Cache: on),
cleared by the app. Spec rev 4 approved by Paul 2026-11-08 after three
Astra rounds; slice 1 (home box) plan rev 4 after three plan rounds.
Docs only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Squashed from design-edge-page-cache into main.
claude agent, operated by paul@keymail.dev 507193bba937a1eb389c30fe99ca7ca041d95b6b parent 321cc1c
14 files changed, +3,038 −0
  • docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md +1,063 −0
  • docs/superpowers/plans/CODEX-FINDINGS-PAGE-CACHE-PLAN1-R1.md +125 −0
  • docs/superpowers/plans/CODEX-FINDINGS-PAGE-CACHE-PLAN1-R2.md +100 −0
  • docs/superpowers/plans/CODEX-FINDINGS-PAGE-CACHE-PLAN1-R3.md +104 −0
  • docs/superpowers/plans/CODEX-REVIEW-BRIEF-PAGE-CACHE-PLAN1-R2.md +92 −0
  • docs/superpowers/plans/CODEX-REVIEW-BRIEF-PAGE-CACHE-PLAN1-R3.md +97 −0
  • docs/superpowers/plans/CODEX-REVIEW-BRIEF-PAGE-CACHE-PLAN1.md +78 −0
  • docs/superpowers/specs/2026-11-08-edge-page-cache-design.md +900 −0
  • docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R1.md +73 −0
  • docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R2.md +65 −0
  • docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R3.md +28 −0
  • docs/superpowers/specs/CODEX-REVIEW-BRIEF-PAGE-CACHE-R2.md +105 −0
  • docs/superpowers/specs/CODEX-REVIEW-BRIEF-PAGE-CACHE-R3.md +116 −0
  • docs/superpowers/specs/CODEX-REVIEW-BRIEF-PAGE-CACHE.md +92 −0

CI passed — run details

diff --git a/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md b/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md
new file mode 100644
index 000000000..669c39d79
--- /dev/null
+++ b/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md
@@ -0,0 +1,1063 @@
+# Edge page cache, slice 1 (home box) 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.
+
+Plan rev 3, after Astra plan rounds 1 and 2
+(`CODEX-FINDINGS-PAGE-CACHE-PLAN1-R1.md`, `-R2.md`). Marks like
+**(P1-3)** point at a round-1 finding, and **(R2-1)** at a round-2 one.
+
+Stopping rule 2 fired after round 2 in two families. Paul chose, on
+2026-11-08:
+- **Release and config invalidation:** "One invariant + gate units".
+ One function computes an instance's current inputs. A page is served
+ only while its tag matches them, and stored only when the answering
+ process started from exactly those inputs. Unit-backed instances are
+ refused in v1.
+- **Marker stripping:** "One list, every scrub". Every client-boundary
+ scrub iterates one vocabulary list, and a guard test checks each
+ scrub against every entry.
+
+Round 3 (`CODEX-FINDINGS-PAGE-CACHE-PLAN1-R3.md`) found 4 P1s and 5 P2s,
+all concrete fit-with-code fixes. Rev 4 applies Astra's own fixes; marks
+like **(R3-n)** point at them. The plan's review budget is spent: building
+waits on Paul's go.
+
+**Goal:** An app marks a response with `Carlos-Page-Cache: on`, and its
+home box keeps the page on disk and serves it without waking the app,
+until the app clears it or the instance's installed build or delivered
+config changes.
+
+**Architecture:**
+- **`internal/pageindex`** is the spec's page index (§6.1). It is the
+ only code that publishes, clears, resets or looks up a page.
+ - **Bytes** live in the existing `internal/assetcache` store. Each
+ attempt to publish gets its own physical key, whose `Gen` begins
+ `page:`.
+ - **The index** maps each logical page to the one physical object it
+ published.
+- **The edge** looks pages up at today's LRU point. It records marked
+ responses through the index, and routes both purge channels into it.
+- **Opted-in instances** (holding a durable opt-in mark) skip the LRU
+ entirely.
+- **One invariant decides release and config freshness (Paul's
+ choice; R2-1, R2-2):**
+ - **The current inputs.** `currentInputs(route)` is computed from
+ box-local state only: the installed build (`route.Version`) and a
+ fingerprint of the instance's delivered config files.
+ - **Serving.** A page is served only while its tag equals the current
+ inputs. A sleeping instance whose build or config changed misses at
+ once and wakes.
+ - **Storing.** A page is stored only when the process answering was
+ started from exactly the current inputs, both when the render began
+ and when it finished. The activator publishes a process's inputs at
+ the moment it becomes current (`noteCurrent`, or a non-staged spawn),
+ never at staging.
+ - **What follows:** a same-build, same-config wake keeps its pages,
+ and an old process still serving during a staged switch never
+ stores.
+- **Unit-backed instances** (`route.Backing == registry.BackingUnit`)
+ are refused in v1: always `bypass` and documented, with a follow-up
+ for a root-to-agent inputs signal (R2-3).
+- **Not in this slice:**
+ - far boxes, leases and pushes;
+ - single-flight: the spec's Join (§6.1) arrives with far fills in
+ slice 2, so concurrent misses each render, as they do today.
+
+**Tech Stack:** Go stdlib; existing `internal/assetcache`,
+`internal/edge`, `internal/activator`, `internal/registry`,
+`internal/provision`, `internal/console`, `internal/host`, CLI in the
+repo root.
+
+**Spec:** `docs/superpowers/specs/2026-11-08-edge-page-cache-design.md`
+(rev 4, approved).
+- **Coverage:** slice 1 is §11 item 1. The sections it builds are §4,
+ §5, §6, §8.1 (home side), §8.6 and §10.
+- **One change of mechanism:** §8.6's "clear on a new release or config"
+ is implemented as the current-inputs invariant above. Entries tagged
+ with earlier inputs are unreachable as soon as the inputs change,
+ whether or not the instance is awake. That is the same guarantee
+ without a hook that could fire early or late. Plan round 1 showed both
+ hooks did.
+- **One cut:** unit-backed instances are left out of v1 (Paul's choice).
+
+**Branch:** `edge-page-cache-1`, cut from `main` after
+`design-edge-page-cache` (spec and this plan) has merged (stopping rule
+4).
+
+## Global Constraints
+
+**The marker and lifetimes:**
+- The marker header is exactly `Carlos-Page-Cache`. Value `on`, with an
+ optional `; ignore-cookies="a,b"` parameter.
+- The edge strips it from every final response, every 1xx response and
+ every trailer, on every box, armed or not, local or backhauled
+ **(P1-7, R2-4)**.
+- **One list:** every client-boundary scrub iterates
+ `clientScrubVocabulary`, and nothing keeps a list of its own.
+- Lifetime is `s-maxage`, else `max-age`. It must be positive and is
+ capped at 365 days. `private`, `no-store` and `no-cache` refuse.
+
+**What is kept:**
+- Status 200 only.
+- No `Set-Cookie`, as a header or as a trailer.
+- `Vary` absent or exactly `Accept-Encoding`.
+- No `Content-Range`, no `Cache-Control: no-transform`, and
+ `Content-Encoding` absent or `identity`.
+- Body at most 8 MiB: `pageindex.MaxBody = 8 << 20`.
+- Any `Content-Type`.
+
+**Requests:**
+- **Reading the cache:** GET or HEAD; no `Range`; not an upgrade; not a
+ door call; not `markedRequest(r)`; no `Authorization`; and every
+ cookie name (if any) is on the hit entry's ignore list. The path must
+ satisfy `canonicalAssetPath`.
+- **Storing:** only a GET with no `Cookie` and no `Authorization`. A
+ HEAD is never stored.
+
+**Eligible requests** (`pageRouteEligible`):
+- **The route:** `Kind == "instance"`, not `IsForward()`, not `HA`, not
+ `IsSidecar()`, `Backing != registry.BackingUnit`, `Status == "ready"`,
+ `Gate == ""`, `ImportGate == ""`, `!PagesOff`.
+- **The account (R3-9):** no plan throttle is active for it. The edge's
+ installed throttle hook says so (`e.planThrottle`, `planthrottle.go:22`),
+ whether or not this request passed `planThrottleAdmit`.
+- **No path rows (P1-6):** neither the requested hostname's own entry in
+ `e.current()` nor its primary has path rows. The request was not
+ dispatched by path to another instance.
+- **Asset prefixes:** the path is not under a prefix the serving build
+ declares, and the declaration is known **(P2-9)**.
+- **Inputs:** `currentInputs(route)` is known.
+- **Storing also needs** the answering process's published inputs to
+ equal `currentInputs(route)`, both at Begin and at Finish.
+
+**Keys and scopes:**
+- A **scope** is (account, app, instance), where the instance is the
+ primary `route.Host`. Aliases fold to their primary.
+- A **logical key** is (host, path, raw query) exactly as sent.
+
+**Clears:**
+- A clear target `all` (bare word) clears every host of the instance.
+ It works in the `Carlos-Purge` header and the control socket
+ (`{"path":"all"}`).
+- **Clear log bounds:** the last 256 clears or 10 minutes, whichever
+ holds less.
+
+**The opt-in mark (P1-5):** it is cleared only by the operator switch
+(`PagesOff`) or the route leaving the box. Any other ineligibility
+resets page contents but keeps the mark, so the LRU stays off.
+
+**Arming and visibility:**
+- **Arming:** `CARLOS_PAGE_CACHE=1` in host.env. It needs the asset
+ store armed (`CARLOS_ASSET_CACHE=1`). Unarmed boxes treat the marker
+ as absent (still stripped; a marked response still never enters the
+ LRU).
+- **`Carlos-Cache: hit|miss|bypass`** goes on every response of an
+ opted-in instance, and on every marked response, whatever the method,
+ eligibility or inputs, and whether or not a body was recorded
+ **(P2-10, R2-6)**:
+ - `hit`: served from the index;
+ - `miss`: the request was storable and the response was considered;
+ - `bypass`: everything else.
+
+**Copy and commits:**
+- **Copy:** every new user-facing string goes through the copy deck and
+ the `copy-review` skill before it is written into code (Task 11). No
+ em dashes.
+- **Tests:** targeted runs only, `go test ./internal/<pkg> -run
+ '<Name>' -count=1`. CI runs the full suite.
+- **Socket packages** (`edge`, `activator`, `host`) need a short temp
+ path. Use task-owned disk scratch, never `/tmp` **(P2-12)**:
+ `export TMPDIR=$(mktemp -d "$HOME/.cache/epc.XXXX")` before the run and
+ `rm -rf "$TMPDIR"` after. Leave `GOCACHE` at its default.
+- **Commits:** subjects under 80 characters, prefixed by package
+ (`pageindex:`, `assetcache:`, `edge:`, `activator:`, `registry:`,
+ `console:`, `cli:`, `docs:`, `host:`).
+
+## Review Focus
+
+1. **Range, HEAD and `If-None-Match` on a page hit.** A `Range` request
+ bypasses. HEAD gets headers and no body. A matching
+ `If-None-Match` gets 304. Tests go in Task 7.
+2. **An app that compresses its own response** (`Content-Encoding:
+ gzip`). It is passed through, not stored, and never compressed
+ twice. Test in Task 7.
+3. **A marked response with no `Content-Length` that grows past 8 MiB.**
+ The visitor still gets every byte, and nothing is stored or half
+ stored. Test in Task 7.
+4. **A marked response to a cookie-carrying request.** It isn't stored
+ in either cache, and a later anonymous request still misses. Test in
+ Task 7.
+5. **Clearing through an alias or custom domain.** `Carlos-Purge: *` on
+ an alias host clears that host's pages. `all` clears the primary and
+ every alias. Test in Task 8.
+
+---
+
+### Task 1: The store gives the index what it needs
+
+**Files:**
+- Modify: `internal/assetcache/store.go` (add `Delete`). Modify:
+ `internal/assetcache/key.go` (add `PageGenPrefix` and `IsPageKey`).
+- Modify: `internal/edge/assetarm.go:81` (`sweepAssets` keeps page
+ keys).
+- Test: `internal/assetcache/store_test.go`,
+ `internal/edge/assetarm_test.go`.
+
+**Interfaces:**
+- Produces:
+ - `const PageGenPrefix = "page:"`;
+ - `func IsPageKey(k Key) bool`;
+ - `func (s *Store) Delete(k Key) bool`.
+
+- [ ] **Step 1: Write failing tests**
+ - `TestDeleteDropsEntryAndFiles`: Commit an entry, then `Delete` →
+ `true`. `Get` misses, and no `<id>.*` files remain. A second
+ `Delete` → `false`.
+ - `TestDeleteConcurrentWithGet`: 4 goroutines alternating `Get` and
+ `Delete` on 20 keys finish within 5 s under `-race`. That is the
+ deadlock guard.
+ - `TestSweepAssetsKeepsPageKeys`: in a `newLAScene` store, commit one
+ asset key and one key with `Gen: "page:x:1:a"`, with both
+ authorities ready and naming neither. `sweepAssets` drops only the
+ asset key.
+- [ ] **Step 2: Run them to see them fail** on the missing symbols.
+- [ ] **Step 3: Implement**
+ - **`Delete` (P1-2):** under `s.mu`, look up the entry pointer and
+ release `s.mu`. Then call `s.drop(e)`, which takes `lockID` itself
+ and keeps its identity check.
+ - **`sweepAssets`'s keep predicate** returns `true` first when
+ `assetcache.IsPageKey(k)`.
+- [ ] **Step 4: Run them to see them pass** (`-race`).
+- [ ] **Step 5: Commit:** `assetcache: Delete and page keys the asset
+ sweep leaves alone`.
+
+### Task 2: The page index core (`internal/pageindex`)
+
+**Files:**
+- Create: `internal/pageindex/index.go` (types, Open, Begin, Clear,
+ Reset, Lookup).
+- Create: `internal/pageindex/pending.go` (Reserve, Pending).
+- Create: `internal/pageindex/optin.go` (durable marks).
+- Test: `internal/pageindex/index_test.go`.
+
+**Interfaces:**
+- Consumes: `assetcache.Store` (`Reserve`, `Fill.Write/Abort/Commit`,
+ `Get`, `Delete`, `Retain`), `PageGenPrefix` and `IsPageKey`.
+- Produces:
+```go
+type Scope struct{ Account, App, Instance string }
+type Key struct{ Host, Path, RawQuery string }
+type TargetKind int // TargetHost, TargetPath, TargetURL
+type Target struct{ Kind TargetKind; Path, RawQuery string }
+type Clear struct {
+ Hosts []string // nil = every host of the scope
+ Targets []Target // nil = everything on Hosts
+}
+type Ticket struct{ Scope Scope; Epoch, Seq uint64; Inputs string }
+type Info struct{ ValidAt uint64; Ignore []string; Inputs string }
+type Miss int // MissNone (a hit), MissAbsent, MissCookies, MissInputs
+type Config struct {
+ Store *assetcache.Store
+ MarkDir string
+ Now func() time.Time
+ LogMax int // 0 means 256
+ LogAge time.Duration // 0 means 10 * time.Minute
+ afterCommit func() // test seam: runs between Commit and the scope lock
+}
+const MaxBody = 8 << 20
+func Open(cfg Config) (*Index, error)
+func (x *Index) Begin(s Scope, inputs string) Ticket
+func (x *Index) Reserve(t Ticket, k Key, contentLength int64) (*Pending, error)
+func (p *Pending) Write(b []byte) (int, error)
+func (p *Pending) Abort()
+func (p *Pending) Finish(m assetcache.Meta, ignore []string) (published bool, err error)
+func (x *Index) Clear(s Scope, c Clear) (seq uint64)
+func (x *Index) Reset(s Scope)
+func (x *Index) Lookup(s Scope, k Key, inputs string, cookieNames []string) (*assetcache.Entry, Miss)
+func (x *Index) Sweep() int // drops records whose physical object the store no longer has; returns how many
+func (x *Index) MarkOptIn(s Scope) error
+func (x *Index) ClearOptIn(s Scope) error
+func (x *Index) OptedIn(s Scope) bool
+func (x *Index) Scopes() []Scope
+```
+
+**Rules the implementation must keep** (spec §6.1):
+- **One `sync.Mutex` per scope.** Clear, Reset, Lookup and the indexing
+ step of Finish run under it.
+- **Physical keys are unique per attempt (P1-1).** `Reserve` draws a
+ random 64-bit attempt id. The store key is `assetcache.Key{Account,
+ App, Gen: PageGenPrefix + Instance + ":" + hex(Epoch) + ":" +
+ hex(attempt), Host, Path, RawQuery}`, so no two attempts share a
+ store object.
+- **The index map** goes from a logical `Key` to the record {physical
+ key, `Info`} under the scope.
+- **The epoch** is a random 64-bit value, drawn the first time a scope
+ is touched in this process. Reset draws a new one.
+- **`Finish`:**
+ - commits its own physical object first, outside the scope lock,
+ with `gzipCopy=true`;
+ - then calls `afterCommit` (when set) and takes the lock;
+ - indexes the entry only if all of these hold:
+ - `t.Epoch` is the scope's epoch;
+ - `t.Seq` ≤ the scope's sequence;
+ - the log covers every sequence in (`t.Seq`, current];
+ - no clear in that range matches the logical key;
+ - **if it indexes:** it replaces the logical key's record. The
+ previous physical object is deleted after the lock is released.
+ `Info.ValidAt` is set to the current sequence, and `Info.Inputs` to
+ `t.Inputs`;
+ - **if it doesn't:** it deletes only its own physical object and
+ returns `false`.
+- **`Clear`:**
+ - increments the sequence and appends to the log (trimmed to `LogMax`
+ and `LogAge`);
+ - removes the matching records and deletes their physical objects
+ after the lock is released;
+ - returns the new sequence.
+- **Matching:**
+ - `TargetHost` matches every key on the host;
+ - `TargetPath` matches the path with any query;
+ - `TargetURL` matches the exact path and raw query;
+ - `Hosts == nil` means every host;
+ - `Targets == nil` means everything.
+- **`Lookup`:**
+ - finds the logical key's record under the current epoch;
+ - requires `record.Inputs == inputs`, otherwise returns `MissInputs`;
+ - requires every cookie name to be in `Ignore`, otherwise
+ `MissCookies`;
+ - then calls `Store.Get(physical key)`. A miss there (evicted or
+ expired) removes the record and returns `MissAbsent`.
+- **`Open`** runs `Store.Retain(func(k) bool { return
+ !assetcache.IsPageKey(k) })` once, because an earlier process's
+ epochs are gone.
+- **`Sweep` (R2-8)** checks every record against `Store.Get` and drops
+ the dangling ones. The edge calls it on the asset sweep's tick
+ (`assetSweepEvery`). Records are then bounded by the store's own
+ entries plus what was published since the last sweep.
+- **Opt-in marks:**
+ - each is one file per scope in `MarkDir`, named by the hex sha256
+ of `Account + "\x00" + App + "\x00" + Instance`;
+ - written to a temp file, fsynced, renamed, then the dir fsynced;
+ - `Open` loads them;
+ - `ClearOptIn` removes the file and fsyncs the dir.
+
+- [ ] **Step 1: Write failing tests** (a temp-dir store):
+ - **Publish and look up:**
+ - `TestPublishThenLookup`: a hit with the same inputs, and its body
+ reads back.
+ - `TestLookupNeedsInputs`: publish under inputs `b1`, then Lookup
+ with `b2` → `MissInputs`.
+ - **Clears:**
+ - `TestClearRemovesMatching`: `/a`, `/a?x=1` and `/b` with path and
+ URL targets, as in rev 1.
+ - `TestClearBetweenBeginAndFinishFences`: the Finish → `false`,
+ Lookup misses, and the store holds no page object for the key.
+ - `TestUnrelatedClearDoesNotFence`.
+ - `TestLogGapRefuses`: with `LogMax: 2`.
+ - **The overwrite race (P1-1):**
+ `TestStaleCommitCannotReplaceFreshPage`:
+ - render A begins, then a Clear of the key lands;
+ - render B begins after the clear, and its Finish → `true`;
+ - A's Finish runs with `afterCommit` blocking on a channel. While
+ A is paused, Lookup returns B's bytes;
+ - release A. A's Finish → `false`, Lookup still returns B's bytes,
+ and B's physical object still exists.
+ - **Replacement:** `TestRepublishDeletesPreviousObject`. Two
+ successful publishes of the same key leave exactly one page object
+ in the store.
+ - **Reset and the store:**
+ - `TestResetDropsAndChangesEpoch`.
+ - `TestIgnoreCookies`: `MissCookies` for an unlisted cookie.
+ - `TestEvictedObjectIsMissAbsent`: `Store.Delete` the physical key
+ behind the index's back, then Lookup → `MissAbsent`, and the
+ record is gone.
+ - `TestOpenDropsEarlierPages`.
+ - `TestSweepBoundsRecords` (R2-8): with a store budget for about 10
+ entries, publish 500 distinct query keys and call `Sweep`. The
+ record count is ≤ the store's page entries, with no Reset.
+ - **Marks and size:**
+ - `TestOptInMarkSurvivesOpen`.
+ - `TestTooLargeAborts`.
+- [ ] **Step 2: Run them to see them fail:** `go test
+ ./internal/pageindex -count=1` fails to compile.
+- [ ] **Step 3: Implement the types and rules above.**
+- [ ] **Step 4: Run them to see them pass** (`-race`).
+- [ ] **Step 5: Commit:** `pageindex: one index owns every page publish,
+ clear, reset and lookup`.
+
+### Task 3: The index under simulation, and its guard
+
+**Files:**
+- Test: `internal/pageindex/sim_test.go`,
+ `internal/pageindex/guard_test.go`.
+
+**Interfaces:** Task 2's API only.
+
+- [ ] **Step 1: Write `TestSimulationInvariants` (P2-11).**
+ - **The setup:** 8 goroutines run 2000 random operations (300 under
+ `-short`) over 3 scopes. The scopes differ in account, app or
+ instance, with 2 hosts each, overlapping host names across scopes,
+ 6 paths and 2 input values.
+ - **The operations:** Begin + Reserve + Write + Finish, where
+ `afterCommit` randomly yields or sleeps 0–2 ms; Clear with random
+ targets; Reset; Lookup; MarkOptIn and ClearOptIn.
+ - **Every body is unique** and encodes (scope, host, path, query,
+ identity, ticket epoch, ticket seq).
+ - **Ordering model:** each Clear records (scope, epoch, seq, clear) in
+ a mutex-guarded model log when it returns. A Lookup snapshots the
+ model log before it calls the index, and checks against that
+ snapshot only.
+ - **At every hit, assert:**
+ - **I1:** no clear in the snapshot on the same scope and epoch, with
+ seq > the body's ticket seq, matches its key;
+ - **I3:** the body's scope, host, path and query equal the Lookup's
+ arguments;
+ - the inputs equal the Lookup's inputs.
+ - **Seeding:** the seed comes from `-seed` (default the time), and is
+ printed on failure.
+- [ ] **Step 2: Write `TestStoreHoldsNoUnindexedPages`.** After the
+ simulation and a final Reset of every scope, the store holds zero page
+ keys.
+- [ ] **Step 3: Write `TestOnlyPageindexBuildsPageKeys`.**
+ - It walks the repo's `.go` files (from `runtime.Caller`, up to the
+ module root).
+ - It fails if any file outside `internal/pageindex/` and
+ `internal/assetcache/` mentions `PageGenPrefix` or the literal
+ `"page:"`.
+ - Test files are excluded, except this guard's own fixtures.
+- [ ] **Step 4: Watch each test fail under its own mutation,** then
+ restore:
+ - skip the fence check → the simulation fails;
+ - drop the attempt id from the physical key → the simulation or
+ Task 2's race test fails;
+ - skip deleting the refused object → the store test fails;
+ - add `"page:"` to a scratch file in `internal/edge` → the guard
+ fails.
+- [ ] **Step 5: Run:** `go test ./internal/pageindex -count=3 -race`
+ passes.
+- [ ] **Step 6: Commit:** `pageindex: randomized invariants and the
+ page-key guard`.
+
+### Task 4: The per-instance switch, `PagesOff`
+
+**Files and sites:** every place that carries `AssetsOff` or `Assets`:
+- `internal/provision/provision.go`: `Pages *bool` beside `Assets`
+ (:217), and `PagesOn()` beside `AssetsOn` (:569);
+- `internal/provision/reconcile.go`: `RouteFor` (:586), and
+ `convergeOwned` (:1005–1016) calling `reg.SetPages`;
+- `internal/registry/registry.go`:
+ - the field (:120) and column `pages_off` (:747);
+ - read and scan (:1111–1138), upsert keep (:1620), insert (:1708);
+ - `SetPages(host string, off bool) error` beside `SetAssets` (:2520,
+ `kind <> 'forward'`);
+ - Fingerprint `"\x1fpages_off=1"` (:4060) and SnapshotFingerprint
+ (:4407);
+- `internal/registry/remote_dispatch.go` (:72, :320);
+- `internal/registry/forward.go` (:115, :154, :214).
+- Test: `internal/registry/registry_test.go`,
+ `internal/provision/reconcile_test.go`.
+
+**Interfaces:**
+- Produces: `Record.Pages *bool`, `Record.PagesOn() bool`,
+ `Route.PagesOff bool` and `Registry.SetPages(host string, off bool)
+ error`.
+
+- [ ] **Step 1: Write failing tests**
+ - `TestSetPagesRoundTripsAndMovesFingerprint`.
+ - `TestConvergeAppliesPagesSwitch`.
+ - `TestForwardRowRefusesPagesOff`.
+- [ ] **Step 2: Run them to see them fail:** `go test
+ ./internal/registry ./internal/provision -run Pages -count=1`.
+- [ ] **Step 3: Implement,** mirroring every site above.
+- [ ] **Step 4: Run them to see them pass,** plus `-run
+ 'Fingerprint|Forward'` in `internal/registry`.
+- [ ] **Step 5: Commit:** `registry: per-instance pages switch, mirrored
+ on assets_off`.
+
+### Task 5: One scrub list; the marker is read once, stripped everywhere, kept out of the LRU
+
+**Files:**
+- Create: `internal/edge/pagemark.go`.
+- Modify `internal/edge/assetcatch.go` (Paul's choice, "One list, every
+ scrub"; R2-4):
+ - rename `assetVocabulary` (:966) to `clientScrubVocabulary` and add
+ `pageCacheHeader` to it;
+ - `stripAssetResponseHeaders`, `stripAssetTrailers`,
+ `assetInformationalScrub` and `scrubBackhaulResponse` (:1362) all
+ iterate it;
+ - `scrubBackhaulResponse` keeps only the entries its `assetFill`
+ argument names (the ack and expiry headers), by an explicit keep set
+ rather than a list of its own;
+ - `stripAssetFillVocabulary` (:1349) iterates the list too, with an
+ explicit keep set of `{assetCacheHeader}` (R3-5).
+- Modify:
+ - `internal/edge/cookiescope.go:85`: in `responseModifier`, call
+ `takePageMark(resp)` before the scrub;
+ - `internal/edge/edge.go`:
+ - wrap the local proxy and activator calls (:2707–2730) in
+ `assetInformationalScrub{w}`, as `edge.go:4285` does for hops;
+ - `maybeStore` (:2907) refuses when `pageMarkOf(rec.request)` is
+ `Marked`.
+- Test: `internal/edge/pagemark_test.go`,
+ `internal/edge/scrub_guard_test.go`.
+
+**Interfaces:**
+- Produces:
+```go
+var clientScrubVocabulary = []string{assetFillHeader, assetAckHeader, assetExpiresHeader, assetCacheHeader, pageCacheHeader}
+type pageMark struct{ Marked bool; Ignore []string; Bad bool }
+func withPageMarkHolder(r *http.Request) *http.Request
+func pageMarkOf(r *http.Request) *pageMark // nil when no holder
+func takePageMark(resp *http.Response) // final response header only; never trailers or 1xx
+const pageCacheHeader = "Carlos-Page-Cache"
+```
+- **Parsing:**
+ - `on` gives `Marked`;
+ - `on; ignore-cookies="a,b"` adds the names;
+ - anything else sets `Bad`.
+- **Where the holder goes (R2-6):** ServeHTTP attaches it for **every**
+ proxied request to a `Kind == "instance"` route, whatever the method,
+ before the activator or proxy runs.
+
+- [ ] **Step 1: Write failing tests**
+ - **`TestEveryScrubRemovesEveryVocabularyEntry`** (the guard). For
+ each scrub function and each entry in `clientScrubVocabulary`:
+ - set the entry as a header, a trailer (announced and not) and on a
+ 1xx;
+ - run the scrub, and assert it's gone. `scrubBackhaulResponse` with
+ `assetFill=true` may keep only the ack and expiry headers.
+ - **The table of scrub functions** is listed in the test, including
+ `stripAssetFillVocabulary` (which may keep only `Carlos-Cache`). A
+ comment says a new client-boundary scrub must be added to it.
+ - `TestPageMarkStrippedFinalHeader`: on an edge with no page index,
+ the visitor never sees the marker.
+ - `TestPageMarkStrippedThroughBackhaul` (R2-4): a mock older home
+ returns the marker on an ordinary backhaul. The visitor never sees
+ it, with page caching armed and unarmed.
+ - `TestPageMarkStripped103` (use
+ `httptrace.ClientTrace.Got1xxResponse`).
+ - `TestPageMarkStrippedTrailers`: announced and unannounced. Neither
+ marks the page.
+ - `TestPageMarkParses`.
+ - `TestMarkedResponseNeverEntersLRU`.
+ - `TestUnmarkedResponseStillUsesLRU`.
+- [ ] **Step 2: Run them to see them fail.**
+- [ ] **Step 3: Implement as above.**
+- [ ] **Step 4: Watch the guard fail** when one scrub reverts to a
+ private list. Restore it.
+- [ ] **Step 5: Run them to see them pass,** plus `-run
+ 'Asset.*Scrub|Vocabulary|Trailer|Backhaul'`.
+- [ ] **Step 6: Commit:** `edge: one client scrub list; read and strip
+ Carlos-Page-Cache everywhere`.
+
+### Task 6: The current inputs, and the inputs each process was started from
+
+This is the invariant Paul chose ("One invariant + gate units"; R2-1,
+R2-2, R2-3).
+
+**Files:**
+- Create: `internal/activator/inputs.go`, holding the one function both
+ sides use.
+- Modify: `internal/activator/genservice.go:96` (`noteCurrent`), and
+ the exec spawn site that makes a process current without staging
+ (`backend_exec.go:2565–2575`, the `exe == ""` branch).
+ - **When a process is staged:** its inputs are captured when it
+ starts, and carried with it (on `genMember`, or the `Gen` the
+ staging returns).
+ - **When they are published:** only when it becomes current.
+- Modify: `internal/edge/cache.go`: a table of published inputs.
+- Test: `internal/activator/inputs_test.go`, `internal/edge/cache_test.go`.
+
+**Interfaces:**
+- Produces:
+```go
+// in internal/activator. One encoding, used by both sides (R3-2):
+func inputsFingerprint(build string, env map[string]string) string
+// hex sha256 over the build and env in sorted key order
+//
+// The current side, exported for the host wiring (R3-4). It reads the
+// instance's two web env layers exactly as a spawn does,
+// b.instanceEnvParts(rt) then mergeEnv: paths.configEnv (the delivered
+// <host>.config.env) and paths.envFile (R3-1). A missing file is a valid,
+// empty layer. An unreadable file means false.
+func (b *ExecBackend) CurrentInputs(rt registry.Route) (string, bool)
+//
+// The launch side, never a re-read: the fingerprint of the env map the
+// spawn actually hands to exec (the fileEnv from launchEnvLayer at
+// backend_exec.go:2392, before the platform's own CARLOS_* variables are
+// added) and the build actually executed. That is g.Build for a staged
+// generation (genbackend.go:274), else the version the spawn resolved.
+// The value is computed once at launch and carried, immutable, to the
+// point the process becomes current (R3-2).
+func launchInputs(build string, fileEnv map[string]string) string // = inputsFingerprint(build, fileEnv)
+// in internal/edge, all exported:
+func (c *Cache) NoteProcessInputs(host, inputs string)
+func (c *Cache) ProcessInputs(host string) (string, bool)
+func (c *Cache) SetCurrentInputs(f func(registry.Route) (string, bool))
+func (c *Cache) CurrentInputs(rt registry.Route) (string, bool)
+```
+
+**The rules:**
+- **The current side's cost:** `CurrentInputs` is called on every page
+ lookup. It caches per route on the (path, size, mtime, inode) of both
+ env files, and re-reads and re-merges only when one changes. The
+ build is `rt.Version`.
+- **Mismatches are safe:**
+ - a process running a build other than `rt.Version` publishes inputs
+ that never equal the current ones, so it never stores;
+ - so does a process launched from config bytes that have since
+ changed.
+- **Unit-backed routes** never reach these. `pageRouteEligible` refuses
+ them (Task 7).
+
+- [ ] **Step 1: Write failing tests**
+ - **The function:**
+ - `TestCurrentInputsStable`: the same version and files give the
+ same value, twice.
+ - `TestCurrentInputsChanges`: a version change gives a new value.
+ So does each of these, through the real config delivery
+ (`appconfig.SyncExec` writing `paths.configEnv`, R3-1): an edit, a
+ removal, and an edit to `paths.envFile`.
+ - `TestCurrentInputsStatCache`: an unchanged stat doesn't read the
+ file again (count reads with a seam).
+ - `TestLaunchInputsUseCapturedEnv` (R3-2): replace the config file
+ between the spawn's env capture and exec (a seam in the spawn).
+ The published inputs are the captured bytes' fingerprint, so they
+ differ from `CurrentInputs` afterwards.
+ - `TestRetainedBuildNeverMatches` (R3-2): a generation whose
+ `g.Build` differs from `rt.Version` publishes inputs that don't
+ equal `CurrentInputs`.
+ - **Through the real exec backend:**
+ - `TestNonStagedSpawnPublishesInputs`: a fresh spawn publishes
+ inputs equal to `CurrentInputs` at launch.
+ - `TestWakeSameInputsSameValue`: sleep, then wake with nothing
+ changed. The published inputs are unchanged.
+ - `TestStagedSuccessorPublishesAtSwitch`: stage a successor with new
+ inputs (native nested and rootfs backends). Until the switch,
+ `ProcessInputs` still returns the incumbent's inputs. After the
+ switch it returns the successor's, which are its launch-time
+ inputs, even if config changed again after it launched.
+ - **The table:** `TestCacheProcessInputs`, a round-trip, and an
+ unknown host → `false`.
+- [ ] **Step 2: Run them to see them fail:** `go test
+ ./internal/activator -run 'CurrentInputs|PublishesInputs|WakeSameInputs|StagedSuccessor'
+ -count=1` (with the task-owned `TMPDIR`).
+- [ ] **Step 3: Implement as above.**
+- [ ] **Step 4: Run them to see them pass,** plus `-run
+ 'Purge|Gen|Swap'` in `internal/activator`.
+- [ ] **Step 5: Commit:** `activator: current inputs and per-process
+ launch inputs, published when current`.
+
+### Task 7: Serving and storing pages on the home box
+
+**Files:**
+- Create: `internal/edge/pagecache.go`, `internal/edge/pagerecord.go`.
+- Modify: `internal/edge/edge.go`, at the LRU gate (:2673–2690) and the
+ proxy calls (:2707–2729).
+- Modify: `internal/host/assetpolicy.go`: add `DeclaresPrefix` and a
+ background declaration loader **(P2-9, R2-5)**.
+- Modify: `internal/edge/assettypes.go`: an optional interface for
+ `DeclaresPrefix`.
+- Test: `internal/edge/pagecache_test.go`,
+ `internal/edge/pagecache_sim_test.go`,
+ `internal/host/assetpolicy_test.go`.
+
+**Interfaces:**
+- Consumes:
+ - Tasks 2, 5 and 6;
+ - `serveAssetEntry` (`assetserve.go:37`), `parseMaxAge`
+ (`edge.go:3110`), `canonicalAssetPath` (`assetcatch.go:47`);
+ - `assetManifestCache.cached` (`assetmanifests.go:64`).
+- Produces:
+```go
+func (e *Edge) EnablePageCache(x *pageindex.Index)
+func pageScopeOf(up upstream) pageindex.Scope // Account via release.RouteAccount(up.route), App, Instance = up.route.Host
+func (e *Edge) pageRouteEligible(host, path string, up upstream) (inputs string, ok bool)
+func pageReadable(r *http.Request) (cookieNames []string, ok bool)
+func pageStorable(r *http.Request) bool
+func pageAdmit(status int, h http.Header, mark *pageMark) (lifetime time.Duration, ok bool)
+func (e *Edge) pagesOptedIn(up upstream) bool
+type assetDeclarations interface{ DeclaresPrefix(host, build, path string) (declared, known bool) }
+func (p *assetPolicy) DeclaresPrefix(host, build, path string) (declared, known bool)
+func (p *assetPolicy) WantDeclarations(acct, app, build string) // queue a background manifest read
+```
+
+**Declarations (R2-5):**
+- **On requests:** `DeclaresPrefix` reads only
+ `p.manifests.cached(acct, app, build)`, with `build = route.Version`,
+ whatever `AssetsOff` says. It never reads storage on a request.
+- **Publication (R3-6):** `p.manifests` becomes an
+ `atomic.Pointer[assetManifestCache]`, stored by `bindManifests`
+ (`assetpolicy.go:179`). `DeclaresPrefix` returns `known=false` while
+ it is nil.
+- **When the cache has no entry:** it returns `known=false` and calls
+ `WantDeclarations`. That queues a background `p.manifests.paths` read
+ on the policy's own schedule, deduplicated and bounded.
+- **After the read:** later requests know the answer. An assets-off
+ instance goes from bypass to cacheable without a request-time read.
+
+**Eligibility:**
+- **Path rows (P1-6):** `pageRouteEligible` checks the requested
+ hostname's own `e.current()[host]` entry for path rows, and refuses a
+ path dispatch: that entry's `route.Host` differs from `up.route.Host`.
+- **Unit-backed routes** are refused.
+- **The inputs it returns** are `Cache.CurrentInputs(up.route)`. Not
+ known means not eligible.
+
+**At the LRU gate:**
+1. **Whenever `pagesOptedIn(up)` holds,** whatever the path, eligibility
+ or inputs, the LRU is off: `cacheable = false`. This is the one place
+ §5.3's rule is checked.
+2. **When eligible and `pageReadable`,** call `idx.Lookup(scope, key,
+ inputs, cookies)`. On a hit, call `serveAssetEntry(w, r, entry, now,
+ "hit")`, and return only if it returned nil. Otherwise continue down
+ the miss path **(P1-8)**.
+3. **When eligible and `pageStorable`,** and only when
+ `Cache.ProcessInputs(host) == inputs` (the answering process started
+ from the current inputs):
+ - `t := idx.Begin(scope, inputs)`;
+ - a `pageRecorder` reserves at WriteHeader if `pageAdmit` passes and
+ `Content-Length` (when present) ≤ `MaxBody`, then tees.
+ - **After the proxy returns:**
+ - abort on a `Set-Cookie` trailer, an error or an overflow;
+ - abort also if `CurrentInputs` or `ProcessInputs` no longer equal
+ `inputs`;
+ - otherwise `MarkOptIn` (durable), then `Finish`. Its meta uses
+ `assetStoredHeader`, `Lifetime`, and `Expires = now + lifetime`.
+4. **The diagnostic writer (R2-6, R3-7)** wraps every proxied response
+ of a `Kind == "instance"` route on every box, armed or not,
+ independent of eligibility and inputs. On an unarmed box only the
+ marker can trigger it, and the value is always `bypass`. At WriteHeader it sets `Carlos-Cache` when the
+ instance is opted in or the holder says `Marked`:
+ - `miss` when step 3 recorded;
+ - `bypass` otherwise.
+
+- [ ] **Step 1: Write failing tests** (a `newLAScene`-style scene with
+ an asset store, a page index, and a fake config file):
+ - **The scene's inputs:** `SetCurrentInputs` wired to a test
+ `CurrentInputs`, and `NoteProcessInputs(host, CurrentInputs(rt))`
+ as a spawn would publish them.
+ - **The core path:**
+ - `TestPageMissThenHitWithoutApp`.
+ - `TestPageHitOnHibernatingRouteDoesNotWake`.
+ - **Responses that must not be stored:**
+ - `TestPageRefusesSetCookie`, `TestPageRefusesVaryCookie`,
+ `TestPageRefusesNon200`, `TestPageRefusesPrivate`.
+ - `TestPageRefusesAppGzip` (Review Focus 2).
+ - `TestPageOverflowStreamsAndStoresNothing` (Review Focus 3).
+ - **Requests that bypass:**
+ - `TestPageCookieRequestNotStoredAnywhere` (Review Focus 4).
+ - `TestPageIgnoredCookieHits`, `TestPageAuthorizationBypasses`.
+ - **Hit behaviour:** `TestPageHeadRangeConditional` (Review Focus 1).
+ - **Inputs (R2-1, R2-2):**
+ - `TestPageSleepingNewBuildMisses`:
+ - cache a page, then mark the route hibernating;
+ - set `route.Version` to a new build without any spawn, and
+ Reload;
+ - request only the cached URL. It misses, and the activator is
+ asked to wake.
+ - `TestPageSleepingConfigChangeMisses`: the same, editing the config
+ file. A second variant removes it.
+ - `TestPageSameInputsWakeKeepsHits`: a wake with nothing changed
+ still hits.
+ - `TestPageOldProcessDuringStagingNotStored`: the current inputs
+ change while `ProcessInputs` still returns the old ones. A marked
+ response is `bypass` and isn't stored.
+ - `TestPageUnitBackedBypasses` (R2-3): `Backing: BackingUnit`. A
+ marked response is `bypass` and isn't stored.
+ - **Failed delivery:**
+ `TestPageEvictedBetweenLookupAndOpenFallsThrough` (P1-8).
+ - **Opt-in and the LRU:** `TestOptedInInstanceSkipsLRU`.
+ - **Path routing:** `TestPagePathRoutedHostRefused` (P1-6).
+ - **Asset prefixes:**
+ - `TestPageAssetPrefixWinsWhenAssetsOff` (P2-9).
+ - `TestPageDeclarationsLoadInBackground` (R2-5). An assets-off
+ instance's first marked request is `bypass`, with no storage read
+ on the request path (assert with a counting manifest store).
+ After the background load, the next one is stored, and a marked
+ `/assets/x` never is.
+ - **Diagnostics:** `TestPageDiagnostics` (P2-10, R2-6), a table:
+ - hit → `hit`;
+ - stored miss → `miss`;
+ - a cookie-rejected lookup → `bypass`;
+ - the first marked POST on a not-yet-opted-in instance → `bypass`;
+ - a marked GET with unknown inputs → `bypass`;
+ - a HEAD miss → `bypass`;
+ - an opted-in instance made temporarily ineligible → `bypass`;
+ - a marked GET and a marked POST on an unarmed box → `bypass` (R3-7);
+ - an unrelated app → no header.
+ - **The account throttle:** `TestPageThrottledAccountBypasses` (R3-9).
+ The throttle hook reports an active throttle and a token lets the
+ request through `planThrottleAdmit`. The marked response is `bypass`
+ and isn't stored, and an existing entry isn't served.
+ - **Declarations under a race:**
+ `TestDeclaresPrefixBeforeBindIsUnknown` (R3-6). Requests run
+ concurrently with a delayed `bindManifests` under `-race`. Before the
+ bind they get `known=false`, with no panic.
+ - **Ineligible routes:** `TestPageIneligibleRoutes`, the table from
+ rev 1 plus unit-backed.
+ - **Host side:** `TestDeclaresPrefixIgnoresAssetsOff`.
+- [ ] **Step 2: Run them to see them fail:** `go test ./internal/edge
+ -run 'TestPage|TestOptedIn' -count=1` (with the
+ task-owned `TMPDIR`), and `go test ./internal/host -run DeclaresPrefix
+ -count=1`.
+- [ ] **Step 3: Implement as above.**
+- [ ] **Step 4: Watch each guard fail under its own mutation,** then
+ restore:
+ - drop `maybeStore`'s marked refusal → `TestMarkedResponseNeverEntersLRU`
+ fails;
+ - drop the opted-in LRU gate → `TestOptedInInstanceSkipsLRU` fails;
+ - drop the inputs check in Lookup → `TestPageSleepingNewBuildMisses`
+ fails.
+- [ ] **Step 5: Run them to see them pass,** then `-run
+ 'Cache|Asset|Purge'` for the neighbours.
+- [ ] **Step 6: Commit:** `edge: home-box page cache at the LRU point`.
+
+### Task 8: Clears reach the index (header, socket and `all`)
+
+**Files:**
+- Modify: `internal/edge/purge_header.go` (`applyPurgeTargets` :606,
+ the token loop :643–659).
+- Modify: `internal/edge/purge.go` (`ListenControl` :126, the handler
+ :134–153).
+- Modify: `internal/edge/cache.go` (the bridge).
+- Test: `internal/edge/pageclear_test.go`.
+
+**Interfaces:**
+- Produces:
+```go
+type purgeBridge interface {
+ clearPages(host string, c pageindex.Clear) // host to scope through e.current(); no-op when unarmed
+ instanceHosts(host string) []string // the primary and every alias whose upstream has the same route.Host
+}
+func (c *Cache) setBridge(b purgeBridge) // set in EnableCache
+```
+
+**Header channel.** `applyPurgeTargets` keeps its LRU calls exactly as
+today, then calls `clearPages` for each host with the same targets:
+- `*` → `TargetHost`;
+- a path → `TargetPath`;
+- `path?query` → `TargetURL`;
+- the over-limit fallback → `TargetHost`.
+
+**The `all` token:**
+- it is accepted before `validPurgeTarget`;
+- for the LRU, it purges `PurgeHost` on every `instanceHosts(host)`;
+- for pages, it sends `clearPages(host, Clear{})`.
+
+**Socket channel.** `{"path":"all"}` does the same, and every other
+socket path also calls `clearPages`. Activator start sites still call
+only `PurgeHost`, plus Task 6's `NoteProcessInputs`. They never clear
+pages.
+
+- [ ] **Step 1: Write failing tests**
+ - `TestPurgeHeaderClearsPage`.
+ - `TestPurgeHeaderOnStoredResponseOrder`: a marked GET of `/post`
+ whose own response carries `Carlos-Purge: /post` is not stored,
+ because its ticket predates the clear. The next GET is a `miss`.
+ - `TestPurgeAllClearsAliases` (Review Focus 5).
+ - `TestControlSocketClearsPageAndAll`.
+ - `TestSpawnPurgeKeepsPages`.
+- [ ] **Step 2: Run them to see them fail.**
+- [ ] **Step 3: Implement as above.**
+- [ ] **Step 4: Run them to see them pass,** plus `-run Purge`.
+- [ ] **Step 5: Commit:** `edge: Carlos-Purge and the control socket
+ clear pages; add the all target`.
+
+### Task 9: Route changes reset a scope; only two things clear the mark
+
+**Files:**
+- Modify: `internal/edge/pagecache.go`: a reload hook registered in
+ `EnablePageCache` through `OnReload` (`edge.go:1479`).
+- Test: `internal/edge/pagecache_reload_test.go`.
+
+**Behaviour (P1-5, R3-3).** The hook compares `idx.Scopes()` with the
+**complete registry route snapshot**: every row Reload read, before it
+filtered out sidecars and rows that aren't ready (`edge.go:956`). Reload
+keeps that snapshot for the hook. Absence from `e.current()` alone
+never counts as departure.
+- **The route is gone from this box** (no row for the instance host, or
+ its account or app changed): `Reset` and `ClearOptIn`.
+- **`PagesOff` is set:** `Reset` and `ClearOptIn`.
+- **Ineligible for any other reason** (HA, forward, a gate, an import
+ gate, a sidecar, a status that isn't ready): `Reset` only. The mark
+ stays, so the LRU stays off.
+
+Releases and config are not handled here. Task 6's current-inputs
+invariant covers them, checked on every lookup and store.
+
+- [ ] **Step 1: Write failing tests**
+ - `TestRouteDepartureResetsAndClearsMark`.
+ - `TestPagesOffResetsAndClearsMark`.
+ - `TestGateKeepsMarkAndLRUStaysOff`:
+ - seed an LRU entry before opt-in, then opt in;
+ - add a gate, Reload, pass the gate → the seeded URL reaches the
+ app, not the LRU;
+ - remove the gate → same;
+ - pages miss after the reset.
+ - `TestHAFlipKeepsMark`: the same, with `HA` set and then cleared.
+ - `TestNotReadyAndBackKeepsMark` (R3-3): seed a personalised LRU entry
+ before opt-in, then opt in. Change the route's status from ready to
+ something else and back, reloading each time. The mark survives, and
+ the seeded URL still reaches the app.
+- [ ] **Step 1b: Write `TestEdgeSimulationNoPersonalLeak` (I2; R2-7,
+ R3-8).** It lives here, because it needs the reload behaviour above.
+ - **The setup:** a fake app whose every body names the request's
+ provenance (a request id, plus whether it carried `Cookie` or
+ `Authorization`).
+ - **The run:** 1000 random requests (200 under `-short`) over 2
+ instances and 4 paths, mixing:
+ - anonymous requests, requests with ignorable cookies, requests with
+ session cookies, and requests with `Authorization`;
+ - marked and unmarked `s-maxage` responses;
+ - personalised LRU entries stored before opt-in (adversarial
+ fixtures);
+ - opt-in transitions;
+ - gate, status and HA reloads;
+ - clears.
+ - **The oracle** tracks each instance's opt-in state. It asserts:
+ - every page-cache hit has anonymous provenance (an
+ ignorable-cookie request may get an anonymous body);
+ - while an instance is opted in, no response comes from the LRU at
+ all;
+ - before opt-in, LRU behaviour is today's, and the oracle doesn't
+ judge it.
+ - **Seeding:** the seed is printed on failure.
+ - **Mutation:** dropping the opted-in LRU gate makes it fail.
+- [ ] **Step 2: Run them to see them fail.**
+- [ ] **Step 3: Implement as above.**
+- [ ] **Step 4: Run them to see them pass.**
+- [ ] **Step 5: Commit:** `edge: route departure and switch-off reset
+ pages and the mark; other changes keep the mark`.
+
+### Task 10: Arming on the host
+
+**Files:**
+- Create: `internal/host/pagearm.go`.
+- Modify: `internal/host/agent.go:1290`: after `armEdgeAssetCache`,
+ call `armEdgePageCache` with the returned store.
+- Test: `internal/host/pagearm_test.go`.
+
+**Interfaces:**
+- Produces:
+```go
+const pageCacheDirName = "page-cache" // marks; bytes stay in asset-cache
+func pageCacheArmed(getenv func(string) string) bool
+func armEdgePageCache(getenv func(string) string, dataDir string, store *assetcache.Store, enable func(*pageindex.Index)) *pageindex.Index
+```
+- **When it arms:** nil, without enabling, when the variable isn't
+ `"1"` or `store == nil`. With the variable set but no store, it logs
+ one line ("page cache needs the asset cache").
+- **Declarations:** the asset policy's `DeclaresPrefix` reaches the edge
+ through the same `LocalAssets` value already passed to
+ `EnableAssetCache`.
+- **Current inputs (R3-4):** the host calls
+ `cache.SetCurrentInputs(execBackend.CurrentInputs)`. `cache` is the
+ host-local `*edge.Cache` built at `agent.go:334` and shared with the
+ activator. `execBackend` is the `*activator.ExecBackend` the agent
+ builds beside it, and its exported method matches `func(registry.Route)
+ (string, bool)`.
+- **The sweep:** `EnablePageCache` registers `idx.Sweep` on the asset
+ sweep's tick (`assetSweepEvery`).
+
+- [ ] **Step 1: Write failing tests**
+ - `TestArmPageCacheNeedsFlagAndStore`, a table.
+ - `TestAgentWiresCurrentInputs`: a focused agent test. After the
+ wiring, `Cache.CurrentInputs` answers for an exec route.
+- [ ] **Step 2: Run it to see it fail.**
+- [ ] **Step 3: Implement.**
+- [ ] **Step 4: Run it to see it pass.**
+- [ ] **Step 5: Commit:** `host: arm the page cache with
+ CARLOS_PAGE_CACHE`.
+
+### Task 11: The copy deck, reviewed before any string is written
+
+**Files:**
+- Create: `docs/superpowers/plans/2026-11-08-edge-page-cache-copy.md`.
+ Rows `EPC-1..n`, in the asset deck's format: id | file | text |
+ status.
+- Create: `docs/superpowers/plans/2026-11-08-edge-page-cache-copy-approved.json`.
+
+**Slots to draft** (the wording is the reviewer's):
+- **Console:**
+ - the PATCH `pages` validation message, on the model of
+ `apiAssetsOnOff`;
+ - the "nothing to update" key list, with `pages` added.
+- **CLI:**
+ - `carlos instances set-pages` usage;
+ - the on and off result lines, on the model of `printSetAssets`;
+ - the "console predates" line;
+ - the help lines (`instances_cli.go:230`, `main.go:301`).
+- **Docs:** `docs/site/cli.md`:
+ - a "Caching pages at the edge" section after the `carlos ship`
+ asset paragraph (:285–289). It covers the marker, lifetimes, the
+ `max-age=0` advice, ignorable cookies, what is never cached,
+ `Carlos-Cache`, the clear targets including `all`, that a new
+ release or config stops old pages being served, that asset paths
+ win, and that unit-backed instances (`carlos-app@` units) are not
+ page-cached yet;
+ - a `### carlos instances set-pages` section;
+ - the `CARLOS_PURGE` row (:1186);
+ - `docs/site/rootfs.md:46` if needed.
+- **Operator log lines** are outside copy review (human text only).
+
+- [ ] **Step 1: Draft the deck,** `pending`.
+- [ ] **Step 2: Run the `copy-review` skill,** apply Paul's edits
+ verbatim, and write the approved JSON.
+- [ ] **Step 3: Commit:** `docs: page cache copy deck, approved`.
+
+### Task 12: The switch door, the CLI, the docs and the copy gate
+
+**Files:**
+- Modify: `internal/console/apiinstances.go`:
+ - `Pages *string \`json:"pages"\`` (:2949);
+ - the empty check and message (:2965–2967);
+ - `pagesSwitch` (:2991);
+ - `rec.Pages = pages` (:3096);
+ - audit `"pages"` (:3241).
+- Create: `internal/console/apipages.go`, with `func pagesSwitch(w
+ http.ResponseWriter, v *string) (*bool, bool)` and the approved
+ message.
+- Create: `instances_pages.go`, with `instancesSetPagesUsage`,
+ `runInstancesSetPages` and `printSetPages`.
+- Modify: `apimode.go` (`instanceSetPages` beside :5694), `cli.go:615`
+ (`"set-pages"`), and the help lines.
+- Modify: `docs/site/cli.md` and `docs/site/rootfs.md` as approved.
+- Create: `approved_page_cache_copy_test.go`, with `pageCacheCopyBuilt`.
+- Test: `internal/console/apiinstances_test.go`, plus a CLI test beside
+ `set-assets`.
+
+- [ ] **Step 1: Write failing tests**
+ - `TestPatchInstancePagesOffAndOn`.
+ - `TestSetPagesCLI`.
+ - The `internal/docsite` gate.
+ - `TestApprovedPageCacheCopy`.
+- [ ] **Step 2: Run them to see them fail.**
+- [ ] **Step 3: Implement,** mirroring `assets`.
+- [ ] **Step 4: Run them to see them pass.**
+- [ ] **Step 5: Commit:** `console, cli: carlos instances set-pages;
+ page cache docs`.
+
+### Task 13: The whole branch
+
+- [ ] **Step 1:** `go build ./...`, `go vet ./...`, and `gofmt -l .`
+ (which must print nothing). Then `GOOS=darwin go build ./...` and
+ `GOOS=windows go build ./...`.
+- [ ] **Step 2: The census,** per AGENTS.md § The census.
+- [ ] **Step 3: Push and describe.** Push `edge-page-cache-1`, then run
+ `amadan branch describe`. CI must be green on the tip.
+- [ ] **Step 4: One whole-branch review** by a reviewer from another
+ model family, under the stopping rules.
+- [ ] **Step 5: Paul's go, then the merge:** `amadan branch merge
+ carlos/platform edge-page-cache-1 -squash -expect <full sha>
+ -message ...`.
+- [ ] **Step 6:** remove every `$HOME/.cache/epc.*` scratch dir this
+ work created.
+
+**After the merge (not part of this plan; each step needs Paul's go):**
+1. Release, then roll to dev.
+2. Set `CARLOS_PAGE_CACHE=1` on a dev box that already has the asset
+ cache.
+3. Patrix sends the marker and `Carlos-Purge`.
+4. Check a repeat view is `Carlos-Cache: hit` with no wake, and a
+ publish clears the homepage.
diff --git a/docs/superpowers/plans/CODEX-FINDINGS-PAGE-CACHE-PLAN1-R1.md b/docs/superpowers/plans/CODEX-FINDINGS-PAGE-CACHE-PLAN1-R1.md
new file mode 100644
index 000000000..bbaa24b3b
--- /dev/null
+++ b/docs/superpowers/plans/CODEX-FINDINGS-PAGE-CACHE-PLAN1-R1.md
@@ -0,0 +1,125 @@
+Reviewed commit `90da7cd5680c644676a9b47f852ddc7500bb17a1`, round 1. No files changed, subagents spawned, or test suites run.
+
+1. **P1 — Task 2: A rejected render can replace a published page before its fence is checked.**
+
+ **Evidence:** The [plan:208–221](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:208) gives concurrent fills the same store key and commits outside the scope lock. [Fill.Commit:432](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/assetcache/fill.go:432) replaces the existing entry; [Store.Get:425](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/assetcache/store.go:425) returns that replacement.
+
+ **Failure:** Render A starts before a clear. After the clear, render B publishes fresh content. A then commits over B’s store key. Before A acquires the scope lock and refuses publication, Lookup finds B’s index record but returns A’s stale bytes. A’s subsequent `Delete` also deletes the replacement at that shared key.
+
+ **Fix:** Give each pending publication a unique physical store key. Under the scope lock, publish the mapping from logical page key to that exact stored object and its cookie metadata. Refusal must delete only its own object. Add a deterministic test pausing A between Commit and the fence check.
+
+ **Boundary:** I1; only successful index publication may make bytes servable.
+
+2. **P1 — Task 1: The prescribed Delete implementation deadlocks.**
+
+ **Evidence:** [Plan:150](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:150) says to wrap `drop` under the store lock. [Store.drop:391](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/assetcache/store.go:391) calls `lockID`, which acquires `s.mu` at [store.go:365](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/assetcache/store.go:365). Its contract explicitly requires calling without `s.mu` held.
+
+ **Failure:** The first deletion hangs, including the proposed Task 1 test and every clear that deletes an entry.
+
+ **Fix:** Find the entry under `s.mu`, release that mutex, then call `drop`, preserving its identity check and lock ordering.
+
+ **Boundary:** Store locking and clear completion.
+
+3. **P1 — Task 8: The Version tracker can miss releases and permit old content to refill after a clear.**
+
+ **Evidence:** [Plan:589–597](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:589) examines existing index scopes and seeds unseen versions without clearing. Separately, [edge.go:1190](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/edge.go:1190) states that registry Version identifies the installed build, not the serving generation. [assetpolicy.go:64](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/host/assetpolicy.go:64) explicitly handles generation switches that change no registry row.
+
+ **Failure:** A scope first caches v1, then its first reload observes v2. The hook seeds v2 and leaves v1 cached. Even with initialization fixed, an installed-version clear can occur while the old generation still serves; a subsequent render caches old content, and the eventual generation switch causes no further Version change.
+
+ **Fix:** Initialize release identity when a scope becomes usable. Define invalidation against the actual serving transition as well as installation for sleeping instances, and prevent old-generation responses from publishing across that transition. Test the first release after opt-in and a delayed generation switch, while preserving same-build wakes.
+
+ **Boundary:** Spec §8.6, automatic release invalidation.
+
+4. **P1 — Task 9: Neither proposed config callback supplies the required complete signal.**
+
+ **Evidence:** [Plan:643–648](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:643) leaves selection between two callbacks to implementation. [WithHostOutcome:840](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/appconfig/syncexec.go:840) reports unchanged files too. `Delivered` is suppressed for unmanaged socket and TCP shapes at [syncexec.go:635](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/appconfig/syncexec.go:635), and runs before restart at [syncexec.go:1490](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/appconfig/syncexec.go:1490). Unit-backed delivery occurs separately in [unitsync.go:318](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/appconfig/unitsync.go:318).
+
+ **Failure:** Using host outcomes clears on unchanged passes. Using `Delivered` misses eligible route shapes and root-side unit delivery. Clearing before a delayed restart also permits the old process to refill the cache under the new sequence.
+
+ **Fix:** Specify the exact change notification, its wiring to the edge across both agent and root delivery, and its relationship to activation before implementation begins. Preserve existing rollout callbacks. Test writes, removals, unchanged passes, delayed/failed restart, and unit-backed delivery through the real wiring.
+
+ **Boundary:** Spec §8.6, delivered-config invalidation without wake clears.
+
+5. **P1 — Task 8: Temporary ineligibility removes the protection against the old LRU.**
+
+ **Evidence:** [Plan:591–593](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:591) clears the opt-in mark for gates, HA and other ineligible states. [Spec:432](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:432) permits clearing it only for operator switch-off or route departure. The [LRU gate:2673](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/edge.go:2673) does not exclude password-gated routes.
+
+ **Failure:** Adding a gate re-enables LRU entries stored before opt-in. A request passing the gate can receive a previously stored visitor-specific response that the durable mark was meant to make unreachable.
+
+ **Fix:** Separate resetting page contents from clearing opt-in. Preserve the mark through temporary predicate failures. Test a pre-opt-in LRU entry across gate addition/removal and HA changes.
+
+ **Boundary:** I2; an opted-in instance never uses the LRU.
+
+6. **P1 — Task 6: Checking only `up.paths` admits path-routed hosts whose clears cannot reach their entries.**
+
+ **Evidence:** The predicate at [plan:64](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:64) checks `len(up.paths) == 0`. However, [lookupUpstreamPath:1761](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/edge.go:1761) returns the target upstream wholesale. The original hostname’s path map is no longer necessarily present in `up`.
+
+ **Failure:** Host A routes `/blog` to instance B, whose own path map is empty. The page is stored under B’s scope with host A. Task 7’s `clearPages(A, …)` resolves A’s scope, so even an authorized `Carlos-Purge-Host: A` fails to clear B’s stored page.
+
+ **Fix:** Check path rows on the requested hostname and its primary before path dispatch, as the existing [asset predicate:314](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/host/assetpolicy.go:314) does. Add a real path-routing test, including an alias of the front host.
+
+ **Boundary:** I1 and the spec’s exclusion of path-routed hosts.
+
+7. **P1 — Task 5: ModifyResponse alone does not strip the marker everywhere.**
+
+ **Evidence:** [Plan:387–390](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:387) specifies header deletion through `responseModifier`. Informational responses bypass that hook, as documented and handled at [assetcatch.go:1372](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/assetcatch.go:1372). Trailer values arrive later and require separate removal at [assetcatch.go:986](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/assetcatch.go:986).
+
+ **Failure:** An app sends the marker in a 103 response or an announced/unannounced trailer, and the visitor receives it on armed and unarmed boxes.
+
+ **Fix:** Add the marker to informational and trailer stripping, without treating those occurrences as admission signals. Test final headers, 103s, and both trailer forms.
+
+ **Boundary:** The unconditional marker-stripping contract.
+
+8. **P1 — Task 6: A failed hit delivery returns an empty response.**
+
+ **Evidence:** [Plan:447–448](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:447) calls `serveAssetEntry` and returns. Its [documented contract:33](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/assetserve.go:33) returns an error with the writer untouched when eviction or replacement prevents opening the body.
+
+ **Failure:** The shared store evicts a page between Lookup and Open. Following the plan, the handler returns without reaching the app or writing a response body.
+
+ **Fix:** Return only after successful delivery; otherwise continue through the ordinary miss path. Test eviction between lookup and body opening.
+
+ **Boundary:** Store eviction must remain a cache miss, not a broken HTTP response.
+
+9. **P2 — Task 6: `LocalAssets.For` cannot establish that a path has no declared asset prefix.**
+
+ **Evidence:** [Plan:427–428](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:427) uses `For(host)` for this decision. [assetpolicy.go:302](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/host/assetpolicy.go:302) refuses asset opt-outs and missing generations; [For:388](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/host/assetpolicy.go:388) also returns false before initialization and after expiry.
+
+ **Failure:** With assets switched off, a marked response under a release’s declared `/assets/` prefix can enter the page cache.
+
+ **Fix:** Provide declaration knowledge independently of asset-catching eligibility, with an explicit decision for unknown declarations. Test assets-off and unavailable-policy cases.
+
+ **Boundary:** Declared asset prefixes retain exclusive ownership.
+
+10. **P2 — Task 6: The diagnostic header rules omit cookie-rejected lookups and marked unstorable responses.**
+
+ **Evidence:** [Plan:449–466](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:449) installs the header-setting recorder only for storable requests. Its bypass branch requires the request to be neither readable nor storable, while cookie acceptance is decided inside Lookup. [Plan:491–493](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:491) nevertheless expects an unignored cookie to produce `bypass`.
+
+ **Failure:** A cookie-bearing lookup rejected by the entry’s ignore list falls through without either header-setting path. A marked answer to a POST or cookie-bearing request has the same omission.
+
+ **Fix:** Carry the lookup rejection reason and set diagnostics independently of body recording. Test marked POSTs, HEAD misses, and cookie-policy rejection.
+
+ **Boundary:** The promised `Carlos-Cache` visibility.
+
+11. **P2 — Tasks 3 and 6: The verification does not cover all required invariants.**
+
+ **Evidence:** [Task 3:289–307](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:289) asserts clear ordering only. The spec requires I2/I3 assertions at [spec:743–751](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:743) and a publication-bypass guard at [spec:409–412](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:409).
+
+ **Failure:** Cross-scope/host lookup defects or a page write outside the index can pass the prescribed checks. Random sleeps also do not guarantee exercising the Commit-to-index window in finding 1.
+
+ **Fix:** Add explicit ownership assertions across account, app, instance and host; exercise cookie/Authorization provenance and opt-in transitions through the edge; add the publication guard and deterministic interleaving barriers. Give the concurrent model a defined ordering for observing clears and lookups.
+
+ **Boundary:** Required evidence for I1, I2, I3 and sole publication authority.
+
+12. **P2 — Global constraints: The test instructions contradict this machine’s scratch-space rules.**
+
+ **Evidence:** [Plan:90–93](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:90) mandates `/tmp/g`, repeated throughout the tasks. The supplied AGENTS instructions prohibit task scratch directly under the shared RAM-backed `/tmp`.
+
+ **Failure:** Following the plan puts test scratch on the shared tmpfs.
+
+ **Fix:** Use the configured disk-backed `$TMPDIR` or task-owned disk scratch and remove it afterward; retain the default Go cache.
+
+ **Boundary:** Shared-machine resource rules.
+
+No P3 findings.
+
+**NOT READY**
\ No newline at end of file
diff --git a/docs/superpowers/plans/CODEX-FINDINGS-PAGE-CACHE-PLAN1-R2.md b/docs/superpowers/plans/CODEX-FINDINGS-PAGE-CACHE-PLAN1-R2.md
new file mode 100644
index 000000000..6e3f8a615
--- /dev/null
+++ b/docs/superpowers/plans/CODEX-FINDINGS-PAGE-CACHE-PLAN1-R2.md
@@ -0,0 +1,100 @@
+- **R1 P1-1 — Resolved:** unique physical keys prevent a rejected render from replacing a published object.
+- **R1 P1-2 — Resolved:** `Delete` releases `s.mu` before calling `drop`.
+- **R1 P1-3 — Partly resolved:** serving identity replaces Version tracking, but sleeping updates and staged starts remain unsafe.
+- **R1 P1-4 — Partly resolved:** exec starts gain identity tracking; sleeping config changes and unit-backed delivery remain uncovered.
+- **R1 P1-5 — Resolved:** temporary ineligibility preserves the opt-in mark.
+- **R1 P1-6 — Resolved:** eligibility checks the requested host and rejects path dispatch.
+- **R1 P1-7 — Partly resolved:** local headers, informational responses and trailers are covered; final backhaul headers are not.
+- **R1 P1-8 — Resolved:** failed body opening falls through to the app.
+- **R1 P2-9 — Partly resolved:** independent declaration lookup is proposed, but its data source and build input remain incomplete.
+- **R1 P2-10 — Partly resolved:** cookie rejection is represented; marked POSTs and unknown-identity responses still lack the required wiring.
+- **R1 P2-11 — Partly resolved:** I1/I3 simulation and a publication guard are added; randomized I2 coverage and several mutation checks remain absent.
+- **R1 P2-12 — Resolved:** scratch uses disk-backed storage and the default Go cache.
+
+Reviewed `design-edge-page-cache` at `c006cd41ed172977b4edafda271dadda38eff299`. No files changed, subagents spawned, or tests run.
+
+1. **P1 — Tasks 6, 7 and 9: Sleeping instances can serve old pages indefinitely after a release or config change.**
+
+ **Evidence:** [Plan:489](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:489) updates identity at starts and switches; [plan:729](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:729) explicitly removes release/config handling from reload. However, [agent.go:3027](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/host/agent.go:3027) leaves sleeping instances to adopt the new build on their next wake. Config delivery likewise records delivery-on-wake without starting anything at [syncexec.go:1518](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/appconfig/syncexec.go:1518).
+
+ **Failure:** Cache a page under identity A, let the instance sleep, then install build B or deliver changed configuration. The identity table still contains A. Requests for that page hit before the activator, preventing the wake that would update the identity. Old pages remain servable until expiry, potentially 365 days.
+
+ **Fix:** Define both the active process identity and the effective inputs for the next start. Changed inputs on a sleeping instance must invalidate its old pages without requiring a wake. Add real-wiring tests for build changes, config changes and config removal while asleep, followed exclusively by requests for an already-cached URL. Retain the same-build, same-config wake test.
+
+ **Boundary:** Spec §8.6; release/config invalidation must work independently of cache misses.
+
+2. **P1 — Task 6: Two prescribed identity hooks publish a successor’s identity before it serves.**
+
+ **Evidence:** [Plan:489–494](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:489) adds `NoteServing` at every listed purge site. Nested staged successors call `spawnUnitFrom` at [genbackend.go:300](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/activator/genbackend.go:300), which unconditionally reaches the purge at [backend_exec.go:2849](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/activator/backend_exec.go:2849). Rootfs staged successors similarly reach `spawnRootfs` at [rootfs.go:271](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/activator/rootfs.go:271) and its purge at [rootfs.go:426](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/activator/rootfs.go:426). The actual serving switch happens later at [swap.go:787–796](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/activator/swap.go:787).
+
+ **Failure:** Successor B starts while A remains current. The new hook publishes identity B. A request then receives A’s page but stores it under B. After the switch, that old page passes B’s identity check. The prescribed “staged successor doesn't change the identity until the switch” test fails for these backends.
+
+ **Fix:** Capture the identity with the process, but publish it only when that process becomes current. Use the exact configuration snapshot consumed by the launch, carrying it to `GenSwitched`; do not reread mutable config files there. Extend the staged-successor test to nested native and rootfs backends, including an old-process render between staging and switching.
+
+ **Boundary:** Spec §8.6; the cache identity must name the process that actually serves.
+
+3. **P1 — Task 6: Unit-backed instances never receive a usable identity.**
+
+ **Evidence:** [Plan:519](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:519) explicitly bypasses starts without an existing `PurgeHost` call. [UnitBackend.Start:146–162](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/activator/backend_unit.go:146) has no such call. `SplitBackend` dispatches unit-backed starts to that backend at [backend_unit.go:489–499](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/activator/backend_unit.go:489). Unit config delivery also runs separately at [unitsync.go:318](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/appconfig/unitsync.go:318).
+
+ **Failure:** A unit-backed instance sends a valid marker on every response but always fails the known-identity predicate. It never stores or serves pages. This excludes a supported home-box case; the spec explicitly describes unit-backed apps using response-header clears.
+
+ **Fix:** Specify an identity signal covering unit-backed starts, adoption of already-running units, and root-side release/config restarts. Capture the actual launched inputs through an appropriate root-to-agent interface. Add unit-backed fill/hit, release-change, config-change and same-build-wake tests through that wiring.
+
+ **Boundary:** Slice-1 coverage and spec §8.6; safe bypass does not deliver the required unit-backed feature.
+
+4. **P1 — Task 5: Final backhaul responses can still leak the marker.**
+
+ **Evidence:** [Plan:434–442](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:434) extends `assetVocabulary` and the local response hook. But [scrubBackhaulResponse:1362](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/assetcatch.go:1362) deletes an explicit list of final headers rather than iterating that vocabulary. `assetInformationalScrub` leaves final responses untouched at [assetcatch.go:1379](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/assetcatch.go:1379).
+
+ **Failure:** During a mixed-version rollout, an older home forwards an app’s `Carlos-Page-Cache` header. A newly updated receiving box still forwards that final header to the visitor.
+
+ **Fix:** Add unconditional marker removal to the final backhaul response scrub. Test a mock older home returning the marker through ordinary backhaul, with page caching both armed and unarmed.
+
+ **Boundary:** Unconditional marker stripping on every box. This concerns existing backhaul handling, not implementing far-box page caching.
+
+5. **P2 — Tasks 6 and 7: Declaration lookup lacks a complete source contract.**
+
+ **Evidence:** [Plan:577–580](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:577) says to call `p.manifests.paths` while returning unknown when the manifest has not been read. In fact, [assetmanifests.go:42–50](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/host/assetmanifests.go:42) fetches an uncached manifest from storage; `cached` is the read-only lookup. The existing loader refuses `AssetsOff` before loading manifests at [assetpolicy.go:302](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/host/assetpolicy.go:302). Task 6 also exposes only an opaque digest, while `DeclaresPrefix` requires the serving build.
+
+ **Failure:** Following `paths` adds storage reads to request eligibility. Following the stated unknown-until-loaded rule can leave assets-off instances bypassing permanently. A sleeping instance’s retained digest does not supply the build needed for the declaration lookup.
+
+ **Fix:** Retain the build alongside the fingerprint. Specify background declaration loading independent of asset-catching eligibility, then use `cached` on requests. Test an assets-off instance progressing from unknown declarations to cacheable pages without a request-time storage read.
+
+ **Boundary:** Declared asset-prefix ownership and workable identity/declaration interfaces.
+
+6. **P2 — Tasks 5 and 7: The diagnostic writer cannot produce all prescribed results.**
+
+ **Evidence:** [Plan:460](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:460) attaches the marker holder only to GET and HEAD. [Plan:604–609](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:604) requires that holder to identify marked POSTs and installs the writer only for eligible routes. Known identity is itself an eligibility condition at [plan:91](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:91).
+
+ **Failure:** A marked POST on an instance not yet opted in has no holder, so it gets no diagnostic. An unknown-identity response gets no diagnostic writer, contradicting `TestPageUnknownIdentityBypasses`.
+
+ **Fix:** Attach marker observation to every applicable proxied method. Install diagnostics independently of cache admission and known identity. Test a first marked POST, an unknown-identity marked GET, and an opted-in instance that becomes temporarily ineligible.
+
+ **Boundary:** The promised `Carlos-Cache` visibility.
+
+7. **P2 — Tasks 3 and 7: Required I2 verification remains missing.**
+
+ **Evidence:** The simulation operations and assertions at [plan:348–367](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:348) contain no cookie/Authorization provenance or LRU operations. The mutation list at [plan:380](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:380) covers publication fencing and the key guard. [Spec:743–771](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:743) additionally requires I2 assertions and independently demonstrated cache-separation fences.
+
+ **Failure:** The simulation can pass if the edge re-enables a personalized pre-opt-in LRU entry during an opt-in transition. The added index ownership assertions cannot detect that defect.
+
+ **Fix:** Add randomized edge operations with cookie/Authorization provenance, pre-opt-in LRU entries and opt-in/predicate transitions. Assert that neither cache serves forbidden provenance. Watch the marked-response and opted-in-LRU guards fail under their own mutations.
+
+ **Boundary:** Required evidence for I2 and spec §12.
+
+8. **P2 — Task 2: Eviction leaves unbounded index metadata.**
+
+ **Evidence:** [Plan:250](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:250) retains a record for each logical key. Evicted records are removed only when that same key is looked up at [plan:287](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:287). Store eviction calls `drop` independently at [evict.go:25](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/assetcache/evict.go:25), without notifying the page index.
+
+ **Failure:** Repeated requests with distinct queries publish distinct records. The disk store remains within budget, but records for evicted objects accumulate in memory because those queries are never requested again.
+
+ **Fix:** Specify bounded index retention or eviction reconciliation owned by the index. Test many distinct keys against a small store budget and assert that metadata remains bounded without a final Reset.
+
+ **Boundary:** Shared-cache resource bounds and store/index lifecycle.
+
+No P3 findings.
+
+The release/config and marker-stripping fault families recur from round 1, triggering stopping rule 2. Before another repair cycle, choose an upfront gate, a feature cut, or one centrally enforced invariant with guard tests or simulation. I recommend the centrally enforced invariant for both families.
+
+**NOT READY**
\ No newline at end of file
diff --git a/docs/superpowers/plans/CODEX-FINDINGS-PAGE-CACHE-PLAN1-R3.md b/docs/superpowers/plans/CODEX-FINDINGS-PAGE-CACHE-PLAN1-R3.md
new file mode 100644
index 000000000..f4b844654
--- /dev/null
+++ b/docs/superpowers/plans/CODEX-FINDINGS-PAGE-CACHE-PLAN1-R3.md
@@ -0,0 +1,104 @@
+- **R2-1 — Partly resolved:** lookup-time inputs cover sleeping releases, but the prescribed file list misses delivered config.
+- **R2-2 — Partly resolved:** publication moves to the switch, but launch fingerprints can still describe inputs the process never consumed.
+- **R2-3 — Resolved:** unit-backed instances are explicitly refused.
+- **R2-4 — Resolved:** final backhaul stripping now includes the marker.
+- **R2-5 — Resolved:** declaration loading is independent of asset eligibility and runs in the background.
+- **R2-6 — Partly resolved:** diagnostics cover more requests, but still omit unarmed boxes.
+- **R2-7 — Partly resolved:** randomized I2 coverage is specified, but its assertion also rejects intentionally unchanged pre-opt-in behavior.
+- **R2-8 — Resolved:** index records are reconciled against store eviction.
+
+Reviewed `design-edge-page-cache` at `4c5c988fca7e8a2b1c672894ba9901c1325facdb`. No files changed, subagents spawned, or tests run.
+
+1. **P1 — Task 6: The prescribed config-file list omits the delivered configuration.**
+
+ **Evidence:** [Plan:570](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:570) identifies `backend_exec.go:2421` and `:3355` as the spawn’s environment reads. Those read the admin-token file and sidecar environment. The web process consumes both `paths.configEnv` and `paths.envFile` through [instanceEnvParts:3064](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/activator/backend_exec.go:3064).
+
+ **Failure:** Following the named file list leaves `<host>.config.env` outside the fingerprint. Editing or removing delivered configuration while the instance sleeps leaves cached pages reachable.
+
+ **Fix:** Explicitly name both web environment layers, resolved through `pathsFor`. Test real config delivery and removal against an already-cached URL, rather than only editing a synthetic file supplied by the test.
+
+ **Boundary:** Current-inputs invariant; carries forward R2-1.
+
+2. **P1 — Task 6: Calling `CurrentInputs` at launch does not identify the inputs actually consumed.**
+
+ **Evidence:** [Plan:566](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:566) hashes `rt.Version` and rereads files. The spawn captures its environment earlier at [backend_exec.go:2392](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/activator/backend_exec.go:2392), then supplies that captured environment at [2545](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/activator/backend_exec.go:2545). Staged processes execute `g.StagedPath`, independently of the route’s installed version, at [genbackend.go:274](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/activator/genbackend.go:274).
+
+ **Failure:** Config A is captured for execution; delivery writes B before the fingerprint read. The process runs A but publishes B’s fingerprint. Both store checks then accept A’s response under B. Likewise, a retained or staged build can differ from `rt.Version`.
+
+ **Fix:** Derive launch inputs from the exact captured config bytes and actual executable identity. Carry that immutable value to `noteCurrent`. Share the fingerprint encoding with current-input computation, rather than independently rereading launch files. Test config replacement between capture and exec, plus `g.Build != rt.Version`.
+
+ **Boundary:** The answering process must have consumed the inputs attached to its page; carries forward R2-2.
+
+3. **P1 — Task 9: The serving map cannot distinguish departure from temporary ineligibility.**
+
+ **Evidence:** [Plan:848](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:848) decides whether to clear marks using `e.current()`. Reload excludes sidecars and non-ready rows entirely at [edge.go:956](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/edge.go:956). Their absence therefore looks identical to deletion.
+
+ **Failure:** Seed a personalized LRU entry, opt the instance in, then change its status away from ready and back. The first reload incorrectly clears its mark. On return, the old LRU entry is reachable before any wake or new opt-in response.
+
+ **Fix:** Determine departure from the complete registry route snapshot, including ownership, rather than absence from the serving map. Preserve marks for existing but ineligible rows. Add a ready → non-ready → ready test with a pre-opt-in personalized LRU entry.
+
+ **Boundary:** I2 and durable opt-in lifetime; the R1-5 mechanism remains incomplete.
+
+4. **P1 — Tasks 6 and 10: The specified host wiring cannot compile.**
+
+ **Evidence:** [Plan:896](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:896) calls `e.cache.SetCurrentInputs` from package `host` and supplies `ExecBackend.configFilesFor`. `Edge.cache` is unexported at [edge.go:284](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/edge.go:284), and the proposed method is also unexported at [plan:570](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:570).
+
+ **Failure:** Package `host` cannot access either member.
+
+ **Fix:** Use the existing host-local `cache` variable and expose an exported backend method or callback that computes current inputs. State the callable interface explicitly.
+
+ **Boundary:** Cross-package API and buildability.
+
+5. **P2 — Task 5: One client-boundary scrub still retains its private vocabulary.**
+
+ **Evidence:** The scrub inventory at [plan:475](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:475) omits [stripAssetFillVocabulary:1349](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/assetcatch.go:1349), which explicitly deletes three headers before client delivery.
+
+ **Failure:** The proposed guard passes while an existing client-boundary scrub still uses its own list. Upstream backhaul stripping closes the reported marker leak, but the chosen “one list, every scrub” mechanism is not fully enforced.
+
+ **Fix:** Make this scrub iterate the shared vocabulary with an explicit keep exception for the edge’s `Carlos-Cache`, and include it in the guard.
+
+ **Boundary:** Paul’s fixed marker-stripping mechanism.
+
+6. **P2 — Task 7: Direct manifest-cache access needs a publication contract.**
+
+ **Evidence:** [Plan:654](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:654) reads `p.manifests` on requests. That pointer starts nil at [agent.go:926](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/host/agent.go:926) and is assigned without synchronization by [bindManifests:179](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/host/assetpolicy.go:179). Its existing contract explicitly relies on request handlers never touching it.
+
+ **Failure:** Request-time reads can race initialization; calling `cached` before initialization dereferences nil.
+
+ **Fix:** Specify synchronized publication and an unknown result before initialization, or expose declaration data through an immutable published snapshot. Test requests concurrent with delayed manifest binding under `-race`.
+
+ **Boundary:** Declaration-source initialization and concurrency.
+
+7. **P2 — Task 7: Diagnostics still omit unarmed boxes.**
+
+ **Evidence:** [Plan:148](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:148) requires diagnostics on every marked response, but [plan:691](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:691) installs the diagnostic writer only on armed boxes.
+
+ **Failure:** An unarmed home receives a marked GET or POST, strips the marker, and returns no `Carlos-Cache`.
+
+ **Fix:** Install marker-based diagnostics independently of page-cache arming; these responses report `bypass`. Add unarmed GET and POST cases.
+
+ **Boundary:** Promised visibility; carries forward R2-6.
+
+8. **P2 — Task 7: The simulation asserts I2 before I2 applies.**
+
+ **Evidence:** [Plan:759](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:759) mixes pre-opt-in LRU traffic, while [plan:768](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:768) requires anonymous provenance for every cache hit. The approved [spec:155](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:155) deliberately preserves the LRU’s existing cookie behavior for instances that never opt in.
+
+ **Failure:** Before opt-in, a cookie-bearing unmarked response enters the ordinary LRU and is replayed. The prescribed assertion rejects behavior this slice intentionally preserves.
+
+ **Fix:** Track opt-in state in the oracle. Require anonymous provenance for page hits always and LRU exclusion while opted in. Retain personalized pre-opt-in entries as adversarial fixtures. Run reload-dependent simulation cases after Task 9, when that behavior exists.
+
+ **Boundary:** Correct I2 verification and task ordering; carries forward R2-7.
+
+9. **P2 — Task 7: Page eligibility omits the account-throttle refusal.**
+
+ **Evidence:** The predicate at [plan:114](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md:114) has no throttle condition. The required asset-policy predicate refuses throttled accounts at [assetpolicy.go:311](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/host/assetpolicy.go:311). Passing `planThrottleAdmit` is different: it allows requests when a token is available at [planthrottle.go:75](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/planthrottle.go:75).
+
+ **Failure:** A throttled account’s admitted request can still serve or populate the page cache, contrary to spec §5.1.
+
+ **Fix:** Add the explicit account-throttle predicate and test a throttled request that successfully passes admission but bypasses page caching.
+
+ **Boundary:** Approved host-eligibility policy.
+
+No P3 findings. Round 3 exhausts the review budget; a fourth requires Paul’s approval.
+
+**NOT READY**
\ No newline at end of file
diff --git a/docs/superpowers/plans/CODEX-REVIEW-BRIEF-PAGE-CACHE-PLAN1-R2.md b/docs/superpowers/plans/CODEX-REVIEW-BRIEF-PAGE-CACHE-PLAN1-R2.md
new file mode 100644
index 000000000..76b737631
--- /dev/null
+++ b/docs/superpowers/plans/CODEX-REVIEW-BRIEF-PAGE-CACHE-PLAN1-R2.md
@@ -0,0 +1,92 @@
+# Review brief: edge page cache plan 1 (home box), round 2 of 3
+
+Repo carlos/platform, branch `design-edge-page-cache`, the commit named in
+your prompt.
+Under review: `docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md`.
+Authorities: the approved spec
+`docs/superpowers/specs/2026-11-08-edge-page-cache-design.md` (rev 4, approved
+by Paul; it merges together with this plan), and the code on this branch
+(`internal/edge`, `internal/assetcache`, `internal/registry`,
+`internal/provision`, `internal/console`, `internal/host`, CLI files in the
+repo root).
+
+You are an independent reviewer and the engineer who will implement each
+task with only the plan and spec in hand. Check every file, line, signature
+and behaviour the plan names against the code.
+
+## Fixed: do not re-argue
+
+- The spec's design, its rulings in §16, and Paul's rule-2 choices:
+ - one page index per box owns every publish, clear, reset and lookup;
+ - an opted-in instance never uses the LRU.
+- The slice boundary: home box only, with no far boxes, leases, pushes or
+ single-flight.
+
+## What to check
+
+1. **Fit with the spec.** Does each task deliver what spec slice 1
+ (§11 item 1) needs, with nothing in the spec's invariants I1 (home
+ side), I2 and I3 left untested? Does any task contradict the spec?
+2. **Fit with the code.**
+ - Are the named sites real, and are the signatures workable? Pay
+ particular attention to:
+ - where `ModifyResponse` runs relative to the recorders (Task 5's
+ context holder);
+ - the LRU gate (Task 6);
+ - `applyPurgeTargets` and `ListenControl` (Task 7);
+ - `OnReload` and the Version signal (Task 8);
+ - the config-delivery hook (Task 9).
+ - Does anything the plan relies on not exist?
+3. **Safety.** Could a task as written:
+ - serve a personalised page;
+ - serve a page after a clear;
+ - leak the marker;
+ - let the asset sweep or store eviction break the index;
+ - or make a wake clear pages?
+4. **Tests.** Does each test fail for the right reason before the change
+ and prove the behaviour after it? Name any missing test for a real
+ failure mode.
+5. **Order and size.** Can each task be built and pass its tests with
+ only the earlier tasks done?
+
+## Round 2
+
+Earlier rounds: `CODEX-FINDINGS-PAGE-CACHE-PLAN1-R1.md` (plan rev 1). First
+give one line per round-1 P1 and P2: resolved, partly, or not. The plan's
+"(P1-n)" marks show where each was answered. Carry unresolved ones forward
+at their severity, then add new findings. The verdict covers everything
+outstanding.
+
+Plan rev 2 replaces spec §8.6's release and config clear hooks with
+serving-identity tagging (Task 6, Task 7). Check that it delivers §8.6's
+guarantee. That means a new build or config is never served from old
+pages, and a same-build wake keeps them. Check also that every process
+start site is covered, including unit-backed instances.
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work.
+ Blocks merge.
+- **P2**: wrong or missing. Fixed without reopening this review.
+- **P3**: clarity or polish. Goes on a follow-up list; never a reason for
+ another round.
+
+A P1 states its failure scenario and the evidence (file:line). Do not
+raise a P2 to P1 to keep the review open.
+
+## Output
+
+Findings ranked P1, P2, P3. Each gives:
+- the task;
+- the problem;
+- the evidence (file:line, verified);
+- the failure scenario;
+- a concrete fix;
+- the invariant or boundary it breaks.
+
+End with exactly one verdict: **READY**, **READY AFTER FIXES**
+(no P1; the P2s are fixed without another round), or **NOT READY** (P1s
+listed).
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of
+your own. Do not run the full test suites.
diff --git a/docs/superpowers/plans/CODEX-REVIEW-BRIEF-PAGE-CACHE-PLAN1-R3.md b/docs/superpowers/plans/CODEX-REVIEW-BRIEF-PAGE-CACHE-PLAN1-R3.md
new file mode 100644
index 000000000..fe844ce2d
--- /dev/null
+++ b/docs/superpowers/plans/CODEX-REVIEW-BRIEF-PAGE-CACHE-PLAN1-R3.md
@@ -0,0 +1,97 @@
+# Review brief: edge page cache plan 1 (home box), round 3 of 3
+
+Repo carlos/platform, branch `design-edge-page-cache`, the commit named in
+your prompt.
+Under review: `docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md`.
+Authorities: the approved spec
+`docs/superpowers/specs/2026-11-08-edge-page-cache-design.md` (rev 4, approved
+by Paul; it merges together with this plan), and the code on this branch
+(`internal/edge`, `internal/assetcache`, `internal/registry`,
+`internal/provision`, `internal/console`, `internal/host`, CLI files in the
+repo root).
+
+You are an independent reviewer and the engineer who will implement each
+task with only the plan and spec in hand. Check every file, line, signature
+and behaviour the plan names against the code.
+
+## Fixed: do not re-argue
+
+- The spec's design, its rulings in §16, and Paul's rule-2 choices:
+ - one page index per box owns every publish, clear, reset and lookup;
+ - an opted-in instance never uses the LRU.
+- The slice boundary: home box only, with no far boxes, leases, pushes or
+ single-flight.
+
+## What to check
+
+1. **Fit with the spec.** Does each task deliver what spec slice 1
+ (§11 item 1) needs, with nothing in the spec's invariants I1 (home
+ side), I2 and I3 left untested? Does any task contradict the spec?
+2. **Fit with the code.**
+ - Are the named sites real, and are the signatures workable? Pay
+ particular attention to:
+ - where `ModifyResponse` runs relative to the recorders (Task 5's
+ context holder);
+ - the LRU gate (Task 6);
+ - `applyPurgeTargets` and `ListenControl` (Task 7);
+ - `OnReload` and the Version signal (Task 8);
+ - the config-delivery hook (Task 9).
+ - Does anything the plan relies on not exist?
+3. **Safety.** Could a task as written:
+ - serve a personalised page;
+ - serve a page after a clear;
+ - leak the marker;
+ - let the asset sweep or store eviction break the index;
+ - or make a wake clear pages?
+4. **Tests.** Does each test fail for the right reason before the change
+ and prove the behaviour after it? Name any missing test for a real
+ failure mode.
+5. **Order and size.** Can each task be built and pass its tests with
+ only the earlier tasks done?
+
+## Round 3
+
+Earlier rounds: `CODEX-FINDINGS-PAGE-CACHE-PLAN1-R1.md` (plan rev 1) and
+`CODEX-FINDINGS-PAGE-CACHE-PLAN1-R2.md` (plan rev 2). This is the last
+round in the budget.
+
+First give one line per round-2 P1 and P2: resolved, partly, or not. The
+plan's "(R2-n)" marks show where each was answered. Carry unresolved ones
+forward at their severity, then add new findings. The verdict covers
+everything outstanding.
+
+Stopping rule 2 fired after round 2, and Paul chose the fixes (see the
+plan's header). These are fixed; report only a mechanism that fails to
+deliver them:
+- **Release and config freshness:** one current-inputs invariant, with
+ unit-backed instances refused in v1;
+- **Marker stripping:** every scrub iterates one vocabulary list, with a
+ guard test.
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work.
+ Blocks merge.
+- **P2**: wrong or missing. Fixed without reopening this review.
+- **P3**: clarity or polish. Goes on a follow-up list; never a reason for
+ another round.
+
+A P1 states its failure scenario and the evidence (file:line). Do not
+raise a P2 to P1 to keep the review open.
+
+## Output
+
+Findings ranked P1, P2, P3. Each gives:
+- the task;
+- the problem;
+- the evidence (file:line, verified);
+- the failure scenario;
+- a concrete fix;
+- the invariant or boundary it breaks.
+
+End with exactly one verdict: **READY**, **READY AFTER FIXES**
+(no P1; the P2s are fixed without another round), or **NOT READY** (P1s
+listed).
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of
+your own. Do not run the full test suites.
diff --git a/docs/superpowers/plans/CODEX-REVIEW-BRIEF-PAGE-CACHE-PLAN1.md b/docs/superpowers/plans/CODEX-REVIEW-BRIEF-PAGE-CACHE-PLAN1.md
new file mode 100644
index 000000000..8b0e160f8
--- /dev/null
+++ b/docs/superpowers/plans/CODEX-REVIEW-BRIEF-PAGE-CACHE-PLAN1.md
@@ -0,0 +1,78 @@
+# Review brief: edge page cache plan 1 (home box), round 1 of 3
+
+Repo carlos/platform, branch `design-edge-page-cache`, the commit named in
+your prompt.
+Under review: `docs/superpowers/plans/2026-11-08-edge-page-cache-plan-1-home.md`.
+Authorities: the approved spec
+`docs/superpowers/specs/2026-11-08-edge-page-cache-design.md` (rev 4, approved
+by Paul; it merges together with this plan), and the code on this branch
+(`internal/edge`, `internal/assetcache`, `internal/registry`,
+`internal/provision`, `internal/console`, `internal/host`, CLI files in the
+repo root).
+
+You are an independent reviewer and the engineer who will implement each
+task with only the plan and spec in hand. Check every file, line, signature
+and behaviour the plan names against the code.
+
+## Fixed: do not re-argue
+
+- The spec's design, its rulings in §16, and Paul's rule-2 choices:
+ - one page index per box owns every publish, clear, reset and lookup;
+ - an opted-in instance never uses the LRU.
+- The slice boundary: home box only, with no far boxes, leases, pushes or
+ single-flight.
+
+## What to check
+
+1. **Fit with the spec.** Does each task deliver what spec slice 1
+ (§11 item 1) needs, with nothing in the spec's invariants I1 (home
+ side), I2 and I3 left untested? Does any task contradict the spec?
+2. **Fit with the code.**
+ - Are the named sites real, and are the signatures workable? Pay
+ particular attention to:
+ - where `ModifyResponse` runs relative to the recorders (Task 5's
+ context holder);
+ - the LRU gate (Task 6);
+ - `applyPurgeTargets` and `ListenControl` (Task 7);
+ - `OnReload` and the Version signal (Task 8);
+ - the config-delivery hook (Task 9).
+ - Does anything the plan relies on not exist?
+3. **Safety.** Could a task as written:
+ - serve a personalised page;
+ - serve a page after a clear;
+ - leak the marker;
+ - let the asset sweep or store eviction break the index;
+ - or make a wake clear pages?
+4. **Tests.** Does each test fail for the right reason before the change
+ and prove the behaviour after it? Name any missing test for a real
+ failure mode.
+5. **Order and size.** Can each task be built and pass its tests with
+ only the earlier tasks done?
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work.
+ Blocks merge.
+- **P2**: wrong or missing. Fixed without reopening this review.
+- **P3**: clarity or polish. Goes on a follow-up list; never a reason for
+ another round.
+
+A P1 states its failure scenario and the evidence (file:line). Do not
+raise a P2 to P1 to keep the review open.
+
+## Output
+
+Findings ranked P1, P2, P3. Each gives:
+- the task;
+- the problem;
+- the evidence (file:line, verified);
+- the failure scenario;
+- a concrete fix;
+- the invariant or boundary it breaks.
+
+End with exactly one verdict: **READY**, **READY AFTER FIXES**
+(no P1; the P2s are fixed without another round), or **NOT READY** (P1s
+listed).
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of
+your own. Do not run the full test suites.
diff --git a/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md b/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md
new file mode 100644
index 000000000..aa319f92d
--- /dev/null
+++ b/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md
@@ -0,0 +1,900 @@
+# Edge page cache: design
+
+Status: rev 4, APPROVED by Paul 2026-11-08 ("Yes go ahead"), without a fourth review round. Branch `design-edge-page-cache`.
+Builds on the edge asset cache (`2026-10-24-edge-asset-cache-design.md`,
+merged and armed on dev and flagship) and on today's `Carlos-Purge`
+channel (`internal/edge/purge_header.go`, `internal/edge/purge.go`).
+Review history is in §16. Marks like **(astra R1-3)** point at the finding
+a passage answers.
+
+## 1. Why
+
+Many apps build pages from data, the way WordPress does: posts in a
+database, and a homepage, post pages, archives, tags and feeds drawn from
+them. Those pages are effectively static until an author publishes,
+edits or approves a comment. Today every visit renders the page again, a
+sleeping app wakes for it, and a reader far from the app's home box waits
+for the round trip.
+
+This feature lets an app say, on a response, "keep this page at the edge
+until I tell you it changed." The edge keeps it on disk, on the home box
+and on far boxes near readers, and serves it without waking the app. When
+content changes, the app clears one page, a list of pages, or all of its
+pages, and every edge stops serving the old copy within a few seconds.
+
+**Who is asking and when it switches on (AGENTS.md stopping rule 5).**
+Paul, for Patrix (`amadan.net/patrix/patrix`), a WordPress-style blog app
+built on Rastrillo whose public pages have no caching today. It switches
+on with slice 1 on dev, and Patrix sends the header in the same week.
+Later, an events app that uses today's 120-second `Carlos-Purge` caching
+could switch to this and drop its own workarounds (§13).
+
+**Paul's words that fix the shape:**
+- "pass a header that caches a page at the edge until it updates"
+- "Definitely don't want stale cached content to hang around."
+- "the app implementer or agent would probably want the option of
+ clearing one or all pages"
+- On how fast a clear must reach a far reader: "Ideally low seconds if
+ not instant."
+
+**Words used here.** An *instance* is one deployed copy of an app, with
+its own record, route and hosts (what `carlos assets purge --app` walks
+over). The *home* is the box whose route table serves the instance
+directly. Clear state, leases and switches are all per instance
+**(astra R1 builder Q3)**.
+
+## 2. What exists today
+
+Facts the design leans on. File references are to `main` at 06bb3f7e.
+
+- **The shared response cache** is one in-memory LRU per agent process
+ (`internal/edge/cache.go`). It holds 4096 entries of up to 1 MiB each,
+ and every lifetime is cut to `DefaultCacheMaxTTL`, 5 minutes
+ (`edge.go:82-88`). Five minutes is there because a purge only reaches
+ the box that saw it, so a lost purge must heal itself quickly.
+ - **What it stores:** a response that is 2xx with a positive
+ `s-maxage` or `max-age`, has no `Set-Cookie`, and does not vary on
+ `Cookie` or `*` (`maybeStore`, `edge.go:2879-2970`).
+ - **What it doesn't check:** the request's own `Cookie` header. It
+ allows a request with `Authorization` when the response says
+ `public`.
+ - **Where the lookup sits:** after the password gate
+ (`edge.go:2498-2505`) and the plan throttle, and before the rate
+ limit and the activator (`edge.go:2673-2690`). A hit never wakes the
+ app.
+ - **Far edges** never use it: they backhaul before reaching it.
+- **The purge channel.**
+ - **Header.** The app sends `Carlos-Purge: <targets>` on any response:
+ - `*` clears the host;
+ - a path clears every query under it;
+ - `path?query` clears one URL.
+ `Carlos-Purge-Host` redirects the targets to other hosts of the same
+ app and account. The limits are 64 targets, 8 KiB and 32 hosts; over
+ the target or byte limit, the purge falls back to whole hosts.
+ - **Control socket.** `POST /purge` on `CARLOS_CONTROL_SOCKET` with
+ `{"path","query"}`. It exists only for exec-backed instances; a
+ unit-backed (DynamicUser) instance has no socket (`purge.go:115-125`).
+ - **Reach.** Both channels act on the local LRU only. Nothing forwards
+ a purge to another box.
+ - **A known race.** A response in flight while a purge runs can
+ resurrect what the purge removed (`purge_header.go:266`).
+- **The edge asset cache** keeps immutable, declared-prefix, non-HTML
+ responses in a disk store (`internal/assetcache`). The store has a
+ budget, a per-app share, eviction, reserved fills, and a gzip copy written with
+ each entry.
+ - **Fills.** Far edges catch a declared path and ask the home for it
+ with a signed fill (`X-Carlos-Asset-Fill`, HMAC under the mesh key).
+ They store only what the home acknowledges. The acknowledgement
+ MACs the original assertion (`assetfill.go:120`).
+ - **Which hosts may serve.** The home decides with one predicate,
+ `assetPolicy.decide` (`internal/host/assetpolicy.go:291-320`). It
+ refuses:
+ - a row that isn't ready, or is a sidecar;
+ - the record's opt-out;
+ - a password gate or an import gate;
+ - hostnames with path rows;
+ - a throttled or lapsed account.
+ - **Purge.** A per-instance generation in the key, written to the
+ record. It reaches far edges through the 30-second home-map poll,
+ "within a minute" (`homemap.go:124`, asset spec §6).
+ - **HTML is refused** (`assetadmit.go:95`).
+- **Box-to-box push exists once:** probe-burst notices,
+ `POST /.carlos/burst-notice`, sealed with AES-GCM under an HKDF of the
+ mesh key. Each one is receiver-bound and replay-checked, with bounded
+ reads and acceptance limits (`burst_notice.go:444-520`). Everything
+ else between boxes is pulled from the bucket.
+- **Several boxes can serve one app.**
+ - **Region HA.** A request that reaches a non-holder is forwarded to
+ the holder before the cache, except for verified hops, door calls
+ and tunnel deliveries (`forwardha.go:175-180`). A hibernating
+ holder releases its serving lease (`activator.go:5253`).
+ - **Stateless replicas and managed fleets** use forward rows, which
+ the hub never caches (`edge.go:2663-2675`).
+
+## 3. Goals, non-goals, anti-goals
+
+**Goals**
+- G1. An app opts a response in with one response header. Nothing else
+ is needed to start.
+- G2. A cached page lasts as long as the app's `Cache-Control` says, up
+ to a year. No 5-minute ceiling for opted-in pages.
+- G3. Clear one page, a list of pages, one host, or every host of the
+ instance, from a response header, from the control socket, or from
+ the CLI.
+- G4. Once a clear reaches the home, no edge serves a page it covers
+ more than L seconds later (§8.4, invariant I1). L is a few seconds. In
+ the usual case the clear lands on every edge in well under a second.
+- G5. Far boxes serve cached pages to readers near them, without waking
+ the app and without new S3 requests.
+- G6. Requests with a cookie the app hasn't declared harmless, or with
+ `Authorization`, never read from or write to the page cache. A
+ response marked for the page cache never enters the LRU (§5.3).
+- G7. A new release of the instance clears its pages automatically.
+
+**Non-goals (v1)**
+- **Region HA routes** (`route.HA`): refused up front, so their pages
+ are never page-cached **(astra R1-2)**. The serving authority moves
+ between members, and a hibernating holder gives up its lease, so no
+ box can vouch for an entry while the app sleeps. HA apps keep today's
+ LRU. A follow-up can tie page authority to the HA lease once there is
+ a use for it.
+- **Forward rows:** stateless replicas, managed fleets and fleet public
+ routes. The hub never caches these today, and this spec doesn't change
+ that.
+- **Hosts the asset policy refuses** (§2): password gates, import
+ gates, path-routed hostnames, sidecars, and throttled or lapsed
+ accounts **(astra R1-4)**.
+- **Variants** other than `Accept-Encoding`: no geo country, no
+ language headers. A response with any other `Vary` is not stored.
+- **Statuses** other than 200: no 404s and no redirects.
+- **A control socket for unit-backed instances.** Today they can clear
+ only from a response header (§4.4).
+- **Browser copies.** The edge can't clear them; §4.2 tells apps what to
+ send.
+- **Static sites and the asset cache** keep their own rules.
+- **The LRU's cookie gap** (§2) is older than this feature. For apps
+ that never opt in, it stays as it is, and it goes on a follow-up
+ discussion for the LRU's own owner. Opted-in instances don't use the
+ LRU at all (§5.3).
+- **Paths under a declared asset prefix** stay with the asset cache
+ (§5.2) **(astra R2-4)**.
+
+**Anti-goals** (failures even if everything else works)
+- A reader sees a page drawn for someone else: a signed-in view, a paid
+ member's view, a page behind a password gate, or another account's
+ page.
+- An author publishes, a reader reloads a few seconds later and sees the
+ old homepage, and nothing will ever fix it short of a manual clear.
+- The edge keeps serving copies it can't vouch for while the home is
+ unreachable.
+- Adding per-box polling of the bucket (see the S3 cost rulings).
+
+## 4. The app's side
+
+### 4.1 Opting a response in
+
+```
+Carlos-Page-Cache: on
+Cache-Control: public, s-maxage=31536000, max-age=0
+```
+
+- **The marker.** `Carlos-Page-Cache: on` is the opt-in. The edge
+ strips it before the visitor sees it. Without it, today's rules apply
+ unchanged: `s-maxage` alone still means the 5-minute home-box LRU, so
+ apps already using it (§13) see no change.
+ - **Why a marker, not `s-maxage` alone:** apps that send `s-maxage`
+ today rely on the 5-minute ceiling to heal a lost purge. The marker
+ is the app's promise that it clears when content changes.
+- **Lifetime.** `s-maxage`, else `max-age`. It must be positive and is
+ capped at 365 days. `private`, `no-store` and `no-cache` refuse.
+- **Ignorable cookies.** An optional parameter names cookies that don't
+ change this page, such as a consent cookie:
+ `Carlos-Page-Cache: on; ignore-cookies="consent"`.
+ - **Scope:** the list belongs to the stored entry only. It is not a
+ host-wide policy, and no box learns or carries it from one entry to
+ another **(astra R1 builder Q2)**.
+ - **Effect:** it lets a request carrying only those cookies *hit*
+ that entry (§5.1).
+- **Exact syntax.** The plan settles the syntax, with copy review. The
+ two parts, the marker and an ignore list, are fixed.
+
+### 4.2 Lifetimes and browsers
+
+**Guidance to apps (docs):**
+- **Long edge lifetime, short browser lifetime.** Send `s-maxage` long
+ and `max-age=0`. The edge can clear its own copy, but not a copy a
+ browser holds, so a long `max-age` would let a reader's browser show
+ an old homepage after a clear. With `max-age=0` the browser asks the
+ edge each time, and the edge answers from the cache.
+- **Pages that change on a schedule.** A post scheduled for 9:00 goes
+ live with no write at 9:00, so nothing would trigger a clear. Set the
+ lifetime to end at the page's next scheduled change: Patrix's front
+ page, archives and feeds would use the time of the next scheduled
+ post. An exec-backed app can instead schedule a clear through its
+ control socket.
+
+**Conditional requests (my call).** When the stored response has an
+`ETag`, a hit answers a matching `If-None-Match` with 304. With
+`max-age=0`, browsers revalidate on every view, so this saves the body
+on repeat views.
+
+### 4.3 Clearing
+
+- **Targets** keep today's meaning: `*` for the host, a path for every
+ query under it, `path?query` for one URL. `Carlos-Purge-Host` keeps
+ today's rules.
+- **New: an instance-wide clear.** One target clears every host the
+ instance serves: its own host, aliases and custom domains. Today the
+ socket's `*` can't reach aliases (`purge.go:38-41`). The plan names
+ the token and the socket field. A bare word is unambiguous because
+ path targets must start with `/`.
+- **Channels:** the response header, the control socket, and a CLI and
+ console door. The CLI is
+ `carlos pages clear --app shop [--instance …] [--path /p]`, with names
+ to copy review, for operators and agents working from outside the
+ app.
+- **What a clear touches:** on the home it clears the page store and the
+ LRU (as today), then reaches far boxes (§8). A clear that arrives on a
+ response applies before that response is considered for storing, as
+ today.
+
+### 4.4 What the app must still do
+
+The app clears when content changes. The platform can't know that a
+post went up. Background work on a unit-backed instance can't clear,
+because it has no response to ride and no socket. Until unit-backed
+instances get a socket, such writes rely on the lifetime. Documented,
+with Patrix's case as the worked example: publish, edit and comment
+approval all arrive as admin POSTs whose responses can carry the clear.
+
+## 5. What is kept, and when
+
+### 5.1 Which requests may use the page cache
+
+**Host eligibility.** The host must pass the page predicate, which is the
+asset policy's host predicate (`assetPolicy.decide`) with two changes:
+- the page switch replaces the assets opt-out and generation;
+- it adds: the route is not HA and not a forward row.
+
+The home evaluates the predicate:
+- for every home hit;
+- for every fill it acknowledges;
+- for every host it lists in a lease answer.
+
+So a policy change takes effect on the home at once, and on far boxes at
+their next renewal **(astra R1-4)**.
+
+**Request eligibility.** A request may read from the page store only when
+all of these hold:
+- it is GET or HEAD, with no `Range`, not an upgrade, not a door call;
+- it is not a request held for a stream (`carlos_hold`, as the LRU
+ already excludes);
+- it carries no `Authorization` header;
+- it carries no `Cookie` header, or every cookie name in it is on the
+ ignore list of the entry it would hit;
+- the path is canonical (the asset cache's rule; anything else is
+ `bypass`).
+
+A request may be *stored* (or fill) only when it carries no `Cookie` and
+no `Authorization` at all. A request with ignorable cookies can hit an
+entry, but never creates one.
+
+A HEAD is answered from a stored GET and is never stored itself.
+
+### 5.2 Which responses are kept
+
+A response goes into the page store only when all of these hold:
+- the response carries the marker;
+- the status is 200;
+- the request was storable (§5.1);
+- there is no `Set-Cookie`, as a header or as a trailer;
+- the lifetime is valid (§4.1);
+- `Vary` is absent or exactly `Accept-Encoding`;
+- there is no `Content-Range` and no `Cache-Control: no-transform`;
+- the body is at most 8 MiB (my call: above the LRU's 1 MiB, below the
+ asset cache's 32 MiB);
+- the content type is anything, HTML included. The marker is what makes
+ HTML acceptable here, where the asset cache refuses it;
+- the path is not under one of the release's declared asset prefixes.
+ Those paths belong to the asset cache, whose catcher answers them
+ before the page store is reached (`edge.go:2596`). A marker on such a
+ response is ignored, and page clears don't reach asset copies:
+ `carlos assets purge` does. The docs say so **(astra R2-4)**.
+
+Pages are stored the way the asset store stores a fill: identity, plus a
+gzip copy made once when the entry is written, and served by picking the
+stored copy **(astra R2-5)**. The stored headers follow the asset
+cache's list. The `Carlos-*` control headers are never stored or
+replayed.
+
+### 5.3 The two caches never mix (astra R1-3, R2-2; Paul's choice, rule 2)
+
+- **A marked response never enters the LRU**, whether or not the page
+ store kept it, whatever the request carried, and on any instance.
+- **An opted-in instance doesn't use the LRU at all**, for lookups or
+ for stores, on any of its hosts.
+ - **What makes it opted in:** its home holds the durable opt-in mark
+ (§6.2).
+ - **Where it's checked:** in one place, the LRU lookup gate. So
+ entries stored before the mark existed, and stores that finish
+ after it, can never be served while the mark stands. Nothing needs
+ purging, and no in-flight store can race it.
+ - **The cost:** unmarked `s-maxage` pages of an opted-in instance lose
+ the 5-minute cache. The docs tell such apps to mark them.
+- **Instances that never opt in** keep today's LRU rules unchanged.
+
+### 5.4 The key and the entry
+
+- **Key:** account, app, instance, host, path and raw query exactly as
+ sent. No query normalisation in v1.
+- **Each entry also records:**
+ - the home box and its clear epoch for the instance (§8);
+ - the clear sequence the entry is valid at (§6.1);
+ - the absolute expiry;
+ - the ignore list;
+ - the `ETag`, if any.
+
+### 5.5 Where it lives
+
+Pages live in the asset cache's disk store (`internal/assetcache`). They
+use the same budget, and each app's share covers its assets and its
+pages together. Eviction order inside a share is the builder's call. A
+box serves pages only when page caching is armed on it
+(`CARLOS_PAGE_CACHE=1`, which needs the asset store), and only for an
+instance whose page switch is on (§10).
+
+## 6. The page index, and serving on the home box
+
+### 6.1 One index, one rule (astra R1-1, R2-1; Paul's choice, rule 2)
+
+Every box, home or far, keeps its pages behind one **page index**. It is
+the only code that makes a page servable, removes one, or answers a
+lookup. Rounds 1 and 2 each found a path that applied the clear rule in
+one place and not another. The index exists so there is only one place.
+
+**Scopes.** The index holds one scope per (home box, instance). On the
+home, the home box is itself. A scope holds:
+- the epoch and the applied sequence;
+- the clear log (§8.1);
+- the entries;
+- on a far box, the lease.
+
+**One lock per scope.** All five operations below run under it, so they
+are totally ordered within the scope.
+
+- **Publish(entry, epoch, valid-at).** Writing the file (and its gzip
+ copy, `assetcache/fill.go:474`) happens before, outside the lock.
+ Under the lock, the entry is indexed only if all of these hold:
+ - the scope's epoch equals `epoch`;
+ - `valid-at` ≤ the scope's applied sequence;
+ - the scope's clear log covers every sequence in
+ (`valid-at`, applied];
+ - no clear in that range matches the entry's key.
+ Otherwise the file is discarded and nothing is indexed.
+- **Clear(epoch, seq, targets).** Applies only as the next sequence on
+ the scope's epoch. On the home it is always the next one, because
+ the home assigns it. It records the clear in the log, removes the
+ matching entries, and marks matching in-flight renders as fenced.
+- **Reset(new epoch).** Drops every entry, empties the log and sets the
+ new epoch and sequence. This covers a new epoch, a lease answer that
+ says "reset", a switch turned off, and a route that left.
+- **Lookup(request).** Returns an entry only when all of these hold:
+ - the entry's epoch is the scope's epoch;
+ - the host passes the predicate (on the home), or the lease is valid
+ and lists the host (on a far box);
+ - the request may read it under §5.1.
+ Nothing else returns a stored page.
+- **Join(request)** (astra R3-1). A request may join an in-flight render
+ or fill for the same key only when two things hold:
+ - the flight isn't fenced;
+ - on a far box, the scope's lease is valid at the moment of joining,
+ under the same lock.
+
+ A waiter gets a stored page only through Lookup, after the flight's
+ Publish succeeds. Whatever ends a flight without a successful Publish
+ (fenced, refused, a 500, a redirect, no marker) sends every waiter
+ to make its own request: on the home to the app, on a far box as a
+ plain backhaul. Only the request that started the flight keeps the
+ in-flight exception of I1 (§8.4) and gets that flight's own response.
+ No waiter ever receives a response the index didn't admit.
+
+**Where `valid-at` comes from:**
+- **A home render:** the scope's sequence when the render started.
+- **A far fill:** the acknowledgement's validated sequence (§7).
+
+**What the rule gives.** An entry in the index is valid at the scope's
+current sequence: any clear that matched it either removed it under the
+lock, or came before its Publish and refused it.
+
+**Checking it.** The randomized simulation (§12) drives the index
+directly, with the operations interleaved at random. It also checks the
+index's callers: no code path outside the index can make a page
+servable. A guard test fails if a page-store write bypasses Publish.
+
+### 6.2 Serving on the home box
+
+**Where the lookup sits.** At the point where the LRU lookup happens
+today: after the password gate and the plan throttle, before the rate
+limit and the activator. An eligible request is looked up in the page
+index. A hit is served with `Carlos-Cache: hit`. A miss goes to the app
+as today, and a response kept under §5.2 is published with `valid-at` =
+the sequence when the request started.
+
+**The opt-in mark** (astra R2-2 and R2-3):
+- **When it is written:** the first time the home admits a marked
+ response for an instance, it writes a durable opt-in mark for that
+ instance beside the page store. It is fsynced before that response is
+ published.
+- **What it does:**
+ - turns the LRU off for the instance (§5.3);
+ - lets the home advertise page caching for the instance's hosts to
+ far boxes (§7.1).
+- **What clears it:** only the operator's switch turned off, or the
+ instance's route leaving this box. A restart or a new epoch keeps it.
+
+**Single-flight per key** (my call) follows the index's Join (§6.1). A
+render that isn't kept sends its waiters to the app for themselves,
+never an error, an empty body, or the unkept response.
+
+**Losing authority.** When the instance's route leaves this box, or the
+page switch turns off, the box resets the scope **(astra R1-2)**. When
+the route arrives again, a new epoch starts with nothing in it.
+
+## 7. Serving on far boxes
+
+### 7.1 Starting cold (astra R2-3)
+
+A far box learns which hosts to try from the edges file, which the home
+already publishes and every box already polls. No new polling is added.
+- **The flag.** The home adds a `pages` flag to a host's entry when two
+ things hold:
+ - the instance holds the opt-in mark (§6.2);
+ - the host passes the page predicate.
+- **Without the flag,** the far box backhauls as today and sends no
+ lease traffic. Hosts of apps that never opt in cost nothing.
+- **The first lease.** For a flagged host with no scope yet, the far box
+ sends a host-scoped first renewal: the host, the home box it dials, a
+ nonce and a timestamp. The home answers from its own route table,
+ with the same fields as any lease answer (§8.3): the instance, the
+ epoch, the sequence and the eligible hosts. That opens the scope, and
+ later renewals name the instance.
+- **The cold request itself** goes as a plain backhaul, and the first
+ renewal runs in the background (my call), so a cold reader never
+ waits on it. Fills start with the next request.
+- **The flag is a hint, not authority.** Only a lease answer authorizes
+ serving. A flag that is up to 30 s stale costs at most a refused
+ first renewal, or a late start.
+
+### 7.2 Hits and fills
+
+A far box today backhauls every request for a host homed elsewhere. With
+page caching armed on the far box and the request eligible:
+
+1. **A hit.** The far box serves the entry with `Carlos-Cache: hit` when
+ all of these hold:
+ - it has a live entry for the key;
+ - its lease for that home and instance is valid (§8);
+ - the home is still the home map's dial target for the host;
+ - the host is in the lease's host list;
+ - the home map's account and app for the host match the entry's.
+
+ Neither the home nor the app is contacted, except for a background
+ lease renewal (§8.3).
+2. **A fill.** Otherwise, if the request is storable (no cookies, no
+ `Authorization`), the far box sends it to the home as a signed page
+ fill. This is a normal signed hop plus an assertion, modelled on
+ `X-Carlos-Asset-Fill`, in its own MAC domain (`carlos-page-fill-v1`).
+ The assertion binds:
+ - the host, path and query;
+ - the account, app and instance;
+ - the far box's lease epoch;
+ - a nonce.
+
+ The home runs its ordinary pipeline: the predicate, the page store,
+ the throttle, the wake and the app. A request with cookies goes as a
+ plain backhaul.
+3. **The home's acknowledgement.** The home acknowledges only an entry
+ it holds valid under the scope lock (§6.1): a fresh render it just indexed, or
+ a retained entry it still holds. The acknowledgement is signed in its
+ own domain and MACs the assertion, as asset acks do. It carries:
+ - the expiry and the epoch;
+ - the **validated sequence**: the home's sequence when it read the
+ entry under the lock;
+ - the ignore list;
+ - the account, app and instance from the home's own route table, not
+ from the far box's claim.
+4. **What the far box stores (astra R1-5, R2-1).** The far box calls the
+ index's Publish (§6.1) with the acknowledgement's epoch and validated
+ sequence as `valid-at`. The index's one rule decides:
+ - a clear that matches the key and landed in between refuses it;
+ - a different epoch refuses it;
+ - a gap in the log refuses it;
+ - a validated sequence newer than the far box's applied sequence
+ refuses it.
+
+ A refused fill's response goes only to the request that started the
+ fill, and nothing is kept. Its waiters make their own requests
+ (§6.1 Join). When the acknowledgement was newer,
+ the far box also renews in the background. Account, app and instance
+ come from the acknowledgement.
+
+Fill limits (waiters, deadlines, concurrency per box and per instance)
+follow the asset cache's. Fills the home acknowledged are unbilled at the
+home, and the delivering edge meters them, as for assets.
+
+## 8. Clearing across boxes
+
+### 8.1 Epoch and sequence
+
+For each instance it serves as home, a box keeps a clear epoch and a
+clear sequence.
+- **Epoch:** a random 64-bit value, drawn when the box starts serving
+ the instance's route (process start or route arrival).
+- **Sequence:** starts at 0 and goes up by one for every clear of that
+ instance, whatever its target.
+- **Clear log:** a bounded log of recent clears: the sequence, the
+ hosts and the targets. The size is the builder's call. Something like
+ the last 256 clears or 10 minutes, whichever holds less.
+- **Far boxes** keep the same bounded log per (home, instance) for what
+ they've applied (§6.1, §7.2 step 4).
+- **Starting a new epoch:** the box holds no entries for the instance
+ (§6.1 Reset).
+
+### 8.2 Push
+
+After applying a clear locally, the home pushes it to every far box with
+a live or recent lease for the instance, renewed within L plus a small
+margin. The push is modelled on burst notices:
+- `POST /.carlos/page-clear` over `backhaulTransport`;
+- sealed and signed under an HKDF of the mesh key in its own domain;
+- a bounded queue per peer;
+- dropped if not sent within about 2 s. The lease covers a lost push.
+
+The body carries the destination box, the account, app and instance, the
+home box, the epoch, the sequence, and the hosts and targets.
+
+**On the far box:**
+- **Next in order** (the next sequence on the same epoch): apply it.
+- **Already applied:** ignore it. A replay is a no-op.
+- **A gap or a different epoch:** stop serving hits for that home and
+ instance until a lease renewal resolves it.
+
+### 8.3 Leases
+
+A far box may serve a hit for (home, instance) only while it holds a
+lease. A lease is the home's answer to a signed renewal,
+`GET /.carlos/page-lease`, sent on a hop, door-style.
+
+**The answer carries:**
+- the epoch and the sequence;
+- the clears after the far box's sequence, when the log still covers
+ them, or "reset" when it doesn't;
+- the hosts of the instance that pass the page predicate right now. An
+ instance with none is "not allowed".
+
+**How the far box applies it:**
+- a different epoch or "reset" drops every entry it holds for that home
+ and instance;
+- otherwise it applies the missing clears;
+- a host missing from the list drops that host's entries.
+
+**The lease lasts L seconds,** measured on the far box's monotonic clock
+from when it **sent** the renewal, not when the answer arrived. It accepts
+only an answer that matches its one outstanding renewal for that home
+and instance (§8.5).
+- **Default:** L = 5 s (my call). The builder may tune it between 2 and
+ 10, and the plan states the number.
+- **Renewing:** a hit that finds the lease expired waits on a
+ single-flight renewal, with a short timeout of about 1 s. If the
+ renewal fails, the request goes as a plain backhaul and nothing is
+ served from the cache. A hit that finds less than half the lease left
+ renews in the background.
+- **Cost:** about one renewal per far box per instance every L/2 seconds
+ while readers are arriving, and nothing when the box is quiet. All of
+ it is box-to-box, with no S3 requests. The app is never woken for a
+ renewal.
+- **Push targets:** the home records which far boxes renewed recently,
+ in a table bounded by the boxes in the mesh. That record is the push
+ list for §8.2.
+
+### 8.4 The bound
+
+**Invariant I1.** Let a clear be applied at the home at time t. No
+request that arrives at any edge after t + L is answered with a page the
+clear covers. The one exception is the request that started a render or
+fill, which gets that flight's own response (§6.1 Join). A flight
+started after t reaches the home after the clear and so carries
+post-clear content. Only a flight started before t can carry the old
+page, and its starter arrived before t.
+
+**Why it holds:**
+- **On the home:** the clear and every Publish and Lookup share the
+ scope lock (§6.1). Nothing the clear covers is servable there after
+ t.
+- **On a far box, served from a lease:** any renewal sent before t
+ either was answered after t, and so carries the clear, or expires by
+ `sent + L < t + L`. Any renewal sent after t carries the clear. Once a
+ far box has applied a clear, the index guarantees what follows for
+ that box.
+- **On a far box, from fills:** a fill validated before the clear can't
+ be published after it (§6.1).
+- **The push** makes the usual case far faster. The bound doesn't depend
+ on it.
+
+### 8.5 Message rules (astra R1-6)
+
+Every new message inherits the asset fill's and burst notice's
+protections and adds these:
+
+- **Fill acknowledgement:** MACs the whole assertion (including its
+ nonce), as `assetfill.go:120` does, so it authorizes storing exactly
+ the URL the far box asked for.
+- **Lease renewal:** carries the sender box, the home box, the account,
+ app and instance (or only the host, for a first renewal, §7.1), a
+ fresh nonce and a timestamp. The answer is MACed over the request and
+ its nonce.
+ - The far box keeps at most one outstanding renewal per (home,
+ instance), and accepts only the answer to it.
+ - The lease runs from that request's send time. An old answer, or one
+ for another box, is refused.
+- **Clear push:** receiver-bound (it names the destination box), and
+ ordered by (epoch, sequence), which makes replays no-ops.
+- **Receivers:** bound body size, reading time and acceptance rate, as
+ burst notices do.
+- **Home state:** the lease-holder table and the far boxes' clear logs
+ are bounded by mesh membership, the number of instances and the log
+ size.
+- **Numbers:** left to the builder.
+
+### 8.6 A new release
+
+When the instance's build or its delivered configuration changes on the
+home, the home performs an instance-wide clear as part of switching to
+the new route. The plan names the exact signal; the config receipts work
+(#522) may already provide one. A hibernation wake is not a change, and
+must not clear.
+
+## 9. More than one box serving the app
+
+- **Region HA:** out of v1 (§3). The page predicate refuses HA routes,
+ so neither home hits nor leases exist for them.
+- **Moves:** the old home's route leaves, so its epoch ends and its
+ entries go (§6.2). Its lease answers stop listing the hosts, and far
+ boxes drop them. The new home starts a new epoch. A plain backhaul
+ that still reaches the old box finds no entry to serve, because the
+ entries are gone.
+- **Forward rows** (stateless replicas, fleets) are not cached (§3).
+
+## 10. Switches, tenancy and metering
+
+- **Box arming.** `CARLOS_PAGE_CACHE=1` in host.env, armed home first,
+ then far boxes, as for assets. A box that isn't armed treats the
+ marker as absent and strips it (§5.3 still applies: a marked response
+ never enters the LRU).
+- **Instance switch.** An off switch on the instance record, on by
+ default, the asset cache's R1 parity (`carlos pages off|on`, names to
+ copy review). Off means:
+ - the home resets the scope (§6.1) and clears the opt-in mark, so the
+ LRU's ordinary rules return;
+ - the edges-file flag drops;
+ - lease answers list no hosts.
+ It is per instance: other instances of the same app keep theirs. It is
+ the operator's tool when an app caches something it shouldn't.
+- **Tenancy.** Entries are keyed by the account, app and instance from
+ the home's route table. A far hit also needs the home map's current
+ account and app for the host to match. No field the far box asserts
+ is trusted for ownership.
+- **Plan throttle, lapse, password gate.** These are part of the page
+ predicate (§5.1). Home hits come after the gate and the throttle, as
+ LRU hits do today. Far hits pass the far edge's request protection
+ the same way asset hits do; the builder confirms the order.
+- **Metering.** Page bytes count as usage like any response (asset
+ cache ruling R2). The delivering edge meters hits. Whatever the edge
+ records for a request (usage, analytics, logs), it records for a page
+ hit too. Page views matter more to apps than asset views, so the
+ builder checks that edge analytics count hits.
+- **Visibility.** `Carlos-Cache: hit|miss|bypass` on every eligible
+ response, using the asset cache's header and words. A
+ `carlos pages status --app` shows, per instance:
+ - armed or not;
+ - the switch;
+ - the entry count and bytes;
+ - the epoch and sequence.
+ Its contents are the builder's call, and its copy goes to review.
+
+## 11. Slices
+
+Each slice changes something Paul can see (stopping rule 6).
+
+1. **Home box.**
+ - **Built:** the marker, the page predicate, the page index (§6.1)
+ with its simulation, the opt-in mark, the epoch and sequence, the
+ instance-wide clear, clear on a new release, the instance switch,
+ the §5.3 rules and `Carlos-Cache` on pages.
+ - **Rollout:** armed on dev.
+ - **Patrix:** sends the header (in its own repo), and repeat views
+ are served without waking it.
+2. **Far boxes.**
+ - **Built:** the edges-file flag and first renewal, page fills,
+ leases, push and catch-up, the message rules, and the simulation
+ extended to far boxes (§12).
+ - **Rollout:** armed on dev far boxes.
+ - **Check:** a reader through a far box gets hits, and a clear lands
+ there within L.
+3. **Operator surface.**
+ - **Built:** the CLI and console clear, status, and the docs page.
+ - **Rollout:** flagship arming, in the asset cache's order.
+
+## 12. How we know it works
+
+- **A randomized simulation** of homes, far boxes, clears, renders,
+ fills, renewals and pushes, built on the real page index (§6.1), not
+ a model of it. It runs with:
+ - lost, delayed, duplicated and reordered pushes;
+ - renders and fills that straddle clears, with Publish delayed after
+ the file is written;
+ - round 3's timeline: an acknowledgement just before the clear, a slow
+ body, the lease expiring, a late request joining, and the push
+ arriving after t + L;
+ - box restarts and moves;
+ - switch and predicate flips, and the opt-in mark appearing mid-run;
+ - clock skew between boxes.
+
+ It checks:
+ - **I1:** no request arriving after t + L gets a page the clear
+ covers;
+ - **I2:** for an opted-in instance, nothing stored from a request that
+ carried a cookie or an `Authorization` header is ever served, by
+ either cache, including LRU entries stored before the mark;
+ - **I3:** a hit is never served under a different account, app,
+ instance or host than the home stored it for, nor for a host the
+ predicate refuses at the last renewal.
+ This follows the rule to check invariants with simulations rather than
+ fix examples one at a time.
+- **An end-to-end test through the real edge wiring:**
+ - fill, hit, clear and miss on home and far;
+ - a render that straddles a clear is never indexed;
+ - HEAD from a stored GET;
+ - a 500 never stored;
+ - a cookie-bearing request never served from or stored into either
+ cache;
+ - enabling a password gate stops far hits by the next renewal;
+ - a clear on the response that carried it;
+ - a new release clearing.
+- **Fences** (each watched failing under its own mutation):
+ - a page without the marker still goes to the LRU with the 5-minute
+ ceiling;
+ - a marked response never enters the LRU;
+ - an opted-in instance's host never reaches the LRU lookup;
+ - a page-store write that bypasses the index's Publish is caught;
+ - a path under a declared asset prefix is never page-cached;
+ - the marker and the internal headers never reach a visitor;
+ - a far box with an expired lease forwards;
+ - an HA route is never page-cached.
+
+## 13. Reference: what an existing app learned
+
+An events app on the platform already caches its public pages with
+today's machinery. It sends `s-maxage=120`, and every write purges just
+the pages it changed:
+- through the control socket on exec instances;
+- through `Carlos-Purge` and `Carlos-Purge-Host` on unit instances,
+ where admin and webhook writes arrive on a different host from the
+ pages they change.
+
+It also keeps a 15-second in-process page cache. Lessons this design
+takes:
+
+- **Per-page clears matter.** That app clears a single event page or
+ its availability fragment far more often than whole hosts. Hence G3.
+- **Visitor-shaped requests.** Language and currency cookies, query
+ parameters and sessions must bypass. It enforces this with a test
+ that every cookie the app reads bypasses its cache. Hence §5.1's
+ default that any cookie bypasses unless declared ignorable.
+- **Writes with no response to ride** are bounded only by the lifetime.
+ Hence §4.4, and the socket as a follow-up for unit instances.
+- **Pages that change on a schedule** expire at the next scheduled
+ change. Hence §4.2.
+- **Racing stores** use per-scope clear sequences to refuse stores that
+ started before a clear. Hence §6.
+- **HEAD and failed renders:** a HEAD is never stored, and a failed
+ render never hands its waiters an error. Hence §6.
+
+That app could adopt this feature by adding the marker and keeping its
+existing purge calls.
+
+## 14. Calls made in this draft
+
+These are mine, not Paul's. They are listed so they can be checked.
+
+- An explicit marker header rather than reading `s-maxage` alone (§4.1).
+- **Cookies:** any cookie bypasses unless the entry declares it
+ ignorable. The list belongs to each entry, and only cookieless
+ requests create entries (§4.1, §5.1).
+- **Responses:** 200 only; `Vary` only `Accept-Encoding`; an 8 MiB body
+ cap (§5.2).
+- **The opt-in mark:** written by the home on the first marked response,
+ so opting in needs nothing beyond the header (§6.2).
+- **Cold far boxes:** they learn which hosts to try from a flag in the
+ edges file, and the first request goes as a plain backhaul (§7.1).
+- **Asset paths:** declared asset prefixes win over the marker (§5.2).
+- **Storage:** pages share the asset store and each app's share (§5.5).
+- **Leases:** L = 5 s, measured from send, is what guarantees the bound;
+ the push only makes the usual case fast. The far box fails closed
+ when the home is unreachable (§8).
+- **Clear state:** a per-home, per-instance epoch and sequence with a
+ bounded log, not a generation in the record. The record route takes a
+ 30 s poll, too slow for G4 (§8.1).
+- **Releases:** a new release clears the instance's pages; a wake does
+ not (§8.6).
+- **Region HA routes** are refused in v1 (§3, §9).
+- **Also out of v1:** forward rows, other variants, non-200 statuses,
+ and a socket for unit instances (§3).
+- **Conditional requests:** an `If-None-Match` hit answers 304 (§4.2).
+
+## 15. Left to the builder
+
+- Exact header, token, socket-field and CLI names, through copy review.
+- The clear log's size, the push margin, the message limits, and L
+ within 2-10 s.
+- Eviction order between pages and assets inside an app's share.
+- How the console reaches the home box for a CLI clear: a door call is
+ preferred. Whatever the route, the clear must reach the box within
+ seconds.
+- The signal for "new release" (§8.6).
+- The contents of `carlos pages status`.
+
+## 16. Review history
+
+**Round 1** (Astra, `CODEX-FINDINGS-PAGE-CACHE-R1.md`, rev 1 at 82e62c09).
+NOT READY: four P1s and two P2s, each in a different fault family. All
+were accepted:
+
+| Finding | Fault family | Resolution |
+|---|---|---|
+| **R1-1 (P1)** | I1, a clear must fence pending publications | §6: clears and publications share a per-instance lock, and joining a render after a clear is refused |
+| **R1-2 (P1)** | I1, cached responses must not bypass ownership | §3, §9: HA routes refused in v1. §6: a home that loses the route or the switch ends the epoch |
+| **R1-3 (P1)** | I2, no second shared-cache path | §5.3: marked responses never enter the LRU, and opted-in instances' LRU skips cookie and `Authorization` requests |
+| **R1-4 (P1)** | Access control on far hits | §5.1: one page predicate built on the asset policy's, checked for home hits, acknowledgements and every lease answer |
+| **R1-5 (P2)** | Refilling unaffected entries | §7 step 4: the validated sequence, plus the far box's own clear log |
+| **R1-6 (P2)** | Mesh trust | §8.5 |
+
+**Builder questions:**
+- **Q1 (HA while sleeping):** settled by refusing HA routes in v1.
+- **Q2 (cookie list scope):** settled as per entry, with no learning.
+- **Q3 (switch scope):** settled as per instance throughout.
+
+**Round 2** (Astra, `CODEX-FINDINGS-PAGE-CACHE-R2.md`, rev 2 at
+5421a0f0). NOT READY.
+- **Resolved:** R1-2, R1-4, R1-5 and R1-6.
+- **Partly resolved:** R1-1, the far-box publication fence, came back as
+ R2-1. R1-3, LRU entries stored before the switch, came back as R2-2.
+
+Both families recurred two rounds running, which triggers stopping rule
+2. Paul chose, 2026-11-08:
+
+| Finding | Fault family | Paul's choice and resolution |
+|---|---|---|
+| **R2-1 (P1)** | I1, a clear must fence pending publications | "One rule, one place": the page index (§6.1) is the only code that publishes, clears, resets or looks up, on home and far alike, and the simulation drives it directly |
+| **R2-2 (P1)** | I2, no second shared-cache path | "Opted-in skips old cache": an opted-in instance never uses the LRU, checked once at the lookup gate (§5.3, §6.2) |
+| **R2-3 (P2)** | Protocol completeness | The edges-file `pages` flag and the host-scoped first renewal (§7.1) |
+| **R2-4 (P2)** | Cache ownership | Declared asset prefixes win (§5.2) |
+| **R2-5 (P3)** | Implementation accuracy | Corrected: the gzip copy is made at write time (§5.2) |
+
+Round 3 is the last in the budget. A fourth needs Paul's go.
+
+**Round 3** (Astra, `CODEX-FINDINGS-PAGE-CACHE-R3.md`, rev 3 at
+4e634b3b). NOT READY, with one P1.
+- **Resolved:** R2-2, R2-3, R2-4 and R2-5.
+- **Partly resolved:** R2-1.
+- **R3-1 (P1), same family (I1):** §6.1's Join handed a fenced flight's
+ response to its waiters, and on a far box let a request join without a
+ valid lease. That contradicted §6.2.
+- **Resolution in rev 4:**
+ - a far box joins only under a valid lease;
+ - waiters get pages only through Lookup after a successful Publish;
+ - only the request that started a flight keeps its response;
+ - I1's exception is restated to match;
+ - the timeline is added to the simulation.
+
+The review budget is spent. Rev 4 has not been reviewed.
diff --git a/docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R1.md b/docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R1.md
new file mode 100644
index 000000000..4d6f26d3d
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R1.md
@@ -0,0 +1,73 @@
+Reviewed commit `82e62c099a7715f76bd4e8bd24cb62eda717307f`, round 1 of 3, against the merged authorities. No files changed, subagents spawned, or tests run.
+
+1. **P1 — §6: the clear fence ends before publication.**
+
+ **Problem and evidence:** The design checks whether a clear happened before the response arrived, then permits storage ([design:274](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:274)). Arrival and publication are separate: the existing disk store compresses, syncs and renames files before indexing the entry ([fill.go:474](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/assetcache/fill.go:474)). The existing purge code explicitly documents this resurrection race ([purge_header.go:266](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/purge_header.go:266)).
+
+ **Failure scenario:** A response arrives at sequence 0 and passes the check. A clear increments the sequence to 1 and removes existing entries. The pending response then commits. Its epoch still matches, so §6 permits subsequent home hits, potentially for a year.
+
+ **Fix:** Make publication conditional on the captured epoch and sequence still being current, atomically with respect to clearing. Include single-flight waiter delivery in the same validity rules. Checking immediately before an independently synchronized `Commit` is insufficient.
+
+ **Fault family:** I1 — a clear must fence pending publications.
+
+2. **P1 — §§2, 6, 8.3 and 9: an old HA holder can answer the fallback from its cache.**
+
+ **Problem and evidence:** The design assumes non-holders forward before caching, but verified hops and door calls explicitly bypass `frontForwardHA` ([forwardha.go:175](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/forwardha.go:175)). The proposed home-hit predicate checks expiry and epoch, without checking current serving authority ([design:270](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:270)). Starting a new epoch is specified on acquisition, not on losing authority.
+
+ **Failure scenario:** A retains a page after B becomes holder. B clears the page. A far edge still routes to A; its page lease expires or is refused, so §8.3 sends a plain backhaul. That verified hop bypasses HA forwarding at A and reaches A’s page hit before the activator. A returns the old page after B’s clear plus L.
+
+ **Fix:** Require current serving authority for every home hit, fill acknowledgement and lease grant, including ordinary backhaul and door paths. Retire the old authority’s cache eligibility when ownership ends. Specify how this works while the app sleeps, without introducing bucket polling.
+
+ **Fault family:** I1 — cached responses must not bypass ownership fencing.
+
+3. **P1 — §§4.1, 5.1 and 6: the privacy guarantee does not close the LRU path.**
+
+ **Problem and evidence:** The design promises cookie/authorization bypass while retaining today’s unmarked-response behaviour and putting page lookup before the LRU ([design:138](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:138), [design:205](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:205)). Today’s LRU lookup checks neither credential type ([edge.go:2673](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/edge.go:2673)); storage ignores request cookies and allows authorization when the response says `public` ([edge.go:2914](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/edge.go:2914)).
+
+ **Failure scenario:** A cookie-bearing request bypasses the page store and follows the existing pipeline. Its personalized 200, with positive shared lifetime and no `Set-Cookie` or `Vary: Cookie`, enters the LRU. A later anonymous page-store miss receives that response. A marked response rejected by page admission also needs an explicit prohibition against falling into this path.
+
+ **Fix:** Define bypass across both caches for the protected request classes. Explicitly prohibit marked responses from falling back to LRU storage, including when page admission fails. Resolve the compatibility promise for unmarked responses and existing LRU entries.
+
+ **Fault family:** I2 — page-cache rejection must not expose a second shared-cache path.
+
+4. **P1 — §§5.1, 7 and 8.3: leases can keep a password-protected page publicly readable.**
+
+ **Problem and evidence:** Page eligibility excludes `ImportGate`, but not `Route.Gate`. Lease permission checks list the instance switch, lapse, throttle and whether the home serves the app ([design:210](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:210), [design:363](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:363)). The existing asset policy explicitly refuses password gates and hosts with path-routing rows ([assetpolicy.go:299](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/host/assetpolicy.go:299)). Ordinary requests enforce the password gate before cache lookup ([edge.go:2499](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/edge.go:2499)).
+
+ **Failure scenario:** A public page warms a far cache. The operator enables its password gate. Ownership and home remain unchanged, and the listed lease checks still allow serving. Anonymous far hits continue bypassing the gate, even through renewed leases.
+
+ **Fix:** Derive lease host eligibility from an explicit route-policy predicate. For v1, refuse password-gated hosts and path-routed hosts unless their protection can be represented safely. Policy changes must revoke eligibility for retained entries as well as prevent new fills.
+
+ **Fault family:** Access control — far hits must enforce the protections of the resolved route.
+
+5. **P2 — §7 steps 3–4: an unrelated clear prevents refilling an unchanged page.**
+
+ **Problem and evidence:** The acknowledgement carries the sequence **at render**, and far storage requires equality with the lease’s **current** sequence ([design:299](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:299)). Every clear increments that app-wide sequence, regardless of target ([design:323](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:323)).
+
+ **Failure scenario:** `/about` is cached at sequence 0. Clearing `/news` advances the app to 1 but correctly retains `/about`. A new far reader fills `/about` from the home’s retained entry. Its acknowledgement says 0, its lease says 1, and it cannot store the page. Repeated requests keep backhauling until that otherwise-valid home entry expires or is removed.
+
+ **Fix:** Distinguish render sequence from a sequence through which the home has validated the entry. A retained entry may be acknowledged against the current clear state only after an atomic validity check. Preserve its original expiry.
+
+ **Fault family:** Clear sequencing — selective invalidation must preserve refillability of unaffected entries.
+
+6. **P2 — §§7–8: the control-message authentication and replay contract is incomplete.**
+
+ **Problem and evidence:** The fill acknowledgement’s listed claims omit binding to its initiating assertion; lease request/response bindings and replay rules are unspecified ([design:293](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:293), [design:359](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:359)). Existing asset acknowledgements explicitly MAC the originating assertion ([assetfill.go:120](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/assetfill.go:120)). Burst notices additionally enforce bounded reads, receiver-bound authentication, replay rejection and acceptance limits ([burst_notice.go:503](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/burst_notice.go:503)). Ordinary hop authentication binds only host and timestamp.
+
+ **Failure scenario:** An implementation following only the listed acknowledgement fields cannot cryptographically distinguish acknowledgements for different URLs with otherwise matching claims. Likewise, accepting an old lease answer against a new renewal’s send time would invalidate the freshness proof. A bounded sender queue does not bound receiver work or subscription state.
+
+ **Fix:** Specify request-bound acknowledgements and lease answers, authenticated scope and peer identity, duplicate/out-of-order handling, receiver size/time limits, and bounded subscription state. Define inherited asset/burst protections explicitly; leave numerical tuning to the builder.
+
+ **Fault family:** Mesh trust — authenticated messages must authorize one bounded, correctly scoped operation.
+
+No P3 findings.
+
+**Builder questions, ranked**
+
+1. **HA authority while sleeping:** Who may grant page leases after hibernation releases the serving lease? The current stop path releases it ([activator.go:5253](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/activator/activator.go:5253)). This needs a defined answer that preserves both no-wake caching and the ownership fence.
+
+2. **Cookie-policy scope and lifetime:** Is `ignore-cookies` one host-wide policy or a property of each cached representation? Entries record individual lists, while far boxes learn one list per host. What resolves conflicting declarations, and what invalidates learned lists on clears, releases, owner changes and epoch changes? A stale or broader list must not authorize a different entry.
+
+3. **Instance switches versus app-wide leases:** If two instances of one app share a home and only one has page caching disabled, which hosts remain allowed? The record switch is per instance, but the lease has one app-wide permission and §10 describes dropping the app’s entries. Define whether permission is per host/instance or disabling one deliberately disables all.
+
+**NOT READY**
\ No newline at end of file
diff --git a/docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R2.md b/docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R2.md
new file mode 100644
index 000000000..7563b6de0
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R2.md
@@ -0,0 +1,65 @@
+- **R1-1 — partly resolved, remains P1.** Home publication is fenced; far publication is not.
+- **R1-2 — resolved.** Refusing HA routes removes the reported holder-change failure; route departure ends the home epoch.
+- **R1-3 — partly resolved, remains P1.** New admissions are protected, but existing LRU entries survive enabling the switch.
+- **R1-4 — resolved.** The shared host predicate now governs home hits, acknowledgements and lease host lists.
+- **R1-5 — resolved.** A retained entry can be acknowledged at its validated sequence.
+- **R1-6 — resolved.** Request-bound signatures, renewal nonces, receiver limits and bounded state address the reported omissions.
+
+Reviewed `5421a0f0a605303a15460a973815547510a39740`, round 2 of 3, against the merged authorities. No files changed, subagents spawned or tests run.
+
+1. **P1 — §§7–8: a far fill can resurrect a cleared entry.**
+
+ **Problem and evidence:** The atomic clear/publication rule is specified for the home in [design:345](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:345). Far admission instead checks `a` against `f` and then permits storage, without requiring that check and publication to be atomic with pushes and renewals ([design:412](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:412)). The reused store performs file work before publishing its index entry ([fill.go:474](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/assetcache/fill.go:474), [fill.go:563](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/assetcache/fill.go:563)).
+
+ **Failure scenario:** A far fill passes `a == f == 0`. Before publication, clear 1 removes `/post` and advances the far box to sequence 1. The pending fill then publishes the old `/post`. Subsequent renewals report sequence 1 with no missing clears, so they do not remove it. New readers can receive it after `t + L`, potentially until its year-long expiry.
+
+ **Concrete fix:** Apply one atomic transition rule on each far box to fill publication, clear application and lease resets. Under that lock, recheck epoch and complete clear-history coverage through the current sequence before indexing. Reject a fill when the required history has been discarded. Waiters must obtain entries through the same current-validity checks.
+
+ **Fault family:** **I1 — a clear must fence pending publications.** Carry-forward of R1-1.
+
+2. **P1 — §§5.3 and 10: enabling page caching leaves personalised LRU entries readable.**
+
+ **Problem and evidence:** The new LRU rule checks credentials on the *current request* ([design:308](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:308)). Switch handling only specifies retiring page entries ([design:569](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:569)). Existing LRU entries contain no credential provenance ([cache.go:44](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/cache.go:44)); admission ignores request cookies ([edge.go:2914](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/edge.go:2914)), and a no-`Vary` entry matches an anonymous request ([cache.go:129](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/cache.go:129)).
+
+ **Failure scenario:** With the page switch off, a cookie-bearing request stores a personalised, unmarked response in the LRU. The operator turns page caching on. An anonymous page-store miss passes the new credential check and receives that retained response. A pre-enable request completing after an enable-time purge can recreate the problem.
+
+ **Concrete fix:** Make enabling the switch an admission boundary for the LRU too. Invalidate all existing entries for the instance’s served hosts and fence admissions begun under the previous policy. Alternatively, tag entries and pending admissions with a policy generation and require a current, credential-safe generation at lookup.
+
+ **Fault family:** **I2 — page-cache rejection must not expose a second shared-cache path.** Carry-forward of R1-3.
+
+3. **P2 — §§7–8: the first fill and lease have no defined bootstrap.**
+
+ **Problem and evidence:** A fill must assert the instance and the far box’s lease epoch ([design:393](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:393)); a renewal must already name the instance ([design:528](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:528)). The design does not explain how a cold far box obtains those values. Today’s `AssetsFor` supplies its primary only through an asset block and refuses hosts without declared asset paths ([homemap.go:1190](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/homemap.go:1190)).
+
+ **Failure scenario:** A blog declares no asset prefixes. A cold far box knows its host’s home, account and app, but cannot construct the required instance-bound renewal or epoch-bound fill. Reusing asset discovery would prevent the promised header-only adoption.
+
+ **Concrete fix:** Define a cold-start exchange: for example, an authenticated host-scoped discovery/initial renewal whose answer supplies the authoritative instance, epoch and eligible hosts. Alternatively, publish the necessary instance identity through the existing edges-file channel. Specify the initial fill’s epoch semantics.
+
+ **Fault family:** **Protocol completeness — cold readers must establish authoritative cache scope without an asset declaration or additional bucket polling.**
+
+4. **P2 — §§3, 5.2 and 6: page-marker precedence over the asset catcher is unresolved.**
+
+ **Problem and evidence:** The design permits non-HTML page responses and places page lookup at the LRU position ([design:293](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:293), [design:335](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:335)). The asset catcher already handles declared paths and returns before that point ([edge.go:2596](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/edge.go:2596)). Meanwhile, §3 says the asset cache keeps its rules, and clears touch the page store and LRU ([design:233](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:233)).
+
+ **Failure scenario:** A marked JSON feed falls under a declared asset prefix. The existing asset path handles it before page admission. Treating the marker as effective would promise page clears that cannot invalidate the asset copy; treating it as ineffective contradicts the unrestricted marker contract.
+
+ **Concrete fix:** State which declaration wins. If asset paths are excluded, explicitly scope page eligibility and document the refusal. If the page marker wins, specify admission and lookup changes on both home and far asset paths, including treatment of existing asset entries.
+
+ **Fault family:** **Cache ownership — an opted-in representation needs one unambiguous invalidation contract.**
+
+5. **P3 — §§2 and 5.2: assets are compressed at fill time, not serve time.**
+
+ **Evidence and consequence:** [Design:296](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:296) says pages are compressed at serve time “as assets are.” Existing fills create the gzip copy during commit ([fill.go:432](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/assetcache/fill.go:432)); serving selects that stored copy ([assetserve.go:37](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/assetserve.go:37)). Following the description would introduce a different CPU/storage tradeoff.
+
+ **Concrete fix:** Correct the description and state whether pages reuse stored gzip copies or deliberately compress per delivery.
+
+ **Fault family:** Implementation accuracy.
+
+**Builder questions, ranked**
+
+1. How does a cold far box discover the authoritative instance and establish its first epoch when the app declares no assets? This determines the initial wire exchange.
+2. Does a page marker override an asset-prefix declaration, or are those paths excluded? This determines cache precedence and the scope of clearing.
+
+R1-1 and R1-3 recur in the same fault families across two rounds, so stopping rule 2 applies. Before another fix cycle, choose refusal of the problematic cases, removal of the offending paths, or central enforcement of each invariant with guard tests/simulation. I recommend central enforcement.
+
+**NOT READY**
\ No newline at end of file
diff --git a/docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R3.md b/docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R3.md
new file mode 100644
index 000000000..a6139a339
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R3.md
@@ -0,0 +1,28 @@
+- **R2-1 — partly resolved, remains P1.** Publication is fenced on both home and far boxes; waiter delivery still permits the failure below.
+- **R2-2 — resolved.** The durable opt-in mark disables LRU lookup, including entries stored before opt-in.
+- **R2-3 — resolved.** The edges-file flag and host-scoped first renewal provide bootstrap without asset declarations.
+- **R2-4 — resolved.** Declared asset prefixes explicitly take precedence.
+
+Reviewed commit `4e634b3b1ac8bfe79b1013a69639db823c099402` on `design-edge-page-cache` against the merged authorities. No files changed, subagents spawned or tests run. R2-5’s compression correction is also resolved.
+
+1. **P1 — §§6.1, 6.2, 7.2 and 8.3–8.4: far waiters can receive a cleared response after the lease expires.**
+
+ **Problem and evidence:** The index’s `Lookup` checks lease validity, but `Join` checks only whether the flight is fenced. It explicitly gives a fenced flight’s response to existing waiters ([design:381](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:381)). Expired-lease renewal is specified for hits, leaving a miss joining an unfinished fill without that gate ([design:577](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:577)).
+
+ **Failure scenario:** With `L = 5 s`, a far fill obtains an acknowledgement for `/post` just before the home clears it at `t = 0`; its body is delayed. The far lease expires before `t = 5`. At `t = 6`, another request misses and joins the unfinished, unfenced fill. The delayed clear reaches the far box at `t = 7`, fencing that fill. At `t = 8`, publication correctly fails, but §6.1 delivers the old response to existing waiters—including the request arriving after `t + L`. These timings fit the inherited 10-second waiter timeout and 60-second fill deadline ([assetcatch.go:39](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/assetcatch.go:39), [assetcatch.go:193](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/assetcatch.go:193)).
+
+ §6.2 instead requires fenced waiters to make their own requests ([design:426](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:426)). That contradicts the central index contract; it does not establish one safe rule for the builder.
+
+ **Concrete fix:** Keep waiter delivery inside the index’s validity checks. Require a current lease before joining an existing far flight, and deliver shared results only through `Lookup`. A refused or fenced fill sends waiters through their own requests; only its original requester may retain the in-flight response exception. Reconcile §§6.1, 6.2 and 7.2 accordingly, and add the timeline above to the simulation. Existing asset coalescing already shares only admitted entries ([assetcatch.go:85](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/assetcatch.go:85)).
+
+ **Fault family:** **I1 — clears must fence pending publications and shared delivery.** The publication fix works, but the explicit waiter exception bypasses it.
+
+No additional P2 or P3 findings.
+
+**Builder questions, ranked**
+
+1. Which fenced-waiter contract governs: §6.1’s shared response or §6.2’s independent retry? Use independent retry consistently on home and far boxes, with lease validation covering joins and waiter delivery.
+
+Round 3 exhausts the review budget; another round requires Paul’s approval.
+
+**NOT READY**
\ No newline at end of file
diff --git a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PAGE-CACHE-R2.md b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PAGE-CACHE-R2.md
new file mode 100644
index 000000000..9aa5b8ced
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PAGE-CACHE-R2.md
@@ -0,0 +1,105 @@
+# Review brief: edge page cache spec, round 2 of 3
+
+Repo carlos/platform, branch `design-edge-page-cache`, the commit named in
+your prompt.
+Under review: `docs/superpowers/specs/2026-11-08-edge-page-cache-design.md`.
+Authorities (merged on main): `docs/superpowers/specs/2026-10-24-edge-asset-cache-design.md`,
+`docs/superpowers/specs/2026-11-01-stateless-replicas-design.md`, the code
+under `internal/edge/` (cache.go, purge.go, purge_header.go, asset*.go,
+burst_notice.go, mesh.go, homemap.go, forwardha.go), `internal/assetcache/`,
+`internal/host/assetpolicy.go`. Do not review against unmerged branches; if
+this work needs one, say so as a P1 and stop.
+
+You are an independent reviewer and also the person who will plan the
+build from this document without being able to ask its author anything.
+Read the document, then the code it names, and check every claim against
+that code.
+
+## Fixed: do not re-argue
+
+Paul's requirements, recorded in spec §1:
+- an app opts in with a response header and a page stays until the app
+ clears it;
+- clearing one page or all pages, from inside the app or by an agent;
+- no stale content left hanging around;
+- a clear reaches far readers in low seconds.
+
+Also fixed: no new per-box polling of the S3 bucket (S3 request cost
+rulings), and page bytes count as usage (asset cache ruling R2). Report
+only mechanisms that fail to honour these. The calls listed in spec §14
+are the author's, not Paul's, and are open to challenge.
+
+## What to check
+
+1. **Invariant I1 (§8.4).** Can a far box, or the home, serve a page
+ covered by a clear more than L after the home applied it? Try lost,
+ delayed and reordered pushes, renewals racing clears, home restarts,
+ HA holder changes, moves, clock skew, and a fill that races a clear
+ (§6, §7 step 4).
+2. **Personalised pages (I2).** Can a response drawn for a signed-in or
+ cookie-carrying request be stored or served to someone else? Check
+ the ignore-list learning on far boxes (§7 step 5), HEAD, and the
+ interaction with today's LRU, which doesn't check request cookies.
+3. **Tenancy (I3).** Can an entry be served under the wrong account, app
+ or host? Check the fill acknowledgement, the lease's host set, and the
+ home-map checks against how `farAssetCatch` and `AssetsFor` work
+ today.
+4. **Trust.** Are the new push, lease and fill messages bounded and
+ unforgeable at least to the standard of asset fills and burst notices?
+ Can any of them be replayed for a wrong effect?
+5. **Fit with the code.** Is the claimed position of the page-store
+ lookup (after the plan throttle, before the rate limit and activator)
+ right, and does the far branch have a place to look up before
+ backhaul? Does anything in §2 misstate the code?
+6. **Builder check.** As the planner: list the questions you would still
+ need answered before planning well, where a wrong guess would matter.
+ Rank them. Skip anything §15 leaves to the builder or that you could
+ reasonably decide yourself.
+
+## Round 2
+
+Earlier rounds: `CODEX-FINDINGS-PAGE-CACHE-R1.md` (round 1, rev 1). The
+round number counts every earlier review of this design or change, under
+any file name or reviewer.
+
+First give one line per P1 and P2 from round 1: resolved, partly, or
+not. Spec §16 says how the author resolved each. Carry every unresolved
+or partly resolved finding forward at its current severity, then add new
+findings. The verdict covers everything outstanding, earlier rounds
+included. Refusing region HA routes in v1 (§3) is the author's cut for
+R1-2. Challenge it only if it does not remove the failure.
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work.
+ Blocks merge.
+- **P2**: wrong or missing. Fixed without reopening this review. (The
+ census, and review of any newly changed security, root, termination
+ or production-storage behaviour, still check the fix; see AGENTS.md,
+ "Stopping rules".)
+- **P3**: clarity or polish. Goes on a follow-up list; never a reason for
+ another round.
+
+A P1 states its failure scenario and the evidence (file:line). Do not
+raise a P2 to P1 to keep the review open.
+
+## Output
+
+Findings ranked P1, P2, P3. Each gives:
+- the section;
+- the problem;
+- the evidence (file:line, verified);
+- the failure scenario;
+- a concrete fix;
+- the invariant or trust boundary it breaks. That is its fault family.
+
+Then the builder questions (item 6), as a separate ranked list. End with
+exactly one verdict:
+
+- **READY**: no P1 and no P2.
+- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another
+ round.
+- **NOT READY**: one or more P1s, listed.
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of
+your own. Do not run the full test suites.
diff --git a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PAGE-CACHE-R3.md b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PAGE-CACHE-R3.md
new file mode 100644
index 000000000..1b0664435
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PAGE-CACHE-R3.md
@@ -0,0 +1,116 @@
+# Review brief: edge page cache spec, round 3 of 3
+
+Repo carlos/platform, branch `design-edge-page-cache`, the commit named in
+your prompt.
+Under review: `docs/superpowers/specs/2026-11-08-edge-page-cache-design.md`.
+Authorities (merged on main): `docs/superpowers/specs/2026-10-24-edge-asset-cache-design.md`,
+`docs/superpowers/specs/2026-11-01-stateless-replicas-design.md`, the code
+under `internal/edge/` (cache.go, purge.go, purge_header.go, asset*.go,
+burst_notice.go, mesh.go, homemap.go, forwardha.go), `internal/assetcache/`,
+`internal/host/assetpolicy.go`. Do not review against unmerged branches; if
+this work needs one, say so as a P1 and stop.
+
+You are an independent reviewer and also the person who will plan the
+build from this document without being able to ask its author anything.
+Read the document, then the code it names, and check every claim against
+that code.
+
+## Fixed: do not re-argue
+
+Paul's requirements, recorded in spec §1:
+- an app opts in with a response header and a page stays until the app
+ clears it;
+- clearing one page or all pages, from inside the app or by an agent;
+- no stale content left hanging around;
+- a clear reaches far readers in low seconds.
+
+Also fixed: no new per-box polling of the S3 bucket (S3 request cost
+rulings), and page bytes count as usage (asset cache ruling R2). Report
+only mechanisms that fail to honour these. The calls listed in spec §14
+are the author's, not Paul's, and are open to challenge.
+
+## What to check
+
+1. **Invariant I1 (§8.4).** Can a far box, or the home, serve a page
+ covered by a clear more than L after the home applied it? Try lost,
+ delayed and reordered pushes, renewals racing clears, home restarts,
+ HA holder changes, moves, clock skew, and a fill that races a clear
+ (§6, §7 step 4).
+2. **Personalised pages (I2).** Can a response drawn for a signed-in or
+ cookie-carrying request be stored or served to someone else? Check
+ the ignore-list learning on far boxes (§7 step 5), HEAD, and the
+ interaction with today's LRU, which doesn't check request cookies.
+3. **Tenancy (I3).** Can an entry be served under the wrong account, app
+ or host? Check the fill acknowledgement, the lease's host set, and the
+ home-map checks against how `farAssetCatch` and `AssetsFor` work
+ today.
+4. **Trust.** Are the new push, lease and fill messages bounded and
+ unforgeable at least to the standard of asset fills and burst notices?
+ Can any of them be replayed for a wrong effect?
+5. **Fit with the code.** Is the claimed position of the page-store
+ lookup (after the plan throttle, before the rate limit and activator)
+ right, and does the far branch have a place to look up before
+ backhaul? Does anything in §2 misstate the code?
+6. **Builder check.** As the planner: list the questions you would still
+ need answered before planning well, where a wrong guess would matter.
+ Rank them. Skip anything §15 leaves to the builder or that you could
+ reasonably decide yourself.
+
+## Round 3
+
+Earlier rounds: `CODEX-FINDINGS-PAGE-CACHE-R1.md` (round 1, rev 1) and
+`CODEX-FINDINGS-PAGE-CACHE-R2.md` (round 2, rev 2). The round number
+counts every earlier review of this design or change, under any file
+name or reviewer. This is the last round in the budget.
+
+First give one line per P1 and P2 from round 2: resolved, partly, or
+not. Spec §16 says how the author resolved each. Carry every unresolved
+or partly resolved finding forward at its current severity, then add new
+findings. The verdict covers everything outstanding, earlier rounds
+included.
+
+Stopping rule 2 fired after round 2. Paul chose the fixes (spec §16).
+These are fixed; do not re-argue them, and report only a mechanism that
+fails to deliver them:
+- R2-1: one page index per box is the only code that publishes, clears,
+ resets or looks up (§6.1);
+- R2-2: an opted-in instance never uses the LRU, checked at the lookup
+ gate (§5.3, §6.2).
+
+Refusing region HA routes in v1 is the author's cut for R1-2, and round
+2 accepted it.
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work.
+ Blocks merge.
+- **P2**: wrong or missing. Fixed without reopening this review. (The
+ census, and review of any newly changed security, root, termination
+ or production-storage behaviour, still check the fix; see AGENTS.md,
+ "Stopping rules".)
+- **P3**: clarity or polish. Goes on a follow-up list; never a reason for
+ another round.
+
+A P1 states its failure scenario and the evidence (file:line). Do not
+raise a P2 to P1 to keep the review open.
+
+## Output
+
+Findings ranked P1, P2, P3. Each gives:
+- the section;
+- the problem;
+- the evidence (file:line, verified);
+- the failure scenario;
+- a concrete fix;
+- the invariant or trust boundary it breaks. That is its fault family.
+
+Then the builder questions (item 6), as a separate ranked list. End with
+exactly one verdict:
+
+- **READY**: no P1 and no P2.
+- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another
+ round.
+- **NOT READY**: one or more P1s, listed.
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of
+your own. Do not run the full test suites.
diff --git a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PAGE-CACHE.md b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PAGE-CACHE.md
new file mode 100644
index 000000000..750f7321e
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PAGE-CACHE.md
@@ -0,0 +1,92 @@
+# Review brief: edge page cache spec, round 1 of 3
+
+Repo carlos/platform, branch `design-edge-page-cache`, the commit named in
+your prompt.
+Under review: `docs/superpowers/specs/2026-11-08-edge-page-cache-design.md`.
+Authorities (merged on main): `docs/superpowers/specs/2026-10-24-edge-asset-cache-design.md`,
+`docs/superpowers/specs/2026-11-01-stateless-replicas-design.md`, the code
+under `internal/edge/` (cache.go, purge.go, purge_header.go, asset*.go,
+burst_notice.go, mesh.go, homemap.go, forwardha.go), `internal/assetcache/`,
+`internal/host/assetpolicy.go`. Do not review against unmerged branches; if
+this work needs one, say so as a P1 and stop.
+
+You are an independent reviewer and also the person who will plan the
+build from this document without being able to ask its author anything.
+Read the document, then the code it names, and check every claim against
+that code.
+
+## Fixed: do not re-argue
+
+Paul's requirements, recorded in spec §1:
+- an app opts in with a response header and a page stays until the app
+ clears it;
+- clearing one page or all pages, from inside the app or by an agent;
+- no stale content left hanging around;
+- a clear reaches far readers in low seconds.
+
+Also fixed: no new per-box polling of the S3 bucket (S3 request cost
+rulings), and page bytes count as usage (asset cache ruling R2). Report
+only mechanisms that fail to honour these. The calls listed in spec §14
+are the author's, not Paul's, and are open to challenge.
+
+## What to check
+
+1. **Invariant I1 (§8.4).** Can a far box, or the home, serve a page
+ covered by a clear more than L after the home applied it? Try lost,
+ delayed and reordered pushes, renewals racing clears, home restarts,
+ HA holder changes, moves, clock skew, and a fill that races a clear
+ (§6, §7 step 4).
+2. **Personalised pages (I2).** Can a response drawn for a signed-in or
+ cookie-carrying request be stored or served to someone else? Check
+ the ignore-list learning on far boxes (§7 step 5), HEAD, and the
+ interaction with today's LRU, which doesn't check request cookies.
+3. **Tenancy (I3).** Can an entry be served under the wrong account, app
+ or host? Check the fill acknowledgement, the lease's host set, and the
+ home-map checks against how `farAssetCatch` and `AssetsFor` work
+ today.
+4. **Trust.** Are the new push, lease and fill messages bounded and
+ unforgeable at least to the standard of asset fills and burst notices?
+ Can any of them be replayed for a wrong effect?
+5. **Fit with the code.** Is the claimed position of the page-store
+ lookup (after the plan throttle, before the rate limit and activator)
+ right, and does the far branch have a place to look up before
+ backhaul? Does anything in §2 misstate the code?
+6. **Builder check.** As the planner: list the questions you would still
+ need answered before planning well, where a wrong guess would matter.
+ Rank them. Skip anything §15 leaves to the builder or that you could
+ reasonably decide yourself.
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work.
+ Blocks merge.
+- **P2**: wrong or missing. Fixed without reopening this review. (The
+ census, and review of any newly changed security, root, termination
+ or production-storage behaviour, still check the fix; see AGENTS.md,
+ "Stopping rules".)
+- **P3**: clarity or polish. Goes on a follow-up list; never a reason for
+ another round.
+
+A P1 states its failure scenario and the evidence (file:line). Do not
+raise a P2 to P1 to keep the review open.
+
+## Output
+
+Findings ranked P1, P2, P3. Each gives:
+- the section;
+- the problem;
+- the evidence (file:line, verified);
+- the failure scenario;
+- a concrete fix;
+- the invariant or trust boundary it breaks. That is its fault family.
+
+Then the builder questions (item 6), as a separate ranked list. End with
+exactly one verdict:
+
+- **READY**: no P1 and no P2.
+- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another
+ round.
+- **NOT READY**: one or more P1s, listed.
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of
+your own. Do not run the full test suites.