feat(08-cron-reporting): create archive-stale-sessions.sh with dry-run toggle

- Created ~/.hermes/scripts/archive-stale-sessions.sh (1146 bytes, executable)
- Script has DRY_RUN=true safe default (export only, no prune)
- Export uses date-stamped JSONL filename
- Prune gated behind DRY_RUN=false with --older-than 30 --yes
- set -euo pipefail strict error handling
- Created ~/.hermes/archive/sessions/ archive directory
- Progress echo statements for Telegram delivery
This commit is contained in:
2026-06-15 22:45:14 +08:00
parent 63230edf4d
commit 47d0b80be8
3 changed files with 528 additions and 19 deletions

View File

@@ -49,10 +49,19 @@ Set up daily operational reporting and weekly stale session lifecycle management
- **D-18:** The daily report skill references the existing session skill (Phase 7) and ngn-jira skill (Phase 4) for operations
- **D-19:** The stale archive step uses `no_agent: true` mode (deterministic CLI commands, no LLM cost)
### Technical Corrections from Research
- **`hermes sessions export`** has NO `--older-than` flag — exports ALL sessions, filters by `--source` or `--session-id` only. Archive script must export all then `prune --older-than 30 --yes` to clean up.
- **`hermes sessions prune`** uses `--yes` (not `--confirm`)
- **`hermes sessions list`** has NO `--json` flag
- **Jira-session mapping** lives in hindsight memory (saved by Phase 7 session skill), not in the session DB — cron agent must use `hindsight_recall` to discover which Jira tickets belong to which sessions
- **System timezone already SGT (+08)** — no TZ configuration needed
- **Three cron jobs required**: Daily report (09:00 SGT), weekly stale summary (Sunday 20:00 SGT), weekly archive (Sunday 20:05 SGT — 5 min after summary to avoid race conditions)
### the agent's Discretion
- **Report formatting**: How the Telegram message is structured (sections, bullet points) — planner can design based on Telegram's 4096-char limit
- **Cron job naming**: Standard naming convention for the two cron jobs
- **Dry-run phase**: First archive run should be manual (`hermes sessions export --older-than 30d` then review JSONL before enabling prune)
- **Report formatting**: Telegram message structure — planner designs based on 4096-char limit
- **Cron job naming**: Standard naming convention for the three cron jobs
- **Dry-run phase**: First archive via `hermes sessions export sessions.jsonl` then review JSONL before enabling prune
</decisions>
<canonical_refs>