Contract-first QA for OpenClaw skills and agents.
ClawSpec gives you one testing surface for four things:
| Contract | File | Purpose |
|---|---|---|
| Structural validation | SKILL.md / SOUL.md |
Enforce required sections, permissions, gates, and safety rules |
| Scenario contract | tests/scenarios.yaml |
Test a single skill or agent outcome |
| Handoff contract | tests/handoffs/*.yaml |
Test what one stage passes to another |
| Pipeline contract | tests/pipeline.yaml |
Test multi-stage orchestration health |
ClawSpec ships:
clawspec validateclawspec runclawspec initclawspec coverageclawspec baseline— performance baseline capture and regression detection- 29 shipped assertion types (19 standard + 10 trace-aware)
- Observability integration via Opik — one-click trace debugging from any failing assertion
- a Python API and an OpenClaw skill wrapper
uv tool install .
# or
uv pip install -e .clawspec validate examples/basic/skills/hello
clawspec init examples/basic/skills/hello --force
clawspec run examples/basic/skills/hello --scenario hello-smoke --dry-run
clawspec coverage --ledger examples/ceremonia/coverage-ledger.yaml --jsonConnect ClawSpec to Opik to get trace URLs in every report and unlock 10 trace-aware assertion types.
pip install clawspec[opik]
export OPIK_API_KEY=your-keyAdd to clawspec.yaml:
observability:
backend: opik
opik:
project_name: my-project
workspace: my-workspaceWhen observability is active, each report includes a trace_url pointing directly to the run in the Opik dashboard. See docs/observability-integration.md for full setup instructions.
Capture performance baselines to detect regressions in cost, latency, and token usage:
clawspec baseline capture skills/my-skill --runs 20
clawspec baseline show skills/my-skillAdd a regression: block to any scenario contract to enforce drift thresholds in CI. See docs/baselines-and-regression-detection.md.
ClawScaffold is the spec-first target lifecycle manager for OpenClaw. When used together, ClawScaffold auto-generates ClawSpec test scenarios during agent/skill adoption and creation.
pip install clawscaffold[spec] # installs both packagesWhen both are installed:
clawscaffold adoptauto-generatestests/scenarios.yamlwith ClawSpec assertionsclawscaffold audituses ClawSpec validation for structural checksclawscaffold createscaffolds test contracts alongside the target spec
ClawSpec works independently — you don't need ClawScaffold to write and run test contracts.
- ClawWrap — Spec-first outbound message routing gate (policy enforcement, audit trail)
- ClawScaffold — Spec-first target lifecycle manager (interactive interviews, adoption, auditing)
- OpenClaw — Local-first AI agent framework (LLM + chat channels + Markdown skills)
ClawSpec looks for clawspec.yaml from the target directory upward.
gateway_base_url: "http://127.0.0.1:18789"
gateway_webhook_endpoint: "/webhook/mcp-skill-invoke"
report_dir: "reports"
gateway_log_pattern: "/tmp/openclaw/openclaw-{date}.log"
scenario_patterns:
- "skills/**/tests/scenarios.yaml"
- "agents/**/tests/scenarios.yaml"
ledger_path: "coverage-ledger.yaml"Compiler-managed repos can point ClawSpec at generated QA artifacts by overriding
scenario_patterns and ledger_path. For example:
scenario_patterns:
- "compiler/generated/qa/**/scenarios.yaml"
ledger_path: "docs/testing/coverage-ledger.yaml"from clawspec import coverage, init, run, validate
validate("examples/basic/skills/hello")
init("examples/basic/skills/hello", force=True)
run("examples/basic/skills/hello", scenario="hello-smoke", dry_run=True)
coverage("examples/ceremonia/coverage-ledger.yaml")- examples/basic/skills/hello/SKILL.md
- examples/multi-agent/skills/orchestrator/tests/pipeline.yaml
- examples/ceremonia/README.md
- docs/quick-start.md
- docs/configuration-reference.md
- docs/assertion-reference.md
- docs/observability-integration.md
- docs/baselines-and-regression-detection.md
- docs/compiler-integration.md
- docs/contract-first-methodology.md
- docs/building-new-pipelines.md
- docs/migrating-existing-agents.md
- docs/launch-posts.md
ClawSpec ships with a gateway plugin that registers the clawspec tool directly in the OpenClaw gateway. The plugin delegates all actions to the Python CLI via child_process.
- Copy the
extensions/clawspec/directory into your OpenClaw workspace:
cp -r extensions/clawspec/ ~/.openclaw/extensions/clawspec/- Register the plugin in your
~/.openclaw/openclaw.json:
{
"extensions": {
"clawspec": {
"repoRoot": "/path/to/your/workspace",
"timeoutMs": 60000
}
}
}- Restart the gateway:
openclaw gateway restart| Option | Type | Default | Description |
|---|---|---|---|
repoRoot |
string | $OPENCLAW_WORKSPACE or cwd |
Workspace root containing the clawspec package |
pythonBin |
string | python3 |
Path to Python binary |
timeoutMs |
integer | 60000 |
CLI execution timeout in milliseconds |
validate, run, init, coverage, baseline-capture, baseline-show, baseline-reset
See the openclaw.plugin.json for the full config schema.
This package is part of ClawSuite — the OpenClaw agent infrastructure toolkit.
| Package | Description | Repo |
|---|---|---|
| ClawPipe | Config-driven pipeline orchestration | austinmao/clawpipe |
| ClawSpec | Contract-first testing for skills & agents | austinmao/clawspec |
| ClawWrap | Outbound policy & conformance engine | austinmao/clawwrap |
| ClawAgentSkill | Skill discovery, scanning & adoption | austinmao/clawagentskill |
| ClawScaffold | Agent/skill scaffold interviews | austinmao/clawscaffold |
| ClawInterview | Pipeline interview compilation & execution | (coming soon) |
All packages include OpenClaw gateway plugins for autonomous agent access.
MIT