clawgov-enforcer
v1.0.0
Published
OpenClaw Agent Governance Toolkit – SURGE × OpenClaw Hackathon
Maintainers
Readme
🦀 ClawGov — OpenClaw Agent Governance Toolkit
"Turn chaotic agent skills into a governed, community-owned ecosystem"
Built for the SURGE × OpenClaw Hackathon — Track 3: Developer Infrastructure + Community Incentives & Governance
What is ClawGov?
ClawGov is a governance-as-a-plugin system for OpenClaw agents. It scans community platforms (Moltbook) for risky skills, enables SURGE-backed community voting on governance proposals, compiles decisions into enforceable policy files, and enforces them at the OpenClaw Gateway level — blocking banned skills before they execute.
Governance Lifecycle
Moltbook Posts
│
▼
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ clawgov │───▶│ clawgov │───▶│ clawgov │
│ scan │ │ propose │ │ vote │
└─────────────┘ └──────────────┘ └─────────────┘
│
▼
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Gateway │◀───│ clawgov │◀───│ clawgov │
│ Enforces │ │ compile │ │ tally │
└─────────────┘ └──────────────┘ └─────────────┘Quick Start
# Clone and install
git clone https://github.com/Aadthiyan/Clawgov.git
cd Clawgov/clawgov
npm install
npm run build
# Run the full demo (no API keys needed)
node dist/cli/index.js demoCLI Commands
clawgov scan [options] # Scan Moltbook for risky skills
clawgov propose [options] # Create governance proposals from scan results
clawgov vote [options] # Cast or tally votes on proposals
clawgov compile [options] # Compile decisions into policy.json
clawgov enforce-test [options] # Test gateway enforcement against a skill
clawgov registry [options] # View and query the skill registry
clawgov log [options] # View governance event history
clawgov status # System health check
clawgov demo # Full end-to-end demo (all steps)Scan
# Mock scan (offline demo)
clawgov scan --mock --limit 8 --save
# Live scan from Moltbook lablab submolt (requires MOLTBOOK_API_KEY)
clawgov scan --limit 50 --submolt lablab --savePropose
# Generate proposals from latest scan
clawgov propose --scan data/scans/scan_abc123.json
# Manual proposal
clawgov propose --skill wallet-drainer --action BAN --bounty 100Vote
# Add simulated votes (demo)
clawgov vote --proposal P-ABC123 --mock
# Cast a real vote
clawgov vote --proposal P-ABC123 --side yes --voter 0xYourAddress --balance 144
# Tally votes and determine outcome
clawgov vote --proposal P-ABC123 --tallyCompile & Enforce
# Compile passed proposal into policy
clawgov compile --proposal P-ABC123
# Test enforcement (will BLOCK banned skills)
clawgov enforce-test --skill wallet-drainer # → ❌ BLOCKED
clawgov enforce-test --skill file-organizer # → ✅ ALLOWEDRegistry
clawgov registry --list # All skills with statuses
clawgov registry --banned # Banned skills only
clawgov registry --skill wallet-drainer # Skill detailsArchitecture
src/
├── cli/
│ ├── index.ts # Commander.js entry point
│ └── commands/
│ ├── scan.ts # Moltbook scanner + risk scorer
│ ├── propose.ts # Proposal generator
│ ├── vote.ts # Quadratic voting engine
│ ├── compile.ts # Policy compiler
│ ├── enforce-test.ts # Gateway enforcement tester
│ ├── registry.ts # Skill registry viewer
│ ├── log.ts # Governance event log
│ ├── status.ts # System health
│ └── demo.ts # Full E2E demo orchestrator
├── db/
│ └── index.ts # JSON file-based DB (zero native deps)
├── enforcement/
│ └── gateway-hook.ts # OpenClaw Gateway plugin
├── utils/
│ ├── logger.ts # Winston structured logging
│ └── events.ts # Governance event system
└── config.ts # Zod-validated configurationEnvironment Variables
Copy .env.example to .env:
# OpenClaw
OPENCLAW_HOME=~/.openclaw
OPENCLAW_GATEWAY_URL=http://localhost:3000
# SURGE (testnet)
SURGE_WALLET_ADDRESS=0xYourAddress
SURGE_PRIVATE_KEY=0xTestnetPrivateKey
SURGE_NETWORK=testnet
# Moltbook (optional — use --mock flag without it)
MOLTBOOK_API_KEY=your_key_here
MOLTBOOK_SUBMOLT=lablab
# ClawGov config
LOG_LEVEL=info
VOTING_MODEL=quadratic
QUORUM_PERCENTAGE=50
PASS_THRESHOLD=60Tech Stack
| Component | Technology | |-----------|-----------| | Runtime | Node.js 22 + TypeScript | | CLI | Commander.js | | Logging | Winston (file + console) | | Database | JSON file store (zero native compilation) | | Config | Zod schema validation | | Gateway Hook | OpenClaw GatewayPlugin API | | Voting | Quadratic weighted voting | | HTTP | Axios |
Full Setup Guide
See docs/ENVIRONMENT_SETUP.md for complete installation instructions including Ollama/Llama 3 setup, SURGE wallet configuration, and Moltbook integration.
Governance Data
All governance data is stored locally in data/clawgov.json. After running the demo:
data/scans/— JSON scan reports per rundata/policies/current.policy.json— Active enforcement policylogs/combined.log— Full event loggovernance-history.md— Exported human-readable history
License
MIT © 2026 AADHITHAN
