name: arbiter description: 将决策推送给Arbiter Zebu进行异步人工审核。当您需要人类对计划、架构选择或批准进行输入时使用。 metadata: {“openclaw”:{“requires”:{“bins”:[“arbiter-push”]}}}
Arbiter 技能
将决策推送给Arbiter Zebu进行异步人工审核。当您需要人类对计划、架构选择或批准进行输入时使用。
安装
通过ClawHub快速安装:
clawhub install arbiter
或通过bun(使CLI命令全局可用):
bun add -g arbiter-skill
或手动安装:
git clone https://github.com/5hanth/arbiter-skill.git
cd arbiter-skill && npm install && npm run build
ln -s $(pwd) ~/.clawdbot/skills/arbiter
前提条件
- 运行中的Arbiter Zebu机器人(或直接运行
bunx arbiter-zebu) ~/.arbiter/queue/目录(由机器人自动创建)
环境变量
在您的代理环境中设置这些变量以实现自动代理/会话检测:
| 变量 | 描述 | 示例 |
|---|---|---|
CLAWDBOT_AGENT |
代理ID | ceo, swe1 |
CLAWDBOT_SESSION |
会话密钥 | agent:ceo:main |
何时使用
- 实施前的计划审查
- 需要权衡的架构决策
- 任何需要人类判断的阻塞性问题
- 作为批处理的多个相关决策
请勿用于:
- 不需要解释的简单是/否问题
- 紧急的实时决策(请改用直接消息)
- 您可以自己研究的技术问题
工具
arbiter_push
创建供人工审核的决策计划。
CLI: arbiter-push '<json>' — 接受包含所有字段的单个JSON参数。
arbiter-push '{
"title": "API设计决策",
"tag": "nft-marketplace",
"context": "SWE2在API工作前需要这些决策",
"priority": "normal",
"notify": "agent:swe2:main",
"decisions": [
{
"id": "auth-strategy",
"title": "认证策略",
"context": "如何认证管理员用户",
"options": [
{"key": "jwt", "label": "JWT令牌", "note": "无状态"},
{"key": "session", "label": "会话", "note": "更多控制"},
{"key": "oauth", "label": "OAuth", "note": "外部提供商"}
]
},
{
"id": "database",
"title": "数据库选择",
"context": "主数据存储",
"options": [
{"key": "postgresql", "label": "PostgreSQL + JSONB"},
{"key": "mongodb", "label": "MongoDB"}
],
"allowCustom": true
}
]
}'
JSON字段:
| 字段 | 必填 | 描述 |
|---|---|---|
title |
是 | 计划标题 |
tag |
否 | 用于筛选的标签(例如项目名称) |
context |
否 | 审核者的背景信息 |
priority |
否 | low, normal, high, urgent(默认:normal) |
notify |
否 | 完成时通知的会话 |
agent |
否 | 代理ID(从CLAWDBOT_AGENT环境变量自动检测) |
session |
否 | 会话密钥(从CLAWDBOT_SESSION环境变量自动检测) |
decisions |
是 | 决策数组 |
决策对象:
| 字段 | 必填 | 描述 |
|---|---|---|
id |
是 | 计划内的唯一ID |
title |
是 | 决策标题 |
context |
否 | 给审核者的解释 |
options |
是 | {key, label, note?}数组 |
allowCustom |
否 | 允许自由文本答案(默认:false) |
default |
否 | 建议的选项键 |
返回:
{
"planId": "abc123",
"file": "~/.arbiter/queue/pending/ceo-api-design-abc123.md",
"total": 2,
"status": "pending"
}
arbiter_status
检查决策计划的状态。
CLI: arbiter-status <plan-id> 或 arbiter-status --tag <tag>
arbiter-status abc12345
# 或
arbiter-status --tag nft-marketplace
返回:
{
"planId": "abc123",
"title": "API设计决策",
"status": "in_progress",
"total": 3,
"answered": 1,
"remaining": 2,
"decisions": {
"auth-strategy": {"status": "answered", "answer": "jwt"},
"database": {"status": "pending", "answer": null},
"caching": {"status": "pending", "answer": null}
}
}
arbiter_get
从已完成的计划中获取答案。
CLI: arbiter-get <plan-id> 或 arbiter-get --tag <tag>
arbiter-get abc12345
# 或
arbiter-get --tag nft-marketplace
返回:
{
"planId": "abc123",
"status": "completed",
"completedAt": "2026-01-30T01:45:00Z",
"answers": {
"auth-strategy": "jwt",
"database": "postgresql",
"caching": "redis"
}
}
如果未完成则报错:
{
"error": "计划未完成",
"status": "in_progress",
"remaining": 2
}
arbiter_await
阻塞直到计划完成(带超时)。
arbiter-await abc12345 --timeout 3600
每30秒轮询一次,直到完成或超时。
返回: 完成时与arbiter_get相同。
使用示例
示例1:计划审查
# 推送计划决策(单个JSON参数)
RESULT=$(arbiter-push '{"title":"Clean IT i18n计划","tag":"clean-it","priority":"high","notify":"agent:swe3:main","decisions":[{"id":"library","title":"i18n库","options":[{"key":"i18next","label":"i18next"},{"key":"formatjs","label":"FormatJS"}]},{"id":"keys","title":"键结构","options":[{"key":"flat","label":"扁平(login.button)"},{"key":"nested","label":"嵌套({login:{button}})"}]}]}')
PLAN_ID=$(echo $RESULT | jq -r '.planId')
echo "已推送计划 $PLAN_ID — 等待人工审核"
示例2:检查并继续
# 检查决策是否就绪
STATUS=$(arbiter-status --tag nft-marketplace)
if [ "$(echo $STATUS | jq -r '.status')" == "completed" ]; then
ANSWERS=$(arbiter-get --tag nft-marketplace)
AUTH=$(echo $ANSWERS | jq -r '.answers["auth-strategy"]')
echo "使用认证策略: $AUTH"
# 继续实施
else
echo "仍在等待 $(echo $STATUS | jq -r '.remaining') 个决策"
fi
示例3:阻塞等待
# 等待决策最多1小时
ANSWERS=$(arbiter-await abc12345 --timeout 3600)
if [ $? -eq 0 ]; then
# 获得答案,继续
echo "决策就绪: $ANSWERS"
else
echo "等待决策超时"
fi
最佳实践
- 批量相关决策 — 不要一次推送一个
- 提供背景信息 — 人类需要理解权衡
- 使用标签 — 便于筛选(
--tag project-name) - 设置通知 — 以便被阻塞的代理被唤醒
- 谨慎使用优先级 — 为真正的阻塞问题保留
urgent
文件位置
| 路径 | 用途 |
|---|---|
~/.arbiter/queue/pending/ |
等待审核的计划 |
~/.arbiter/queue/completed/ |
已回答的计划(存档) |
~/.arbiter/queue/notify/ |
代理通知 |
检查通知(代理心跳)
在您的HEARTBEAT.md中添加:
## 检查Arbiter通知
1. 检查`~/.arbiter/queue/notify/`是否有我的会话文件
2. 如果有,读取答案并继续被阻塞的工作
3. 处理完成后删除通知文件
故障排除
| 问题 | 解决方案 |
|---|---|
| 计划未在Arbiter中显示 | 检查文件是否为有效的YAML frontmatter |
| 答案未出现 | 检查arbiter_status,可能未完成 |
| 未收到通知 | 确保--notify设置正确 |