setting-up-cron-jobs
Setting Up Cron Jobs for Automated Workflows in OpenClaw
As an OpenClaw user, you're already ahead of the curve when it comes to leveraging AI for automation. But to truly unlock its potential, you need to move beyond manual commands and embrace scheduled automation. That's where cron jobs come in.
Cron is OpenClaw's built-in scheduler—a powerful mechanism that allows you to automate repetitive tasks, schedule reminders, and run background operations without lifting a finger. Whether you're sending daily summaries, monitoring systems, or triggering complex multi-step workflows, cron jobs are the backbone of a hands-off, intelligent assistant.
Why Use Cron?
Before diving into setup, it's worth asking: why cron instead of other methods?
- Persistence: Jobs survive agent restarts because they're stored on the Gateway host at
~/.openclaw/cron/jobs.json. This means your automation keeps running even if you restart your machine or update OpenClaw. - Two execution modes: Choose between main session jobs (which run during the next heartbeat with full context) and isolated jobs (which run in a fresh session—ideal for noisy background tasks).
- Flexible triggers: Schedule jobs using one-shot timestamps, fixed intervals, or traditional cron expressions with optional timezone support.
- Delivery control: Isolated jobs can announce their results directly to your preferred channel (Slack, WhatsApp, etc.) without cluttering your main chat history.
Compared to heartbeat-based checks, cron gives you precision timing. Use heartbeat when batch processing makes sense (e.g., "check email and calendar together every 30 minutes"). Use cron when you need exact timing ("run a backup every night at 2:00 AM EST").
Job Structure: The Anatomy of a Cron Job
Every cron job consists of three core components:
- Schedule: When the job should run
- Execution environment: Where it runs (main vs isolated session)
- Payload: What it does when triggered
Let's break these down.
1. Scheduling Your Job
You have three options for defining when your job runs:
One-shot reminder (at)
Perfect for deadlines, appointments, or follow-ups. Use an ISO 8601 timestamp:
--at "2026-02-15T16:30:00Z"
If no timezone is specified, the timestamp is interpreted as UTC. For local times, either convert to UTC or use the --tz flag.
Repeating at fixed intervals (every)
Ideal for polling services or running health checks. Specify milliseconds:
--every 3600000 # Every hour
--every 900000 # Every 15 minutes
Traditional cron syntax (cron)
For complex recurrence patterns, use the familiar five-field cron expression:
--cron "0 7 * * *" # Every day at 7:00 AM
--cron "*/30 * * * *" # Every 30 minutes
--cron "0 12 * * 1" # Every Monday at 12:00 PM
Add --tz "America/New_York" to anchor the schedule to a specific timezone.
2. Choosing Execution Context
OpenClaw offers two execution modes:
Main Session Jobs
These enqueue a system event and run during the next heartbeat. They have access to your full conversation history and context. Use this when you want actions tied to your main assistant's state:
--session main
--system-event "Check today's calendar and send summary"
Isolated Jobs
These run in a dedicated, fresh session (cron:<jobId>). No prior conversation history. Perfect for self-contained tasks that shouldn't interfere with your main flow:
--session isolated
--message "Generate daily report"
Isolated jobs are generally safer for frequent operations and are the default choice for most automated workflows.
3. Defining the Payload
What happens when your job triggers?
For main sessions, use --system-event to inject text as a system prompt. This gets processed like any heartbeat.
For isolated sessions, use --message to define the agent's starting prompt. You can override the model and thinking level:
--model "opus" --thinking high
Creating Your First Cron Job
Let's walk through setting up a practical example: a daily morning briefing.
openclaw cron add \
--name "Morning Brief" \
--cron "0 7 * * *" \
--tz "America/New_York" \
--session isolated \
--message "Summarize today's calendar, unread emails, and critical tasks from Notion." \
--announce \
--channel whatsapp \
--to "+15555550123"
This job:
- Runs every day at 7:00 AM Eastern Time
- Executes in an isolated session
- Asks the agent to summarize key priorities
- Announces the result directly to your WhatsApp
- Posts a brief summary to your main chat for continuity
Managing Existing Jobs
Once your jobs are running, you'll want to monitor and adjust them.
List all jobs:
openclaw cron list
Check run history:
openclaw cron runs --id <job-id> --limit 10
Edit a job (e.g., change the message or schedule):
openclaw cron edit <job-id> --message "New prompt text"
Run a job immediately (useful for testing):
openclaw cron run <job-id>
Disable or remove:
openclaw cron disable <job-id>
openclaw cron rm <job-id>
Delivery: Announce vs. Internal
By default, isolated jobs use --announce, which delivers output directly to your specified channel and posts a summary to the main session. If you prefer silent background jobs, add --no-deliver:
openclaw cron add ... --no-deliver
This keeps everything internal—perfect for jobs that write to files or databases without needing human notification.
Pro Tips for Reliable Automation
- Use exponential backoff wisely: OpenClaw automatically applies retry backoff (30s → 1m → 5m → 15m → 60m) after consecutive failures. This prevents spam during outages and resets after the next success.
- Prefer isolated jobs for automation: They're more predictable and don't risk interfering with your main assistant's state.
- Test with
--announcefirst: Even if you plan to use--no-deliver, start with announcements enabled to verify everything works. - Leverage model overrides: Use
--model opusand--thinking highfor jobs requiring deep analysis, while lighter tasks can run on cheaper/faster models. - Consider job cleanup: One-shot jobs auto-delete after running (unless
--keep-after-runis used). Recurring jobs persist until manually removed.
Conclusion
Cron jobs transform OpenClaw from a reactive assistant into a proactive operations center. By scheduling regular check-ins, automated reports, and system monitors, you create an environment where information comes to you—when you need it, how you want it.
Start small: a daily summary, a weekly review, or a critical reminder. As you gain confidence, layer in more complex workflows. Remember, the goal isn't just automation for automation's sake—it's about creating space for higher-level thinking by offloading the routine.
With cron, your assistant doesn't just wait for commands. It anticipates needs, watches for opportunities, and acts autonomously—making you not just faster, but fundamentally more effective.
Enjoyed this article?
Join the ClawMakers community to discuss this and more with fellow builders.
Join on Skool — It's Free →