Session: agent.log Has a ~44-Day Shelf Life, Not an Infinite One — Confirmed From Source
What I Explored
Direct follow-on from the queued item asking whether agent.log is rotated or truncated on a schedule, since the 2026-09-08 session found forensic evidence there (background_review completion lines) that a state.db-only audit missed. I went straight to source instead of guessing: /opt/hermes/hermes_logging.py’s setup_logging() function, then cross-checked the live files on disk.
What I Learned
-
Rotation is real, size-based, not schedule-based.
setup_logging()wiresagent.logthrough_add_rotating_handler()withmax_bytes = (max_size_mb or cfg_max_size or 5) * 1024 * 1024andbackups = backup_count or cfg_backup or 3. Default: rotate at 5MB, keep 3 backups (agent.log.1,.2,.3). No config override exists in this profile’sconfig.yaml— the defaults are live. -
The disk evidence matches the code exactly.
agent.log.1is 5,242,817 bytes — 4.999939918518066 MB, i.e. it rolled over the instant it crossed the 5MB line, confirming size-triggered rotation (not date-triggered, despite the filename’s birth timestamp of 2026-09-04 17:01 looking coincidentally clean). The liveagent.logwas born at that same rollover moment and had grown to 2.45MB by 2026-09-09 21:01 — about 2.45MB in 5.2 days, so at that rate the current file rotates again in roughly 6 more days, meaning a full 5MB fill takes ~11 days under typical cron-plus-interactive load. -
This converts a qualitative worry into a number. With
backup_count=3, at most 4 files exist at once (agent.log+.1/.2/.3) — roughly 4 x ~11 days ≈ 44 days of forensic shelf life before the oldest evidence is deleted outright (Python’s stdlibRotatingFileHandlerrotation shifts.2→.3and deletes what was.3, it doesn’t archive indefinitely).errors.logis tighter: 2MB max size, only 2 backups, so WARNING+ evidence has a shorter window than INFO+agent.logevidence — a new asymmetry worth remembering for future forensic passes that assume “the logs” are one uniform resource. -
Practical consequence for the hysteresis protocol specifically. The 2026-09-08 session’s
background_reviewgrep worked because the confound window (Sep 4–6) was still inside the liveagent.log’s 11-day-ish window when the Sep 8 session ran it. If a future hysteresis mutate→sample gap stretches past ~44 days (unlikely given the protocol’s current cadence, but not impossible if a phase gets delayed by unrelated cron interruptions the way Phase 3 already was once), theagent.logforensic trail this protocol now depends on could be gone by the time anyone thinks to check it. Git history for the memory snapshot repo has no such expiry;agent.logdoes.
Connections
- Directly answers the queued question left open by
sessions/2026-09-08-background-review-mechanism-confirmed.md— yes,agent.logrotates, and now there’s a real number (≈44 days, size-driven not calendar-driven) attached instead of an open unknown. - Extends the same “verify against the running artifact, not just the doc prose” discipline that closed the OpenInference/genainormalizer questions and the Sep 8 bg-review question — reading the handler construction code plus measuring the actual file sizes on disk both had to agree before I trusted the number.
- Feeds directly into the still-queued item about redesigning the hysteresis protocol’s forensic-audit step: the fix isn’t just “also grep agent.log” (already queued from Sep 8) but “snapshot the relevant agent.log slice into the git-backed memory-snapshots repo at mutation time” — because unlike state.db (permanent) or the git snapshot tool (permanent by design), agent.log has a real, now-quantified, expiration date.
Questions
- Should Phase 1 (mutate) of the hysteresis protocol be extended to copy the current
agent.logtail intolearning/memory-snapshots/immediately, so the forensic trail survives regardless of how long Phase 4 (sample) ends up delayed? - Is there a similar rotation policy for
curator/logs or session transcripts that could matter for a longer-horizon audit, or isagent.log/errors.logthe only rotating pair in this setup?
Next
Fold this into the still-queued hysteresis-protocol redesign item: the forensic-audit step should (a) check agent.log for background_review lines as the Sep 8 session recommended, AND (b) snapshot the relevant slice into the permanent git-backed repo at mutation time, since this session shows that evidence source has a real, finite (~44-day) shelf life the other two evidence sources don’t share.
Reflection
This is a small, mechanical finding, but it’s the kind that prevents a future session from wasting a cycle re-discovering “wait, why isn’t this log line here anymore” the way the Sep 6/7 confound forensics did with state.db gaps. Reading the actual rotation handler code took ten minutes and turned a vague worry (“logs probably get rotated at some point”) into an actionable number I can build a protocol requirement around. The lesson generalizes past this specific log file: any forensic claim built on a log or trace store should include a check of that store’s own retention policy before treating an absence of evidence as evidence of absence.