cron-helper
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCron Helper Skill
Cron Helper Skill
Purpose: Guides me to use CLI for time-based tasks and send logs on create/remove.
openclaw cronWhen 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
用途: 指导我使用 CLI处理基于时间的任务,并在创建/删除任务时发送日志。
openclaw cron适用场景:
- 用户需要周期性任务/提醒任务
- 用户提及"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 when you want the agent to actually perform a task:
--session isolated- 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 feishuMain Session (simple notifications only)
主会话(仅用于简单通知)
Use with for simple notifications only:
--session main--system-event- 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 feishuFor 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 listOther 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 , you can deliver output to a chat:
--session isolated| Option | Description |
|---|---|
| Enable delivery (required for channel output) |
| Channel: feishu, telegram, slack, whatsapp, etc. |
| Channel-specific target (chat ID, phone, etc.) |
| Post full output instead of summary |
Examples:
bash
undefined使用时,你可以将输出发送至聊天工具:
--session isolated| 参数 | 说明 |
|---|---|
| 启用输出功能(发送至渠道时必填) |
| 渠道:feishu, telegram, slack, whatsapp, etc. |
| 渠道目标(聊天ID、手机号等) |
| 发送完整输出而非摘要 |
示例:
bash
undefinedDeliver 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
通用参数
| Option | Description |
|---|---|
| Cron expression (5-field or 6-field with seconds) |
| Run every duration (e.g., 10m, 1h) |
| Run once at time (ISO or +duration, supports m/s) |
| Timezone (default: local) |
| Target session (default: main) |
| System event payload (main session only) |
| Agent message payload (isolated session only) |
| Delete one-shot job after success |
| Create job in disabled state |
| 参数 | 说明 |
|---|---|
| Cron表达式(5位格式或带秒的6位格式) |
| 按固定间隔执行(例如:10m、1h) |
| 单次执行(支持ISO时间格式或+时长格式,如+10m) |
| 时区(默认:本地时区) |
| 目标会话(默认:main) |
| 系统事件内容(仅主会话可用) |
| Agent任务消息内容(仅隔离会话可用) |
| 单次任务执行成功后自动删除 |
| 创建处于禁用状态的任务 |
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
--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
--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
--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
--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 Case | Session | Payload | Delivery |
|---|---|---|---|
| Agent performs task | | | |
| Simple notification | | | ❌ |
Rule of thumb: If you want the agent to do something (use tools, send messages), use + .
--session isolated--message| 使用场景 | 会话类型 | 内容参数 | 输出设置 |
|---|---|---|---|
| Agent执行任务 | | | |
| 简单通知 | | | ❌ |
经验法则: 如果你希望Agent执行操作(调用工具、发送消息),请使用 + 。
--session isolated--messageWhat NOT To Do
禁止操作
❌ Don't say "I'll set a reminder myself"
❌ Don't try to track time manually
❌ Don't use when you need the agent to execute tasks
❌ Don't forget when you need output sent to chat
❌ Don't send execution logs (only log on create/remove)
--system-event--deliver✅ Always use the CLI
✅ Use for agent tasks
✅ Use for simple notifications only
✅ Send log on create/remove only
✅ Keep log simple and clean
openclaw cron--session isolated--session main❌ 不要说"我会自己设置提醒"
❌ 不要尝试手动跟踪时间
❌ 当需要Agent执行任务时,不要使用
❌ 当需要将输出发送至聊天工具时,不要忘记添加参数
❌ 不要发送任务执行日志(仅在创建/删除时发送日志)
--system-event--deliver✅ 始终使用 CLI
✅ 针对Agent任务使用
✅ 仅在简单通知场景使用
✅ 仅在创建/删除任务时发送日志
✅ 保持日志简洁清晰
openclaw cron--session isolated--session mainCommon Schedule Patterns
常见调度规则示例
五位 Cron(分 时 日 月 周)
5位Cron表达式(分 时 日 月 周)
| Frequency | Cron Expression | CLI Flag |
|---|---|---|
| Every 5 min | | |
| Every 30 min | | |
| Every hour | | |
| Every 2 hours | | |
| Daily at 9am | | |
| Twice daily (10am, 10pm) | | |
| Weekly (Monday 9am) | | |
| 执行频率 | Cron表达式 | CLI参数 |
|---|---|---|
| 每5分钟一次 | | |
| 每30分钟一次 | | |
| 每小时一次 | | |
| 每2小时一次 | | |
| 每天上午9点 | | |
| 每天两次(上午10点、晚上10点) | | |
| 每周一次(周一上午9点) | | |
六位 Cron(秒 分 时 日 月 周)
6位Cron表达式(秒 分 时 日 月 周)
| Frequency | Cron Expression | CLI Flag |
|---|---|---|
| Every 1 second | | |
| Every 5 seconds | | |
| Every 30 seconds | | |
Duration flags:
| Frequency | CLI Flag |
|---|---|
| Every 10 minutes | |
| Every 2 hours | |
| Once in 20 minutes | |
| Once in 20 seconds | |
Loaded automatically when skill is installed.
| 执行频率 | Cron表达式 | CLI参数 |
|---|---|---|
| 每秒一次 | | |
| 每5秒一次 | | |
| 每30秒一次 | | |
时长参数:
| 执行频率 | CLI参数 |
|---|---|
| 每10分钟一次 | |
| 每2小时一次 | |
| 20分钟后执行一次 | |
| 20秒后执行一次 | |
Skill安装后会自动加载。