Skip to content

Instantly share code, notes, and snippets.

@jai
Created February 7, 2026 09:28
Show Gist options
  • Select an option

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

Select an option

Save jai/c6c2cc006a607c90947a0dc3da976473 to your computer and use it in GitHub Desktop.
Heartbeat wording tweak (context/location conflicts)

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:

    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"
  2. 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
  3. Context calendar maintenance (next ~72 hours):

    • Detect gaps (missing coverage) and seed blocks to maintain continuous location context.
    • Detect overlaps within the context calendar and resolve by shifting/shortening blocks.
    • Detect context/location conflicts with meetings in primary/work calendars and adjust context blocks (never meetings).
  4. Email: Check for important unread personal emails:

    source ~/.profile && export GOG_KEYRING_PASSWORD
    gog gmail search --account jai@govindani.com "is:unread label:inbox" --max 10 --plain
  5. Todoist: Check overdue and today's tasks (exclude med labels):

    td today --json | jq '.results[] | select((.labels[]? != "💊Meds") and (.labels[]? != "💉"))'
  6. For calendar events with a real meeting/task (skip meditation, workouts):

    • Search brain: qmd search "<event summary keywords>"
    • If NO relevant brain entry found AND event is within 12 hours → flag it
  7. Update state tracking (in-memory only) for this run

Alert Format (if items need attention):

📅 **Calendar items needing context:**
- [TIME] EVENT_NAME — no brain entry found

📧 **Unread emails** (if important/urgent):
- [SENDER] SUBJECT

✅ **Overdue tasks:**
- TASK_NAME (due DATE)

Do NOT alert for:

  • Meditation, workouts, habits (🆓 prefix or workout keywords)
  • Items already flagged in last 24 hours
  • Events >12 hours away (will catch them later)
  • Routine/newsletter emails

Context-aware rules (extendable)

State files:

  • ~/.openclaw/workspace/.context-briefings.json — scheduled briefing cron jobs (jobId + start time)
  • ~/.openclaw/workspace/.context-rule-state.json — per-rule memory (last seen meal blocks + pending reminders)

Define each rule with:

  • Trigger window (e.g., look ahead 2h, or evaluate completed blocks)
  • Condition (calendar context / data check)
  • Action (schedule one-shot cron or send reminder next heartbeat)

Rule: Commute block → Briefing

  • Trigger window: Look ahead 2 hours in 🚶 Jai Context
  • Condition: next block summary starts with 🚶 Walk, 🚕 Travel, 🚗 Drive, or 🚆 Transit
  • Action: schedule a one-shot cron to deliver a commute briefing at the block’s start time.
    • Before creating, check for existing cron jobs with name prefix "Briefing: Commute":
      • If a job exists for the same start time, do nothing.
      • If the time changed, delete the old job and create a new one.
    • Track scheduled job IDs in ~/.openclaw/workspace/.context-briefings.json to avoid duplicates.

Rule: Walk‑home reminder time sync

  • Trigger window: Look ahead 6 hours in 🚶 Jai Context
  • Condition: next block summary starts with 🚶 Walk Home
  • Action: if there is a Todoist task for today that includes "walk home" or "stop at" and has no time, set its due time to the walk‑home block start.

Rule: Post‑breakfast → Calorie reminder

  • Trigger window: Evaluate morning workout completion
  • Condition: morning gym block ended; calories not logged
  • Action: send reminder on next heartbeat

Rule: Post‑lunch → Calorie reminder

  • Trigger window: Evaluate recently completed lunch blocks
  • Condition: lunch block ended; calories not logged
  • Action: send reminder on next heartbeat

Rule: Post‑dinner → Calorie reminder

  • Trigger window: Evaluate recently completed dinner blocks
  • Condition: dinner block ended; calories not logged
  • Action: send reminder on next heartbeat

Guidance

  • Only report items that are truly new or changed
  • Do not invent tasks from old chat context
  • If nothing needs attention, reply HEARTBEAT_OK
  • Keep calendar alerts concise — max 3 items per heartbeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment