Skip to main content
Chapter 3 The Soul Architecture: Designing Your Agent's Identity

The Heartbeat File: Giving Your Agent a Pulse

7 min read Lesson 19 / 65 Preview

Heartbeat: from reactive to autonomous

This is the file that turns OpenClaw from "smart chat" into a real employee. Without a Heartbeat, the agent only acts when you talk to it. With one, it acts on a schedule, even when you are asleep.

What a Heartbeat is

A list of recurring "ticks" — each tick fires a small task on a schedule, with a tiny prompt and a budget.

Working example

# Heartbeat

## Tick: morning briefing
- Schedule: 08:55 Mon–Fri (Europe/Amsterdam)
- Budget: 1 USD or 30 seconds
- Prompt: |
    Pull yesterday's commits across my repos.
    Check the inbox for messages flagged "important".
    Write a 5-line briefing and send it to my Telegram.

## Tick: tail-of-day
- Schedule: 18:30 daily
- Budget: 0.50 USD or 20 seconds
- Prompt: |
    Look at sessions from today.
    What was started but not finished?
    Append a "carry-over" note to the journal.

## Tick: midnight cleanup
- Schedule: 03:00 daily
- Budget: 0.25 USD
- Prompt: |
    Rotate sessions older than 7 days into the archive folder.
    Compress logs older than 30 days.
    Report failures only.

Heartbeat rules that keep the bills sane

  1. Always set a budget per tick — token cap or wall-clock cap
  2. Use a cheaper model for ticks (Haiku, Gemini Flash, or local) — covered in chapter 7
  3. Fail loud — every tick should log its outcome; silent failures become invisible costs

Pairing with Hooks

The Heartbeat triggers tasks on a schedule. Hooks (chapter 4) trigger tasks on events ("when a Telegram message arrives", "when a file appears in ~/inbox/"). Most powerful agents use both.

Try it

Add the morning-briefing tick to your Heartbeat. Set the schedule for two minutes from now. Watch it fire. Then move it to its real time.

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support