微算力 · API 导航与自营网关
API 接入 EN
未登录登录
⏰

精确调度,告别漂移提醒

Cron Mastery · v1.0.3
入口已确认,内容待校验 文件树里有 SKILL.md,但正文还没采回,frontmatter 未核对。
专业技能 安全 S+ 级 作者 i-mw 公开目录收录
16.1k 下载 34 安装 63.5k 收藏 63 浏览

简介

OpenClaw定时任务权威指南,精确区分Cron与Heartbeat适用场景,解决"错过提醒"痛点,2026.2.15+版本标准实践

原始描述

Master OpenClaw's timing systems. Use for scheduling reliable reminders, setting up periodic maintenance (janitor jobs), and understanding when to use Cron v...

通过你的 Agent 添加

安装目录:cron-mastery/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/cron-mastery/
Codex CLI~/.codex/skills/cron-mastery/
DeepSeek Harness~/.agents/skills/cron-mastery/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心功能与用法

Cron Mastery 是 OpenClaw 2026.2.15+ 版本的定时任务管理指南,核心解决「提醒失效」问题——通过严格区分 Heartbeat(心跳检测) 与 Cron(定时调度) 两种机制。

机制 行为 适用场景
Heartbeat "有空时检查"(30-60分钟间隔) 邮件检查、新闻摘要、低优先级轮询
Cron "精确在X时刻执行" 即时提醒、每日报告、系统维护

关键用法

1. 可靠提醒设置(2026.2.15+ 标准)

  • 禁止用 act:wait 处理>1分钟延迟
  • 使用 cron:add + at 一次性调度
  • 推送通知:agentTurn + 严格指令模式(DELIVER THIS EXACT MESSAGE...)+ announce 模式
  • 静默日志:systemEvent 注入聊天历史,无手机推送

2. 关键配置参数

  • deleteAfterRun: true:一次性任务自动清理(v2026.2.15+ 内置)
  • sessionTarget: "isolated":默认隔离会话
  • sessionTarget: "main":仅系统维护任务使用(完整工具权限)
  • wakeMode: "now":确保任务唤醒执行

3. 时区锁定 必须在 MEMORY.md 中记录用户时区(如 Cairo (GMT+2)),确认「晚上9点」指代明确。

显著优点

  • 精确性:Cron 消除 Heartbeat 漂移问题,适合时间敏感任务
  • 自动化:一次性任务自动清理,告别「幽灵任务」
  • 稳定性:v2026.2.15+ 解决 nextRunAtMs 损坏和「添加-更新」死锁
  • 灵活性:支持 at(精确时刻)与 every(周期性)两种调度模式

潜在缺点与局限性

  • 执行方差:实际执行依赖 Gateway Heartbeat(10-60秒),可能产生~30秒延迟
  • 配置复杂:推送通知需严格遵循 agentTurn + 指令模式,误用 systemEvent 导致静默失败
  • 权限陷阱:子代理(isolated)无法删除 Cron 任务,维护任务必须用 main 会话
  • 版本依赖:大量功能(自动清理、稳定性修复)要求 2026.2.15+,旧版本需手动迁移

适合人群

  • OpenClaw 用户:需要可靠提醒、定时报告、系统维护的开发者
  • 迁移用户:从旧版本升级,需更新 atMs → ISO 8601、deliver → announce 等配置
  • 自动化爱好者:构建个人工作流、健康提醒、数据备份等周期性任务

常规风险

  • 静默失败:误用 systemEvent 替代 agentTurn 导致提醒不发推送
  • AI 画蛇添足:未使用严格指令模式,子代理添加冗余评论
  • 时区混乱:未锁定时区导致跨地区提醒时间错误
  • 并发误操作:虽 v2026.2.15+ 已稳定,仍建议单步 cron.add 避免历史死锁模式

技能正文


name: cron-mastery description: Master OpenClaw's timing systems. Use for scheduling reliable reminders, setting 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 skill provides the definitive guide for managing time in OpenClaw. It solves the "I missed my reminder" problem by enforcing a strict separation between casual checks (heartbeat) and hard schedules (cron).

The Core Principle

System Behavior Best For Risk
Heartbeat "I'll check in when I can" (e.g., every 30-60m) Email checks, casual news summaries, low-priority polling. Drift: A "remind me in 10m" task will fail if the heartbeat is 30m.
Cron "I will run at exactly X time" Reminders ("in 5 mins"), daily reports, system maintenance. Clutter: Creates one-off jobs that need cleanup.

1. Setting Reliable Reminders

Never use act:wait or internal loops for long delays (>1 min). Use cron:add with a one-shot at schedule.

Standard Reminder Pattern (JSON)

Use this payload structure for "remind me in X minutes" tasks:

{
  "name": "Remind: Drink Water",
  "schedule": {
    "kind": "at",
    "atMs": <CURRENT_MS + DELAY_MS>
  },
  "payload": {
    "kind": "agentTurn",
    "message": "⏰ Reminder: Drink water!",
    "deliver": true
  },
  "sessionTarget": "isolated",
  "wakeMode": "next-heartbeat"
}

Note: Even with wakeMode: "next-heartbeat", the cron system forces an event injection at atMs. Use mode: "now" in the cron:wake tool if you need to force an immediate wake outside of a job payload.

2. The Janitor (Auto-Cleanup)

One-shot cron jobs (kind: at) disable themselves after running but stay in the list as "ghosts" (enabled: false, lastStatus: ok). To prevent clutter, install the Daily Janitor.

Setup Instructions

  1. Check current jobs: cron:list (includeDisabled: true)
  2. Create the Janitor:
    • Name: Daily Cron Cleanup
    • Schedule: Every 24 hours (everyMs: 86400000)
    • Payload: An agent turn that runs a specific prompt.

The Janitor Prompt (Agent Turn)

"Time for the 24-hour cron sweep. List all cron jobs including disabled ones. If you find any jobs that are enabled: false and have lastStatus: ok (finished one-shots), delete them to keep the list clean. Do not delete active recurring jobs. Log what you deleted."

3. Reference: Timezone Lock

For cron to work, the agent must know its time.

  • Action: Add the user's timezone to MEMORY.md.
  • Example: Timezone: Cairo (GMT+2)
  • Validation: If a user says "remind me at 9 PM," confirm: "9 PM Cairo time?" before scheduling.

4. 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 tool loop open (using act:wait).
  • Wait > 1 minute (async): Use Cron with wakeMode: "now".

Example Payload for "Checking back in 30s":

{
  "schedule": { "kind": "at", "atMs": <NOW + 30000> },
  "payload": { "kind": "agentTurn", "message": "⏱️ 30s check-in. Report status." },
  "wakeMode": "now"
}

Troubleshooting

  • "My reminder didn't fire": Check cron:list. If the job exists but didn't fire, check the system clock vs atMs.
  • "I have 50 old jobs": Run the Janitor manually immediately.

正文来自原始仓库, 版权归作者所有,许可:MIT。 权利人认为有不妥,可申请下架。

原始仓库

作者的项目地址:https://github.com/sundial-org/awesome-openclaw-skills

标签

cronschedulingreminderstime-managementgatewayautomationpush-notificationsopenclaw

同类 Skill