🦞 OpenClaw Bootcamp
DAY 06 / 16
💓
OpenClaw Bootcamp · Day 6

HEARTBEAT.md:
Your Agent Never Sleeps

Your agent can now talk to you on any channel. Today it learns to act without being asked. HEARTBEAT.md is the file that transforms your agent from a chatbot into an autonomous system — running tasks, sending briefings, and monitoring your world while you sleep.

Proactive Automation Scheduled Tasks Works While You Sleep
🦞 OpenClaw Bootcamp
DAY 06 / 16
What We Cover Today

Day 6 Agenda

💡

The Mental Model

Reactive vs proactive. What changes when your agent acts without waiting for input.

🔄

Heartbeat Loop

How the tick cycle works, when HEARTBEAT.md is read, and what happens next.

📄

HEARTBEAT.md Anatomy

File format, what to write, what not to write, and the silence rule.

🌞

Morning Briefing

The most common first automation. How to write it correctly so it runs once and stays quiet.

📊

Monitoring & Research

System checks, news summaries, and recurring research tasks — built step by step.

⏱️

Time-Aware Tasks

How your agent knows what time it is and how to write time-conditional instructions.

💸

Cost & Safety

Token burn risk, how to keep HEARTBEAT.md lean, and the model choice that prevents runaway costs.

🔧

Debugging

Reading the heartbeat log, verifying tasks ran, and fixing a silent agent.

🦞 OpenClaw Bootcamp
DAY 06 / 16
Today’s Goal

By end of day you have three things

01
A working HEARTBEAT.md that sends you a morning briefing automatically every day — no prompt required
02
A clear mental model of the heartbeat loop — tick interval, file read, task execution, channel delivery
03
A lean HEARTBEAT.md that won’t burn tokens — short, specific, silent when there’s nothing to report
🦞 OpenClaw Bootcamp
DAY 06 / 16
60-Second Recap

Day 5 Recap

What You Connected
  • Telegram secured with your user ID allowlist
  • At least one second channel live and tested
  • Cross-channel memory verified — same agent everywhere
  • Voice notes transcribed and processed correctly
Why It Matters Now
  • Your channels are the delivery mechanism for everything HEARTBEAT.md triggers
  • Morning briefings land on Telegram. Alerts hit wherever you are. All set up already.
🦞 OpenClaw Bootcamp
DAY 06 / 16
The Shift

From Reactive to Proactive

Days 1–5: Reactive

You ask → agent responds. You send a Telegram message → agent replies. Every interaction starts with you. The agent is always waiting. Nothing happens unless you initiate it.

You → Agent → Response
Day 6+: Proactive

The Gateway ticks on a schedule. On each tick it reads HEARTBEAT.md, decides what to do, takes action, and delivers results to your channels. You wake up to a briefing you never asked for. That’s the shift.

Tick → Agent → Action → You

This is the difference between a chatbot and an autonomous agent. HEARTBEAT.md is what makes the difference concrete.

🦞 OpenClaw Bootcamp
DAY 06 / 16
Architecture

The Heartbeat Tick Loop

STEP 1
⏱️ Timer fires
Interval set in openclaw.json
(e.g. every 30m or 60m)
STEP 2
📄 Read HEARTBEAT.md
Gateway loads the file as
the agent’s task context
STEP 3
🧠 Agent decides & acts
Calls tools, fetches data,
composes message if needed
STEP 4
📱 Deliver via channel
Pushes to Telegram, WhatsApp,
or stays silent if nothing to report

Set model in the heartbeat config to a cheap model (Haiku / GPT-4o Mini). Without an explicit override, heartbeat uses your default agent model. Set lightContext: true and isolatedSession: true to minimize token load per tick.

🦞 OpenClaw Bootcamp
DAY 06 / 16
Critical Distinction

Schedule in openclaw.json — Tasks in HEARTBEAT.md

// openclaw.json — controls WHEN { "agents": { "defaults": { "heartbeat": { "every": "30m", "model": "claude-haiku-4-5", "target": "last", "lightContext": true, "isolatedSession": true } } } }
openclaw.json controls

How often the tick fires. Which model runs it. target controls delivery ("last" = last active channel). lightContext + isolatedSession keep token costs low.

# HEARTBEAT.md — controls WHAT - Check memory for pending tasks - Send morning briefing at 8am - Monitor system status - Stay silent if nothing to report
HEARTBEAT.md controls

What the agent does on each tick. Plain English bullet points — no special syntax. The agent reads this as its task list for the run. HEARTBEAT.md has no scheduling power of its own.

🦞 OpenClaw Bootcamp
DAY 06 / 16
File Format

HEARTBEAT.md Anatomy

# HEARTBEAT.md # What to do on every heartbeat tick. # Keep this short. Every line costs tokens. - Check memory for any pending tasks and complete them if possible - If it is 8:00am, send a morning briefing to Telegram with: - Today's date and weather - Top 3 tasks from memory - Any calendar events today - If nothing needs attention, stay completely silent
What Works
  • Plain English bullet points
  • Time conditions (“if it is 8am”)
  • Channel directives (“send to Telegram”)
  • Explicit silence rule at the end
  • Short — under 20 lines ideally
What Doesn’t Belong
  • Scheduling syntax (cron, intervals) — that’s openclaw.json
  • Long prose paragraphs — burns tokens every tick
  • Tasks the agent can’t complete autonomously
  • Anything that requires your real-time input
🦞 OpenClaw Bootcamp
DAY 06 / 16
The Most Important Line

The Silence Rule

- If nothing needs attention, stay completely silent.
Without This Line

Your agent sends you a message every 30 minutes confirming there’s nothing to report. Your phone buzzes 48 times a day. You turn off notifications. Your agent is now useless for alerts because you stopped looking. This is the most common beginner mistake.

With This Line

Your agent only reaches out when it has something real to tell you. The channels stay quiet. When a message arrives, you pay attention because you know it’s signal, not noise. The silence rule is what makes proactive alerts valuable.

Under the hood, OpenClaw uses a HEARTBEAT_OK token. When the agent replies with HEARTBEAT_OK, the Gateway strips and drops the message (up to ackMaxChars, default 300). The silence rule in your HEARTBEAT.md causes the agent to emit this token, which the Gateway suppresses.

🦞 OpenClaw Bootcamp
DAY 06 / 16
Example 1

Morning Briefing

# HEARTBEAT.md - If the current time is between 8:00am and 8:30am and you have not sent a morning briefing today, send one to Telegram containing: - Good morning greeting - Today's date (day of week, date) - Top 3 tasks from MEMORY.md - Any calendar events today - One sentence weather summary Mark briefing as sent in memory so it doesn't repeat this tick - Otherwise, stay silent
Key: the “sent today” guard

Tell the agent to mark the briefing as sent in memory after sending. Without this, every tick in the 8:00–8:30 window triggers another briefing. You’d get three or four messages in thirty minutes.

What It Looks Like

You wake up. Telegram has one message. Good morning, today is Wednesday, here are your three priorities, you have a 2pm call, it’s sunny and 68°F. Done. Your day starts with context.

Model Used

Haiku 4.5 ($1/$5 per M tokens) or GPT-4o Mini ($0.15/$0.60 per M). Weather is a web search. Calendar is a tool call. Typical briefing: ~$0.006 on Haiku 4.5, ~$0.001 on GPT-4o Mini.

🦞 OpenClaw Bootcamp
DAY 06 / 16
Example 2

Task Queue Monitor

# HEARTBEAT.md - Check MEMORY.md for any tasks marked as "pending" or "todo" - If a pending task has a due date within the next 2 hours, send an alert to Telegram with the task name and time remaining - If a task is overdue, flag it as urgent and message me - If no tasks are due soon, stay silent
How It Works

On each tick, the agent reads your MEMORY.md, looks for tasks with due dates, calculates time remaining, and only alerts you when the threshold is crossed. Two hours before a deadline, your phone buzzes. Not before.

Adding Tasks

Tell your agent via any channel: “Add to my task list: review the contract by 3pm tomorrow.” The agent writes it to MEMORY.md. The heartbeat loop picks it up on the next tick automatically.

🦞 OpenClaw Bootcamp
DAY 06 / 16
Example 3

System & Server Monitoring

# HEARTBEAT.md - Run a disk space check. If any drive is above 85% full, send an alert to Telegram immediately - Check if key services are running (nginx, postgres). If any are down, alert immediately with service name - If CPU load average has been above 80% for the past two ticks, send a warning - Stay silent if all systems normal
Tools Required

These tasks require tool access: shell execution for disk/CPU checks, process status for service monitoring. Make sure the relevant tools are enabled in your agent config. Shell tool is off by default — enable it explicitly.

Interval Tuning

System monitoring usually warrants a shorter heartbeat interval — 15m or 30m. For a morning briefing only, 60m is fine. Tune your interval to match your most time-sensitive task.

Production Note

For critical infrastructure, dedicated monitoring tools (Datadog, Prometheus) are more reliable. Use heartbeat monitoring for personal projects and convenience alerts, not production SLA requirements.

🦞 OpenClaw Bootcamp
DAY 06 / 16
Example 4

Daily Research Summary

# HEARTBEAT.md - Every day at 7:00pm, search for the top news in AI and crypto from the past 24 hours - Summarize in 5 bullet points, one sentence each - Send the summary to Telegram with the header "Evening Briefing" - Mark as sent so it doesn't repeat on the same day - Otherwise stay silent
Customizing Topics

Replace AI and crypto with whatever you track. Competitors, industry news, stock tickers, arxiv papers, GitHub releases. The agent runs a web search on each tick that matches the time condition, summarizes, and delivers.

Model Consideration

Web search + summarization into 5 bullets works well with Haiku. If you want deeper analysis or synthesis across multiple sources, use an escalation directive: “use the premium model for this task.”

🦞 OpenClaw Bootcamp
DAY 06 / 16
Time Conditions

Writing Time-Aware Instructions

IntentHow to Write ItWatch Out For
Once per day at a time“If it is 8am and briefing not sent today”Missing the “not sent today” guard → repeats every tick
Every tick, always“Check pending tasks” (no time condition)Token burn if the check is expensive
Weekdays only“If it is a weekday morning…”Agent infers from system date — verify timezone is set correctly
Only on an event“If a task is overdue…”Condition must be checkable from memory or a tool call
Interval within day“Every 4 hours, check…”Set heartbeat interval ≤ 4h in openclaw.json first
Timezone

The agent uses the system timezone of the machine running the Gateway. If your server is in UTC and you’re in New York, write times in UTC or specify your timezone explicitly: “at 8am Eastern Time.”

🦞 OpenClaw Bootcamp
DAY 06 / 16
Full Example

A Complete HEARTBEAT.md

# HEARTBEAT.md # Keep this file under 25 lines. It runs every tick. - If it is 8:00am–8:30am and morning briefing not sent today: Send to Telegram: date, top 3 tasks, calendar events, weather. Mark briefing as sent in memory. - If it is 7:00pm and evening news not sent today: Search top AI and tech news from past 24h. Send 5-bullet summary to Telegram. Mark as sent. - Check MEMORY.md for pending tasks due within 2 hours. If any found, alert via Telegram with task name and deadline. - If nothing needs attention, stay completely silent.

This covers morning briefing, evening news, and deadline alerts. Three distinct automations. 14 lines. Token cost per tick when nothing fires: near zero — the agent reads the file, evaluates each condition, finds nothing to do, and exits silently.

🦞 OpenClaw Bootcamp
DAY 06 / 16
Cost Impact

Keeping Heartbeat Lean

Silent tick
Agent reads HEARTBEAT.md, evaluates conditions, finds nothing to do. With lightContext + isolatedSession on Haiku: ~$0.001/tick. Without those flags, context loading alone can cost 10× more.
Briefing tick
Web search + memory read + compose + send. Haiku 4.5: ~$0.005–0.008. GPT-4o Mini: ~$0.001. Either way, pennies per month.
Bad HEARTBEAT
Long file + expensive tasks on every tick + wrong model = $15–30/month on heartbeat alone. This is avoidable.
Do This

Use Haiku / GPT-4o Mini for heartbeat. Keep HEARTBEAT.md under 25 lines. Use time conditions so most ticks are silent. Only escalate to the primary model for tasks that need it.

Avoid This

Heartbeat model set to Opus or GPT-4o. HEARTBEAT.md that runs web searches on every tick unconditionally. Forgetting the silence rule. Not checking the heartbeat log after first setup.

🦞 OpenClaw Bootcamp
DAY 06 / 16
Day 5 + Day 6

Heartbeat Delivers Via Channels

HEARTBEAT.md tells the agent what to do. Your channels from Day 5 determine where the output lands. The two systems are designed to work together.

✈️

Telegram

Best for heartbeat delivery. Push notifications on mobile. Most users route all heartbeat alerts here. Specify: “send to Telegram” in HEARTBEAT.md.

📷

WhatsApp

Works identically. Specify: “send to WhatsApp.” Use if WhatsApp is your primary phone app. Reliable delivery on iOS and Android.

🌐

WebChat Log

Every heartbeat run is logged in the Dashboard. Even silent ticks appear in the log. Open WebChat and check the Heartbeat tab to verify your setup is running.

Specifying the Channel in HEARTBEAT.md

The target key in your heartbeat config controls the default delivery channel. Set it to "last" (your last active channel), a specific channel name, or "none". You can also write channel directives in HEARTBEAT.md itself: “send to Telegram.”

🦞 OpenClaw Bootcamp
DAY 06 / 16
When Things Don’t Work

Reading the Heartbeat Log

Where to Find Logs

Open the Dashboard at localhost:18789 and navigate to the Heartbeat tab. Every tick is logged with a timestamp, status (silent / action taken / error), and the agent’s reasoning. This is the first place to check.

CLI: Live Tail & Last Run
openclaw logs --follow openclaw system heartbeat last

Stream all Gateway logs (including heartbeat) in real time with logs --follow. View the last heartbeat run’s output with system heartbeat last.

Common Issues
  • Briefing repeating — missing “mark as sent” instruction
  • Agent always silent — time condition never matches (check timezone)
  • No ticks at all — heartbeat disabled in openclaw.json or Gateway not running
  • Tool errors — web search or shell tool not enabled; check agent tool config
  • Messages not arriving — channel not enabled or allowlist missing your number
Force a Test Tick

Use openclaw system heartbeat enable / disable to toggle the heartbeat. Check openclaw system heartbeat last to review the most recent tick’s output and verify behavior.

🦞 OpenClaw Bootcamp
DAY 06 / 16
Before Day 7

Day 6 Homework

  • 01

    Write Your First HEARTBEAT.md

    Create ~/.openclaw/workspace/HEARTBEAT.md with at least two tasks: a morning briefing and a silence rule. Keep it under 20 lines. Set the heartbeat interval to 30m in openclaw.json. Set lightContext: true and isolatedSession: true.

  • 02

    Verify with --run-now

    Enable the heartbeat with openclaw system heartbeat enable and wait for the first tick. Run openclaw system heartbeat last to review its output. Confirm the agent evaluated your conditions and stayed silent (since it’s not 8am).

  • 03

    Wake Up to Your First Briefing

    Let the heartbeat run overnight. Tomorrow morning, check Telegram before you open anything else. Your briefing should be there. If it is, your autonomous agent is live. If not, check the heartbeat log and debug.

  • 04

    Add One Monitoring Task

    Add a second automation to your HEARTBEAT.md: a pending task check, a news summary, or a system check — your choice. Verify it works with openclaw system heartbeat last after the next tick. Keep the total file under 25 lines.

🦞 OpenClaw Bootcamp
DAY 06 / 16
🦞
Coming Up

Day 7: SOUL.md
Give Your Agent an Identity

Your agent is autonomous and proactive. But right now it has no identity — it’s just a generic AI. On Day 7 you write SOUL.md: the file that defines who your agent is, how it thinks, what it values, and how it speaks. This is what separates a useful tool from a truly personal agent.

Personality & Tone Values & Priorities Always-On Context