🦞
Tutorial

OpenClaw Cron Automation

Schedule tasks, automate workflows, and let your AI work while you sleep. Master the built-in Gateway scheduler.

What is OpenClaw Cron?

OpenClaw Cron is a built-in scheduler that runs inside the Gateway process. It persists across restarts and lets you automate any task on a schedule.

  • Built-in Gateway scheduler - No external dependencies needed
  • Persistent across restarts - Jobs survive Gateway restarts
  • Automate any task - Reminders, reports, checks, deliveries
  • Flexible scheduling - One-shot, intervals, or cron expressions

Three Scheduling Types

at

One-shot timestamp. Runs once at a specific time.

ISO 8601 or relative time

Examples: "2024-12-25T09:00:00Z", "20m", "2h"

every

Fixed intervals in milliseconds. Repeats forever.

Milliseconds interval

Examples: 60000 (1 min), 3600000 (1 hour)

cron

Five-field expressions with timezone support.

Standard cron syntax

Examples: "0 9 * * *", "*/15 * * * *"

Execution Modes

💬 Main Session

Enqueues the event for the next heartbeat. The task runs with full conversation context.

  • +Access to conversation history
  • +Shares context with user interactions
  • -May wait for current turn to complete
🔒 Isolated

Dedicated agent turn in a separate cron:<jobId> session.

  • +Runs immediately, no waiting
  • +Clean slate every execution
  • -No access to main conversation

CLI Examples

Simple Reminder

Set a one-shot reminder that triggers in 20 minutes:

$openclaw cron add --name "Check calendar" --at "20m" --session main --wake now

--at "20m": Runs once, 20 minutes from now
--session main: Uses main conversation context
--wake now: Activates immediately

Daily Job with Delivery

Schedule a daily morning status that delivers to WhatsApp:

$openclaw cron add --name "Morning status" --cron "0 7 * * *" --tz "America/Los_Angeles" --session isolated --message "Summarize inbox" --deliver --channel whatsapp --to "+1555..."

--cron "0 7 * * *": Every day at 7:00 AM
--tz: Timezone for the cron expression
--session isolated: Runs in dedicated session
--deliver: Sends output to a channel

Interval-Based Check

Run a health check every 5 minutes:

$openclaw cron add --name "Health check" --every 300000 --session isolated --message "Check system status"

300000ms = 5 minutes

Cron Expression Reference

Five-Field Format
* * * * *
minhourdaymonthdow
FieldRangeExamples
Minute0-590, 30, */15
Hour0-239, 0, */2
Day of Month1-311, 15, *
Month1-121, 6, *
Day of Week0-6 (0=Sunday)0, 1-5, *
Common Patterns
PatternDescription
0 9 * * *Daily at 9 AM
0 9 * * 1Every Monday 9 AM
*/15 * * * *Every 15 minutes
0 0 1 * *First of month at midnight
0 */2 * * *Every 2 hours
30 8 * * 1-5Weekdays at 8:30 AM

Advanced Features

Model Override

Use a specific model for scheduled tasks:

--model opus

Thinking Level

Control reasoning depth for complex tasks:

--thinking high

Channel Delivery

Send output to messaging platforms:

--deliver --channel telegram --to @username

Telegram Topic Support

Target specific forum topics:

--topic 12345

Managing Jobs

1

List all jobs

$openclaw cron list

Shows all scheduled jobs with their IDs, schedules, and status.

2

Remove a job

$openclaw cron remove <id>

Permanently delete a scheduled job by its ID.

3

Pause and resume

$openclaw cron pause <id>
$openclaw cron resume <id>

Temporarily stop a job without deleting it.

Storage

Cron jobs and their execution history are stored locally:

Jobs:~/.openclaw/cron/jobs.json
History:~/.openclaw/cron/runs/

The runs directory contains timestamped logs for each job execution, useful for debugging and auditing.

Start Automating

Build your first scheduled task and let OpenClaw work while you focus on what matters.