Agent Harness Doctor
Based on Anthropic's "Effective Harnesses for Long-Running Agents" and ClawHub's agent-harness-architect, this skill automatically diagnoses and hardens your OpenClaw harness.
The 8 Dimensions
| Dimension | What it checks | Why it matters |
|---|
| Session Bridge | Is there a structured state file (agent-progress.json) that survives restarts? | Without this, every session starts blank |
| Fixed Startup Sequence |
Does the agent have a mandatory first N steps (read bridge, smoke test, etc.)? | Prevents skipping crucial initialization |
|
Smoke Test | Does the agent verify environment (network, API keys, disk) before tasks? | Catches failures early |
|
Atomic Checkpoint | After each task, does agent commit/save state? | Ensures progress isn't lost |
|
Output Self-Verification | Before saying "done", does agent validate the result? | Prevents false completions |
|
State File Format | Is state stored as JSON (not Markdown) to resist accidental edits? | Markdown is too easy for LLM to mangle |
|
Multi-Agent Protocol | If multiple agents, is there clear message passing? | Avoids race conditions and confusion |
|
Fallback Plan | Does agent have a Plan B if a dependency fails? | Increases robustness |
Usage
Run Diagnostic
CODEBLOCK0
Output includes:
CODEBLOCK1
Auto-Apply P0 Fixes
CODEBLOCK2
The tool will:
- 1. Create
agent-progress.json in workspace root with template - Update
AGENTS.md or CLAUDE.md to include a fixed startup sequence section - Log changes made
Apply Single Fix
CODEBLOCK3
Fixes Implemented
- -
create_session_bridge — generates agent-progress.json with schema v1.0 - INLINECODE7 — inserts mandatory startup steps into AGENTS.md (if present)
- INLINECODE8 — adds pre-task environment check (gateway status, API connectivity)
- INLINECODE9 — adds post-task commit template
- INLINECODE10 — injects self-check prompt into system instructions
- INLINECODE11 — migrates existing state files from MD to JSON
- INLINECODE12 — adds fallback handling patterns to AGENTS.md
Integration with Memory Stack
If memory-stack-core is installed, harness doctor will:
- - Check WAL and buffer health as part of "Session Bridge" score
- Recommend enabling WAL auto-capture if missing
- Verify buffer threshold is set appropriately
Pricing
$99 one-time. Includes:
- - Unlimited diagnostics
- Auto-fix application
- Future dimension additions
Based on ClawHub's agent-harness-architect skill, extended with auto-fix capabilities.
技能名称: agent-harness-doctor
详细描述:
Agent Harness Doctor
基于Anthropic的Effective Harnesses for Long-Running Agents和ClawHub的agent-harness-architect,此技能可自动诊断并强化你的OpenClaw harness。
8个维度
| 维度 | 检查内容 | 重要性 |
|---|
| 会话桥接 | 是否存在重启后仍保留的结构化状态文件(agent-progress.json)? | 若无此文件,每次会话都将从空白开始 |
| 固定启动序列 |
代理是否有强制的前N步操作(读取桥接、冒烟测试等)? | 防止跳过关键初始化步骤 |
|
冒烟测试 | 代理在执行任务前是否验证环境(网络、API密钥、磁盘)? | 尽早捕获故障 |
|
原子检查点 | 每个任务完成后,代理是否提交/保存状态? | 确保进度不会丢失 |
|
输出自验证 | 在声明完成之前,代理是否验证结果? | 防止虚假完成 |
|
状态文件格式 | 状态是否以JSON(而非Markdown)存储,以抵御意外编辑? | Markdown格式容易被LLM破坏 |
|
多代理协议 | 若存在多个代理,是否有清晰的消息传递机制? | 避免竞态条件和混乱 |
|
备用计划 | 若依赖项失败,代理是否有备用方案? | 增强鲁棒性 |
使用方法
运行诊断
bash
tool(agent-harness-doctor, harnesscheck, {fixapply: []})
输出示例:
json
{
summary: {
score: 6.5,
grade: B,
weakest_dimension: Session Bridge
},
dimensions: [
{
id: session_bridge,
name: Session Bridge,
score: 2,
max: 10,
finding: 未找到agent-progress.json文件,
recommendation: 创建包含lastSession、taskTracking、environmentStatus部分的agent-progress.json,
p0: true
},
...
],
plan: {
P0: [createsessionbridge, fixstartupsequence],
P1: [addsmoketest, enableatomiccheckpoint],
P2: [outputverificationgate, multiagentprotocol]
}
}
自动应用P0修复
bash
tool(agent-harness-doctor, harnesscheck, {fixapply: [createsessionbridge, fixstartupsequence]})
该工具将:
- 1. 在工作区根目录创建带模板的agent-progress.json
- 更新AGENTS.md或CLAUDE.md,添加固定启动序列部分
- 记录所做的更改
应用单个修复
bash
tool(agent-harness-doctor, applyfix, {fixid: createsessionbridge})
已实现的修复
- - createsessionbridge — 生成符合v1.0模式的agent-progress.json
- fixstartupsequence — 在AGENTS.md(若存在)中插入强制启动步骤
- addsmoketest — 添加任务前环境检查(网关状态、API连接性)
- enableatomiccheckpoint — 添加任务后提交模板
- outputverificationgate — 在系统指令中注入自检提示
- statejsonformat — 将现有状态文件从MD迁移至JSON
- fallbackplantemplate — 向AGENTS.md添加备用处理模式
与Memory Stack的集成
若已安装memory-stack-core,harness doctor将:
- - 在会话桥接评分中检查WAL和缓冲区健康状态
- 若缺失,建议启用WAL自动捕获
- 验证缓冲区阈值设置是否合适
定价
一次性收费$99。包含:
基于ClawHub的agent-harness-architect技能,扩展了自动修复功能。