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

Create Cron Job

Create Cron Job · v1.0.0
安全 unknown 级 作者 kjvarga 公开目录收录
949 下载 0 安装 3.5k 收藏 1 浏览

简介

Create Cron Job

原始描述

Create and configure OpenClaw cron jobs with correct scheduling, execution modes, and delivery patterns. Use when asked to schedule a task, set up a recurrin...

通过你的 Agent 添加

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

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

或者手动安装

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

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

技能正文


name: create-cron-job description: Create and configure OpenClaw cron jobs with correct scheduling, execution modes, and delivery patterns. Use when asked to schedule a task, set up a recurring job, create a reminder, run something at a specific time, or automate a periodic operation. verified-against: "2026.3.2"

Create Cron Job

Set up a scheduled task per conventions/cron.md. Read the convention first.

Need a periodic check instead? Consider HEARTBEAT.md — see "Cron vs Heartbeat" in conventions/cron.md.

Before You Start

Determine:

  • Which agent handles the job
  • Main session (needs conversation context) or isolated (standalone)
  • Delivery mode (announce, webhook, none)

Steps

1. Choose the execution mode

Question If yes If no
Does the task need recent conversation context? Main session Isolated
Does the agent need its AGENTS.md/SOUL.md? Isolated (normal) Isolated + lightContext
Is this a one-shot reminder? --at with --delete-after-run Recurring schedule

2. Choose a job name

Format: <agent-id>-<purpose> in kebab-case.

Examples: auditor-daily-report, archivist-daily-backup, reminder-standup-meeting

3. Choose a schedule

Pattern CLI flag Example
Cron expression --cron --cron "0 7 * * *" (7 AM daily)
Fixed interval --every --every "4h"
One-shot (relative) --at --at "20m"
One-shot (absolute) --at --at "2026-03-15T09:00:00Z"

Always set timezone for cron expressions: --tz "America/Los_Angeles"

4. Create the job

Main session (task needs conversational context):

openclaw cron add \
  --name "<agent-id>-<purpose>" \
  --every "<interval>" \
  --session main \
  --system-event "<instruction text>" \
  --wake now

Isolated (standalone task):

openclaw cron add \
  --name "<agent-id>-<purpose>" \
  --cron "<expr>" \
  --tz "<timezone>" \
  --session isolated \
  --message "<instruction text>" \
  --agent <agent-id> \
  --announce \
  --channel <channel> \
  --to "<target>"

Isolated + lightweight context (simple, self-contained chore):

openclaw cron add \
  --name "<agent-id>-<purpose>" \
  --every "<interval>" \
  --session isolated \
  --message "<self-contained instruction>" \
  --light-context \
  --announce

One-shot reminder:

openclaw cron add \
  --name "reminder-<purpose>" \
  --at "<time>" \
  --session isolated \
  --message "<reminder text>" \
  --announce \
  --delete-after-run

5. Bind to an agent

Always use --agent <agent-id> for agent-specific jobs.

6. Set delivery mode

  • Announce (most jobs): --announce --channel <ch> --to "<target>"
  • Webhook: --webhook <url>
  • None: omit delivery flags

7. Document in the agent's AGENTS.md

## Scheduled Tasks

| Job | Schedule | Message | Action |
|---|---|---|---|
| `<job-name>` | `<schedule>` | `<message>` | <what the agent does> |

8. Create a skill if the job uses scripts

If the cron job executes scripts (not just a self-contained message), create a skill using the create-skill skill:

  • Scripts live in workspace/skills/<skill-name>/scripts/, not in ad-hoc workspace directories
  • The skill makes the capability discoverable for on-demand use, not just cron
  • Description should cover both automated (cron) and on-demand (user request) triggers
  • See "Workspace File Placement" in conventions/skills.md for where files belong

Skip if the cron job's message is fully self-contained (no external scripts or supporting files).

9. Test the job

openclaw cron run <jobId>           # Force immediate execution
openclaw cron list                  # Verify job exists
openclaw cron runs --id <jobId>     # Check run history

Post-Creation Checklist

  • Job name follows <agent-id>-<purpose> kebab-case convention
  • Timezone set for cron expressions (--tz)
  • Explicit --agent binding for agent-specific jobs
  • Delivery mode set (announce/webhook/none)
  • Channel and target specified for announce delivery
  • Agent's AGENTS.md updated with Scheduled Tasks entry
  • Job tested with openclaw cron run <jobId>
  • No duplicate: checked that no system crontab or existing job covers the same task
  • One-shot reminders use --delete-after-run
  • If job uses scripts: skill created in workspace/skills/<name>/ with scripts in its scripts/ subdir
  • No ad-hoc files or directories created at workspace root (see conventions/skills.md)

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

没有标签

同类 Skill