name: openclaw-task-delegation description: Deploy and delegate complex tasks to OpenClaw agent — wrapper scripts + task guide + handoff protocol, respecting OpenClaw's sandbox constraints and 8-tool-call limit. tags: - openclaw - delegation - agent-pairing - workflow
OpenClaw Task Delegation Protocol
Context
You (Hermes) work alongside OpenClaw(口水虾), a subordinate agent with constraints:
- 8 tool calls per session max — complex tasks get truncated
- Sandbox-first — must write drafts to /tmp/openclaw_draft/, cannot modify Hermes files
- Silent execution — doesn't ask questions, just does what it's told
- Review-gate — any changes to server/Wiki must go through Hermes approval
- 飞书 channel only — communicates via Feishu messages
- Cannot create cron jobs — that's Hermes's domain
Your role: Hermes = supervisor/approver. OpenClaw = worker that executes well-defined tasks.
When to Delegate to OpenClaw
Any task where OpenClaw can be given a clear, single-line command and read back the result. Good candidates: - Running pre-installed tools/scripts - Reading output files and summarizing - Generating reports from structured data - Executing batch analyses
Deployment Steps (do this ONCE per tool)
1. Install the tool in a shared location
s
## Deployment Steps (do this ONCE per tool)
### 1. Install the tool in a shared location
```bash# Clone/install outside Hermes's directory, where OpenClaw can access
git clone <repo> /root/data/disk/<project-name>/
cd /root/data/disk/<project-name>/
pip install -e .
2. Write a wrapper script (critical!)
OpenClaw's 8-tool-call limit means it cannot do multi-step workflows. You must package the entire operation into a single bash command.
The wrapper script should: - Take simple arguments (stock code, date, mode) - Handle all setup internally (API keys, paths, error handling) - Output structured results to a predictable directory - Return a clear exit code
Script location: /root/data/disk/<project-name>/run_<task>.sh
Output convention: /root/data/disk/<project-name>-results/<task-id>/
3. Write a task guide document
Place at /root/openclaw-learning/<project>-task-guide.md containing:
- Project location and purpose
- Exact commands OpenClaw should run
- What each output file contains
- Common issues and resolutions
- Safety boundaries (what NOT to do)
4. Notify OpenClaw via Feishu
Send a message to OpenClaw's Feishu chat with:
📢 **新任务上线通知**
你有了一个新能力:<description>
项目:/root/data/disk/<project-name>/
任务指南(必读):/root/openclaw-learning/<project>-task-guide.md
你有两种模式:
- <模式1>:bash run_...sh <arg1> <arg2>
- <模式2>:bash run_...sh recommend <date>
请先读一遍任务指南熟悉项目。
请先读一遍任务指南熟悉项目。
``### 5. Update AGENTS.md (optional)
If OpenClaw's AGENTS.md at/root/.openclaw/workspace/AGENTS.mdneeds a permanent role update, write a draft to/tmp/openclaw_draft/` and let OpenClaw handle it.
Handoff Protocol (per task)
User -> Hermes: "分析 688017"
Hermes -> OpenClaw (Feishu): "请分析 688017,执行:
bash /root/data/disk/<project>/run_analysis.sh 688017 [date]
读结果发报告给我审核"
OpenClaw -> (runs, reads) -> Hermes (Feishu): 报告内容
Hermes -> User: 审核后转发给用户
实际验证有效的派发方式:interagent.py API 调用
已验证可用(2026-05-14 Wiki 审查任务):
python3 /root/.hermes/scripts/interagent.py --to niouma "<任务描述>" --max-tokens XXXX
- OpenClaw(niouma-doufu)通过 API Server(localhost:8643)接收任务
- 任务消息必须自包含——OpenClaw 没有当前对话上下文
- 较长的任务(grep 搜索 275 个文件等)容易 timeout(120s 限制)
- 成功模式:写任务指南 → 写执行脚本 → 通过 interagent.py 派发单个明确命令
派发策略(经验总结)
| 任务复杂度 | 方式 | 示例 |
|---|---|---|
| 简单(读文件+报告) | 直接在 interagent.py 消息里描述 | "读取 X 文件,汇总清单" |
| 中等(按规则执行操作) | 先写执行脚本到 /tmp/openclaw_draft/,然后派发"读取并执行" |
archive_execute.sh |
| 复杂(需要判断标准) | 先写任务指南到 /root/openclaw-learning/,再派发"按指南执行" |
wiki-vrchat-audit-guide.md |
已知限制
- interagent.py 有 120-300s timeout——大数据集任务(275个文件 grep)容易超时
- 超时后任务可能实际上已完成(只是没等到返回),可以依赖文件系统检查结果
- 重复派发不影响结果——幂等操作可以安全重试
- 不要一条消息塞太多任务——贴 40 个 mv 命令的脚本比在消息里列出更容易成功
- 用文件传数据比在消息里传更可靠——长清单/脚本写到文件再让 OpenClaw 读取 以安全重试
- 不要一条消息塞太多任务——贴 40 个 mv 命令的脚本比在消息里列出更容易成功
- 用文件传数据比在消息里传更可靠——长清单/脚本写到文件再让 OpenClaw 读取### 旧方案对比(飞书群发/Control UI)
- 飞书群发消息给 OpenClaw 不保证触发执行(不同 app_id)
- 用户通过飞书私聊 @OpenClaw bot 是可行的,但 Hermes 无法自动触发
- Control UI(localhost:18381/0qtaye/)可靠但需手动操作
- interagent.py API 调用是目前最可靠的自动派发方式
Common Pitfalls
- pyproject.toml format bugs — upstream projects often have malformed builds. The
dependenciesarray must be under[project.dependencies], not under[project.urls]. Check before installing. - env vars — always check how the project loads API keys. The TradingAgents project reads
MINIMAX_API_KEYfrom env directly (no dotenv in the main code path). - script syntax — OpenClaw's silent execution means it won't report minor shell errors. Always test the wrapper script yourself before delegating.
- 8-call limit — OpenClaw cannot iterate, retry, or debug. Everything must work first-try. Test the full pipeline before telling OpenClaw.
- OpenClaw cannot modify
/root/.hermes/— all project files must live under/root/data/disk/or another non-Hermes path.