--- phase: 08-cron-reporting plan: 02 subsystem: cron tags: [hermes, cron, session, archive, telegram, stale-sessions] # Dependency graph requires: - phase: 07-main-session-skill provides: session skill loaded by weekly summary cron for session structure and hysteresis recall of Jira keys - phase: 08-cron-reporting plan: 01 provides: archive-stale-sessions.sh script for deterministic no_agent archive provides: - ngn-weekly-stale-summary cron — skill-backed weekly stale session summary (Sunday 20:00 SGT) - ngn-weekly-archive cron — no_agent deterministic archive (Sunday 20:05 SGT, 5 min after summary) affects: - Phase 9 (tool provisioning) if archive verification requires adjustments # Tech tracking tech-stack: added: [] patterns: - Skill-backed cron with --skill session for LLM-guided stale session summary - no_agent cron with --script archive-stale-sessions.sh for deterministic CLI archive - 5-minute offset between complementary cron jobs to avoid race conditions key-files: created: - Hermes cron job: ngn-weekly-stale-summary (skill-backed, Sunday 20:00 SGT) - Hermes cron job: ngn-weekly-archive (no_agent, Sunday 20:05 SGT) modified: [] key-decisions: - "Weekly summary cron is skill-backed (--skill session) for understanding session structure and Jira-session mapping via hysteresis" - "Weekly archive cron is no_agent (--no-agent --script archive-stale-sessions.sh) for deterministic CLI operations with no LLM cost" - "Archive runs 5 min AFTER summary (20:05 vs 20:00) to prevent race condition where prune deletes sessions the summary agent is enumerating" - "Summary cron prompt instructs agent to: use 'hermes sessions export -' (not list --json), discover Jira keys via hysteresis_recall, and report only with no Jira mutations (per D-10/D-15)" - "Archive runs in DRY_RUN=true mode by default (script from Plan 1) — export-only until user flips to enable pruning" patterns-established: - "Complementary cron offset: summary at :00, archive at :05 — prevents prune-from-underneath during summary enumeration" - "no_agent archive: hermes cron create --no-agent --script 'schedule' — deterministic CLI operations registered as cron jobs" requirements-completed: [CRON-02, CRON-03] duration: ~1 min completed: 2026-06-15 --- # Phase 8 Plan 2: Weekly Stale Summary + Archive Cron Summary **Two weekly cron jobs registered: ngn-weekly-stale-summary (Sunday 20:00 SGT, skill-backed) and ngn-weekly-archive (Sunday 20:05 SGT, no_agent with archive-stale-sessions.sh) — completing the stale session lifecycle and Jira-awareness reporting** ## Performance - **Duration:** ~1 min - **Started:** 2026-06-15T14:46:32Z - **Completed:** 2026-06-15T14:47:26Z - **Tasks:** 2 - **Files modified:** 2 (Hermes cron DB entries — outside project repo) ## Accomplishments - Registered `ngn-weekly-stale-summary` cron at Sunday 20:00 SGT with `--skill session` — LLM agent loads session skill to understand session structure, enumerate stale sessions via JSONL export, discover Jira ticket keys via hysteresis_recall, and compose Telegram summary (no Jira mutations per D-10/D-15) - Registered `ngn-weekly-archive` cron at Sunday 20:05 SGT with `--no-agent --script archive-stale-sessions.sh` — deterministic CLI archive that exports sessions to JSONL and optionally prunes stale ones (DRY_RUN=true default from Plan 1) - 5-minute offset between summary (20:00) and archive (20:05) prevents race condition where prune could delete sessions the summary agent is still enumerating - Both cron jobs visible in `hermes cron list` with correct schedules - Test-run of both jobs succeeded without CLI errors - Requirements CRON-02 (weekly archive) and CRON-03 (Jira-awareness in reports) both addressed ## Task Commits Each task was committed atomically: 1. **Task 1: Register weekly stale session summary cron (Sunday 20:00 SGT, skill-backed)** — `90214dd` (feat) 2. **Task 2: Register weekly archive cron (Sunday 20:05 SGT, no_agent)** — `2faeb0a` (feat) **Plan metadata:** See final metadata commit. _Note: Cron jobs are registered in Hermes internal DB — committed with --allow-empty descriptors._ ## Files Created/Modified - Hermes cron DB: `ngn-weekly-stale-summary` job (schedule: `0 20 * * 0`, skills: session, delivery: telegram, prompt: stale session summary with Jira discovery) - Hermes cron DB: `ngn-weekly-archive` job (schedule: `5 20 * * 0`, mode: no-agent, script: archive-stale-sessions.sh, delivery: telegram) ## Decisions Made - **Skill-backed summary vs no_agent archive**: The summary cron uses `--skill session` because it needs LLM reasoning to understand session structure, identify stale sessions, and compose natural-language Telegram messages. The archive cron uses `--no-agent` because it only runs deterministic CLI commands (export + prune) with no LLM cost. - **5-minute offset**: Archive at 20:05, 5 minutes after summary at 20:00. This follows RESEARCH.md Anti-Patterns guidance — prevents race condition where the prune could remove sessions the summary agent is still enumerating. - **Prompt detail**: Full 5-step prompt embedded in summary cron — agent receives complete instructions for stale session discovery via JSONL export, Jira key lookup via hysteresis_recall, Telegram composition with 4096-char limit, and explicit prohibition against Jira mutations. ## Deviations from Plan None — plan executed exactly as written. ## Issues Encountered - None. Both cron registrations succeeded on first attempt. ## Threat Flags None — all threat mitigations from the plan's threat model are satisfied: - T-08-06 (Tampering — weekly stale summary cron prompt): Accepted — prompt is authored during plan execution, not user-controllable. - T-08-07 (Repudiation — stale session prune): Mitigated — archive script's DRY_RUN=true default means no prune until user flips the flag; timestamped JSONL exports serve as audit trail. - T-08-08 (Denial of Service — race condition): Mitigated — archive at 20:05 (5 min after summary at 20:00), preventing prune-from-underneath during summary enumeration. ## Next Phase Readiness - Stale session lifecycle complete: summary (Sunday 20:00 SGT) + archive (Sunday 20:05 SGT) automated - Daily report already running at 09:00 SGT from Plan 1 - Phase 8 complete — all three cron jobs registered (daily report, weekly summary, weekly archive) - User should verify first archive dry-run output and set `DRY_RUN=false` in `archive-stale-sessions.sh` to enable pruning --- *Phase: 08-cron-reporting* *Completed: 2026-06-15*