mirror of
https://github.com/LeoYeAI/openclaw-master-skills.git
synced 2026-08-14 00:48:08 +00:00
2.4 KiB
2.4 KiB
Afterself Heartbeat Check
Run the state check and act accordingly.
Step 1: Load state
node {baseDir}/scripts/state.js status
Read the switchState field from the response.
Step 2: Route by state
If disabled or completed
- Nothing to do. HEARTBEAT_OK
If triggered
- Executor should be running. Check
executorProgressfor stuck actions. IfcurrentActionhasn't changed in multiple heartbeats, log a warning. HEARTBEAT_OK
If armed
- Run:
node {baseDir}/scripts/state.js is-overdue - If
overdue: false→ HEARTBEAT_OK - If
overdue: true→ Send a check-in ping to the owner on all configured channels. Then run:node {baseDir}/scripts/state.js record-ping
If warning
- Run:
node {baseDir}/scripts/state.js is-warning-expired - If
expired: false→ Send another reminder to the owner. HEARTBEAT_OK - If
expired: true→ Begin escalation:- Run
node {baseDir}/scripts/state.js begin-escalation - Load contacts from
node {baseDir}/scripts/state.js config get heartbeat.escalationContacts - Send each contact the escalation message from
{baseDir}/references/escalation-protocol.md - Log:
node {baseDir}/scripts/state.js audit escalation "contacts_notified"
- Run
If escalating
- Run:
node {baseDir}/scripts/state.js escalation-status - Check the
decisionfield:"stand_down"→ Runnode {baseDir}/scripts/state.js stand-down. Notify owner their contacts confirmed they're okay."trigger"→ Runnode {baseDir}/scripts/state.js trigger. Begin executor (see SKILL.md Executor section)."waiting"→ Check if escalation timeout has expired. If timeout exceeded with no responses → runnode {baseDir}/scripts/state.js trigger. Otherwise → HEARTBEAT_OK, wait for responses.
Step 3: Ghost check
If ghost mode is active (ghostState: "active" or "fading"):
- Run:
node {baseDir}/scripts/state.js ghost-decay-check - If
shouldRespond: falseandprobability: 0→ Ghost has fully faded. Update:node {baseDir}/scripts/state.js update ghostState "retired". Log:node {baseDir}/scripts/state.js audit ghost "retired"
Step 4: Mortality pool check
If mortalityPool.enabled is true and state is armed:
- Run:
node {baseDir}/scripts/mortality.js check-balance - If balance changed since last check, the state is updated automatically by the script
- (Nudging the user to buy tokens happens on owner check-in, not during heartbeat)