Repository navigation
Description
#316/#559/#563 gave worktrees a retention owner, and it worked — worktrees went 96 GB → 27.6 GB this week. Every other thing Solenta writes to userData still has none, and two of them say so in their own source.
Inventory (this machine, 2026-08-20)
worktrees 27.6 GB owned by GC (#316/#559) ✓
coder-store.json.bak 177 MB no owner
coder-store.json 163 MB per-thread caps (#89), aggregate unbounded (#225)
memory.db 44 MB memory-server janitor
tool-images 28 MB no owner
attachments 5 MB no owner
electron/tool-images.js:8-9 states the shortcut and its trigger:
// ponytail: files are never pruned — a screenshot is ~200KB and nothing else
// in userData is pruned either. Add an age sweep on boot if it ever grows.Both halves have expired. The premise "nothing else in userData is pruned either" was true when it was written (2026-08-15) and false since #559 shipped. And it grew: 19 MB / 114 files yesterday → 28 MB / 159 files today, roughly +9 MB/day under normal use. electron/attachments.js:92 carries the same note ("nothing here is pruned") without even the trigger condition.
None of this is urgent in absolute terms — 33 MB of images against 27.6 GB of worktrees is a rounding error, and it should be filed as the small ticket it is. It is unbounded, which is the only reason it is worth a ticket at all: at ~9 MB/day it is a few GB a year, and nothing will ever reclaim a byte.
The .bak is the odd one out
coder-store.json.bak is 177 MB, larger than the live store, rewritten in full on every boot (store.js:1086, copyFileSync on the load path — 62 ms measured, see #618). It is not really a retention problem; it is a whole-file backup of a whole-file store, so #225's shard makes it small automatically. Noting it here only so the inventory is complete — do not fix it separately, it falls out of #225.
Proposal
One boot sweep that owns the non-worktree surfaces, next to the existing worktree sweep in main.js:380:
tool-images/andattachments/: drop files older than N days (90?) that no live thread references. Both are content-addressed by random filename and referenced from message bodies, so the reference check is a scan of retained transcripts — which Shard messagesByThread into per-thread files: one message re-serializes all 227 threads #225's per-thread files make cheap and which today would mean touching the 163 MB blob. Reasonable to land after Shard messagesByThread into per-thread files: one message re-serializes all 227 threads #225, or to start age-only with a generous N.- Do it on the same delayed,
unref'd timer as the worktree sweep so startup is untouched (and see First paint waits on the whole boot chain: createWindow() is the last thing whenReady does #618 — that path should not grow).
Deliberately not proposed: a UI. The worktree GC earned one because it was reclaiming tens of GB; 33 MB does not deserve a dialog. A log line is enough.
Tests
- A tool-image older than the cutoff and unreferenced is removed; one referenced by a retained message is kept regardless of age.
- The sweep is a no-op on a fresh profile and never throws on a missing directory.
Related
#559/#316/#563 (the GC that made this comment's premise stale), #225 (owns the .bak and makes the reference scan cheap), #618 (boot ordering — the sweep must stay off the critical path), #89.
Activity
currentbits commentedon Aug 20, 2026
Duplicate of #145, which filed the same defect on 2026-08-16 from a code reading of the same
tool-images.js:8-9/attachments.js:92comments. #145 is the superset - it also covers the syncreadFileSync+ base64 reads on the main thread.The disk inventory and the +9 MB/day growth measurement from this issue have been copied onto #145. Closing here so the retention work has one home.