# Automation Four ways to schedule or trigger Claude Code tasks, with OpenClaw equivalents. ## 1. `/loop` - In-session recurring tasks Run a task repeatedly within a single Claude Code session. ``` /loop Run /health-check every 30 minutes ``` **Best for:** Monitoring during active work sessions, watch loops, polling. **OpenClaw equivalent:** `HEARTBEAT.md` pattern - agent checks a file on each tick and executes tasks listed there. ## 2. `CronCreate` - Claude Code built-in cron Claude Code can create system crontab entries directly via the `CronCreate` tool. ``` # In a Claude Code session: Create a cron job that runs /daily-briefing every day at 7 AM ``` Claude calls `CronCreate` and writes the entry to your system crontab. List with `CronList`, remove with `CronDelete`. **Best for:** Simple recurring tasks, no manual crontab editing. **OpenClaw equivalent:** OpenClaw's scheduler daemon with task definitions in config. ## 3. `/schedule` - Remote triggers via claude.ai/code Trigger Claude Code runs remotely through claude.ai/code using the `RemoteTrigger` tool or the web interface. **Best for:** Event-driven automation, triggering from external systems. **OpenClaw equivalent:** OpenClaw's webhook receiver (listens on a local port). ## 4. `launchd` - macOS native scheduler More reliable than cron on macOS. Survives sleep/wake cycles, logs stdout/stderr, and integrates with the macOS service manager. See `daily-briefing.sh` and `launchd-example.plist` in this directory. ```bash # Install: cp launchd-example.plist ~/Library/LaunchAgents/com.example.claude-briefing.plist launchctl load ~/Library/LaunchAgents/com.example.claude-briefing.plist ``` **Best for:** Production schedules on Mac, anything that needs to survive reboots. **OpenClaw equivalent:** Same - OpenClaw also recommends launchd on macOS for its daemon process. ## Comparison | Approach | Setup | Reliability | Use case | |---------------|----------|-------------|-------------------------------| | `/loop` | Zero | Session | Active monitoring | | `CronCreate` | Minimal | Good | Simple recurring tasks | | `/schedule` | Moderate | Good | Remote/event triggers | | `launchd` | Manual | Best on Mac | Production daily jobs |