OpenClaw Swarm层:规范驱动的工作流编排,ACP 优先执行,监督式自动驾驶控制面板,手动回退,持久会话,...
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.
Current release baseline: openclaw-swarm-layer@0.5.12, validated on OpenClaw local mini 2026.6.5 with startup tool contracts, plugin doctor checks, conservative ACP failure mapping, artifact-acceptance smoke (positive note-producing task plus negative missing-artifact task on a live ACP backend), unique-bridge-session smoke, parallel admission checks, and the full unit/e2e regression suite.
[parallel] phase barriersexpectedArtifacts (absolute paths or globs) per task; a completed ACP run with missing artifacts is downgraded to failed with failure.source: "artifact-validation" instead of reaching done--parallel N and --all-ready batch dispatch with concurrency-aware queued-task drainstatus/start/pause/resume/stop/tick flows with lease-backed decisions, optional watcher-driven ticks, and degraded-mode holdsThree installation paths:
ClawHub (skill only):
bash
openclaw skills install swarm-layer
ClawHub package (full plugin):
bash
openclaw plugins install clawhub:openclaw-swarm-layer
npm (full plugin):
bash
npm install openclaw-swarm-layer
openclaw plugins install -l node_modules/openclaw-swarm-layer
GitHub (source):
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
After install, verify: openclaw plugins info openclaw-swarm-layer should show Status: loaded.
bash
# 1. Initialize
openclaw swarm init --project <TEMP_DIR>/my-project
# 2. Write a spec
cat > <TEMP_DIR>/my-project/SPEC.md << 'EOF'
# Feature Build
## Goals
- Implement and test the new feature
## Phases
### Implement
- Write the core logic
### Test
- Run unit tests
EOF
# 3. Plan
openclaw swarm plan --project <TEMP_DIR>/my-project --spec <TEMP_DIR>/my-project/SPEC.md
# → specId: feature-build, taskCount: 2
# 4. Execute first task
openclaw swarm run --project <TEMP_DIR>/my-project --runner acp
# → action: dispatched, runId: implement-task-1-run-...
# 5. Poll until complete
openclaw swarm session status --project <TEMP_DIR>/my-project --run <runId>
# → status: completed
# 6. Approve
openclaw swarm review --project <TEMP_DIR>/my-project --task <taskId> --approve
# → status: done
# 7. Execute next task, repeat steps 4-6
# 8. View report
openclaw swarm report --project <TEMP_DIR>/my-project
Determine which module to use based on what the user needs:
User IntentModuleKey CommandsInstall, configure, initializeSetupplugins install, doctor, initPlan, execute, review, session opsOperateplan, run, review, session *Supervised automation controlOperateautopilot status/start/pause/resume/stop/tickSomething broken, stuck, or failingDiagnosedoctor, session status/cancel/cleanupCheck progress, read reportsReportstatus, report, session list/inspect
When unsure, start with openclaw swarm status --project . to assess the situation.
First-time install, ACP configuration, project initialization, or config troubleshooting.
bash
node --version # >= 22
openclaw --version # >= 2026.3.22
The 0.5.12 release was smoke-tested on OpenClaw local mini 2026.6.5 with a Daily Papers-style live ACP workload.
bash
openclaw plugins install clawhub:openclaw-swarm-layer # Published package
openclaw plugins install -l /path/to/openclaw-swarm-layer
openclaw plugins info openclaw-swarm-layer # Should show Status: loaded
json
{
"plugins": { "entries": { "openclaw-swarm-layer": { "config": {
"defaultRunner": "auto",
"acp": {
"enabled": true,
"defaultAgentId": "codex",
"allowedAgents": ["codex"],
"defaultMode": "run",
"defaultRuntimeMode": "auto"
}
}}}}
}
bash
openclaw swarm doctor --json
# severity should be "healthy" or "warning", not "blocked"
bash
openclaw swarm init --project .
json
{
"obsidianRoot": "/path/to/vault/reports",
"journal": {
"enableRunLog": true,
"enableReviewLog": true,
"enableSpecArchive": true,
"enableCompletionSummary": true
}
}
openclaw plugins info openclaw-swarm-layeropenclaw swarm doctor --json, confirm public ACP export readiness and runner resolutionacp.defaultRuntimeMode to auto for Codex-backed workflow tasksbridge.acpFallbackEnabled after confirming ACP public path is readyPlan and execute workflows, manage sessions, complete review cycles.
text
Write Spec → Plan → Status → Run → Poll Session → Review → Repeat
markdown
# My Workflow
## Goals
- What to achieve
## Phases
### Phase 1
- Task A
- Task B
bash
openclaw swarm plan --project . --spec SPEC.md # Import and generate tasks
openclaw swarm status --project . --sync # Sync active runs, then see what's ready
openclaw swarm run --project . --sync-active --dry-run # Preview after active-run sync
openclaw swarm run --project . --sync-active --runner acp # Execute (acp/manual)
openclaw swarm run --project . --sync-active --parallel 3 # Dispatch up to 3 ready/queued tasks
openclaw swarm run --project . --sync-active --all-ready # Fill all available concurrency slots
openclaw swarm session status --project . --run <id> # Poll until complete
openclaw swarm review --project . --task <id> --approve
openclaw swarm review --project . --task <id> --reject --retry-now # Reject and force retry
bash
openclaw swarm autopilot status --project . # Health + last decision
openclaw swarm autopilot start --project . # Start supervised loop
openclaw swarm autopilot pause --project . --reason "operator review"
openclaw swarm autopilot resume --project .
openclaw swarm autopilot tick --project . --dry-run # Inspect next actions without mutating state
openclaw swarm autopilot stop --project . --mode graceful
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.
Optional watcher mode:
json
{
"autopilot": {
"enabled": true,
"watcherMode": "hybrid",
"watcher": {
"debounceMs": 100,
"safetyTickMs": 300000,
"library": "auto"
}
}
}
Use watcherMode: "polling" as the rollback path.
RunnerUse WhenmanualSafe explicit fallback when ACP automation is unavailable or not desiredacpDefault-capable automation path through the public ACP control-plane
bash
session list --project . # List all
session inspect --project . --session <id> # Details
session follow-up --project . --session <id> --task <desc> # Inject task
session steer --project . --session <id> --message <text> # Redirect
session cancel --project . --run <id> # Abort
session cleanup --project . --stale-minutes 60 # Clean orphans
PolicyBehaviornoneNew session each run (default)create_persistentCreates reusable persistent sessionreuse_if_availableReuse idle persistent session if match foundrequire_existingFail if no matching session exists
Enable advanced harness features for long-running agent orchestration:
json
{
"enforceTaskImmutability": true,
"bootstrap": { "enabled": true },
"evaluator": { "enabled": true, "autoInjectAfter": ["coding"] }
}
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:
text
coding-task → coding-task-eval → next-task
Quality Rubrics — Replace binary approve/reject with 4-dimension weighted scoring:
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.
User SaysDo This"start a new workflow"Help write spec → plan → status"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
Tasks stuck, ACP readiness failures, sessions not updating, dead letters, orphans.
text
1. openclaw swarm doctor --json → Check ACP readiness and bridge-exit health
2. openclaw swarm status --project . → Find abnormal tasks/sessions
3. Investigate specific issue (see below)
SeverityMeaningActionhealthyAll goodNonewarningWorks but riskyAddress warnings when convenientblockedCannot executeFollow remediation immediately
Legacy bridge compatibility warning:
doctor --json → check warnings / remediationbridge.acpFallbackEnabled, or clean up old versionAllow/ openclawRoot metadataStuck running task:
bash
swarm session status --project . --run <runId> # Check if session died
swarm session cancel --project . --run <runId> # Force cancel if hung
Dead letter task (retries exhausted):
swarm status → find dead_letter tasksreadyOrphaned sessions (stale active):
bash
swarm session cleanup --project . --stale-minutes 60
Version drift (after OpenClaw upgrade):
bash
swarm doctor --json
# Remove stale bridge metadata if present → rerun doctor → verify runner resolution
Check progress, generate reports, understand session inventory.
bash
openclaw swarm status --project . # Structured summary
openclaw swarm report --project . # Full Markdown report
SectionContentAttentionItems needing action: review / blocked / running / dead_letterTasksAll tasks with current statusReview QueueTasks awaiting approve/rejectHighlightsNotable terminal events (completed/failed/cancelled)Recommended ActionsWhat to do nextRecent RunsLast 5 runsSessionsLast 5 sessions with stateSession Reuse CandidatesWhich tasks can reuse which sessions
FileTriggerModeswarm-report.mdEvery operationOverwriterun-log.md``swarm runAppendreview-log.md``swarm reviewAppendspecs/<specId>.md``swarm planCreate oncecompletion-summary.mdAll tasks doneOverwrite
Local: <project>/.openclaw/swarm/reports/ (always)
Obsidian: <obsidianRoot>/<project>/ (optional async mirror)
User SaysDo This"what's the status?"status → 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
For AI tool calling. All tools accept --json for structured output.
ToolParametersPurposeswarm_status``project, sync?Workflow status with optional active-run sync and attention itemsswarm_task_plan``project, specImport spec, generate task graphswarm_run``project, task?, dryRun?, parallel?, allReady?, syncActive?Sync active runs when requested, then dispatch runnable or queued tasksswarm_review_gate``project, task, approve?, reject?, note?Approve/reject review (reject returns to ready by default)swarm_session_status``project, runPoll session statusswarm_session_cancel``project, run, reason?Cancel sessionswarm_session_close``project, run, reason?Close session