auto: sync OpenClaw config 2026-09-16 22:13
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
---
|
||||
name: "scheduled-reminders"
|
||||
description: "创建/管理定时提醒(每周/每天/睡前等周期或一次性)并推送钉钉。触发:帮我设提醒、每天X点提醒、每周提醒。"
|
||||
description: "创建/管理定时提醒(每周/每天/睡前等周期或一次性)并推送到钉钉或飞书。触发:帮我设提醒、每天X点提醒、每周提醒、推送到飞书。"
|
||||
---
|
||||
|
||||
# scheduled-reminders
|
||||
|
||||
创建和管理杨轩的定时提醒:周期性(每周/每天)或一次性,统一通过钉钉推送。非生日类提醒走本 skill;生日提醒走 birthday-reminder skill。
|
||||
创建和管理杨轩的定时提醒:周期性(每周/每天)或一次性,默认推送钉钉,用户点名时改投飞书(见「投递通道」)。非生日类提醒走本 skill;生日提醒走 birthday-reminder skill。
|
||||
|
||||
## 触发场景
|
||||
|
||||
@@ -16,11 +16,21 @@ description: "创建/管理定时提醒(每周/每天/睡前等周期或一次
|
||||
|
||||
所有提醒都是 OpenClaw cron 任务,统一:
|
||||
|
||||
- **投递只交给 delivery**:`--announce --channel dingtalk-connector --to 0464031658857345`。payload 只输出文案 `--command 'echo "..."'`。
|
||||
- **投递只交给 delivery**:payload 只输出文案(`--command 'echo "..."'`),路由写在 delivery 参数上;**默认钉钉**:`--announce --channel dingtalk-connector --to 0464031658857345`。用户要求飞书时按「投递通道」换参数。
|
||||
- **多频道下频道必须显式**:本机已配 3 个频道(dingtalk-connector / feishu / openclaw-weixin),省略投递参数时 `cron add` 直接失败:`cron announce delivery requires an explicit channel when multiple channels are configured`。要推送就照上面写全;**不需要推送给人的内部维护任务**加 `--no-deliver`(实测结果 `delivery.mode=none`),不要只把 flag 省掉。
|
||||
- **禁止**在命令里手动调 `openclaw message send`——CLI 的 message send 不认识 `dingtalk-connector`(内置频道枚举无 DingTalk 插件名),会 exit 1 失败。
|
||||
- **必须 `--agent main`**:多 agent 环境下无 owner(agent-less)的 cron 任务会让调度器 nextWake 锁死,阻塞所有提醒。
|
||||
- **时间参数**:周期性用 `--cron "<表达式>" --tz Asia/Shanghai`;一次性用 `--at`(不带时区按 UTC 处理,北京时间 = UTC+8)。
|
||||
|
||||
## 投递通道:钉钉(默认)/ 飞书
|
||||
|
||||
杨轩说「推送到飞书」时,只把 delivery 换掉:`--announce --channel feishu --to <目标>`。
|
||||
|
||||
- **飞书目标必须用 DM 会话 chat_id**:`oc_8eecfa0e1cc185c1cb19b4f3950cbc52`(杨轩的飞书私聊)。
|
||||
- **不要用用户 open_id**(`ou_28124d6721134f0e31d6122d30088418`):2026-09-16 实测 cron 投递报 `Feishu send failed: Sending messages to users is temporarily unavailable.`,判为 not-delivered;同一时刻改投上面的 chat_id 即刻成功。错误文案含「temporarily」,条件可能变化,但先用 chat_id 就不必试错。用 `conversations_list(channel="feishu")` 可复核 DM 目标。
|
||||
- **换通道只动 delivery**:`--agent main`、时间、打卡机制等其余规则一律不变。
|
||||
- **通了没有要实测,不要推断**:可临时建一条一次性测试任务,用 `automations run <jobId>` 立即跑一次,看 `state.lastDelivered` / `lastDeliveryError`,验证完把测试任务删掉。
|
||||
|
||||
## 创建一条周期提醒
|
||||
|
||||
```bash
|
||||
@@ -34,6 +44,8 @@ openclaw cron add "任务名" \
|
||||
|
||||
cron 星期数字:**周日 = 0,周一 = 1 … 周六 = 6**(容易记错,务必核对)。
|
||||
|
||||
**写在脚本里时用 CLI 绝对路径**:`/home/yangxuan/.openclaw/tmp/agent-cli/openclaw`(裸 `openclaw` 是同一目录下的 shim,只在 exec 的 PATH 里有效)。shell 助手/批量脚本若自行重设了 `PATH`,裸 `openclaw` 会报「未找到命令」(2026-09-16 实测);用绝对路径,或把该目录并入 `PATH`。
|
||||
|
||||
## 一次创建多条(批量)
|
||||
|
||||
多条同类提醒时,写一个 shell 助手函数把上面的标准 flag 包起来,再用循环调用(模板见 `examples/batch-reminders.sh`),比逐条手敲省大量往返。文案相同的提醒合并成变量复用,避免重复粘贴。
|
||||
@@ -43,7 +55,7 @@ cron 星期数字:**周日 = 0,周一 = 1 … 周六 = 6**(容易记错,
|
||||
创建后用 `openclaw cron get <id>` 逐条确认:
|
||||
|
||||
- `agentId=main`
|
||||
- `delivery.mode=announce`、`delivery.channel=dingtalk-connector`、`delivery.to=0464031658857345`
|
||||
- `delivery.mode=announce`,且 `delivery.channel`/`delivery.to` 就是本次要求的目标(钉钉:`dingtalk-connector` + `0464031658857345`;飞书:`feishu` + chat_id)
|
||||
- `schedule.expr` 与下次触发 `nextRunAtMs` 正确
|
||||
|
||||
整库不应残留 `message send` 字样。
|
||||
@@ -68,11 +80,25 @@ openclaw cron add "打卡检查" \
|
||||
--message '检查打卡:用 sessions_history 读会话 agent:main:dingtalk-connector:direct:0464031658857345 今天的消息;若用户在提醒时间后回复过「打卡」则回 NO_REPLY,否则发一条温和催促。'
|
||||
```
|
||||
|
||||
## 盘点已有提醒(用户问「某提醒还在不在 / 是不是在钉钉」时)
|
||||
|
||||
1. `automations list`(`includeDisabled: true`)按 `name` 定位目标;返回已含 `schedule`、`effectiveAgentId`、`nextRunAt`。
|
||||
2. 对关心的每条 `automations get <jobId>`,确认 `agentId=main`、`delivery.mode=announce`,并读实际 `delivery.channel`/`to` 回报它是投到钉钉还是飞书(不要默认钉钉)。
|
||||
3. 回报时给下次触发时间 + 上次投递结果(`state.lastDeliveryStatus=delivered` 才算真的发出去过)。
|
||||
|
||||
## 修改 / 删除
|
||||
|
||||
- 改文案/时间:`openclaw cron edit <id> --command '...'`(或 `--cron`/`--message`)
|
||||
- 改文案/时间:`openclaw cron edit <id> --command '...'`(或 `--cron`/`--message`),也可用 `automations` 工具的 `update <jobId>`
|
||||
- 删除:`openclaw cron rm <id>`
|
||||
|
||||
## 临时改一次(某晚停用某产品、出门在外等)
|
||||
|
||||
只改周期任务的 payload 就完事,会一直错下去;要配一条恢复任务:
|
||||
|
||||
1. 用 `automations update <jobId>`(或 `openclaw cron edit <id> --command '...'`)换成当晚版本,回读 `automations get <jobId>` 确认文案已生效。
|
||||
2. 同一步里建一条一次性任务,在次日合适时间把 payload 改回标准版本。它跑在 isolated 会话、**没有本次对话的记忆**,所以 message 必须写全 jobId 与目标文案原文,并注明改完回读校验、成功即回 `NO_REPLY`。
|
||||
3. 恢复任务不需要给人看:按核心规则加 `--no-deliver`。
|
||||
|
||||
## 参考
|
||||
|
||||
- 生日提醒(农历换算、每年重设、一次性任务):见 `birthday-reminder` skill
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
TO="0464031658857345"
|
||||
CH="dingtalk-connector"
|
||||
AGENT="main"
|
||||
# 本脚本自行设定 PATH 时必须用绝对路径(裸 openclaw 只在 exec 的 PATH 里有效)
|
||||
OC="/home/yangxuan/.openclaw/tmp/agent-cli/openclaw"
|
||||
# 改投飞书:CH="feishu",TO="oc_8eecfa0e1cc185c1cb19b4f3950cbc52"(DM chat_id,不要用用户 open_id)
|
||||
|
||||
# 文案相同的提醒合并为变量复用(示例:护肤用酸日/保湿日/休息日)
|
||||
TEXT_A='第一条提醒文案(可多行)'
|
||||
@@ -13,7 +16,7 @@ TEXT_B='第二条提醒文案(可多行)'
|
||||
add() {
|
||||
local name="$1" dow="$2" text="$3" # dow: 周日=0, 周一=1 ... 周六=6
|
||||
echo "--- 创建: $name (周$dow 21:00) ---"
|
||||
openclaw cron add "$name" \
|
||||
"$OC" cron add "$name" \
|
||||
--cron "0 21 * * $dow" --tz Asia/Shanghai \
|
||||
--agent "$AGENT" \
|
||||
--session isolated --announce \
|
||||
|
||||
Reference in New Issue
Block a user