Each range statsFor keeps (all days, and 30, warmed at start) holds a
Summary for every session, and each had four maps (tools, skills,
skillLast, perDay) plus a tools map in every day. Most hold one or two
names, and a Go map of one is a few hundred bytes. They are now
counts (name, calls, a skill's last date) in the names' order, and
perDay a slice of days in order; the build still sums into maps and
hands those over once.
Run at this head (8ab4fd612 + this change), in a sandbox HOME with the
real ~/.codex and ~/.claude sessions (15,921 files), warm start, two
alternating runs each, 40 s after settling:
before: footprint 174 / 178 MB, live heap 104 / 104 MB
after: footprint 165 / 170 MB, live heap 97 / 96 MB
Both builds side by side on the same files, /api/sessions/overview at
days 30, 0, 30&agent=codex and 0&agent=claude, and /api/sessions/stats
at 30: stats identical; the overviews differ only in the title length
8ab4fd612 changed and in today's counts of the Claude sessions being
written between the two reads (codex-only: titles alone).
go test ./internal/sessions ./internal/gui ok; ./internal/usage red
once on TestUsageReadAfterAppendHashesNothingOnAFineClock's whole-second
case (#3511, #3551, untouched here), 5 of 5 ok rerun. gofmt clean;
GOOS=linux and GOOS=windows go vet -tags nogui ./internal/sessions ok.