Skip to content

austinmao/clawwrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ClawWrap

Spec-first control plane for typed, policy-enforced outbound message routing.

Every agent-initiated send (email, WhatsApp, Slack, SMS) routes through ClawWrap's gate, which validates targets, applies policies, and logs verdicts before dispatch.

Features

  • Outbound gate — 5-stage pipeline: resolve → verify → approve → execute → audit
  • Policy enforcement — allowlists, rate limits, channel restrictions per target
  • Two routing modes — shared (context_key + audience → target) and direct (recipient_ref → adapter resolver)
  • 15+ handler implementations — email, WhatsApp DM/group, Slack, SMS, target resolution
  • Database-backed audit trail — PostgreSQL with Alembic migrations
  • Spec-first contracts — YAML wrapper and policy specifications
  • Conformance auditing — verify all outbound paths comply with declared policies

Installation

pip install clawwrap

Quick Start

# Initialize database schema
clawwrap init

# Run Alembic migrations
clawwrap migrate

# Validate a wrapper spec
clawwrap validate specs/outbound-email.yaml

# Show dependency graph
clawwrap graph specs/outbound-email.yaml

# Run a wrapper
clawwrap run specs/outbound-email.yaml

# Audit conformance
clawwrap conformance audit

CLI Commands

Command Description
init Initialize database schema
migrate Run Alembic migrations
validate Validate wrapper/policy specs
graph Show DAG of dependencies
run Execute a wrapper run
apply Apply policies and handlers
conformance Check conformance to specs
handler Manage handler definitions
legacy Authority/ownership operations

Architecture

Agent → outbound.submit(context_key, audience, channel)
         ↓
    ┌─────────────────────────┐
    │  ClawWrap Gate          │
    │  1. Resolve target      │ ← targets.yaml
    │  2. Verify identity     │ ← live checks (JID, email, channel)
    │  3. Apply policy        │ ← outbound-policy.yaml
    │  4. Dispatch            │ ← channel handler (email, WhatsApp, Slack)
    │  5. Audit log           │ ← PostgreSQL + YAML verdicts
    └─────────────────────────┘

Configuration

targets.yaml — outbound routing addresses:

retreat_staff:
  whatsapp:
    jid: "120363...@g.us"
  email:
    address: "team@example.com"
  slack:
    channel: "#ops"

outbound-policy.yaml — allowlists and checks:

channels:
  email:
    enabled: true
    rate_limit: 50/hour
  whatsapp:
    enabled: true
    require_verification: true
  slack:
    enabled: true

Using with ClawSpec

ClawSpec provides contract-first QA for ClawWrap handlers. Test that your outbound gate routes correctly, applies policies, and logs verdicts:

pip install clawspec
clawspec run --scenario outbound-gate-smoke

ClawSpec's trace-aware assertions can verify the full gate pipeline:

then:
  - type: tool_sequence
    expected: ["target_resolve", "jid_verify", "outbound_submit"]
    mode: ordered
  - type: no_span_errors

Using with ClawScaffold

ClawScaffold manages ClawWrap handler lifecycle. When adopting or creating new handlers:

pip install clawscaffold
clawscaffold adopt --name outbound/email-send --source src/clawwrap/adapters/openclaw/handlers/email_send.py --kind skill

OpenClaw Gateway Plugin

ClawWrap ships with a gateway plugin that registers the clawwrap tool directly in the OpenClaw gateway. The plugin delegates all subcommands to the Python CLI via child_process.

Installation

  1. Copy the extensions/clawwrap/ directory into your OpenClaw workspace:
cp -r extensions/clawwrap/ ~/.openclaw/extensions/clawwrap/
  1. Register the plugin in your ~/.openclaw/openclaw.json:
{
  "extensions": {
    "clawwrap": {
      "repoRoot": "/path/to/your/workspace",
      "timeoutMs": 60000
    }
  }
}
  1. Restart the gateway:
openclaw gateway restart

Plugin Configuration

Option Type Default Description
repoRoot string $OPENCLAW_WORKSPACE or cwd Workspace root containing the clawwrap package
pythonBin string <repoRoot>/clawpipe/.venv/bin/python Path to Python binary
timeoutMs integer 60000 CLI execution timeout in milliseconds

Supported Actions

version, init, migrate, validate, graph, run, apply, conformance, handler, legacy

See the openclaw.plugin.json for the full config schema.

Related Projects

  • ClawSpec — Contract-first QA for OpenClaw skills and agents
  • ClawScaffold — Spec-first target lifecycle manager
  • OpenClaw — Local-first AI agent framework

Development

git clone https://github.com/austinmao/clawwrap.git
cd clawwrap
pip install -e ".[dev]"
pytest

ClawSuite

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.

License

MIT

About

Spec-first control plane for typed, policy-enforced outbound message routing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors