cron-helper

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Cron Helper Skill

Cron Helper Skill

Purpose: Guides me to use
openclaw cron
CLI for time-based tasks and send logs on create/remove.
When to use:
  • User asks for periodic/reminder tasks
  • User mentions "remind me every X"
  • User needs scheduled background checks
  • User wants agent to perform a task at a specific time

用途: 指导我使用
openclaw cron
CLI处理基于时间的任务,并在创建/删除任务时发送日志。
适用场景:
  • 用户需要周期性任务/提醒任务
  • 用户提及"remind me every X"
  • 用户需要定时后台检查
  • 用户希望Agent在特定时间执行任务

Core Principle

核心原则

Always prefer cron over manual timing.
Reason: I lack an internal clock. Manual "track time yourself" fails because I can get absorbed in reading/thinking and lose track of time. Cron is an external clock that works reliably.

始终优先使用cron而非手动计时。
原因: 我没有内置时钟。手动"自行跟踪时间"会失效,因为我可能会专注于阅读/思考而忘记时间。Cron是一个可靠的外部时钟工具。

Main vs Isolated Session

主会话与隔离会话

Isolated Session (RECOMMENDED for tasks) ✅ Best Practice

隔离会话(任务场景推荐)✅ 最佳实践

Use
--session isolated
when you want the agent to actually perform a task:
  • Agent receives the message and executes it
  • Can use tools (exec, read, message, etc.)
  • Can deliver output to a channel
  • Does not pollute main conversation history
Format:
bash
openclaw cron add \
  --name "job_name" \
  --cron "0 9 * * *" \
  --session isolated \
  --message "Task instructions for the agent" \
  --deliver \
  --channel feishu
当你希望Agent实际执行任务时,使用
--session isolated
  • Agent接收消息并执行
  • 可使用工具(exec、read、message等)
  • 可将输出发送至指定渠道
  • 不会污染主会话历史
格式:
bash
openclaw cron add \
  --name "job_name" \
  --cron "0 9 * * *" \
  --session isolated \
  --message "Task instructions for the agent" \
  --deliver \
  --channel feishu

Main Session (simple notifications only)

主会话(仅用于简单通知)

Use
--session main
with
--system-event
for simple notifications only:
  • Just displays a message in main chat
  • Agent does NOT execute any tasks
  • No tool calls, no delivery
Format:
bash
openclaw cron add \
  --name "reminder" \
  --at "+30m" \
  --session main \
  --system-event "Reminder: check email"

仅在需要简单通知时,结合
--system-event
使用
--session main
  • 仅在主聊天中显示消息
  • Agent不会执行任何任务
  • 不调用工具,不发送输出
格式:
bash
openclaw cron add \
  --name "reminder" \
  --at "+30m" \
  --session main \
  --system-event "Reminder: check email"

How I Should Respond

我的响应流程

Step 1: Detect the request

步骤1:识别请求

Keywords: "every", "remind", "schedule", "定时", "每小时/每天/每周", "在X分钟后执行"
关键词: "every", "remind", "schedule", "定时", "每小时/每天/每周", "在X分钟后执行"

Step 2: Ask for details

步骤2:询问详情

Get from user:
  • What - task description or notification message
  • When - schedule (e.g., "every 2 hours", "at 9am daily", "in 10 minutes")
  • Delivery - does output need to be sent to a chat? (default: no)
  • Name - job name (optional, auto-generated if not provided)
向用户确认以下信息:
  • 任务内容 - 任务描述或通知消息
  • 执行时间 - 调度规则(例如:"every 2 hours", "at 9am daily", "in 10 minutes")
  • 输出渠道 - 是否需要将结果发送至聊天工具?(默认:不需要)
  • 任务名称 - 任务名称(可选,未提供时会自动生成)

Step 3: Create cron job

步骤3:创建Cron任务

For agent tasks (RECOMMENDED):
bash
openclaw cron add \
  --name "task_name" \
  --at "+10m" \
  --session isolated \
  --message "Your task instructions here" \
  --deliver \
  --channel feishu
For simple reminders:
bash
openclaw cron add \
  --name "reminder" \
  --at "+10m" \
  --session main \
  --system-event "Your reminder message"
Remove a cron job:
bash
openclaw cron rm <job_id>
List all cron jobs:
bash
openclaw cron list
Other useful commands:
bash
openclaw cron status          # 查看调度器状态
openclaw cron run <job_id>    # 立即触发任务
openclaw cron enable <job_id> # 启用任务
openclaw cron disable <job_id> # 禁用任务
openclaw cron runs <job_id>   # 查看执行历史

Agent任务场景(推荐):
bash
openclaw cron add \
  --name "task_name" \
  --at "+10m" \
  --session isolated \
  --message "Your task instructions here" \
  --deliver \
  --channel feishu
简单提醒场景:
bash
openclaw cron add \
  --name "reminder" \
  --at "+10m" \
  --session main \
  --system-event "Your reminder message"
删除Cron任务:
bash
openclaw cron rm <job_id>
查看所有Cron任务:
bash
openclaw cron list
其他实用命令:
bash
openclaw cron status          # 查看调度器状态
openclaw cron run <job_id>    # 立即触发任务
openclaw cron enable <job_id> # 启用任务
openclaw cron disable <job_id> # 禁用任务
openclaw cron runs <job_id>   # 查看执行历史

Delivery Options

输出渠道选项

When using
--session isolated
, you can deliver output to a chat:
OptionDescription
--deliver
Enable delivery (required for channel output)
--channel <name>
Channel: feishu, telegram, slack, whatsapp, etc.
--to <dest>
Channel-specific target (chat ID, phone, etc.)
--post-mode full
Post full output instead of summary
Examples:
bash
undefined
使用
--session isolated
时,你可以将输出发送至聊天工具:
参数说明
--deliver
启用输出功能(发送至渠道时必填)
--channel <name>
渠道:feishu, telegram, slack, whatsapp, etc.
--to <dest>
渠道目标(聊天ID、手机号等)
--post-mode full
发送完整输出而非摘要
示例:
bash
undefined

Deliver to Feishu

发送至飞书

--deliver --channel feishu
--deliver --channel feishu

Deliver to Telegram

发送至Telegram

--deliver --channel telegram --to "-1001234567890"
--deliver --channel telegram --to "-1001234567890"

Deliver with full output

发送完整输出

--deliver --channel feishu --post-mode full

---
--deliver --channel feishu --post-mode full

---

Common Options

通用参数

OptionDescription
--cron <expr>
Cron expression (5-field or 6-field with seconds)
--every <duration>
Run every duration (e.g., 10m, 1h)
--at <when>
Run once at time (ISO or +duration, supports m/s)
--tz <iana>
Timezone (default: local)
--session main|isolated
Target session (default: main)
--system-event <text>
System event payload (main session only)
--message <text>
Agent message payload (isolated session only)
--delete-after-run
Delete one-shot job after success
--disabled
Create job in disabled state

参数说明
--cron <expr>
Cron表达式(5位格式或带秒的6位格式)
--every <duration>
按固定间隔执行(例如:10m、1h)
--at <when>
单次执行(支持ISO时间格式或+时长格式,如+10m)
--tz <iana>
时区(默认:本地时区)
--session main|isolated
目标会话(默认:main)
--system-event <text>
系统事件内容(仅主会话可用)
--message <text>
Agent任务消息内容(仅隔离会话可用)
--delete-after-run
单次任务执行成功后自动删除
--disabled
创建处于禁用状态的任务

Step 4: Send log

步骤4:发送日志

On CREATE/REMOVE only:

仅在创建/删除任务时发送:

After creating or removing cron jobs, send ONE log with the exact command:
Log format:
bash
undefined
创建或删除Cron任务后,发送一条包含精确命令的日志:
日志格式:
bash
undefined

新增任务

新增任务

[HH:MM] CRON ✅ $ openclaw cron add
--name "job_name"
--at "+10m"
--session isolated
--message "task description"
--deliver
--channel feishu
[HH:MM] CRON ✅ $ openclaw cron add
--name "job_name"
--at "+10m"
--session isolated
--message "task description"
--deliver
--channel feishu

删除任务

删除任务

[HH:MM] CRON ❌ $ openclaw cron rm <job_id>

**Examples:**
```bash
[HH:MM] CRON ❌ $ openclaw cron rm <job_id>

**示例:**
```bash

新增

新增

[21:30] CRON ✅ $ openclaw cron add
--name "daily-summary"
--cron "0 9 * * *"
--tz "Asia/Shanghai"
--session isolated
--message "总结今天的工作"
--deliver
--channel feishu
[21:30] CRON ✅ $ openclaw cron add
--name "daily-summary"
--cron "0 9 * * *"
--tz "Asia/Shanghai"
--session isolated
--message "总结今天的工作"
--deliver
--channel feishu

删除

删除

[21:41] CRON ❌ $ openclaw cron rm 983a0f0e-0976-414a-b3d0-fd09c533e301

**Key points:**
- Send log ONLY on create/remove, NOT on execution
- Keep it minimal: One command block, no extra text

**Cron → Human mapping (五位 - 分时日月周):**
- `*/5 * * * *` → 每5分钟
- `*/30 * * * *` → 每30分钟
- `0 * * * *` → 每1小时
- `0 */2 * * *` → 每2小时
- `0 9 * * *` → 每天1次(09:00)
- `0 10,22 * * *` → 每天2次(10:00,22:00)
- `0 9 * * 1` → 每周1次(周一09:00)

**Cron → Human mapping (六位 - 秒分时日月周):**
- `*/1 * * * * *` → 每1秒
- `*/5 * * * * *` → 每5秒
- `*/30 * * * * *` → 每30秒

---
[21:41] CRON ❌ $ openclaw cron rm 983a0f0e-0976-414a-b3d0-fd09c533e301

**注意要点:**
- 仅在创建/删除任务时发送日志,执行任务时无需发送
- 日志需简洁:仅包含命令块,无额外文本

**Cron表达式→人类可读格式(5位 - 分 时 日 月 周):**
- `*/5 * * * *` → 每5分钟
- `*/30 * * * *` → 每30分钟
- `0 * * * *` → 每1小时
- `0 */2 * * *` → 每2小时
- `0 9 * * *` → 每天1次(09:00)
- `0 10,22 * * *` → 每天2次(10:00,22:00)
- `0 9 * * 1` → 每周1次(周一09:00)

**Cron表达式→人类可读格式(6位 - 秒 分 时 日 月 周):**
- `*/1 * * * * *` → 每1秒
- `*/5 * * * * *` → 每5秒
- `*/30 * * * * *` → 每30秒

---

Best Practice Summary

最佳实践总结

Use CaseSessionPayloadDelivery
Agent performs task
isolated
--message
--deliver
Simple notification
main
--system-event
Rule of thumb: If you want the agent to do something (use tools, send messages), use
--session isolated
+
--message
.

使用场景会话类型内容参数输出设置
Agent执行任务
isolated
--message
--deliver
简单通知
main
--system-event
经验法则: 如果你希望Agent执行操作(调用工具、发送消息),请使用
--session isolated
+
--message

What NOT To Do

禁止操作

❌ Don't say "I'll set a reminder myself" ❌ Don't try to track time manually ❌ Don't use
--system-event
when you need the agent to execute tasks ❌ Don't forget
--deliver
when you need output sent to chat ❌ Don't send execution logs (only log on create/remove)
✅ Always use the
openclaw cron
CLI ✅ Use
--session isolated
for agent tasks ✅ Use
--session main
for simple notifications only ✅ Send log on create/remove only ✅ Keep log simple and clean

❌ 不要说"我会自己设置提醒" ❌ 不要尝试手动跟踪时间 ❌ 当需要Agent执行任务时,不要使用
--system-event
❌ 当需要将输出发送至聊天工具时,不要忘记添加
--deliver
参数 ❌ 不要发送任务执行日志(仅在创建/删除时发送日志)
✅ 始终使用
openclaw cron
CLI ✅ 针对Agent任务使用
--session isolated
✅ 仅在简单通知场景使用
--session main
✅ 仅在创建/删除任务时发送日志 ✅ 保持日志简洁清晰

Common Schedule Patterns

常见调度规则示例

五位 Cron(分 时 日 月 周)

5位Cron表达式(分 时 日 月 周)

FrequencyCron ExpressionCLI Flag
Every 5 min
*/5 * * * *
--cron "*/5 * * * *"
Every 30 min
*/30 * * * *
--cron "*/30 * * * *"
Every hour
0 * * * *
--cron "0 * * * *"
Every 2 hours
0 */2 * * *
--cron "0 */2 * * *"
Daily at 9am
0 9 * * *
--cron "0 9 * * *"
Twice daily (10am, 10pm)
0 10,22 * * *
--cron "0 10,22 * * *"
Weekly (Monday 9am)
0 9 * * 1
--cron "0 9 * * 1"
执行频率Cron表达式CLI参数
每5分钟一次
*/5 * * * *
--cron "*/5 * * * *"
每30分钟一次
*/30 * * * *
--cron "*/30 * * * *"
每小时一次
0 * * * *
--cron "0 * * * *"
每2小时一次
0 */2 * * *
--cron "0 */2 * * *"
每天上午9点
0 9 * * *
--cron "0 9 * * *"
每天两次(上午10点、晚上10点)
0 10,22 * * *
--cron "0 10,22 * * *"
每周一次(周一上午9点)
0 9 * * 1
--cron "0 9 * * 1"

六位 Cron(秒 分 时 日 月 周)

6位Cron表达式(秒 分 时 日 月 周)

FrequencyCron ExpressionCLI Flag
Every 1 second
*/1 * * * * *
--cron "*/1 * * * * *"
Every 5 seconds
*/5 * * * * *
--cron "*/5 * * * * *"
Every 30 seconds
*/30 * * * * *
--cron "*/30 * * * * *"
Duration flags:
FrequencyCLI Flag
Every 10 minutes
--every "10m"
Every 2 hours
--every "2h"
Once in 20 minutes
--at "+20m"
Once in 20 seconds
--at "+20s"

Loaded automatically when skill is installed.
执行频率Cron表达式CLI参数
每秒一次
*/1 * * * * *
--cron "*/1 * * * * *"
每5秒一次
*/5 * * * * *
--cron "*/5 * * * * *"
每30秒一次
*/30 * * * * *
--cron "*/30 * * * * *"
时长参数:
执行频率CLI参数
每10分钟一次
--every "10m"
每2小时一次
--every "2h"
20分钟后执行一次
--at "+20m"
20秒后执行一次
--at "+20s"

Skill安装后会自动加载。