casual-cron

TotalClaw 作者 totalclaw

使用严格的运行保护规则从自然语言创建 Clawdbot cron 作业。使用时间:用户要求安排提醒或消息(重复或一次性),尤其是通过 Telegram,或者当他们使用 /at 或 /every 时。示例:“在上午 8 点创建每日提醒”、“在 20 分钟内提醒我”、“下午 3 点向我发送 Telegram 消息”、“/每 2 小时”。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~gostlightai-casual-cron
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~gostlightai-casual-cron/file -o gostlightai-casual-cron.md
# Casual Cron

Create Clawdbot cron jobs from natural language. Supports one-shot and repeating schedules with safe run-guard rules.

## Cron Run Guard (Hard Rules)

- When running inside a cron job: do NOT troubleshoot, do NOT restart gateway, and do NOT check time.
- Do NOT send acknowledgements or explanations.
- Output ONLY the exact message payload and then stop.

---

## How It Works

1. Agent detects scheduling intent from user message (or `/at` / `/every` command)
2. Parses: time, frequency, channel, destination, message
3. Builds `openclaw cron add` command with correct flags
4. Confirms parsed time, job name, and job id with user before executing

---

## Scheduling Rules

When a message starts with `/at` or `/every`, schedule via the CLI (NOT the cron tool API).

Use: `openclaw cron add`

### /at (one-shot)

- If user gives a clock time (e.g., "3pm"), convert to ISO with offset computed for America/New_York on that date (DST-safe).
- Prefer relative times for near-term reminders (e.g., `--at "20m"`).
- Use `--session isolated --message "Output exactly: <task>"`.
- Always include `--delete-after-run`.
- Always include `--deliver --channel <channel> --to <destination>`.

### /every (repeating)

- If interval: use `--every "<duration>"` (no timezone needed).
- If clock time: use `--cron "<expr>" --tz "America/New_York"`.
- Use `--session isolated --message "Output exactly: <task>"`.
- Always include `--deliver --channel <channel> --to <destination>`.

### Confirmation

- Always confirm parsed time, job name, and job id with the user before finalizing.

---

## Command Reference

One-shot (clock time, DST-aware):
```
openclaw cron add \
  --name "Reminder example" \
  --at "2026-01-28T15:00:00-05:00" \
  --session isolated \
  --message "Output exactly: <TASK>" \
  --deliver --channel telegram --to <TELEGRAM_CHAT_ID> \
  --delete-after-run
```

One-shot (relative time):
```
openclaw cron add \
  --name "Reminder in 20m" \
  --at "20m" \
  --session isolated \
  --message "Output exactly: <TASK>" \
  --deliver --channel telegram --to <TELEGRAM_CHAT_ID> \
  --delete-after-run
```

Repeating (clock time, DST-aware):
```
openclaw cron add \
  --name "Daily 3pm reminder" \
  --cron "0 15 * * *" --tz "America/New_York" \
  --session isolated \
  --message "Output exactly: <TASK>" \
  --deliver --channel telegram --to <TELEGRAM_CHAT_ID>
```

Repeating (interval):
```
openclaw cron add \
  --name "Every 2 hours" \
  --every "2h" \
  --session isolated \
  --message "Output exactly: <TASK>" \
  --deliver --channel telegram --to <TELEGRAM_CHAT_ID>
```

---

## Configuration

| Setting | Value |
|---------|-------|
| Default timezone | `America/New_York` (DST-aware) |
| Default channel | `telegram` (override via `CRON_DEFAULT_CHANNEL` env var) |
| Supported channels | telegram, whatsapp, slack, discord, signal |

---

## Supported Patterns

### Time Formats

| Input | Cron |
|-------|------|
| `8am` | `0 8 * * *` |
| `8:45pm` | `45 20 * * *` |
| `noon` | `0 12 * * *` |
| `midnight` | `0 0 * * *` |
| `14:30` | `30 14 * * *` |

### Frequencies

| Input | Behavior |
|-------|----------|
| `daily` / `every day` | Daily at specified time |
| `weekdays` / `mon-fri` | Mon-Fri at specified time |
| `mondays` / `every monday` | Weekly on Monday |
| `hourly` / `every hour` | Every hour at :00 |
| `every 2 hours` | `0 */2 * * *` |
| `weekly` | Weekly (defaults to Monday) |
| `monthly` | Monthly (1st of month) |

---

## 中文说明

# Casual Cron

从自然语言创建 Clawdbot cron 作业。支持一次性和重复调度,并带有安全的运行保护规则。

## Cron 运行保护(硬性规则)

- 在 cron 作业内运行时:不要排查故障,不要重启 gateway,不要检查时间。
- 不要发送确认信息或解释。
- 只输出确切的消息内容,然后停止。

---

## 工作原理

1. 代理从用户消息(或 `/at` / `/every` 命令)中检测调度意图
2. 解析:时间、频率、渠道、目标、消息
3. 使用正确的标志构建 `openclaw cron add` 命令
4. 在执行前与用户确认解析出的时间、作业名称和作业 id

---

## 调度规则

当消息以 `/at` 或 `/every` 开头时,通过 CLI(而不是 cron 工具 API)进行调度。

使用:`openclaw cron add`

### /at(一次性)

- 如果用户给出钟点时间(例如 "3pm"),将其转换为带偏移量的 ISO 时间,偏移量按该日期下的 America/New_York 计算(DST 安全)。
- 对于近期提醒,优先使用相对时间(例如 `--at "20m"`)。
- 使用 `--session isolated --message "Output exactly: <task>"`。
- 始终包含 `--delete-after-run`。
- 始终包含 `--deliver --channel <channel> --to <destination>`。

### /every(重复)

- 如果是间隔:使用 `--every "<duration>"`(不需要时区)。
- 如果是钟点时间:使用 `--cron "<expr>" --tz "America/New_York"`。
- 使用 `--session isolated --message "Output exactly: <task>"`。
- 始终包含 `--deliver --channel <channel> --to <destination>`。

### 确认

- 在最终确定之前,始终与用户确认解析出的时间、作业名称和作业 id。

---

## 命令参考

一次性(钟点时间,DST 感知):
```
openclaw cron add \
  --name "Reminder example" \
  --at "2026-01-28T15:00:00-05:00" \
  --session isolated \
  --message "Output exactly: <TASK>" \
  --deliver --channel telegram --to <TELEGRAM_CHAT_ID> \
  --delete-after-run
```

一次性(相对时间):
```
openclaw cron add \
  --name "Reminder in 20m" \
  --at "20m" \
  --session isolated \
  --message "Output exactly: <TASK>" \
  --deliver --channel telegram --to <TELEGRAM_CHAT_ID> \
  --delete-after-run
```

重复(钟点时间,DST 感知):
```
openclaw cron add \
  --name "Daily 3pm reminder" \
  --cron "0 15 * * *" --tz "America/New_York" \
  --session isolated \
  --message "Output exactly: <TASK>" \
  --deliver --channel telegram --to <TELEGRAM_CHAT_ID>
```

重复(间隔):
```
openclaw cron add \
  --name "Every 2 hours" \
  --every "2h" \
  --session isolated \
  --message "Output exactly: <TASK>" \
  --deliver --channel telegram --to <TELEGRAM_CHAT_ID>
```

---

## 配置

| 设置 | 值 |
|---------|-------|
| 默认时区 | `America/New_York`(DST 感知) |
| 默认渠道 | `telegram`(通过 `CRON_DEFAULT_CHANNEL` 环境变量覆盖) |
| 支持的渠道 | telegram、whatsapp、slack、discord、signal |

---

## 支持的模式

### 时间格式

| 输入 | Cron |
|-------|------|
| `8am` | `0 8 * * *` |
| `8:45pm` | `45 20 * * *` |
| `noon` | `0 12 * * *` |
| `midnight` | `0 0 * * *` |
| `14:30` | `30 14 * * *` |

### 频率

| 输入 | 行为 |
|-------|----------|
| `daily` / `every day` | 每天在指定时间 |
| `weekdays` / `mon-fri` | 周一至周五在指定时间 |
| `mondays` / `every monday` | 每周一 |
| `hourly` / `every hour` | 每小时整点 |
| `every 2 hours` | `0 */2 * * *` |
| `weekly` | 每周(默认周一) |
| `monthly` | 每月(每月 1 日) |