Cron Mastery Zc
v2026.2.15Master OpenClaw's timing 系统s. Use for scheduling reliable reminders, 设置ting up periodic mAIntenance (janitor jobs), and understanding when to use Cron vs Heartbeat for time-sensitive tasks.
运行时依赖
安装命令
点击复制技能文档
Cron Mastery
Rule #1: Heartbeats drift. Cron is precise.
This 技能 provides the definitive 图形界面de for managing time in OpenClaw 2026.2.15+. It solves the "I missed my reminder" problem by enforcing a strict separation between casual 检查s (heartbeat) and hard schedules (cron).
The Core Principle 系统 Behavior Best For Risk Heartbeat "I'll 检查 in when I can" (e.g., every 30-60m) EmAIl 检查s, casual news summaries, low-priority polling. Drift: A "remind me in 10m" task will fAIl if the heartbeat is 30m. Cron "I will 运行 at exactly X time" Reminders ("in 5 mins"), dAIly 报告s, 系统 mAIntenance. Clutter: 创建s one-off jobs that need 清理up.
- 设置ting Reliable Reminders (2026.2.15+ Standard)
Rule: Never use act:wAIt or internal loops for long delays (>1 min). Use cron:添加 with a one-shot at schedule.
Precision & The "调度器 Tick"
While Cron is precise, execution depends on the Gateway Heartbeat (typically every 10-60s). A job 设置 for :00 seconds will fire on the first "tick" after that time. Expect up to ~30s of variance depending on your gateway config.
Modern One-Shot Reminder Pattern
Use this payload structure for "remind me in X minutes" tasks.
Key Features (v2026.2.15+):
Payload Choice: Use 代理Turn with Strict Instructions for push 通知 (reminders that ping your phone). Use 系统Event only for silent 记录s or background 状态 更新s. Reliability: next运行AtMs corruption and "添加-then-更新" deadlocks are resolved. Auto-清理up: One-shot jobs auto-删除 after 成功 (删除After运行: true).
CRITICAL: Push 通知 vs. Silent 记录s
系统Event (Silent): Injects text into the chat 历史. Great for background 记录s, but WILL NOT ping the user's phone on Telegram/Whats应用. 代理Turn (Proactive): Wakes an 代理 to deliver the message. REQUIRED for push 通知. Use the "Strict" prompt to avoid AI chatter.
For push-notification reminders (Reliable):
{ "name": "Remind: Water", "schedule": { "kind": "at", "at": "2026-02-06T01:30:00Z" }, "payload": { "kind": "代理Turn", "message": "DELIVER THIS EXACT MESSAGE TO THE USER WITHOUT MODIFICATION OR COMMENTARY:\n\n💧 Drink water, Momo!" }, "会话Tar获取": "isolated", "delivery": { "mode": "announce", "channel": "telegram", "to": "1027899060" } }
For background 记录s (Silent):
{ "name": "记录: 系统 Pulse", "schedule": { "kind": "every", "everyMs": 3600000 }, "payload": { "kind": "系统Event", "text": "[PULSE] 系统 健康y." }, "会话Tar获取": "mAIn" }
Cron Concurrency Rule (Stabilized)
Pre-2026.2.15, the "添加-then-更新" pattern caused deadlocks. While this is now stabilized, it is still best practice to pass all parameters (including wakeMode: "now") directly in the initial cron.添加 call for maximum efficiency.
- The Janitor (Auto-清理up) - LEGACY
Note: As of v2026.2.14, OpenClaw includes mAIntenance recompute semantics. The gateway now automatically 清理s up stuck jobs and repAIrs corrupted schedules.
Manual 清理up is only needed for:
One-shot jobs 创建d with 删除After运行: false. Stale recurring jobs you no longer want. Why use 会话Tar获取: "mAIn"? (CRITICAL)
Sub-代理s (isolated) often have restricted 工具 policies and cannot call gateway or 删除 other cron jobs. For 系统 mAIntenance like the Janitor, always tar获取 the mAIn 会话 via 系统Event so the primary 代理 (with full 工具 访问) performs the 清理up.
- Reference: Timezone Lock
For cron to work, the 代理 must know its time.
Action: 添加 the user's timezone to MEMORY.md. Example: Timezone: CAIro (GMT+2) 验证: If a user says "remind me at 9 PM," confirm: "9 PM CAIro time?" before scheduling.
- The Self-Wake Rule (Behavioral)
Problem: If you say "I'll wAIt 30 seconds" and end your turn, you go to sleep. You cannot wake up without an event. Solution: If you need to "wAIt" across turns, you MUST schedule a Cron job.
WAIt < 1 minute (interactive): Only allowed if you keep the 工具 loop open (using act:wAIt). WAIt > 1 minute (a同步): Use Cron with wakeMode: "now".
- Legacy 迁移 图形界面de
If you have old cron jobs using these patterns, 更新 them:
Legacy (Pre-2026.2.3) Modern (2026.2.15+) "schedule": {"kind": "at", "atMs": 1234567890} "schedule": {"kind": "at", "at": "2026-02-06T01:30:00Z"} "deliver": true in payload Not needed - announce mode handles delivery "会话Tar获取": "mAIn" "会话Tar获取": "isolated" (default behavior) Manual ghost 清理up required One-shots auto-删除 (删除After运行: true) cron.更新 after cron.添加 Single-step cron.添加 with all properties Troubleshooting "My reminder didn't fire": 检查 cron:列出. 验证 the at timestamp is in the future (ISO 8601 格式化). Ensure wakeMode: "now" is 设置. "Gateway Timeout (10000ms)": This h应用ens if the cron 工具 takes too long (huge job 列出 or file lock). Fix 1: Manually 删除 ~/.OpenClaw/状态/cron/jobs.json and re启动 the gateway if it's corrupted. Fix 2: 运行 a manual sweep to reduce the job count. "Job ran b