Expand description
The record: AgentMux’s own size over weeks, kept on this computer (docs/specs/SPEC_LONG_RUNNING_ZERO_DEGRADATION_2026_11_16.md §6, task #47820 phase 1).
A leak that takes weeks to show can only be found from a record kept that
long, and Tower’s memory ledger (tower::memory_ledger) forgets after an
hour and a restart. Every five minutes the sample Tower already takes for
the ledger is also written here as one JSON line in a file for its day, with
the machine’s totals, AgentMux’s parts and its largest rows. Raw days are
kept for KEEP_DAYS, oldest first out, and the whole record has a size
budget (MAX_BYTES). Each finished hour is also folded into one rollup
line (min, median, p95 and max of each figure) in a file for its month,
kept for a year (ROLLUP_KEEP_DAYS) within its own budget
(ROLLUP_MAX_BYTES): slow growth over months is read from those.
Nothing leaves the computer, and a line holds numbers and stable keys only
(core, agent:<block>, np:claude.exe, renderer:window:<hash>): no
text, titles or paths. A renderer’s own key is made of its window’s or
page’s name, so a line keeps its kind and a hash of it instead.
Structs§
- Agent
MuxLine - AgentMux’s own processes at the time of a sample.
- Inventory
- What the record holds on disk.
- Machine
Line - The machine’s totals at the time of a sample.
- Page
Line - What one window’s page held when it last reported (
record.page, every five minutes): numbers and the window’s own label (main,window-3), never a title or a path. - Page
Roll - One window’s page over an hour: JS heap (MB), elements and mounted rows.
- Part
Line - One of AgentMux’s four parts, or one of its largest rows.
- Record
- Where the lines go, and when.
- Rollup
- One finished hour of lines folded into one.
- Sample
- One line of a day’s file.
- Stat
- min, median, p95 and max of a figure over an hour.
Constants§
- EVERY_
MS - The gap between lines.
- KEEP_
DAYS - Raw days kept.
- MAX_
BYTES - The record’s own budget: past it, the oldest days go first (never today’s).
- ROLLUP_
KEEP_ DAYS - Hourly rollups kept: a year, and a month’s file goes whole.
- ROLLUP_
MAX_ BYTES - The rollups’ own budget (a year is about 10 MB), so the record as a whole stays under 40 MB.
Functions§
- compact
- A snapshot as one line.
diskis the record’s drive;up_show long srv has run. - day_of
2026-11-16for a time in ms since the epoch (UTC).- default_
dir - Where this AgentMux keeps its record: the
recordfolder of its channel, which an upgrade keeps. - events_
to_ remove - The events files to delete: a month that ended more than
keep_daysbeforetoday. - files_
to_ remove - The day files to delete, given what is on disk as
(file name, bytes): those older thanKEEP_DAYSbeforetoday, then the oldest of what is left while the total is overmax_bytes. Today’s file is never listed. - inventory
- The files of
dir, counted and sized. - note_
page - A window’s page reported: kept until it reports again, and written into the next line of the record.
A label is cut to what an id holds; a window that reports more than [
MAX_PAGES] windows’ worth is ignored. - pages_
at - The pages that reported in the last [
PAGE_FRESH_MS], by label. - read_
events - The events of the months that overlap
from_mstoto_mstaken in that window, newestlimitin time order, and how many the window holds. Each is the line as written:t,kindand numbers. - read_
raw - The last
limitlines taken fromfrom_mstoto_ms, in time order, and how many lines the window holds in all. - read_
rollups - The last
limithourly rollups of the hours that start fromfrom_mstoto_ms, in time order, and how many the window holds in all. - rollup
- The hour starting at
houras one line, from its lines (in time order). None for no lines. - rollups_
to_ remove - The rollup files to delete: a month that ended more than
keep_daysbeforetoday, then the oldest of what is left while the total is overmax_bytes. The month oftodayis never listed.