Appearance
Standing Orders是OpenClaw中给智能体长期操作权限的配置,适用于自动执行定期任务或事件驱动的流程。在AGENTS.md中定义每个程序的授权范围、触发条件、审批关卡和上报规则,配合cron任务实现时间触发。每个程序需要明确“什么不能做”的边界,并遵守执行-验证-报告循环。新授权建议从窄范围开始,逐步扩展信任。
OpenClaw Standing Orders设置:给AI智能体配置自动化任务权限
Standing Orders让你的智能体拥有特定程序的永久操作授权。不用每次手动下发指令,而是定义好清晰边界、触发条件和上报规则的独立程序——智能体在这些边界内自主执行。
区别就像是:告诉助手“每周五发周报” vs. 直接授权“你负责周报。每周五整理发送,只在出现异常时上报。”
为什么需要Standing Orders
没有Standing Orders时:
- 每件任务都要手动提示智能体
- 请求间隙智能体空闲等待
- 常规工作容易被遗忘或延误
- 你成为瓶颈
有了Standing Orders时:
- 智能体在定义边界内自主执行
- 常规工作按计划完成,无需提示
- 你只需介入例外情况和审批
- 智能体利用空闲时间高效工作
工作原理
Standing Orders定义在你的智能体工作区文件中。推荐直接写入AGENTS.md(每次会话自动注入),确保智能体始终有这些指令在上下文中。配置量较大时,也可放在专用文件(如standing-orders.md)并在AGENTS.md中引用。
每个程序需要定义:
- 范围(Scope) ——智能体被授权做什么
- 触发条件(Triggers) ——何时执行(计划、事件或条件)
- 审批关卡(Approval gates) ——什么操作需要人工确认
- 上报规则(Escalation rules) ——何时停下来请求帮助
智能体通过工作区bootstrap文件每次会话都会加载这些指令(完整的自动注入文件列表参见智能体工作区),并结合cron任务实现基于时间的触发。
提示:把Standing Orders放进
AGENTS.md,保证每次会话都能加载。工作区bootstrap会自动注入AGENTS.md、SOUL.md、TOOLS.md、IDENTITY.md、USER.md、HEARTBEAT.md、BOOTSTRAP.md和MEMORY.md——但不会注入子目录中的任意文件。
Standing Order结构
markdown
## Program: Weekly Status Report
**Authority:** Compile data, generate report, deliver to stakeholders
**Trigger:** Every Friday at 4 PM (enforced via cron job)
**Approval gate:** None for standard reports. Flag anomalies for human review.
**Escalation:** If data source is unavailable or metrics look unusual (>2σ from norm)
### Execution steps
1. Pull metrics from configured sources
2. Compare to prior week and targets
3. Generate report in Reports/weekly/YYYY-MM-DD.md
4. Deliver summary via configured channel
5. Log completion to Agent/Logs/
### What NOT to do
- Do not send reports to external parties
- Do not modify source data
- Do not skip delivery if metrics look bad - report accuratelyStanding Orders + Cron任务
Standing Orders定义智能体被授权做什么,cron任务定义何时执行。两者配合使用:
Standing Order: "你负责每日收件箱分类"
↓
Cron Job(每天 8 点):"按 standing orders 执行收件箱分类"
↓
智能体:读取standing orders → 执行步骤 → 报告结果cron任务的提示词应引用standing order,而不是重复其内容:
bash
openclaw cron add \
--name daily-inbox-triage \
--cron "0 8 * * 1-5" \
--tz America/New_York \
--timeout-seconds 300 \
--announce \
--channel imessage \
--to "+1XXXXXXXXXX" \
--message "Execute daily inbox triage per standing orders. Check mail for new alerts. Parse, categorize, and persist each item. Report summary to owner. Escalate unknowns."示例
示例一:内容与社交媒体(周循环)
markdown
## Program: Content & Social Media
**Authority:** Draft content, schedule posts, compile engagement reports
**Approval gate:** All posts require owner review for first 30 days, then standing approval
**Trigger:** Weekly cycle (Monday review → mid-week drafts → Friday brief)
### Weekly cycle
- **Monday:** Review platform metrics and audience engagement
- **Tuesday-Thursday:** Draft social posts, create blog content
- **Friday:** Compile weekly marketing brief → deliver to owner
### Content rules
- Voice must match the brand (see SOUL.md or brand voice guide)
- Never identify as AI in public-facing content
- Include metrics when available
- Focus on value to audience, not self-promotion示例二:财务运营(事件触发)
markdown
## Program: Financial Processing
**Authority:** Process transaction data, generate reports, send summaries
**Approval gate:** None for analysis. Recommendations require owner approval.
**Trigger:** New data file detected OR scheduled monthly cycle
### When new data arrives
1. Detect new file in designated input directory
2. Parse and categorize all transactions
3. Compare against budget targets
4. Flag: unusual items, threshold breaches, new recurring charges
5. Generate report in designated output directory
6. Deliver summary to owner via configured channel
### Escalation rules
- Single item > $500: immediate alert
- Category > budget by 20%: flag in report
- Unrecognizable transaction: ask owner for categorization
- Failed processing after 2 retries: report failure, do not guess示例三:系统监控(持续)
markdown
## Program: System Monitoring
**Authority:** Check system health, restart services, send alerts
**Approval gate:** Restart services automatically. Escalate if restart fails twice.
**Trigger:** Every heartbeat cycle
### Checks
- Service health endpoints responding
- Disk space above threshold
- Pending tasks not stale (>24 hours)
- Delivery channels operational
### Response matrix
| Condition | Action | Escalate? |
| ---------------- | ------------------------ | ------------------------ |
| Service down | Restart automatically | Only if restart fails 2x |
| Disk space < 10% | Alert owner | Yes |
| Stale task > 24h | Remind owner | No |
| Channel offline | Log and retry next cycle | If offline > 2 hours |执行-验证-报告模式
Standing Orders配合严格的执行纪律效果最好。每个任务都应遵循以下循环:
- 执行(Execute) ——实际做这件事(不是只承认指令)
- 验证(Verify) ——确认结果正确(文件存在、消息已发、数据已解析)
- 报告(Report) ——告诉负责人做了什么、验证了什么
markdown
### Execution rules
- Every task follows Execute-Verify-Report. No exceptions.
- "I'll do that" is not execution. Do it, then report.
- "Done" without verification is not acceptable. Prove it.
- If execution fails: retry once with adjusted approach.
- If still fails: report failure with diagnosis. Never silently fail.
- Never retry indefinitely - 3 attempts max, then escalate.这个模式防止了智能体最常见的失败模式:承认任务却没有完成。
多程序架构
对于管理多个关注点的智能体,将Standing Orders组织为独立程序,边界清晰:
markdown
## Program 1: [Domain A] (Weekly)
...
## Program 2: [Domain B] (Monthly + On-Demand)
...
## Program 3: [Domain C] (As-Needed)
...
## Escalation Rules (All Programs)
- [Common escalation criteria]
- [Approval gates that apply across programs]每个程序应有:
- 自己的触发节奏(每周、每月、事件驱动、持续)
- 自己的审批关卡(某些程序需要更多监督)
- 清晰的边界(智能体应知道一个程序结束和另一个开始的界线)
最佳实践
应该
- 从窄授权开始,随信任建立逐步扩大
- 为高风险操作定义明确的审批关卡
- 加入"不应做什么"章节——边界和权限同样重要
- 结合cron任务实现可靠的时间触发
- 每周审查智能体日志,确认Standing Orders被正确执行
- 随需求演进更新Standing Orders——它们是活文档
避免
- 一开始就赋予宽泛授权("你看着办")
- 跳过上报规则——每个程序都需要"何时停下来请求帮助"的条款
- 假设智能体记住口头指令——所有内容写进文件
- 在单个程序中混合多个关注点——不同领域用不同程序
- 忘记用cron任务强制执行——没有触发器的Standing Orders只是建议
相关文档
- 自动化和Cron任务 — Standing Orders的时间触发器与schedule enforcement
- 事件钩子(Hooks) — 智能体生命周期的事件驱动脚本
- Webhooks — 入站HTTP事件触发
- 智能体工作区 — Standing Orders存放位置,含bootstrap文件完整列表
常见问题
Standing Orders和cron任务有什么区别?
Standing Orders定义智能体能做什么(授权范围和边界),cron任务定义什么时候做(时间触发)。两者独立但配合使用:Standing Orders提供执行逻辑,cron任务调用执行指令。一个Standing Order没有cron任务也能手动触发,但定期执行必须配cron任务。
审批关卡不生效怎么办?
检查审批关卡是否写入了AGENTS.md或其他bootstrap自动注入的文件。Standing Orders只有被智能体加载才生效,放在子目录文件需要手动从AGENTS.md引用。如果智能体仍跳过审批,检查AGENTS.md中的Section标题格式是否被正确解析。
系统监控示例中的重启逻辑怎么写?
上面的系统监控示例已经包含完整的自动重启和上报规则:服务宕机自动重启,重启失败2次才上报主人;磁盘空间小于10%直接告警。需要调整阈值或上报方式时,直接修改Response matrix表格中对应条件的Action和Escalate列即可。