OpenClawSkills
GitHub
Automation • TutorialHeader.readTime

Cron vs Heartbeat

Guide to choosing between heartbeats and cron jobs for automation.

Both heartbeats and cron jobs allow you to run tasks on a schedule. This guide helps you choose the right mechanism for your use case.

Tutorial.step

Quick decision guide

| Use case | Recommended | Why |

| --- | --- | --- |

| Session | Main | Main (via system event) |

| History | Shared | Shared | Fresh each run |

| Context | Full | Full | None (clean start) |

| Model | Main session model | Main session model | Can override |

| Output | Delivered if not '<code className="bg-white/10 px-1.5 py-0.5 rounded text-emerald-300 text-sm">'HEARTBEAT_OK'</code>' | Heartbeat prompt + event | Summary posted to main |

#

Tutorial.step

When to use main session cron

Use '<code className="bg-white/10 px-1.5 py-0.5 rounded text-emerald-300 text-sm">'--session main'</code>' with '<code className="bg-white/10 px-1.5 py-0.5 rounded text-emerald-300 text-sm">'--system-event'</code>' when you need:

- Reminders/events that appear in main session context

- Agent to process it during next heartbeat with full context

- No separate isolated run

Bash
openclaw cron add   --name "Check project"   --every "4h"   --session main   --system-event "Time for a project health check"   --wake now

#

Tutorial.step

When to use isolated cron

Use '<code className="bg-white/10 px-1.5 py-0.5 rounded text-emerald-300 text-sm">'--session isolated'</code>' when you need:

- Clean slate without prior context

- Different model or thinking settings

- Output delivered directly to channel (summary still posted to main by default)

- History doesn't clutter main session

Bash
openclaw cron add   --name "Deep analysis"   --cron "0 6 * * 0"   --session isolated   --message "Weekly codebase analysis..."   --model opus   --thinking high   --deliver
Tutorial.step

Cost considerations

| Mechanism | Cost profile |

| --- | --- |

| Heartbeat | Runs every N minutes; scales with HEARTBEAT.md size |

| Cron (main) | Adds event to next heartbeat (no isolated turn) |

| Cron (isolated) | Full agent turn per job; can use cheaper models |

<strong>Tips</strong>:

- Keep '<code className="bg-white/10 px-1.5 py-0.5 rounded text-emerald-300 text-sm">'HEARTBEAT.md'</code>' small to minimize token costs.

- Batch similar checks into heartbeat instead of multiple cron jobs.

- Use '<code className="bg-white/10 px-1.5 py-0.5 rounded text-emerald-300 text-sm">'target: &quot;none&quot;'</code>' on heartbeat if you only need internal processing.

- Use isolated cron with cheaper models for routine tasks.

Tutorial.step

Related

- '<a href="/gateway/heartbeat" className="text-emerald-400 hover:text-emerald-300 transition-colors">'Heartbeat'</a>' - Full heartbeat configuration

- '<a href="/automation/cron-jobs" className="text-emerald-400 hover:text-emerald-300 transition-colors">'Cron jobs'</a>' - Full cron CLI and API reference

- '<a href="/cli/system" className="text-emerald-400 hover:text-emerald-300 transition-colors">'System'</a>' - System events + heartbeat control