carlos / platform Public

census: overlay edge-asset-cache-2 for internal/assetcache (PROPOSED)

The new package's 17 units are new legacy rows (accepted-legacy,
rev3=PROPOSED-edge-asset-cache-2): asset cache files under
$CARLOS_DATA_DIR/asset-cache, written and read only by this package.
The internal/assetcache envelope is pinned. Loaded last through the
chain manifest, after sec-sidecar-create-gate, whose seal is checked
first; the seal moves to 7010939c. Card:
docs/superpowers/notes/census-proposal-edge-asset-cache-2.md, ruling
asked on #280.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev d02902d7621004044e5085dcbd2def5dfbf4a0d1 parent 6bc484a
3 files changed, +119 −0
  • docs/superpowers/notes/census-proposal-edge-asset-cache-2.md +80 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −0
  • internal/provision/testdata/plan14-root-reads-edge-asset-cache-2.tsv +38 −0

CI passed — run details

diff --git a/docs/superpowers/notes/census-proposal-edge-asset-cache-2.md b/docs/superpowers/notes/census-proposal-edge-asset-cache-2.md
new file mode 100644
index 000000000..7081954c2
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-edge-asset-cache-2.md
@@ -0,0 +1,80 @@
+# Census: edge asset cache, plan 2 (the disk store)
+
+Status: PROPOSED-edge-asset-cache-2, asked of the census owner on #280.
+Every change below is `new`, a decision `make census-propose` refuses, so
+the overlay was written by hand following the overlays in the chain.
+
+The branch is `edge-asset-cache-2`, merged with amadan `main` at e3fd2e02.
+It adds one new package, `internal/assetcache`: a store of cached asset
+responses on a box's disk, under a budget and a free-space floor (spec
+`docs/superpowers/specs/2026-10-24-edge-asset-cache-design.md`, §7).
+Nothing imports it yet. Plan 3 wires it into the agent and opens it at
+`$CARLOS_DATA_DIR/asset-cache`.
+
+It adds one root-read overlay,
+`internal/provision/testdata/plan14-root-reads-edge-asset-cache-2.tsv`,
+appended to `internal/provision/testdata/plan14-root-reads-chain.tsv` after
+`plan14-root-reads-sec-sidecar-create-gate.tsv` (the overlay main loads
+last at e3fd2e02).
+
+## Root reads
+
+Every unit is a new plain row and its `@legacy` fingerprint, all with one
+disposition: class `legacy`, task `accepted-legacy`, basis
+`accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package`.
+There is no `cache` class.
+
+Why legacy and not authority: a `Store` reads only files it wrote itself,
+in the one directory it is opened over (`<id>.meta`, `<id>.<v>.body`,
+`<id>.<v>.gz` and their temporaries), plus a statfs of that directory. No
+unit reads a record, a registry, a unit file or anything another component
+writes, and none makes a root decision. A `.meta` that does not parse is
+deleted with its files, never trusted.
+
+Executing identity: none yet. From plan 3 on, the agent
+(`/opt/carlos/carlos agent`, `carlos-edge.service`, user carlos).
+
+| unit | reads | what it reads |
+|---|---|---|
+| `store.go` `Open` | `file:Open`, `file:Statfs` | names `Statfs` as the default `FS`; the scan itself is `Store.scan` |
+| `store.go` `Store.scan` | `file:ReadDir` | lists the cache directory at `Open` |
+| `store.go` `Store.loadMeta` | `file:ReadFile` | one `<id>.meta` during the scan |
+| `store.go` `Store.bodyMatches` | `file:Stat` | a body file's size during the scan, against its `.meta` |
+| `store.go` `Entry.Open` | `file:Open` ×2 | opens a committed body (identity or gzip) to serve it |
+| `store.go` `Reader.Read`, `Reader.ReadAt`, `Reader.Stat` | ×2 each | read the file `Entry.Open` opened |
+| `fill.go` `Fill.open` | `file:OpenFile`, `file:Read` | creates the body temporary (O_EXCL, 0600); the `Read` is `crypto/rand` |
+| `fill.go` `Fill.writeGzip` | `file:OpenFile` | creates the gzip temporary (O_EXCL, 0600) |
+| `fill.go` `Fill.commit` | `file:Read` | `crypto/rand`, the version drawn per commit |
+| `fill.go` `Fill.finish` | `file:Lstat` | the size of a temporary it is about to remove |
+| `fill.go` `writeSynced` | `file:OpenFile` | creates the `.meta` temporary (O_EXCL, 0600) |
+| `fill.go` `syncDir` | `file:Open` | opens the cache directory to fsync it |
+| `statfs_linux.go` `statfsFS.Space` | `file:Statfs` | `unix.Statfs` of the cache directory, for the free-space floor |
+| `statfs_linux.go`, `statfs_other.go` `var Statfs` | `file:Statfs` | the variable's name; `statfs_other.go` returns `ErrUnsupported` and reads nothing |
+
+Seventeen frozen declarations are added, so the seal moves from
+`0ca3baafa26f59c0b7d8c6d6a39237d074afb71f885b7fbd50debebab5bf89f2`
+(sec-sidecar-create-gate's, checked before the overlay loads) to
+`7010939cd0b8485918418a0d3c223cca4a8807cbbe57ab50f77319cfe2af4507`.
+
+One envelope is pinned for the first time: `internal/assetcache`
+(`375fe495911e30962c53e74dea86b519d35151df67fcf0f73baef5ff654a4342`).
+
+Record-write census (9B8): unchanged; the package writes no record keys.
+Claim routes: unchanged. go.mod: unchanged.
+
+## The ruling asked on #280
+
+> Census proposal for `edge-asset-cache-2` (card:
+> `docs/superpowers/notes/census-proposal-edge-asset-cache-2.md`, tip
+> <tip>). A new package, `internal/assetcache`, the edge asset cache's
+> disk store, imported by nothing yet. Its 17 units read only files the
+> package writes itself in its own directory, plus a statfs of that
+> directory. Proposed: each a new `legacy` / `accepted-legacy` row with
+> basis "asset cache files under $CARLOS_DATA_DIR/asset-cache, written and
+> read only by this package", and the `internal/assetcache` envelope
+> pinned. Seal `0ca3baaf…89f2` → `7010939c…4507`. Approve or hold?
+
+If approved as `census-ruling-edge-asset-cache-2`, every row's
+`rev3=PROPOSED-edge-asset-cache-2` becomes
+`rev3=census-ruling-edge-asset-cache-2`, the `@legacy` fingerprints are
+recomputed, and the seal and the chain line move with them.
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index b55f07f47..7fac259b5 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -4,3 +4,4 @@
plan14-root-reads-sec-host-imdsv2-module.tsv 945934f5978ace14dc5a9bae0ed69dfabf29b994504fc843c03d4a633ecd6c6a
plan14-root-reads-sec-deps-dos-bumps.tsv 945934f5978ace14dc5a9bae0ed69dfabf29b994504fc843c03d4a633ecd6c6a
plan14-root-reads-sec-sidecar-create-gate.tsv 0ca3baafa26f59c0b7d8c6d6a39237d074afb71f885b7fbd50debebab5bf89f2
+plan14-root-reads-edge-asset-cache-2.tsv 7010939cd0b8485918418a0d3c223cca4a8807cbbe57ab50f77319cfe2af4507
diff --git a/internal/provision/testdata/plan14-root-reads-edge-asset-cache-2.tsv b/internal/provision/testdata/plan14-root-reads-edge-asset-cache-2.tsv
new file mode 100644
index 000000000..7d70a8271
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-edge-asset-cache-2.tsv
@@ -0,0 +1,38 @@
+# Census overlay edge-asset-cache-2 (plan 2 of the edge asset cache: the disk store, internal/assetcache), loaded LAST through plan14-root-reads-chain.tsv, after sec-sidecar-create-gate, the overlay main loads last at e3fd2e02. PROPOSED-edge-asset-cache-2, asked of the census owner on #280; the card is docs/superpowers/notes/census-proposal-edge-asset-cache-2.md. Written by hand: every row is a new unit, a decision census-propose refuses.
+# internal/assetcache is a new package that nothing imports yet (plan 3 wires it into the agent). Its 17 units read only the files it writes itself: <id>.meta, <id>.<v>.body, <id>.<v>.gz and their temporaries in the one directory a Store is opened over (plan 3 opens it at $CARLOS_DATA_DIR/asset-cache), plus a statfs of that directory for its free-space floor. No unit reads a record, a registry, a unit file or anything another component writes, and none makes a root decision, so each is accepted legacy with one basis. Reader.Read, ReadAt and Stat read the body file Entry.Open opened; statfs_other.go's Statfs reads nothing (ErrUnsupported off Linux) and is listed because the scan matches the name.
+# Seventeen frozen declarations are added, so the seal moves; sec-sidecar-create-gate's seal is checked first. The internal/assetcache envelope is pinned for the first time.
+@legacy c67eb23fdb5a6550bb50133f6ba032c9c06f61e339feba165857b1d15ef46d70 internal/assetcache/fill.go Fill.commit legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Read@368 ad399b420f842b405306be2813eb14fbdc4efcf6968d6f0c7ebf592ff52c0649
+@legacy 47f2e16605d97099952a171ef263c773a136816b1c93ccbc44ed0319b667f679 internal/assetcache/fill.go Fill.finish legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Lstat@375 a37b9660dcdfc494c91fbd98b6f1b30cb5e56e009882a352898ccdb39168c5c0
+@legacy 967fa2a6d3263c12465710066231f8ab4f21d6de0b1416f57128ca2a4d7ec78a internal/assetcache/fill.go Fill.open legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:OpenFile@309,file:Read@59 20bd23b8e51fdaef96f91c47d3bc7c49db3b2e22e83b358c8af5f9abd6f59d23
+@legacy 4d57f569dfa98b9522c21b679cdf4a66faec8bcd699daabfc7c4401ce2d94948 internal/assetcache/fill.go Fill.writeGzip legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:OpenFile@74 f6e320929321f37a3d1fa684927e442f368cc788a828ba6cf2c73aa5f5a2494e
+@legacy de64421e65b39c109f06f43a63bb204a17485bf536c44a9a6f283ff18c04bb25 internal/assetcache/fill.go syncDir legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Open@92 4e9ef58bb277a024bad7f7e39866070d406d7957eda7c64a1ddfa2e3a62d0f32
+@legacy 0210f428c8c530004f9313d6f31552c9b1bac9fe768347ae588e6bd25fcd2d9f internal/assetcache/fill.go writeSynced legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:OpenFile@64 9f8b7beb35272098cf99b8e1e4c723cc981332246f398da885ef996e93c0a5ef
+@legacy 755fdc8d70f1b4fa845949ba5445bbd37cb1c68673af778d9a56f72763fc118a internal/assetcache/statfs_linux.go statfsFS.Space legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Statfs@101 2dd0e0938e78bbbca8ff53a501f1a54ea0ff931ff269a53412a5a5062f3cd26d
+@legacy dafa44144658a56fdd00d32d40eeaee17449a82d9ba3e76d61ba27ab6c492dde internal/assetcache/statfs_linux.go var Statfs legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Statfs@4 3a576cd63f92cf882fff6676a56d5e0aac23dad84a74984a7f8b7e1ee9947074
+@legacy 7184e5f0b036ee7e00856ecc9edc4344f572ce3423b259479eff3d47401640df internal/assetcache/statfs_other.go var Statfs legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Statfs@4 3a576cd63f92cf882fff6676a56d5e0aac23dad84a74984a7f8b7e1ee9947074
+@legacy c617c8a383e52a2148306e7cfa35af6a94c9c3c53fa31a14e3ab79c4232efb5c internal/assetcache/store.go Entry.Open legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Open@16,file:Open@592 ad9287698f3128c134a7b88f286a67db616eaa3b2b56a8c984188ac2e0bcc673
+@legacy 566f5b09465fdd87da4ddcbc001ddf8926e0c493929021909370229bab4b2d25 internal/assetcache/store.go Open legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Open@5,file:Statfs@281 624487c342a1064224e08422715737260afdf297dec7327170781c70d838a192
+@legacy 78cf789b42c5481ff97a10613a378c1d3507377a514349cba45033f3e9ae0c30 internal/assetcache/store.go Reader.Read legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Read@17,file:Read@72 b35cc8c8d77c2133c5adb0020a23cf4cad1bebaf1ec2052f4154ad00f157a795
+@legacy bb15d430191902debaefd209e5f7c3c2bcde8f7f49a4f053234ab9e721e44aba internal/assetcache/store.go Reader.ReadAt legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:ReadAt@17,file:ReadAt@72 7cbd07ec7d26ceb5c5eaa37dbce0dad37050beefc8910434ac48dd0189ddb350
+@legacy 203dc0d29fb435ce83c5c63ea2fe5c42ee024f3d34ecf74be9b8d8ff6509e6ec internal/assetcache/store.go Reader.Stat legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Stat@17,file:Stat@72 8ca5335393585b568da254987b859b4ef40e64e5c7c3bc774f414bf524944115
+@legacy 031ad7bee820f5f3f2c1ddd8791729581054ffa53007d75e0525129304b04fb7 internal/assetcache/store.go Store.bodyMatches legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Stat@81 56610feb6f7852a01c33b4e7dca1a8edc532c4a43cf319068b3f4f7bc09d71bb
+@legacy 3beff06d8cfb450447fabd7177580ddbfd937cb291312321d0c5f9be4ec61268 internal/assetcache/store.go Store.loadMeta legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:ReadFile@99 9be068a53c11f8108b0586a15efd20053b7bf136daa482dc7db1a60ba182d4c6
+@legacy 157b27e94ed49c267fae3e3ce128a8bec352877efff702fab346d3df1bd655a6 internal/assetcache/store.go Store.scan legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:ReadDir@45 347433001a025bbf1ecd81e8c5895c53fdae6af039583588eee37fb0c8a8f175
+internal/assetcache/fill.go Fill.commit legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Read@368 ad399b420f842b405306be2813eb14fbdc4efcf6968d6f0c7ebf592ff52c0649
+internal/assetcache/fill.go Fill.finish legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Lstat@375 a37b9660dcdfc494c91fbd98b6f1b30cb5e56e009882a352898ccdb39168c5c0
+internal/assetcache/fill.go Fill.open legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:OpenFile@309,file:Read@59 20bd23b8e51fdaef96f91c47d3bc7c49db3b2e22e83b358c8af5f9abd6f59d23
+internal/assetcache/fill.go Fill.writeGzip legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:OpenFile@74 f6e320929321f37a3d1fa684927e442f368cc788a828ba6cf2c73aa5f5a2494e
+internal/assetcache/fill.go syncDir legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Open@92 4e9ef58bb277a024bad7f7e39866070d406d7957eda7c64a1ddfa2e3a62d0f32
+internal/assetcache/fill.go writeSynced legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:OpenFile@64 9f8b7beb35272098cf99b8e1e4c723cc981332246f398da885ef996e93c0a5ef
+internal/assetcache/statfs_linux.go statfsFS.Space legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Statfs@101 2dd0e0938e78bbbca8ff53a501f1a54ea0ff931ff269a53412a5a5062f3cd26d
+internal/assetcache/statfs_linux.go var Statfs legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Statfs@4 3a576cd63f92cf882fff6676a56d5e0aac23dad84a74984a7f8b7e1ee9947074
+internal/assetcache/statfs_other.go var Statfs legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Statfs@4 3a576cd63f92cf882fff6676a56d5e0aac23dad84a74984a7f8b7e1ee9947074
+internal/assetcache/store.go Entry.Open legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Open@16,file:Open@592 ad9287698f3128c134a7b88f286a67db616eaa3b2b56a8c984188ac2e0bcc673
+internal/assetcache/store.go Open legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Open@5,file:Statfs@281 624487c342a1064224e08422715737260afdf297dec7327170781c70d838a192
+internal/assetcache/store.go Reader.Read legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Read@17,file:Read@72 b35cc8c8d77c2133c5adb0020a23cf4cad1bebaf1ec2052f4154ad00f157a795
+internal/assetcache/store.go Reader.ReadAt legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:ReadAt@17,file:ReadAt@72 7cbd07ec7d26ceb5c5eaa37dbce0dad37050beefc8910434ac48dd0189ddb350
+internal/assetcache/store.go Reader.Stat legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Stat@17,file:Stat@72 8ca5335393585b568da254987b859b4ef40e64e5c7c3bc774f414bf524944115
+internal/assetcache/store.go Store.bodyMatches legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:Stat@81 56610feb6f7852a01c33b4e7dca1a8edc532c4a43cf319068b3f4f7bc09d71bb
+internal/assetcache/store.go Store.loadMeta legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:ReadFile@99 9be068a53c11f8108b0586a15efd20053b7bf136daa482dc7db1a60ba182d4c6
+internal/assetcache/store.go Store.scan legacy accepted-legacy accepted-legacy;rev3=PROPOSED-edge-asset-cache-2;asset cache files under $CARLOS_DATA_DIR/asset-cache, written and read only by this package file:ReadDir@45 347433001a025bbf1ecd81e8c5895c53fdae6af039583588eee37fb0c8a8f175
+@coverage internal/assetcache 375fe495911e30962c53e74dea86b519d35151df67fcf0f73baef5ff654a4342