定时任务设置:自动化 AI 任务与计划 - Openclaw Skills
作者:互联网
2026-04-05
什么是 定时任务设置?
定时任务设置技能提供了一种使用 Openclaw Skills 实现自动化、循环任务的标准方法。它允许开发者使用 cron 表达式定义复杂的计划,确保 AI 代理可以在无需人工触发的情况下执行后台操作,如系统坚控、数据聚合和状态报告。
通过强调隔离会话和选择特定模型(如 Claude Sonnet 4.5),该技能在保持成本效益的同时,确保了工具调用的高可靠性。它旨在处理从简单的 30 分钟收件箱检查到全面的每日工作区摘要的所有事务,为自主代理运行提供强大的骨干支持。
下载入口:https://github.com/openclaw/skills/tree/main/skills/brennerspear/cron-setup
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install cron-setup
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 cron-setup。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
定时任务设置 应用场景
- 自动化工作区活动提要和用于版本控制的每日 git 提交。
- 设置周期性代理邮件收件箱检查和自动电子邮件回复。
- 坚控子代理健康状况和系统资源以防止停滞。
- 生成每日新闻摘要或每周营销推广总结。
- 为 AI 代理实现自我反思循环,以便审查和学习过去的会话。
- 识别重复性任务,并使用标准 cron 语法或一次性 'at' 模式确定其频率。
- 使用为 Openclaw Skills 量身定制的显式 bash 命令和任务指令配置任务负载。
- 分配隔离的会话目标,以确保定时任务独立于主用户聊天运行。
- 定义传递机制,在内部代理发布(例如直接 T@elegrimm 工具)或系统级公告之间进行选择。
- 在环境中注册任务并使用内置的定时任务列表工具坚控执行情况。
定时任务设置 配置指南
要开始在 Openclaw Skills 中使用计划任务,您可以查看当前配置或使用 CLI 添加新任务。使用以下命令查看活动任务:
cron list
定义新任务时,请使用标准化的 JSON 模板。确保将模型指定为 anthropic/claude-sonnet-4-5,以获得可靠性和速度的最佳平衡:
# 任务注册负载示例
{
"name": "daily-cleanup",
"schedule": {
"kind": "cron",
"expr": "0 4 * * *",
"tz": "America/New_York"
},
"payload": {
"kind": "agentTurn",
"message": "运行清理脚本并报告状态",
"model": "anthropic/claude-sonnet-4-5"
}
}
定时任务设置 数据架构与分类体系
该技能使用结构化的 JSON 架构组织定时任务,以确保在 Openclaw Skills 中的兼容性。以下是主要的元数据分类:
| 属性 | 描述 | 预期值 |
|---|---|---|
name |
唯一标识符 | Kebab-case 字符串 (例如 inbox-check) |
schedule |
时间配置 | 包含 kind、expr 和 tz 的对象 |
sessionTarget |
执行环境 | 后台任务通常为 isolated |
payload |
任务详情 | 包含 message、model 和 timeoutSeconds 的对象 |
delivery |
输出处理 | 具有 mode (none/announce) 和可选频道目标的对象 |
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 ch@t |
| 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 T@elegrimm (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.
T@elegrimm Posting from Cron Jobs
When a cron job needs to notify us, include these instructions in the task:
Post to T@elegrimm 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 T@elegrimm (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 T@elegrimm — 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
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
自动化:工作流优化与定时任务 - Openclaw Skills
文本翻译器:免费多语言免 API 翻译 - Openclaw Skills
主管提案者:主动式 AI 代理沟通 - Openclaw 技能
在线状态监控器:网站状态与性能 - Openclaw Skills
Secret Rotator:自动化 API 密钥审计与轮换 - Openclaw Skills
rey-x-api: 为 AI 智能体提供的安全 X API 集成 - Openclaw Skills
Polymarket 交易者:由 AI 驱动的预测市场自动化 - Openclaw Skills
LinkedIn 自动化:扩展 B2B 增长与内容 - Openclaw Skills
Rey 代码审查:自动化质量与安全审计 - Openclaw 技能
Reddit 发布助手:算法优化的社区参与 - Openclaw Skills
AI精选
