简介
OpenClaw 定时任务配置指南,规范 cron job 创建流程,推荐模型选型与调度策略,适合自动化运维场景。
原始描述
Create and manage OpenClaw cron jobs following our conventions. Use when setting up periodic tasks, reminders, automated checks, or any scheduled work.
安装
下载 zip 解压后,把里面的文件放进你的 Agent 的 skills 目录即可使用。
给 Agent 的直链(让它自己下载安装):
https://v110.com/skill/cron-setup.zip
Claude Code 放 ~/.claude/skills/;Codex、TypingMind 等按各自文档的 skills 目录放置。技能申请什么权限由作者决定,装前请确认。
中文使用说明 来自收录源
核心用法
cron-setup 是一套用于创建和管理 OpenClaw 平台定时任务(cron jobs)的规范技能。它提供了标准化的 JSON 模板、模型选择建议、调度模式及输出交付配置,帮助用户将周期性自动化任务(如数据监控、定时备份、消息推送)无缝集成到 OpenClaw 工作流中。
显著优点
- 标准化模板:提供开箱即用的 JSON 结构,涵盖命名规范、CRON 表达式、时区设置、会话隔离等关键字段,降低配置出错率。
- 模型选型明确:推荐使用
anthropic/claude-sonnet-4-5作为默认模型,避免 DeepSeek 的工具调用不可靠问题;仅在复杂任务时降级至 Opus,成本控制清晰。 - 自包含任务设计:强调任务指令需携带完整上下文(bash 命令、跳过条件、错误处理),确保 cron agent 在无状态唤醒时仍可正确执行。
- 多渠道输出支持:原生支持 Telegram 消息推送,内置 topic ID 映射表(如 Research、Crypto、PR updates 等频道),便于团队分发。
- 反模式防护:明确禁止 Opus 滥用、heartbeat 替代、cron 内循环等常见陷阱,减少资源浪费。
潜在缺点与局限性
- 平台绑定强:专为 OpenClaw 生态设计,迁移至其他 cron 系统需重写配置。
- 调试依赖日志:
delivery: none模式下无自动回显,需主动检查 Telegram 或外部存储确认执行状态。 - 超时硬限制:120-180 秒默认值对重型任务可能不足,需手动覆盖但缺乏动态扩容说明。
- 缺乏可视化:无 UI 管理界面,任务列表依赖
cron list命令行查询。
适合人群
- OpenClaw 重度用户,需将日常运维脚本(服务器监控、数据抓取、定时报告)转为自动化任务。
- 团队协作场景,需通过 Telegram 频道分发定时通知或数据摘要。
- 对成本敏感的 AI 应用开发者,希望精细控制模型调用层级。
常规风险
- Token 消耗失控:未设置
SKIP条件的空跑任务会持续消耗 API 额度。 - 时区误配:
tz字段遗漏或错误导致任务在非预期时段触发。 - 重复通知:同时使用
announce模式与手动 Telegram 推送会造成消息冗余。 - 权限泄露:任务消息中硬编码敏感路径或密钥,可能被 cron agent 日志记录。
- 单点故障:依赖外部服务(Telegram API、Git 仓库)的任务在网络中断时静默失败,需配合监控告警。
技能正文
name: cron-setup version: 1.0.0 description: Create and manage OpenClaw cron jobs following our conventions. Use when setting up periodic tasks, reminders, automated checks, or any scheduled work.
Cron Job Setup
Our conventions for creating cron jobs in OpenClaw.
Default Settings
| Setting | Default | Why |
|---|---|---|
| Model | anthropic/claude-sonnet-4-5 |
Reliable tool calls, works with any Anthropic Max plan — no OpenRouter needed |
| Session | isolated |
Cron jobs run in their own session, not the main chat |
| Delivery | "mode": "none" |
Job handles its own output (posts to Discord, etc.) |
| Timeout | 120-180s | Most jobs should finish fast |
Model Notes
- Default to Sonnet (
anthropic/claude-sonnet-4-5). Reliable, portable (no OpenRouter API key needed). - DeepSeek is unreliable for tool calls — don't use it for cron jobs.
- Use Opus (
anthropic/claude-opus-4-6) only as a last resort — expensive for scheduled tasks. - Model ID format: Use
anthropic/claude-sonnet-4-5not the full dated version (anthropic/claude-sonnet-4-20250514).
Job Template
{
"name": "descriptive-kebab-case-name",
"schedule": {
"kind": "cron",
"expr": "*/30 * * * *",
"tz": "America/New_York"
},
"sessionTarget": "isolated",
"payload": {
"kind": "agentTurn",
"message": "TASK INSTRUCTIONS HERE",
"model": "openrouter/deepseek/deepseek-v3.2",
"timeoutSeconds": 120
},
"delivery": {
"mode": "none"
}
}
Schedule Patterns
| Pattern | Cron Expression | Notes |
|---|---|---|
| Every 30 min | */30 * * * * |
Good for inbox checks, monitoring |
| Every hour | 0 * * * * |
Self-reflection, status checks |
| Daily at 4 AM | 0 4 * * * |
Cleanup, backups (during quiet hours) |
| Daily at 6 AM | 0 6 * * * |
Morning digests, daily summaries |
| Weekly Monday 2 PM | 0 14 * * 1 |
Weekly outreach, reviews |
| One-shot | Use "kind": "at" instead |
Reminders, one-time tasks |
Task Instruction Conventions
- Be explicit with commands — Give the cron agent exact bash commands to run. It doesn't have our context.
- Include skip conditions — If there's nothing to do, the agent should reply
SKIPto avoid wasting tokens. - Handle its own output — The job should post results to Telegram (or wherever) using the
messagetool directly. Don't rely on delivery mode for formatted output. - Include error handling — What should happen if a command fails?
- Keep instructions self-contained — The cron agent wakes up with no context. Everything it needs should be in the task message.
Telegram Posting from Cron Jobs
When a cron job needs to notify us, include these instructions in the task:
Post to Telegram using the message tool:
- action: send
- channel: telegram
- target: -1003856094222
- threadId: TOPIC_ID
- message: Your formatted message
Topic IDs:
1— Main topic (general updates, alerts)573— Research1032— Crypto1488— PR updates / dev notifications1869— Sticker store3188— Activity feed (workspace changes)
Delivery Modes
| Mode | When to Use |
|---|---|
"mode": "none" |
Job posts its own output to Telegram (most common) |
"mode": "announce" |
OpenClaw auto-delivers the agent's final message to a channel. Use when output IS the message (e.g., daily digest). Set "channel": "telegram" and "to": "-1003856094222:TOPIC_ID" |
Anti-Patterns
❌ Don't use Opus for cron jobs unless the task genuinely needs it. Most cron tasks are simple checks. ❌ Don't use heartbeat for things that can be a cron job. Heartbeat runs in the main session (Opus) and costs way more. ❌ Don't create cron jobs that loop/poll — each run should be a single check. If you need polling, use a background exec script instead. ❌ Don't set delivery mode to "announce" and also have the job post to Telegram — you'll get duplicate messages.
Existing Jobs (Reference)
Check current jobs anytime with the cron list tool. As of setup:
workspace-activity-feed— Every 30 min, commits workspace changes, posts to activity feedagentmail-inbox-check— Every 30 min, checks for new emails, responds to agentssub-agent-monitor— Every 15 min, checks on stalled sub-agentsself-reflection— Hourly, reviews recent sessions for lessons learneddaily-workspace-commit— Daily 4 AM, git commits workspace changessystem-watchdog— Daily 4 AM, checks system resourcesOpenClaw Daily News Digest— Daily 6 AM, generates news digeststicker-sales-loop— Weekly Monday 2 PM, agent outreach for sticker store
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。