carlos / platform Public

spec: edge page cache, draft rev 1 and round 1 review brief

Opt-in page caching at home and far edges, cleared by the app within a
few seconds via a per-home clear sequence, push and short leases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 82e62c099a7715f76bd4e8bd24cb62eda717307f parent 06bb3f7
2 files changed, +662 −0
  • docs/superpowers/specs/2026-11-08-edge-page-cache-design.md +570 −0
  • docs/superpowers/specs/CODEX-REVIEW-BRIEF-PAGE-CACHE.md +92 −0
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..051d82933
--- /dev/null
+++ b/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md
@@ -0,0 +1,570 @@
+# Edge page cache: design
+
+Status: draft rev 1, 2026-11-08. 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`).
+
+## 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."
+
+## 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. A
+ response is stored when it 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`). The request's own `Cookie` header
+ is not checked. The lookup sits after the plan throttle and before the
+ rate limit and the activator (`edge.go:2673-2690`), so 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.
+- **The edge asset cache** keeps immutable, declared-prefix, non-HTML
+ responses in a disk store (`internal/assetcache`): a budget, a per-app
+ share, eviction, reserved fills and gzip at serve time. Far edges
+ catch a declared path, ask the home for it with a signed fill
+ (`X-Carlos-Asset-Fill`, HMAC under the mesh key, `assetfill.go`), and
+ store only what the home acknowledges (`X-Carlos-Asset-Fill-Ack`).
+ Purge is a per-instance generation in the key, written to the record,
+ and 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. They go over `backhaulTransport` with a bounded queue per
+ peer, and a notice not sent within 10 s is dropped
+ (`burst_notice.go`). 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 lease holder before the cache (`forwardha.go`).
+ - **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
+ app, from a response header, from the control socket, or from the CLI.
+- G4. Once a clear reaches the home box, no edge serves a page it covers
+ more than L seconds later (§8, 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 from signed-in readers (cookies or `Authorization`) never
+ read from or write to the cache.
+- G7. A new release of the app clears its pages automatically.
+
+**Non-goals (v1)**
+- Pages served through forward rows: stateless replicas, managed
+ fleets and fleet public routes. The hub never caches these today, and
+ this spec doesn't change that.
+- Variants other than `Accept-Encoding` (geo country, language
+ headers). A response with any other `Vary` is not stored.
+- Caching statuses other than 200: no 404s and no redirects.
+- Giving unit-backed instances a control socket. Today they can clear
+ only from a response header (§4.4).
+- Clearing the copies browsers keep. The edge can't reach them; §4.2
+ tells apps what to send.
+- Static sites (`kind:static`) and the asset cache keep their own rules.
+
+**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, 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 the page, such as a consent cookie:
+ `Carlos-Page-Cache: on; ignore-cookies="consent"`. A request whose
+ cookies are all on that list still counts as anonymous (§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 app-wide clear.** One target clears every host the app
+ serves on that box: 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 (`carlos pages clear --app shop [--path /p]`, name to
+ copy review). The CLI is for operators and agents working from
+ outside the app.
+- **What a clear touches:** on the home box, 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.
+- **What doesn't change:** the LRU's behaviour for unmarked responses.
+
+### 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 cache
+
+A request may read from or be stored into the page cache 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);
+- the route is an instance route: not `static`, not `status`, not a
+ forward row, no import gate;
+- it carries no `Authorization` header;
+- it carries no `Cookie` header, or every cookie name in it is on the
+ ignore list the app declared for that host (§4.1);
+- the path is canonical (the asset cache's rule; anything else is
+ `bypass`).
+
+A HEAD is answered from a stored GET and is never stored itself.
+Everything else is a bypass: forwarded as today, never stored.
+
+### 5.2 Which responses are kept
+
+A response is kept only when all of these hold:
+
+- the response carries the marker;
+- the status is 200;
+- the request was eligible (§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.
+
+Pages are stored identity-encoded and compressed at serve time, as
+assets are. The stored headers follow the asset cache's list. The
+`Carlos-*` control headers are never stored or replayed.
+
+### 5.3 The key and the entry
+
+- **Key:** account, app, host, path and raw query exactly as sent. No
+ query normalisation in v1.
+- **Each entry also records:**
+ - the serving home box and that box's clear epoch (§8);
+ - the clear sequence at the time the page was rendered;
+ - the absolute expiry;
+ - the ignore list;
+ - the `ETag`, if any.
+
+### 5.4 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. Serving on the home box
+
+At the point where the LRU lookup happens today (after the plan throttle,
+before the rate limit and the activator), an eligible request is looked
+up in the page store first.
+
+- **A hit** is a live entry whose epoch is this box's current epoch for
+ the app. It is served with `Carlos-Cache: hit`.
+- **A miss** goes to the app as today. A response kept under §5.2 is
+ stored in the page store, not the LRU.
+- **Storing races a clear.** Note the app's clear sequence when the
+ request starts. Store the response only if no clear for the app
+ happened before the response arrived. That check is coarse, but it
+ can't keep a page rendered before a clear (Tito's page cache uses the
+ same idea).
+- **Single-flight per key** (my call). A render that isn't kept (a 500,
+ a redirect, a response without the marker) sends its waiters to the
+ app for themselves, never an error or an empty body.
+
+## 7. Serving on far boxes
+
+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 has a live entry for the key, a valid lease
+ for that home and app (§8), the home is still the home map's dial
+ target for the host, and the host is in the lease's host set. It
+ serves the entry with `Carlos-Cache: hit`. Neither the home nor the
+ app is contacted, except for a background lease renewal (§8.3).
+2. **Otherwise it fills:** the far box sends the request 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, the app and the far box's lease epoch. The home
+ runs its ordinary pipeline: page store, throttle, wake, app.
+3. **The home's acknowledgement.** If the response is kept under §5.2,
+ the home stores it and answers with a signed acknowledgement in its
+ own domain. The acknowledgement carries the expiry, the epoch, the
+ sequence at render, the ignore list and the account and app from the
+ home's own route table, not from the far box's claim.
+4. **What the far box stores.** It stores the response only if the
+ acknowledgement's epoch and sequence equal its lease's current ones.
+ Otherwise it serves the response once and doesn't store it. Account
+ and app come from the acknowledgement.
+5. **Cookies on a fill.** The far box learns each host's ignore list
+ from the acknowledgements, and keeps it in bounded memory. A request
+ carrying only ignorable cookies may fill, with those cookies passed
+ to the app unchanged, because the app declared they don't change the
+ page. Until the far box knows a host's list, any cookie means a plain
+ backhaul.
+
+Fill limits (waiters, deadlines, concurrency per box and per app) 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 app 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 app's route (process start, route arrival, or taking the HA
+ lease).
+- **Sequence:** starts at 0 and goes up by one for every clear of that
+ app, whatever its target.
+- **Clear log:** the box keeps a bounded log of recent clears per app:
+ 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.
+- **Starting a new epoch:** the box drops its own page entries for that
+ app. A box that wasn't serving the app can't know which clears it
+ missed.
+
+### 8.2 Push
+
+After applying a clear locally, the home pushes it to every far box that
+holds, or recently held, a lease for that app: 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 account, the app, 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.
+- **Any gap or a different epoch:** stop serving hits for that home and
+ app until a lease renewal resolves it.
+
+### 8.3 Leases
+
+A far box may serve a hit for (home box, app) only while it holds a
+lease. A lease is the home's answer to a signed renewal:
+`GET /.carlos/page-lease` 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 the app serves on that box;
+- whether page serving is allowed for the app.
+
+Allowed is false when the instance's switch is off, the host is lapsed
+or throttled (the asset cache's parity rule), or the box no longer
+serves the app.
+
+**How the far box applies it:**
+- a different epoch or "reset" drops every entry it holds for that home
+ and app;
+- otherwise it applies the missing clears.
+
+**The lease lasts L seconds,** measured on the far box's monotonic clock
+from when it **sent** the renewal, not when the answer arrived.
+- **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 app 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.
+ 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 edge
+serves a page it covers after t + L. In-flight responses already being
+written are the only exception.
+
+- **Why it holds:** any lease the far box sent before t either includes
+ the clear (the home answered after t), or expires by
+ `sent + L < t + L`. Any lease sent after t includes the clear.
+- **What the push adds:** it makes the usual case far faster. The bound
+ doesn't depend on it.
+- **The home's own store:** it applies the clear synchronously, before
+ the clear is acknowledged to the app (header or socket).
+
+### 8.5 A new release
+
+When the app's build or its delivered configuration changes on the home,
+the home performs an app-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.** Only the lease holder renders and serves the app, and
+ other members forward to it before the cache. The holder is the home
+ for page purposes. When the holder changes:
+ - the new holder starts a new epoch and drops any page entries it
+ kept from an earlier term;
+ - far boxes see a different home in the home map, or get "no longer
+ serving" from the old one, so their old entries stop being served
+ and age out.
+- **Moves.** Same as an HA holder change: new box, new epoch.
+- **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.
+- **Instance switch.** An off switch on the instance record, the asset
+ cache's R1 parity (`carlos pages off|on --app`, names to copy review).
+ Off means:
+ - the home drops the app's page entries and starts a new epoch;
+ - every lease answer says not allowed.
+ It is the operator's tool when an app caches something it shouldn't.
+- **Tenancy.** Entries are keyed by the account and app from the home's
+ route table. A far hit also needs the home map's current account and
+ app for the host to match the entry's. No field the far box asserts
+ is trusted for ownership.
+- **Plan throttle, lapse and protection.**
+ - Home hits come after the plan throttle, as LRU hits do today.
+ - Far hits stop when the lease says not allowed.
+ - 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 home box:
+ - armed or not;
+ - the instance 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 store on the home, the clear epoch
+ and sequence, the app-wide clear, clear on a new release, the
+ instance switch 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:** page fills, leases, push and catch-up, plus the
+ randomized simulation (§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, renewals and
+ pushes, with lost, delayed and reordered pushes, box restarts, holder
+ changes and clock skew between boxes. It checks:
+ - **I1:** nothing covered by a clear is served after t + L;
+ - **I2:** nothing stored from a request that carried a cookie that
+ wasn't ignorable, or an `Authorization` header, is ever served;
+ - **I3:** a hit is never served under a different account, app or
+ host than the one the home stored it for.
+ 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;
+ - HEAD from a stored GET;
+ - a 500 never stored;
+ - a signed-in request never served from or stored into the cache;
+ - 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;
+ - the marker and the internal headers never reach a visitor;
+ - a far box with an expired lease forwards.
+
+## 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 and §7 step 4.
+- **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).
+- Any cookie bypasses unless the app declares it ignorable; the ignore
+ list rides the marker (§4.1, §5.1).
+- 200 only; `Vary` only `Accept-Encoding`; an 8 MiB body cap (§5.2).
+- Pages share the asset store and each app's share (§5.4).
+- The lease (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).
+- Clears are a per-home 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).
+- A new release clears the app's pages; a wake does not (§8.5).
+- Forward rows, other variants, non-200 statuses, and a socket for
+ unit instances are out of v1 (§3).
+- 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, 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.5).
+- The contents of `carlos pages status`.
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.