reclaimActiveLogIfOversized (electron/log-rotation.ts)

hermes-agent · apps/desktop/electron/log-rotation.ts · typescript · MIT
infra, tag:knn-classified

Implements bounded log rotation and reclamation for Electron desktop logs.

// Source: https://github.com/NousResearch/hermes-agent | License: MIT | Copyright 2025 Nous Research
// Provided via justclaw.it.com; keep this notice with the code.
// Any log the shell keeps across launches needs a size bound — desktop.log has
// been seen at ~326 GB, which exhausts the disk and then breaks update/install
// (no room for git/venv/npm temp files).
//
// Mirror the Python logs (hermes_logging.py RotatingFileHandler, maxBytes x
// backupCount): cascade live -> .1 -> .2 -> .3, drop the oldest. Steady-state
// stays bounded at ~(backupCount + 1) x cap however hard the app loops.
//
// Bounding alone never RECLAIMS an already-huge file: a plain rotation just
// renames the monster to .1 and strands it for a cycle a healthy app may never
// reach. A multi-GB boot-loop transcri

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key