Skip to content

feat(hermit): daily midnight auto-close + narrow auto-archive skip#133

Merged
gtapps merged 2 commits into
mainfrom
worktree-feat-prop-48
May 24, 2026
Merged

feat(hermit): daily midnight auto-close + narrow auto-archive skip#133
gtapps merged 2 commits into
mainfrom
worktree-feat-prop-48

Conversation

@gtapps
Copy link
Copy Markdown
Owner

@gtapps gtapps commented May 24, 2026

Summary

  • claude-code-hermit: daily midnight auto-close + narrow auto-archive skip

Verification

  • Tests: pass (13.5s) — bash plugins/claude-code-hermit/tests/run-all.sh, 341 passed, 0 failed at HEAD 311b7e1.

Notes

Long-running daemon sessions never archived because the existing 12h-inactivity auto-close in heartbeat-precheck.js never trips when operators chat continuously. With no archives, cross-session learning (reflect, weekly-review, hermit-brain) silently degrades. This PR adds a daily midnight daily-auto-close routine with a 10-min lull check: the routine queues state/pending-close.json if the operator is currently active, then the heartbeat-precheck drains the flag on the next tick where the lull arrives (bypasses active-hours / tick-count / micro-proposal gates).

The closed_via: auto skip in reflect-precheck.js and weekly-review.js's autonomy calc was narrowed from "all auto archives" to "only-empty (operator_turns: 0)" — chatty-daemon midnight closes carry real operator content and now reach the evidence surfaces, while truly empty 12h-inactivity archives still get excluded.

Followups baked in by code-review iteration:

  • heartbeat-precheck drain fail-opens when last-operator-action.json is absent or malformed (treats as "idle indefinitely" per the skill spec).
  • Operator-invoked /session-close now also clears pending-close.json after archive success (was previously only on --auto), so a queued flag can't fire AUTO_CLOSE against the next session.
  • 9 new test fixtures in tests/test-auto-close.sh cover the drain paths, the empty-12h exclusion, and the routine-prompt prefix invariant.

gtapps added 2 commits May 24, 2026 15:49
Daemons stay in_progress for days when operators chat continuously, so the
existing 12h-inactivity close never trips and reflect/weekly-review/brain
silently degrade. Adds a midnight daily-auto-close routine with a 10-min lull
queue/drain: routine queues state/pending-close.json if the operator is
active, heartbeat-precheck drains the flag on the next tick where the lull
appears (bypasses active-hours/tick gates).

The closed_via:auto skip in reflect-precheck and weekly-review's autonomy
calc is narrowed to only-empty archives (operator_turns:0); daily-lull
closes with real operator content now reach the evidence surfaces. Also
clears pending-close.json on operator-invoked /session-close so a queued
flag can't fire AUTO_CLOSE against the next session.
…chive predicate

Addresses review feedback on the daily-auto-close bridge (PR #133):
- Move the pending-close drain above the HEARTBEAT.md SKIP gates so it fires
  at tick cadence even when HEARTBEAT.md is absent or has no checklist items.
- Guard the missing-last-op fail-open on queued_at being within 24h, so a
  stale flag from a crashed prior session can't auto-close a fresh session
  whose last-op clock has not yet been seeded.
- Extract the duplicated `closed_via:auto && operator_turns:0` predicate into
  a shared isEmptyAutoArchive helper consumed by reflect-precheck and
  weekly-review.
- Fix the session-close doc seam (auto-close path now references step 8
  explicitly instead of duplicating the cleanup prose) and hoist the
  duplicated HERMIT_NOW resolution to module scope.

5 new drain tests cover the moved gate, the staleness guard, and the
unaffected lull-check path.
@gtapps gtapps changed the title claude-code-hermit: daily midnight auto-close + narrow auto-archive skip feat(hermit): daily midnight auto-close + narrow auto-archive skip May 24, 2026
@gtapps gtapps merged commit 940ee02 into main May 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant