# HEARTBEAT.md

# Minimal proactive checks (6-hour cadence via LaunchAgent)
# Keep this list small and operational.

1) Gateway health
- Command: openclaw gateway status
- Suppression: ignore the known THR-18 service-config warning about embedded `OPENCLAW_GATEWAY_TOKEN` / reinstall recommendation when runtime is running and RPC probe is ok
- Log alert condition if runtime is not running or RPC probe is not ok

2) Session count sanity
- Command: openclaw sessions | wc -l
- Baseline: 5–25 sessions is normal during active operation
- Alert condition: count > 30 (indicates session accumulation without pruning)
- Alert condition: count > 50 (high-water; stale sessions have built up — run ops-session-prune)
- Baseline derived 2026-04-06: heartbeat reports consistently showed ~17 during normal ops; 36–50 observed during accumulation periods; current live count at audit time was 9

## End-of-Session Self-Check
Run this before ending any session. Keep it under one minute.

1. Memory write check
- Confirm `memory/YYYY-MM-DD.md` has at least one entry for today.
- If nothing has been written yet, add a concise entry before ending the session.

2. Long-term retention check
- Review whether anything from this session should be promoted to `MEMORY.md`.
- If yes, flag it for curation or update `MEMORY.md` now.

3. Active thread check
- Confirm `active-thread.md` reflects the current thread state.
- Update it if the session changed the active topic, blockers, or next action.

4. Unresolved items check
- Identify anything important that should not be left only in conversation.
- Capture it in memory or the appropriate workspace file before ending.

5. Final state check
- Verify the session ends with no important open loop left uncaptured.
- If an item is still unresolved, write the next action down explicitly.
