Skip to content

Standing Orders(常设指令)

Standing Orders 为你的 agent 赋予特定程序的永久操作授权。与其每次都给 agent 单独的任务指令,不如定义好清晰边界、触发条件和上报规则的程序——让 agent 在这些边界内自主执行。

这就像让助手和你说"每周五发周报"的区别,与直接授权:"你负责周报。每周五整理发送,只在出现异常时上报。"

为什么需要 Standing Orders?

没有 standing orders 时:

  • 每件任务都要手动提示 agent
  • 请求间隙 agent 空闲等待
  • 常规工作容易被遗忘或延误
  • 你成为瓶颈

有了 standing orders:

  • agent 在定义边界内自主执行
  • 常规工作按计划完成,无需提示
  • 你只需介入例外情况和审批
  • agent 利用空闲时间高效工作

工作原理

Standing orders 定义在你的 agent workspace(如有该页面)文件中。推荐的做法是直接写入 AGENTS.md(每次会话自动注入),确保 agent 始终有这些指令在上下文中。对于较大的配置,也可以放在专用文件(如 standing-orders.md)并在 AGENTS.md 中引用。

每个程序需要定义:

  1. 范围(Scope)——agent 被授权做什么
  2. 触发条件(Triggers)——何时执行(计划、事件或条件)
  3. 审批关卡(Approval gates)——什么操作需要人工确认
  4. 上报规则(Escalation rules)——何时停下来请求帮助

agent 通过工作区 bootstrap 文件每次会话都会加载这些指令(完整的自动注入文件列表参见 Agent Workspace),并结合 cron 任务实现基于时间的触发。

提示:把 standing orders 放进 AGENTS.md,保证每次会话都能加载。工作区 bootstrap 会自动注入 AGENTS.mdSOUL.mdTOOLS.mdIDENTITY.mdUSER.mdHEARTBEAT.mdBOOTSTRAP.mdMEMORY.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 accurately

Standing Orders + Cron 任务

Standing orders 定义 agent 被授权做什么cron 任务定义何时执行。两者配合:

Standing Order: "你负责每日收件箱分类"

Cron Job(每天 8 点):"按 standing orders 执行收件箱分类"

Agent:读取 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 bluebubbles \
  --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 配合严格的执行纪律效果最好。每个任务都应遵循以下循环:

  1. 执行(Execute)——实际做这件事(不是只承认指令)
  2. 验证(Verify)——确认结果正确(文件存在、消息已发、数据已解析)
  3. 报告(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.

这个模式防止了 agent 最常见的失败模式:承认任务却没有完成。

多程序架构

对于管理多个关注点的 agent,将 standing orders 组织为独立程序,边界清晰:

markdown
# Standing Orders

## Program 1: [Domain A] (Weekly)

...

## Program 2: [Domain B] (Monthly + On-Demand)

...

## Program 3: [Domain C] (As-Needed)

...

## Escalation Rules (All Programs)

- [通用上报标准]
- [跨程序适用的审批关卡]

每个程序应有:

  • 自己的触发节奏(每周、每月、事件驱动、持续)
  • 自己的审批关卡(某些程序需要更多监督)
  • 清晰的边界(agent 应知道一个程序结束和另一个开始的界线)

最佳实践

应该

  • 从窄授权开始,随信任建立逐步扩大
  • 为高风险操作定义明确的审批关卡
  • 加入"不应做什么"章节——边界和权限同样重要
  • 结合 cron 任务实现可靠的时间触发
  • 每周审查 agent 日志,确认 standing orders 被正确执行
  • 随需求演进更新 standing orders——它们是活文档

避免

  • 一开始就赋予宽泛授权("你看着办")
  • 跳过上报规则——每个程序都需要"何时停下来请求帮助"的条款
  • 假设 agent 会记住口头指令——把所有内容写进文件
  • 在单个程序中混合多个关注点——不同领域用不同程序
  • 忘记用 cron 任务强制执行——没有触发器的 standing orders 只是建议

相关文档

  • Cron 任务 — Standing orders 的时间触发器
  • Agent Workspace(如有)— Standing orders 所在位置,包含 bootstrap 文件完整列表