Skip to main content
OpenClaw runs work in the background through tasks, scheduled jobs, event hooks, and standing instructions. Use this page to pick the right mechanism.

Quick decision guide

Scheduled Tasks (Cron) vs Heartbeat

Use Scheduled Tasks (Cron) when you need precise timing or isolated execution. Use Heartbeat when the work benefits from full session context and approximate timing is fine.

Core concepts

Scheduled tasks (cron)

Cron is the Gateway’s built-in scheduler for precise timing. It persists jobs, wakes the agent at the right time, and can deliver output to a chat channel or webhook endpoint. Supports one-shot reminders, recurring expressions, and inbound webhook triggers. See Scheduled Tasks.

Tasks

The background task ledger tracks all detached work: ACP runs, subagent spawns, isolated cron executions, and CLI operations. Tasks are records, not schedulers. Use openclaw tasks list and openclaw tasks audit to inspect them. See Background Tasks.

Task Flow

Task Flow is the flow orchestration substrate above background tasks. It manages durable multi-step flows with managed and mirrored sync modes, revision tracking, and openclaw tasks flow list|show|cancel for inspection. See Task Flow.

Standing orders

Standing orders grant the agent permanent operating authority for defined programs. They live in workspace files (typically AGENTS.md) and are injected into every session. Combine with cron for time-based enforcement. See Standing Orders.

Hooks

Internal hooks are event-driven scripts triggered by agent lifecycle events (/new, /reset, /stop), session compaction, gateway startup, and message flow. They are discovered from hook directories and managed with openclaw hooks. For in-process tool-call interception, use Plugin hooks. See Hooks.

Heartbeat

Heartbeat is a periodic main-session turn (default every 30 minutes). It batches checklist-style monitoring (inbox, calendar, notifications) in one agent turn with full session context. Heartbeat turns do not create task records and do not extend daily/idle session reset freshness. Heartbeat monitor scratch is small prompt context; schedule recurring work as cron jobs. Empty scratch skips as empty-heartbeat-file. Scheduled heartbeats automatically defer while the main queue or cron work is busy, another reply or embedded run for the same agent is active, or the resolved target session has active or queued work. See Heartbeat.

How they work together

  • Cron handles precise schedules (daily reports, weekly reviews) and one-shot reminders. All cron executions create task records.
  • Heartbeat handles one batched monitoring checklist every 30 minutes; cron owns checks that need independent cadences.
  • Hooks react to specific events (session resets, compaction, message flow) with custom scripts. Plugin hooks cover tool calls.
  • Standing orders give the agent persistent context and authority boundaries.
  • Task Flow coordinates multi-step flows above individual tasks.
  • Tasks automatically track all detached work so you can inspect and audit it.