Skip to content
/

ClawSpec

clawspec · bytegh/clawspec · ★ 43 · last commit 2026-03-29

Embed OpenSpec workflow into OpenClaw chat with visible planning, durable background implementation that survives gateway restarts, and channel-scoped project state.

Best whenPlanning must be visible in the main chat turn; implementation must be durable background work — these are different problems requiring different execution p…
Skip ifRunning implementation in the main visible chat turn, Using blanket git reset for cancel (prefer snapshot restore)
vs seeds
claude-flow's hive-mind consensus complexity.
Primitive shape 14 total
Commands 6 Skills 3 Subagents 1 Hooks 4
00

Summary

ClawSpec — Summary

ClawSpec is an OpenClaw plugin that embeds an OpenSpec workflow directly into chat with a split control surface: /clawspec ... slash commands for deterministic workspace/project/state management, and cs-* chat keywords (cs-plan, cs-work, cs-pause) that inject workflow context into the active conversation. Planning runs visibly in the main chat turn (cs-plan), while implementation runs in a durable background worker via ACP (Agent Control Protocol) that survives gateway restarts (cs-work). The plugin manages one unfinished change per repo across channels, maintains a planning journal of requirement discussions, uses file-backed progress/result state for crash recovery, and can restore tracked files from snapshots rather than doing blanket git resets on cancel. ClawSpec is the most architecturally sophisticated plugin in this batch: six runtime layers, an AcpWorkerClient for background execution, a watcher manager with restart-backoff, and explicit durability guarantees.

differs_from_seeds: ClawSpec is the only framework in this batch that targets OpenClaw (a chat-centric AI platform), making it analogous to claude-flow in architecture (multi-layer orchestration, background workers, durable state) but implemented as a chat plugin rather than a CLI tool. The ACP-based durable background execution with gateway-restart survival has no equivalent in any seed framework.

01

Overview

ClawSpec — Overview

Origin

Published by bytegh, v1.0.21, no license specified. Targets OpenClaw platform with ACP (Agent Control Protocol) for background execution. Node.js >= 24.0.0 required. Last commit 2026-03-29.

Philosophy

From the README: "ClawSpec is an OpenClaw plugin that embeds an OpenSpec workflow directly into chat. It splits project control and execution on purpose."

The design philosophy is visible planning + durable background execution:

  • Planning is visible: cs-plan runs in the main chat turn
  • Implementation is durable: cs-work hands off to a background worker that survives gateway restarts
  • Worker transport is direct: ClawSpec talks to acpx through its own AcpWorkerClient
  • Progress is file-backed: worker writes progress/result files so the watcher can recover after gateway restarts
  • Repo safety is explicit: cancel uses snapshot restore for tracked files instead of blanket repository reset

Manifesto-style statements

  • "Planning is visible. cs-plan runs in the main chat turn and does not use a hidden subagent."
  • "Implementation is durable. cs-work is handed off to a watcher-managed background worker."
  • "Repo safety is explicit. Cancel uses snapshot restore for tracked files instead of blanket repository reset."
  • "One unfinished change is enforced per repo across channels."

Target user

Teams using OpenClaw for AI-assisted development who want to integrate an OpenSpec-style spec-driven workflow into their chat-native workflow without breaking the chat-as-primary-UX model.

LINUX.DO badge

The README references LINUX.DO (a Chinese developer community), suggesting a primarily Chinese developer audience.

02

Architecture

ClawSpec — Architecture

Distribution

  • npm package: clawspec (v1.0.21)
  • Plugin API: OpenClaw pluginApi >= 2026.3.24
  • openclaw.plugin.json manifest defines configuration schema and UI hints

Install method

Add to OpenClaw plugin configuration (analogous to opencode-plugin-openspec):

{ "plugins": ["clawspec"] }

Tech stack

  • Language: TypeScript (Node.js ≥24.0.0, ESM)
  • Plugin entry: index.ts (OpenClaw plugin API)
  • Background execution: AcpWorkerClient → acpx CLI (ACP session manager)
  • Build/test: Node.js --experimental-strip-types

Runtime layers (from README)

Layer Main pieces Responsibility
Bootstrap clawspec.bootstrap, ensureOpenSpecCli, ensureAcpxCli Initializes stores, verifies deps, starts watcher manager
Control plane /clawspec command, hooks Receives user intent, routes commands, attaches chat context
Planning plane message_received, before_prompt_build, main agent turn Records requirement discussion, runs cs-plan
Execution plane WatcherManager, ExecutionWatcher, AcpWorkerClient Arms work, starts background worker, monitors progress/result
Recovery plane startup recovery, restart backoff, session adoption Re-attaches to live workers after gateway restart
Persistence plane OpenClaw state files + repo-local .openclaw/clawspec/ Stores project state, journals, progress, rollback baselines

Directory structure

clawspec/
├── index.ts            # Plugin entry
├── src/
│   ├── acp/            # ACP client
│   ├── bootstrap/      # Dependency initialization
│   ├── config.ts
│   ├── control/        # /clawspec command routing
│   ├── dependencies/   # ensureOpenSpecCli, ensureAcpxCli
│   ├── execution/      # ExecutionWatcher, execution-control.json
│   ├── memory/         # Project memory store
│   ├── openspec/       # OpenSpec CLI client
│   ├── orchestrator/   # Main orchestration
│   ├── planning/       # Planning journal, cs-plan
│   ├── rollback/       # Snapshot-based cancel/restore
│   ├── state/          # Plugin state store
│   ├── types.ts
│   ├── utils/
│   ├── watchers/       # WatcherManager
│   ├── worker/         # AcpWorkerClient, worker-io-helper
│   └── workspace/      # Workspace store
├── skills/
│   ├── openspec-propose.md
│   ├── openspec-explore.md
│   └── openspec-apply-change.md
├── openclaw.plugin.json
└── package.json

Required runtime

  • Node.js >= 24.0.0
  • OpenClaw >= 2026.3.24 plugin API
  • openspec CLI (auto-installed at bootstrap)
  • acpx CLI (auto-installed at bootstrap)
03

Components

ClawSpec — Components

Slash commands (/clawspec ...)

Command Purpose
/clawspec use <path> Select/switch workspace
/clawspec proposal Create/update proposal
/clawspec status Show active project status
/clawspec cancel Cancel active work (restores tracked files from snapshots)
/clawspec archive Archive finished change (validates + archives + clears context)
(others inferred from README) workspace, project selection, pause, continue

Chat keywords (inject workflow context)

Keyword Purpose
cs-plan Refresh proposal.md, design.md, specs, tasks.md in visible chat turn
cs-work Start background implementation via watcher + ACP worker
cs-pause Pause active background worker

Plugin hooks (OpenClaw lifecycle)

Hook Purpose
message_received Records planning discussion into planning-journal.jsonl when project attached
before_prompt_build Injects project, planning, or execution context into visible chat turn
agent_end Reconciles end of visible planning turns
clawspec.bootstrap Startup: initialize stores, ensure deps, start watcher

Skills (used in cs-plan injection)

Skill Purpose
openspec-propose.md Propose a new change with all artifacts in one step
openspec-explore.md Explore project context
openspec-apply-change.md Implement tasks from an OpenSpec change

State stores

Store Location Content
Plugin state OpenClaw state files Active project, change, worker status
Workspace store OpenClaw state files Per-channel workspace mapping
Project memory OpenClaw state files Per-project memory
Planning journal .openclaw/clawspec/planning-journal.jsonl Recorded requirement discussions
Worker progress .openclaw/clawspec/worker-progress.jsonl Background worker progress events
Execution result .openclaw/clawspec/execution-result.json Worker final result
Execution control .openclaw/clawspec/execution-control.json Worker arm/start/stop signals
Rollback baselines .openclaw/clawspec/ File snapshots for cancel/restore
05

Prompts

ClawSpec — Prompts

Verbatim excerpt 1: openspec-propose.md skill

---
name: openspec-propose
description: Propose a new change with all artifacts generated in one step. Use when the
  user wants to quickly describe what they want to build and get a complete proposal with
  design, specs, and tasks ready for implementation.
license: MIT
compatibility: Requires openspec CLI.
metadata:
  author: openspec
  version: "1.0"
  generatedBy: "1.2.0"
---

Propose a new change and generate the planning artifacts needed for implementation.

Artifacts created:
- `proposal.md`
- `design.md`
- `tasks.md`

When ready to implement, run the apply workflow.

...

1. Confirm the intended change
   - If the request is vague, ask what should be built or fixed.
   - Derive a kebab-case change name when needed.
   - Do not proceed until the intended change is understood.

2. Create the change
   ```bash
   openspec new change "<name>"
  1. Inspect workflow status

    openspec status --change "<name>" --json
    
  2. Build artifacts in dependency order For each ready artifact:

    openspec instructions <artifact-id> --change "<name>" --json
    

    Use the returned data to follow the provided template...

    After each artifact:

    • report brief progress
    • re-run openspec status
    • continue until every required apply artifact is complete
  3. Handle ambiguity

    • If the context is critically unclear, ask the user.
    • Prefer keeping momentum when the answer is reasonably inferable.

**Prompting technique**: CLI-orchestration pattern with dependency-order artifact generation. Clarification gate before starting ("Do not proceed until the intended change is understood"). Progressive status re-check after each artifact ("re-run `openspec status`"). Bias toward momentum ("Prefer keeping momentum when the answer is reasonably inferable").

---

## Verbatim excerpt 2: cs-plan context injection (from README description)

During `cs-plan`, ClawSpec injects:
- the active repo and change
- the planning journal
- imported OpenSpec skill text from `skills/`
- **strict rules that prevent code implementation or silent change switching**

The main chat agent then refreshes `proposal.md`, `specs`, `design.md`, and `tasks.md` in the current visible turn.

**Prompting technique**: Context injection + anti-pattern iron laws ("strict rules that prevent code implementation"). This is injected at runtime via the `before_prompt_build` hook, not static skill text.
09

Uniqueness

ClawSpec — Uniqueness & Positioning

differs_from_seeds

ClawSpec is the only plugin in this batch targeting OpenClaw (a chat-native AI platform). Its architectural sophistication exceeds all seeds except claude-flow: six runtime layers, durable background execution via ACP, file-backed worker progress/result state, gateway-restart-survivable workers, and snapshot-based cancel/restore. Unlike claude-flow (which is a CLI orchestrator), ClawSpec is chat-native and keeps planning visible in the main turn. The planning journal (accumulated requirement discussions injected into subsequent planning turns) is a unique context-building mechanism not present in any seed. The "one unfinished change per repo" invariant enforced across channels is a governance constraint no seed implements.

Positioning

  • Category: OpenClaw plugin — OpenSpec workflow orchestration with durable background execution
  • User: Teams using OpenClaw who want OpenSpec-style spec-driven development with background implementation that survives network disruptions
  • Integration: Deep — hooks into OpenClaw's message_received, before_prompt_build, agent_end, and bootstrap lifecycle events
  • Value: Durable background execution + visible planning + accumulated planning journal + snapshot-safe cancel

Observable failure modes

  1. Node.js ≥24.0.0 requirement: Cutting edge — many servers/environments won't have Node 24 available
  2. acpx dependency: External CLI dependency that must be available; bootstrap failure blocks the entire plugin
  3. One-change-per-repo invariant: Teams working on multiple parallel changes must use multiple repos or channels
  4. Deprecated config fields: Several no-op fields retained for backward compatibility — could confuse users
  5. JSONL accumulation: Planning journal has no size limit — long sessions may inflate context injection
  6. OpenClaw-specific: Zero portability to Claude Code, Cursor, or other tools

Cross-references

  • Depends on: OpenClaw platform, OpenSpec CLI, acpx CLI
  • Architecturally analogous to: claude-flow (multi-layer orchestration + background workers) but chat-native
  • Compared to: opcode-plugin-openspec (this batch) — similar chat-plugin pattern but ClawSpec is far more complex
04

Workflow

ClawSpec — Workflow

Setup phase

Step Actor Action Artifact
1 Bootstrap ensureOpenSpecCli, ensureAcpxCli Dependencies verified/installed
2 Bootstrap Initialize state, workspace, memory stores Stores ready
3 Bootstrap Start WatcherManager Background worker monitoring active
4 Human /clawspec use <path> Workspace set for channel
5 Human Attach project Active project set

Planning phase (visible in chat)

Step Actor Action Artifact
1 Human Discuss requirements in chat planning-journal.jsonl updated via message_received
2 Human Type cs-plan before_prompt_build hook injects planning context
3 Agent Refresh planning artifacts in visible turn proposal.md, specs/, design.md, tasks.md
4 Plugin agent_end reconciles turn Turn marked complete

Implementation phase (background)

Step Actor Action Artifact
1 Human Type cs-work execution-control.json written
2 WatcherManager Arm worker ExecutionWatcher started
3 AcpWorkerClient Start acpx CLI session Background ACP worker running
4 ACP worker Implement tasks from tasks.md Code changes, progress events
5 Worker Write worker-progress.jsonl, execution-result.json Progress/result files
6 Watcher Monitor progress files, send chat notifications Human sees progress in chat

Recovery flow

Event Recovery action
Gateway restart Plugin startup checks for live acpx session; re-attaches if alive
Worker failure Restart backoff; re-arms if safe
Cancel Snapshot restore of tracked files

Approval gates

  • One unfinished change enforced per repo (attempting a second change fails until the first is archived or cancelled)
  • /clawspec archive validates completeness before archiving

Phase-to-artifact map

Phase Artifact
Planning (cs-plan) proposal.md, design.md, specs/, tasks.md
Implementation (cs-work) Code changes matching tasks.md
Archive openspec/changes/archive/<name>/, channel context cleared
06

Memory Context

ClawSpec — Memory & Context

State stores (multi-layer)

Plugin state (OpenClaw)

  • Active project per channel
  • Active change per channel
  • Worker status (armed/running/complete/failed)
  • Workspace mapping per channel

Project memory store (OpenClaw)

  • Per-project memory (content not fetched)

Planning journal

  • Location: .openclaw/clawspec/planning-journal.jsonl
  • Content: Requirement discussions recorded via message_received hook
  • Usage: Injected into cs-plan context so the main agent has full discussion history

Worker state files

  • worker-progress.jsonl — background worker progress events (stream)
  • execution-result.json — worker final result
  • execution-control.json — arm/start/stop/pause signals
  • Rollback baselines — file snapshots for snapshot-restore on cancel

OpenSpec files

  • openspec/changes/<name>/proposal.md, design.md, specs/, tasks.md
  • These are the durable output artifacts

Persistence

All state persists to disk. The plugin is designed for crash recovery: "The worker writes progress and result files so the watcher can recover after gateway restarts."

Cross-session handoff

On startup, ClawSpec checks for live acpx sessions and re-attaches rather than starting new workers. Planning journal provides context continuity.

Context compaction handling

The planning journal accumulates over the session. ClawSpec injects it into cs-plan turns — very long journals may inflate context. No explicit compaction mechanism found.

07

Orchestration

ClawSpec — Orchestration

Multi-agent support

Yes — planning runs in the visible main chat agent; implementation runs in a separate background ACP worker via acpx. These are architecturally separate: the main agent never sees implementation execution, and the background worker runs independently.

Orchestration pattern

Hierarchical: the main plugin service orchestrates the planning agent (visible turn) and dispatches implementation to a background worker. The watcher manager monitors the worker and reports back to the main chat.

Isolation mechanism

Background execution via acpx CLI session (separate process). The background worker runs in its own ACP session, isolated from the main chat turn. This provides process-level isolation for implementation.

Execution mode

Event-driven: cs-plan keyword → inject context → planning turn; cs-work keyword → arm watcher → start background worker. message_received hook → journal update.

Background worker durability

The plugin can survive gateway restarts: "A running ACP worker can survive a gateway restart; ClawSpec will try to reattach to the live session before starting a replacement worker." This is the most distinctive durability guarantee in the batch.

Subagents

1 background ACP worker (started by AcpWorkerClient, communicates via acpx CLI)

Consensus mechanism

None.

Crash recovery

Yes — file-backed progress state + session adoption on restart. Rollback baselines for cancel/restore.

Multi-model support

Not explicit. OpenClaw may use different models, but ClawSpec's configuration does not define model routing.

Prompt chaining

Yes — planning journal is accumulated across turns and injected as context for subsequent cs-plan turns.

08

Ui Cli Surface

ClawSpec — UI & CLI Surface

CLI binary

None. The plugin is consumed by OpenClaw.

Control surface: split model

ClawSpec uses two distinct surfaces:

Surface Examples What it does
Slash command /clawspec use, /clawspec proposal, /clawspec status, /clawspec cancel, /clawspec archive Direct plugin control, filesystem setup, state inspection
Chat keyword cs-plan, cs-work, cs-pause Injects workflow context into visible conversation or queues background execution

Local UI

None beyond OpenClaw's chat interface. All interaction is chat-native.

IDE integration

None — OpenClaw is a chat platform, not an IDE.

Observability

  • Chat notifications: Worker sends progress updates back into the active chat channel
  • Planning journal: .openclaw/clawspec/planning-journal.jsonl — persisted discussion log
  • Worker progress: .openclaw/clawspec/worker-progress.jsonl — file-backed progress events
  • Execution result: .openclaw/clawspec/execution-result.json — final worker state

The progress notifier sends brief chat updates so the human sees background execution status without needing to poll.

Plugin configuration (openclaw.plugin.json)

Key configurable options:

  • enabled — enable/disable plugin
  • allowedChannels — optional list of channel IDs
  • openSpecTimeoutMs — OpenSpec CLI invocation timeout
  • workerAgentId — ACP agent for background planning/implementation
  • workerBackendId — optional ACP backend
  • watcherPollIntervalMs — background watcher recovery poll interval
  • archiveDirName — archive folder name
  • defaultWorkspace — base directory for workspace browsing

Several deprecated fields retained for backward compatibility (maxAutoContinueTurns, maxNoProgressTurns, workerWaitTimeoutMs, subagentLane).

Related frameworks

same archetype · same primary tool · same memory type

Claude-Flow / Ruflo ★ 55k

Eliminates single-agent context limits and sequential bottlenecks by orchestrating fault-tolerant swarms of specialized AI agents…

Hermes Agent (NousResearch) ★ 168k

Self-improving personal AI agent with closed learning loop, 7 terminal backends, and messaging gateway — not tied to any AI…

OpenCode ★ 165k

Terminal-first AI coding agent with multi-model routing, native desktop app, and a typed .opencode/ configuration system for…

OpenHands ★ 75k

Open-source AI software development platform (open-source Devin alternative) with Docker sandbox isolation, 77.6% SWE-bench…

DeerFlow ★ 70k

Long-horizon superagent that researches, codes, and creates by orchestrating parallel sub-agents with isolated contexts in Docker…

oh-my-openagent (omo) ★ 60k

Multi-provider AI agent orchestration for OpenCode: escape vendor lock-in by routing Sisyphus (Claude/Kimi/GLM) and Hephaestus…