40 files demonstrating every major OpenClaw capability using Claude Code: - 3 agents (researcher, writer, reviewer) - 3 skills (daily-briefing, slack-message, web-research) - 2 security hooks (pre-tool-use blocker, post-tool-use logger) - 10 self-contained examples with copy-paste prompts - Complete feature map (20 capabilities, 11 full match, 7 different, 2 gap) - Security docs including NemoClaw comparison - Automation, messaging, browser, memory documentation Zero dependencies. Clone and run. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2.1 KiB
Example 08: Cron and Scheduled Automation
Capability: Claude Code supports scheduled and automated execution through three complementary mechanisms, covering in-session polling through to system-level cron jobs.
OpenClaw equivalent: HEARTBEAT.md, cron scheduler, webhooks, auto-reply.
Three Approaches
Approach 1: /loop (In-session polling, v2.1.71)
For tasks that should repeat while Claude Code is running:
/loop interval=60
Every 60 seconds, check if a file called 'trigger.txt' exists in this
directory. If it does, read its contents, execute the task described inside,
delete the file, and write the result to 'loop-output.md'. Then wait for
the next trigger.
Use this for development and testing. The loop runs as long as the session is active.
Approach 2: CronCreate (System-level scheduling, v2.1.71)
For tasks that should run on a schedule even when Claude Code is not open:
Create a cron job that runs the 'daily-briefing' skill every morning at 07:00.
Use the automation/daily-briefing.sh wrapper script. Show me the cron entry
before creating it so I can verify it.
Claude Code calls CronCreate to register the job with the system cron daemon.
Use CronList to see all registered jobs and CronDelete to remove them.
The automation/daily-briefing.sh script in this repo is a ready-made wrapper.
Approach 3: /schedule (Remote trigger, web only)
For triggering runs from anywhere, including from a phone:
/schedule "Run the web-research skill on 'latest Anthropic news' and
email me a summary" at 2025-04-01T08:00:00
/schedule is available in the Claude web interface. It queues a headless
Claude Code run for the specified time. Combines with the Telegram permission
relay (v2.1.81) for approval-gated automation.
Why This Matters
OpenClaw uses HEARTBEAT.md as a persistent loop marker. Claude Code achieves
the same outcome with more granularity: /loop for in-process polling, CronCreate
for system scheduling, /schedule for remote triggering. The automation/ directory
in this repo provides macOS launchd examples as an alternative to cron.