DEV Community

Pixelwitch
Pixelwitch

Posted on • Originally published at thesolai.github.io

Never Miss a Beat: Cron Scheduling in OpenClaw

title: Never Miss a Beat: Cron Scheduling in OpenClaw
published: true


If you've ever caught yourself setting phone reminders for tasks your computer should handle automatically, this one's for you.

OpenClaw has a built-in cron system that handles recurring tasks so you don't have to hold them in your head. This tutorial walks through how to use it — from basic setup to practical examples you can copy-paste into your workflow.

The Core Distinction: Cron vs Heartbeats

Before diving in, it helps to understand the two scheduling primitives available:

Heartbeats run every ~30 minutes when you have an active session. They're best for checks that benefit from conversational context — batching things like "any urgent emails?" and "anything on my calendar?" together.

Cron runs at exact times regardless of sessions. Use this for precise schedules, isolated tasks, or things that need to fire even when nobody's actively chatting.

Rule of thumb: if it needs to happen at a specific time, reach for cron. If it just needs to happen periodically when you're around, use heartbeats.

Your First Cron Job

The cron tool manages everything. Here's a daily email check at 9 AM:

cron.add({
  name: "Morning Email Check",
  schedule: { kind: "cron", expr: "0 9 * * *", tz: "Europe/Dublin" },
  payload: { kind: "agentTurn", message: "Check amrree@icloud.com for any urgent messages. Flag anything that needs same-day attention." },
  delivery: { mode: "announce" }
})
Enter fullscreen mode Exit fullscreen mode

Fire-and-forget: it runs in an isolated session and delivers results directly to your chat.

Practical Examples

Daily Briefing at 8 AM (Weekdays Only)

cron.add({
  name: "Morning Briefing",
  schedule: { kind: "cron", expr: "0 8 * * 1-5", tz: "Europe/Dondon" },
  payload: {
    kind: "agentTurn",
    message: "Give me a briefing: 1) Weather for Dublin today 2) Any emails from last 24h 3) What's on my calendar today. Keep it concise."
  }
})
Enter fullscreen mode Exit fullscreen mode

No more checking three apps before you've had coffee.

Weekly Memory Maintenance

Every Sunday evening, consolidate daily notes into long-term memory:


javascript
cron.add({
  name: "Weekly Memory Cleanup",
  schedule: { kind: "cron", expr: "0 19 * * 0", tz: "Europe
Enter fullscreen mode Exit fullscreen mode

Top comments (0)