Skip to content

Instantly share code, notes, and snippets.

@jai
Created February 9, 2026 07:04
Show Gist options
  • Select an option

  • Save jai/50a0f5d74f1a9a1b4aa27f0d46342bfa to your computer and use it in GitHub Desktop.

Select an option

Save jai/50a0f5d74f1a9a1b4aa27f0d46342bfa to your computer and use it in GitHub Desktop.
OpenClaw heartbeat prompts: current vs streamlined proposals + overlap recommendations

Current: /root/.openclaw/workspace-health/HEARTBEAT.md

# HEARTBEAT.md - Health Agent

## Health Protocol Check (Every Heartbeat)

### Medication & Supplement Tracking
- Todoist meds scan (💊Meds + 💉)

### Workout Check
- Hevy via mcporter (optional)

### Calendar Departure Alerts
- Pull calendars (json) and alert for workouts/medical in next 15–60 min

### Meal Logging Check
- At 9/14/21: query sqlite for calories/protein and nudge if missing

### Health Data Check
- health-ingest ingest + summary
- thresholds for sleep/HRV/RHR/SpO2

## Guidance
(…)

Proposed streamlined HEALTH heartbeat (every 3h)

Principle: hourly-ish nudges only; heavy health-ingest work should be cron-gated.

# HEARTBEAT.md (streamlined)

## 1) Meds only
- Todoist: meds due/overdue (labels 💊Meds, 💉)
- Alert only if something is due/overdue.

## 2) Next departure nudge (next 60 min)
- Check calendars for next 60 min.
- Only alert for:
  - workouts
  - doctor/medical
- No JSON dumps; just find next matching event.

## 3) Meal logging nudges (time-gated)
- Only at 09:00, 14:00, 21:00.
- Query sqlite for calories logged in meal window.

## 4) Heavy health ingest is NOT part of heartbeat
- Rely on existing cron job(s):
  - health-data-ingest (hourly)
  - Daily Brain Health Update

If nothing: HEARTBEAT_OK

Current: /root/.openclaw/workspace/HEARTBEAT.md

# HEARTBEAT.md

## Memory Flush (Every Heartbeat)
If any important information was shared since the last memory write:
- Append to memory/YYYY-MM-DD.md (use today's date in filename)
- AND append to the relevant brain file if found (use `qmd search` to match)
- Include: decisions, preferences, facts, project updates, user requests to remember

## Calendar, Email & Todoist Scan (Hourly)

### Steps:
1. **Calendars**: Fetch personal + work calendar events for next 24 hours:
   ```bash
   source ~/.profile && export GOG_KEYRING_PASSWORD
   END=$(date -d "+1 day" +%Y-%m-%d)
   gog calendar events primary --account jai@govindani.com --from today --to "$END"
source ~/.profile && export GOG_KEYRING_PASSWORD
END=$(date -d "+1 day" +%Y-%m-%d)
gog calendar events primary --account jai.g@ewa-services.com --from today --to "$END"
  1. Context calendar (location blocks):

    source ~/.profile && export GOG_KEYRING_PASSWORD
    END=$(date -d "+3 days" +%Y-%m-%d)
    gog calendar events c_eef4279a66c6d8b67619cfdbf6420c08888c4d54a24eced1567de726e268ce68@group.calendar.google.com --from today --to "$END" --account jai@govindani.com --plain
  2. Context calendar maintenance (next ~72 hours):

    • Fetch context events as JSON:
      • gog calendar events ... --json
    • Parse timeline, detect gaps >15m and create blocks.
    • Resolve overlaps.
    • Resolve conflicts with meetings (modify context blocks only).
    • Notify Jai of any context-block changes.
  3. Email: gog gmail search --account jai@govindani.com "is:unread label:inbox" --max 10 --plain

  4. Todoist: td today --json | jq ...

  5. Brain lookup for real meetings/tasks within 12h.

Alert Format

(…)

Context-aware rules (extendable)

  • Commute block → briefing (cron)
  • Walk-home reminder time sync
  • Post-meal calorie reminders

Guidance

(…)

Proposed streamlined MAIN heartbeat (every 3h)

Goals:

  • Reduce external API calls + token load.
  • Keep the same useful outcomes: upcoming real events, urgent unread emails, overdue/today tasks, and context-calendar sanity.
# HEARTBEAT.md (streamlined)

## Memory Flush
- Only write memory if something durable changed since last run.

## 1) Upcoming (next 6h)
- Personal calendar: next 6h only
- Work calendar: next 6h only
- Output: only non-routine items and meetings starting within 6h.

## 2) Context calendar sanity (lightweight)
- Fetch context calendar (plain) for next 24h.
- Check only:
  - overlaps inside context
  - gaps > 30 min
- If clean: do nothing.
- If broken: report "Context calendar needs repair" with first gap/overlap window.
  - Do NOT auto-repair here (repair can be a separate on-demand command / manual trigger).

## 3) Email (important only)
- Gmail: unread inbox max 10.
- Only surface:
  - billing/payment failures
  - infrastructure alerts (Sentry/Hetzner)
  - anything from known humans

## 4) Todoist (today/overdue)
- `td today --json` (exclude meds labels)
- Only show:
  - overdue
  - due today with time within next 6h

## 5) Brain lookup (only if needed)
- Only run qmd search for:
  - meetings within next 6h
  - and only if title not obviously routine

### Output rules
- Max 3 bullets per section.
- If nothing: HEARTBEAT_OK

Heartbeat + Cron Streamlining Recommendations (2026-02-09)

What’s currently heavy / overlapping

Main heartbeat

  • Does many external calls each run (2 calendars + context calendar + JSON maintenance + Gmail + Todoist + qmd search).
  • Context calendar repair work is the most complex and easiest to spam (creates/updates many events).

Health heartbeat vs health crons

Enabled crons:

  • health-data-ingest (hourly): systemEvent to run health-ingest ingest.
  • Daily Brain Health Update (daily): systemEvent that asks for ingest + metrics + update brain.

Health heartbeat also includes ingest + sqlite + calendar checks. This is redundant: ingest/summary should be cron-driven; heartbeat should be lightweight nudges.

Work triage overlap

Enabled cron:

  • FINN Work Triage (8/12/16) runs finn-triage and pushes to Telegram. This overlaps with any FINN heartbeat/triage logic. Recommendation: keep one source of FINN triage:
  • Prefer the cron (predictable, 3×/day) and make FINN heartbeat minimal (or disable FINN heartbeat entirely).

Recommendations

  1. Keep main heartbeat at 3h, and remove/disable automatic context-calendar repair from heartbeat.

    • Replace with a separate command/flow: "repair context calendar" on-demand.
  2. Keep health heartbeat at 3h, and remove ingest/summary from heartbeat.

    • Use cron jobs for ingest + daily brain updates.
  3. FINN triage: keep the existing cron job (8/12/16). Ensure FINN agent heartbeat does not also run heavy triage.

  4. Reduce retries/failover noise during provider cooldown:

    • When Anthropic is in cooldown, don’t trigger multiple agent heartbeats at once.

Next actions

  • Update main + health heartbeat interval to 3h (DONE).
  • Edit HEARTBEAT.md prompts to streamlined versions (proposed in gist).
  • Review FINN agent heartbeat schedule vs FINN Work Triage cron.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment