5.1 KiB
P1-P3 Provider Sprint Design
Overview
Full sprint across three parallel workstreams to take ClawChain from "built" to "usable operator product." After fixing 3 build failures, parallel agents implement Provider Activation (P1), Earnings Loop (P2), and Supply-Side Expansion (P3).
P0: Build Fixes (prerequisite)
| Fix | File | Issue |
|---|---|---|
| clawd dex.test.ts | cmd/clawd/src/commands/__tests__/dex.test.ts |
TS2322 mock signature mismatch |
| OpenClaw exports | openclaw/src/gateway/protocol/index.js + arbitrage-bot.ts + leaderboard-tools.ts |
Missing type exports, undefined SDK methods |
| Docs site MDX | docs-site/docs/api/*.mdx |
Undefined template variables in static generation |
P1: Provider Activation
Goal: clawd up takes a fresh machine to registered provider with one command.
Files:
cmd/clawd/src/commands/up.ts— enhanced bootstrap flowcmd/clawd/src/lib/bootstrap.ts— new: key generation, wallet setup, faucet funding, on-chain registrationcmd/clawd/src/lib/setup-state.ts— new: resumable setup state trackercmd/clawd/src/commands/__tests__/up.test.ts— testscmd/clawd/src/lib/bootstrap.test.ts— tests
Flow:
- Check/create operator key (
~/.clawd/keys/) - Derive chain address from key
- Request testnet funds from faucet (if balance < threshold)
- Register agent on-chain via
x/agentMsgRegisterAgent - Start heartbeat loop
- Start OpenClaw gateway with provider profile
- Report readiness
Resumability: Each step writes progress to ~/.clawd/setup-state.json. On restart, clawd up skips completed steps.
Error handling: Insufficient funds → retry faucet with backoff. Unreachable RPC → wait + retry. Already registered → skip registration. Partial setup → resume from last checkpoint.
P2: Earnings Loop
Goal: Running providers autonomously discover, accept, execute, and complete tasks.
Files:
openclaw/extensions/clawchain/src/agent-loop.ts— enhanced autonomous loopopenclaw/extensions/clawchain/src/task-executor.ts— new: skill-mapped task executionopenclaw/extensions/clawchain/src/earnings-tracker.ts— new: reward aggregationcmd/clawd/src/commands/earnings.ts— new:clawd earningscommandcmd/clawd/src/lib/profitability.ts— new: profitability controls- Tests for each new file
Agent Loop Enhancement:
- Poll available tasks matching agent capabilities
- Filter by profitability controls (min budget, capability match)
- Auto-accept qualifying tasks
- Execute via skill mapping (task type → OpenClaw skill/tool)
- Submit checkpoints during execution
- Complete task and claim reward
- Update local earnings tracker
Earnings Command:
clawd earnings— show mining + task + staking rewardsclawd earnings --period 7d— time-windowed viewclawd earnings --json— machine-readable output
Profitability Controls:
min_task_budget: reject tasks below thresholdmax_concurrent_tasks: limit parallel execution (default 3)capability_filter: only accept tasks matching listed capabilitiesauto_accept: enable/disable autonomous acceptance
P3: Supply-Side Expansion
Goal: One provider identity exposes multiple earning surfaces.
Files:
cmd/clawd/src/commands/skills.ts— new: skill marketplace CLIcmd/clawd/src/commands/gpu.ts— new: GPU provider managementcmd/clawd/src/commands/models.ts— new: model hosting CLIcmd/clawd/src/commands/inventory.ts— new: unified provider viewsdk/src/marketplace.ts— new SDK methods for skill publishingsdk/src/gpu.ts— new SDK methods for GPU registrationsdk/src/models.ts— new SDK methods for model hosting- Tests for each new file
Skills CLI:
clawd skills publish --name "..." --price 100uclaw --category aiclawd skills list— show published skillsclawd skills price --id <id> --price 200uclawclawd skills delist --id <id>clawd skills sales— show purchase history
GPU CLI:
clawd gpu register --vram 24 --cuda-cores 16384 --price 50uclaw/gb-hrclawd gpu status— show current GPU utilization and leasesclawd gpu earnings— show GPU compute income
Models CLI:
clawd models host --name "llama-3" --endpoint http://... --pricing per-query --price 10uclawclawd models list— show hosted modelsclawd models pricing --id <id> --price 15uclaw
Inventory:
clawd inventory— unified view: tasks + skills + GPU + models with earnings per surface
Architecture Decisions
- All new CLI commands follow existing Commander.js pattern in
cmd/clawd/src/commands/ - SDK methods follow existing
ClawChainClientpattern with typed responses - Agent loop enhancements are additive to existing
agent-loop.ts(198 LOC) - Setup state uses JSON file, not database, matching existing
active_tasks.jsonpattern - All commands support
--jsonoutput for automation
Testing Strategy
- Unit tests for each new module (vitest)
- Integration-style tests using mocked chain responses
- Existing test patterns: mock
fetch, mockexecSync, assert CLI output