Skip to main content

Module memory_ledger

Module memory_ledger 

Source
Expand description

The last hour of AgentMux’s memory, and what grows unusually in it (SPEC_TOWER_MEMORY_FIRST_AND_AGENTMUX_BREAKDOWN_2026_10_25.md §7).

A ring of 360 points at 10-second steps for the total, each part and each row, in bytes. It lives in srv’s memory only, starts empty on a restart, and is fed by whichever sample comes: Tower’s own (every 2 s, thinned to the steps) or the timer in app_api::tower_pane when no Tower is open, so a Tower opened later shows the past hour.

Warnings stay inside Tower (spec D6): nothing here notifies anyone or acts on the memory supervisor.

Structs§

GrowthRule
“Grows unusually” (spec §7.3): all of these over the last Self::window points. First guesses to tune with the memory lab’s noise data, kept in one place on purpose.
Ledger

Constants§

GROWTH
IDLE_EVERY_STEPS
With no Tower open the timer samples every this many steps (30 s): one sample costs about 15-25 ms on a busy Windows machine (debug build), which every 10 s is over the 0.1% of a core the spec allows, and every 30 s is under it (spec section 5.4).
POINTS
An hour of points.
STEP_MS
The gap between points.

Functions§

fed_within
Whether a sample reached the ledger within within: the timer samples only when none did.
feed
Put a sample in srv’s ledger and attach what it knows: the keys that grow unusually, and the hour when with_history.
grows_unusually
Whether points (one per step, newest last) grows unusually: from the lowest point in the window, to now, and how many whole minutes ago that lowest point was.