OpenClaw Swarm Layer
Turn workflow specifications into executable task graphs. Dispatch tasks through manual fallback or ACP automation. Supervise execution through an optional autopilot control plane. Track execution via persistent sessions with reuse and thread binding. Gate completion with review approval. Auto-retry on failure. Generate reports to local disk and Obsidian.
What It Does
- - Spec-driven planning — Write a Markdown spec with goals and phased tasks → generates a dependency-ordered task graph
- Multi-runner execution — Manual (operator-driven safe fallback) and ACP (default-capable automation path)
- Session management — Persistent sessions with binding-key reuse, thread-bound follow-up, and steering messages
- Review gates — Tasks require explicit approve/reject; structured quality rubrics for weighted multi-dimension scoring
- Sprint contracts — Negotiated verifiable acceptance criteria per task with automated evaluator injection (GAN-inspired pattern)
- Cross-session continuity — Progress summary synthesis, bootstrap startup sequence, harness assumption tracking
- Protective guardrails — Task field immutability guard, session budget control (duration + retries)
- Automatic retry — Configurable per-task retry policy with dead letter tracking for exhausted tasks
- Concurrency protection — ACP session concurrency limits with queued task scheduling (FIFO)
- Reject-retry workflow — Review rejections return tasks to ready for re-run; configurable retry limits
- Parallel dispatch —
--parallel N and --all-ready batch dispatch with concurrency-aware slot management - Autopilot control plane — Supervised
status/start/pause/resume/stop/tick flows with lease-backed decisions and degraded-mode holds - Operator reports — Status snapshots, run logs, review logs, spec archives, completion summaries → local + Obsidian sync
What It Does NOT Do
- - Not a distributed multi-node orchestrator — single machine, single project
- Not a CI/CD pipeline — no git push, PR creation, or deployment automation
- Not an autonomous PR factory — operator stays in the loop for review decisions
Install
Three installation paths:
ClawHub (skill only):
CODEBLOCK0
ClawHub package (full plugin):
CODEBLOCK1
npm (full plugin):
CODEBLOCK2
GitHub (source):
CODEBLOCK3
After install, verify: openclaw plugins info openclaw-swarm-layer should show Status: loaded.
End-to-End Example
CODEBLOCK4
Links
- - GitHub: https://github.com/xucheng/openclaw-swarm-layer
- npm: https://www.npmjs.com/package/openclaw-swarm-layer
- Docs: https://github.com/xucheng/openclaw-swarm-layer/tree/main/docs
- Issues: https://github.com/xucheng/openclaw-swarm-layer/issues
- ClawHub: https://clawhub.ai/skills/swarm-layer
Module Router
Determine which module to use based on what the user needs:
| User Intent | Module | Key Commands |
|---|
| Install, configure, initialize | Setup | INLINECODE5 , doctor, INLINECODE7 |
| Plan, execute, review, session ops |
Operate |
plan,
run,
review,
session * |
| Supervised automation control |
Operate |
autopilot status/start/pause/resume/stop/tick |
| Something broken, stuck, or failing |
Diagnose |
doctor,
session status/cancel/cleanup |
| Check progress, read reports |
Report |
status,
report,
session list/inspect |
When unsure, start with openclaw swarm status --project . to assess the situation.
Setup
When to Use
First-time install, ACP configuration, project initialization, or config troubleshooting.
Flow
1. Prerequisites
CODEBLOCK5
2. Install Plugin
CODEBLOCK6
3. Configure ACP Public Path
CODEBLOCK7
4. Verify
CODEBLOCK8
5. Initialize Project
CODEBLOCK9
6. Optional: Obsidian Sync + Journal
CODEBLOCK10
Setup Troubleshooting
- - Plugin not loading → INLINECODE19
- ACP unavailable →
openclaw swarm doctor --json, confirm public ACP export readiness and runner resolution - Legacy bridge config warning → remove
bridge.acpFallbackEnabled after confirming ACP public path is ready
Operate
When to Use
Plan and execute workflows, manage sessions, complete review cycles.
Core Loop
CODEBLOCK11
Write a Spec
CODEBLOCK12
Plan → Run → Review
CODEBLOCK13
Autopilot Control Plane
CODEBLOCK14
Use autopilot when you want the workflow to keep progressing under policy control instead of manually calling run, session status, and recovery commands one by one.
Runner Selection
| Runner | Use When |
|---|
| INLINECODE24 | Safe explicit fallback when ACP automation is unavailable or not desired |
| INLINECODE25 |
Default-capable automation path through the public ACP control-plane |
Session Operations
CODEBLOCK15
Session Policies
| Policy | Behavior |
|---|
| INLINECODE26 | New session each run (default) |
| INLINECODE27 |
Creates reusable persistent session |
|
reuse_if_available | Reuse idle persistent session if match found |
|
require_existing | Fail if no matching session exists |
Harness Enhancement (GAN-Inspired Patterns)
Enable advanced harness features for long-running agent orchestration:
CODEBLOCK16
Sprint Contracts — Add Acceptance Criteria to your spec. plan auto-generates a SprintContract with verifiable criteria attached to coding tasks.
Evaluator Injection — When evaluator.enabled, each coding task gets an auto-injected -eval task that validates the contract. Dependency chains adjust automatically:
CODEBLOCK17
Quality Rubrics — Replace binary approve/reject with 4-dimension weighted scoring:
- - functionality (0.3) / correctness (0.3) / design (0.2) / craft (0.2)
- Weighted total >= 6.0 → approve; < 6.0 → reject
Cross-Session Progress — progress.json auto-updated after each run and review. Bootstrap sequence loads progress on startup: verify env → load progress → select task → verify baseline.
Task Immutability — When enforceTaskImmutability is enabled, agents cannot mutate task definitions (title, deps, runner, etc.). Only status, review.status, and contract.criteria[].passes are mutable.
Session Budget — Set runner.budget.maxDurationSeconds and runner.budget.maxRetries per task. Exceeded budgets annotate [BUDGET EXCEEDED] on run records.
Assumption Tracking — WorkflowState.assumptions tracks model capability, environment, tooling, and workflow structure assumptions with validation lifecycle.
Conversational Patterns
| User Says | Do This |
|---|
| "start a new workflow" | Help write spec → plan → INLINECODE47 |
| "run the next task" |
status → dry-run →
run |
| "what's happening?" |
status →
session status for running tasks |
| "approve everything" | List review queue → approve each |
| "enable harness mode" | Add evaluator + immutability + bootstrap config |
| "something is stuck" | →
Diagnose module |
Diagnose
When to Use
Tasks stuck, ACP readiness failures, sessions not updating, dead letters, orphans.
Diagnostic Flow
CODEBLOCK18
Doctor Severity
| Severity | Meaning | Action |
|---|
| INLINECODE52 | All good | None |
| INLINECODE53 |
Works but risky | Address warnings when convenient |
|
blocked | Cannot execute | Follow
remediation immediately |
Issue Resolution
Legacy bridge compatibility warning:
- -
doctor --json → check warnings / INLINECODE58 - Common: remove stale
bridge.acpFallbackEnabled, or clean up old versionAllow/openclawRoot metadata
Stuck running task:
CODEBLOCK19
Dead letter task (retries exhausted):
- -
swarm status → find dead_letter tasks - Fix root cause → manually reset task to INLINECODE64
Orphaned sessions (stale active):
CODEBLOCK20
Version drift (after OpenClaw upgrade):
swarm doctor --json
# Remove stale bridge metadata if present → rerun doctor → verify runner resolution
Report
When to Use
Check progress, generate reports, understand session inventory.
Quick Check
CODEBLOCK22
Report Sections
| Section | Content |
|---|
| Attention | Items needing action: review / blocked / running / dead_letter |
| Tasks |
All tasks with current status |
|
Review Queue | Tasks awaiting approve/reject |
|
Highlights | Notable terminal events (completed/failed/cancelled) |
|
Recommended Actions | What to do next |
|
Recent Runs | Last 5 runs |
|
Sessions | Last 5 sessions with state |
|
Session Reuse Candidates | Which tasks can reuse which sessions |
Report Files
| File | Trigger | Mode |
|---|
| INLINECODE65 | Every operation | Overwrite |
| INLINECODE66 |
swarm run | Append |
|
review-log.md |
swarm review | Append |
|
specs/<specId>.md |
swarm plan | Create once |
|
completion-summary.md | All tasks done | Overwrite |
Local: <project>/.openclaw/swarm/reports/ (always)
Obsidian: <obsidianRoot>/<project>/ (optional async mirror)
Conversational Patterns
| User Says | Do This |
|---|
| "what's the status?" | INLINECODE75 → summarize counts + attention |
| "show me the report" |
report → read and present key sections |
| "what needs attention?" |
status → focus on
attention array |
| "how are sessions?" |
status → show session counts + recent |
Tools Reference
For AI tool calling. All tools accept --json for structured output.
| Tool | Parameters | Purpose |
|---|
| INLINECODE81 | INLINECODE82 | Workflow status with attention items |
| INLINECODE83 |
project,
spec | Import spec, generate task graph |
|
swarm_run |
project,
task?,
dryRun?,
parallel?,
allReady? | Dispatch runnable tasks (single or batch) |
|
swarm_review_gate |
project,
task,
approve?,
reject?,
note? | Approve/reject review (reject returns to ready by default) |
|
swarm_session_status |
project,
run | Poll session status |
|
swarm_session_cancel |
project,
run,
reason? | Cancel session |
|
swarm_session_close |
project,
run,
reason? | Close session |
OpenClaw Swarm Layer
将工作流规范转化为可执行的任务图。通过手动回退或ACP自动化调度任务。通过可选的自动驾驶控制平面监督执行。通过支持复用和线程绑定的持久化会话跟踪执行。通过审核批准来把关完成。失败时自动重试。生成报告到本地磁盘和Obsidian。
功能概述
- - 规范驱动规划 — 编写包含目标和分阶段任务的Markdown规范 → 生成依赖排序的任务图
- 多运行器执行 — 手动(操作员驱动的安全回退)和ACP(默认能力的自动化路径)
- 会话管理 — 支持绑定键复用、线程绑定后续操作和引导消息的持久化会话
- 审核把关 — 任务需要明确的批准/拒绝;结构化的质量评分标准用于加权多维评分
- 冲刺合约 — 每个任务协商可验证的验收标准,带自动评估器注入(GAN启发模式)
- 跨会话连续性 — 进度摘要合成、引导启动序列、框架假设追踪
- 保护性护栏 — 任务字段不可变性保护、会话预算控制(时长+重试次数)
- 自动重试 — 可配置的每任务重试策略,带死信追踪已耗尽任务
- 并发保护 — ACP会话并发限制,带队列任务调度(FIFO)
- 拒绝重试工作流 — 审核拒绝将任务返回到就绪状态以重新运行;可配置的重试限制
- 并行调度 — --parallel N 和 --all-ready 批量调度,带并发感知的槽位管理
- 自动驾驶控制平面 — 监督的 status/start/pause/resume/stop/tick 流程,带租约支持的决策和降级模式保持
- 操作员报告 — 状态快照、运行日志、审核日志、规范存档、完成摘要 → 本地 + Obsidian同步
不包含的功能
- - 不是分布式多节点编排器 — 单机、单项目
- 不是CI/CD流水线 — 没有git推送、PR创建或部署自动化
- 不是自主PR工厂 — 操作员始终参与审核决策
安装
三种安装方式:
ClawHub(仅技能):
bash
openclaw skills install swarm-layer
ClawHub包(完整插件):
bash
openclaw plugins install clawhub:openclaw-swarm-layer
npm(完整插件):
bash
npm install openclaw-swarm-layer
openclaw plugins install -l node_modules/openclaw-swarm-layer
GitHub(源码):
bash
git clone https://github.com/xucheng/openclaw-swarm-layer.git
cd openclaw-swarm-layer && npm install && npm run build
openclaw plugins install -l /path/to/openclaw-swarm-layer
安装后验证:openclaw plugins info openclaw-swarm-layer 应显示 Status: loaded。
端到端示例
bash
1. 初始化
openclaw swarm init --project /tmp/my-project
2. 编写规范
cat > /tmp/my-project/SPEC.md << EOF
功能构建
目标
阶段
实现
测试
EOF
3. 规划
openclaw swarm plan --project /tmp/my-project --spec /tmp/my-project/SPEC.md
→ specId: feature-build, taskCount: 2
4. 执行第一个任务
openclaw swarm run --project /tmp/my-project --runner acp
→ action: dispatched, runId: implement-task-1-run-...
5. 轮询直到完成
openclaw swarm session status --project /tmp/my-project --run
→ status: completed
6. 批准
openclaw swarm review --project /tmp/my-project --task --approve
→ status: done
7. 执行下一个任务,重复步骤4-6
8. 查看报告
openclaw swarm report --project /tmp/my-project
链接
- - GitHub: https://github.com/xucheng/openclaw-swarm-layer
- npm: https://www.npmjs.com/package/openclaw-swarm-layer
- 文档: https://github.com/xucheng/openclaw-swarm-layer/tree/main/docs
- 问题: https://github.com/xucheng/openclaw-swarm-layer/issues
- ClawHub: https://clawhub.ai/skills/swarm-layer
模块路由
根据用户需求确定使用哪个模块:
| 用户意图 | 模块 | 关键命令 |
|---|
| 安装、配置、初始化 | 设置 | plugins install、doctor、init |
| 规划、执行、审核、会话操作 |
操作 | plan、run、review、session * |
| 监督自动化控制 | 操作 | autopilot status/start/pause/resume/stop/tick |
| 出现故障、卡住或失败 | 诊断 | doctor、session status/cancel/cleanup |
| 检查进度、阅读报告 | 报告 | status、report、session list/inspect |
不确定时,先运行 openclaw swarm status --project . 评估情况。
设置
使用时机
首次安装、ACP配置、项目初始化或配置故障排除。
流程
1. 前置条件
bash
node --version # >= 22
openclaw --version # >= 2026.3.22
2. 安装插件
bash
openclaw plugins install clawhub:openclaw-swarm-layer # 已发布包
openclaw plugins install -l /path/to/openclaw-swarm-layer
openclaw plugins info openclaw-swarm-layer # 应显示 Status: loaded
3. 配置ACP公共路径
json
{
plugins: { entries: { openclaw-swarm-layer: { config: {
defaultRunner: auto,
acp: {
enabled: true,
defaultAgentId: codex,
allowedAgents: [codex],
defaultMode: run
}
}}}}
}
4. 验证
bash
openclaw swarm doctor --json
severity 应为 healthy 或 warning,不能是 blocked
5. 初始化项目
bash
openclaw swarm init --project .
6. 可选:Obsidian同步 + 日志
json
{
obsidianRoot: /path/to/vault/reports,
journal: {
enableRunLog: true,
enableReviewLog: true,
enableSpecArchive: true,
enableCompletionSummary: true
}
}
设置故障排除
- - 插件未加载 → openclaw plugins info openclaw-swarm-layer
- ACP不可用 → openclaw swarm doctor --json,确认ACP公共导出就绪和运行器解析
- 旧版桥接配置警告 → 确认ACP公共路径就绪后移除 bridge.acpFallbackEnabled
操作
使用时机
规划并执行工作流、管理会话、完成审核周期。
核心循环
编写规范 → 规划 → 状态 → 运行 → 轮询会话 → 审核 → 重复
编写规范
markdown
我的工作流
目标
阶段
阶段1
规划 → 运行 → 审核
bash
openclaw swarm plan --project . --spec SPEC.md # 导入并生成任务
openclaw swarm status --project . # 查看就绪状态
openclaw swarm run --project . --dry-run # 预览
openclaw swarm run --project . --runner acp # 执行(acp/manual)
openclaw swarm run --project . --parallel 3 # 调度最多3个就绪任务
openclaw swarm run --project . --all-ready # 填满所有可用并发槽位
openclaw swarm session status --project . --run # 轮询直到完成
openclaw swarm review --project . --task --approve
openclaw swarm review --project . --task --reject --retry-now # 拒绝并强制重试
自动驾驶控制平面
bash
openclaw swarm autopilot status --project .