clawpowers 1.1.3 โ 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +193 -351
- package/bin/clawpowers.js +2 -2
- package/docs/quickstart-first-transaction.md +3 -3
- package/package.json +7 -3
- package/runtime/demo/x402-mock-server.js +1 -1
- package/runtime/init.sh +1 -1
- package/runtime/payments/pipeline.js +1 -5
- package/skills/validator/SKILL.md +281 -0
package/README.md
CHANGED
|
@@ -1,444 +1,286 @@
|
|
|
1
1
|
# ๐ฆ ClawPowers
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
> **v1.1.3** ยท 26 skills ยท 372 tests ยท MIT ยท **Patent Pending**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Your agent needs to pay for APIs. ClawPowers makes that work.**
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
When your agent hits a premium API and gets back HTTP 402 Payment Required, it needs to pay and retry โ automatically, within limits you set, with your approval before anything moves. That's the core problem ClawPowers solves. The other 25 skills are a bonus.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## The Pay-to-Complete Flow
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
```
|
|
12
|
+
Agent calls API
|
|
13
|
+
โ
|
|
14
|
+
โผ
|
|
15
|
+
HTTP 402 โโโ "Payment required: $0.50 USDC"
|
|
16
|
+
โ
|
|
17
|
+
โผ
|
|
18
|
+
ClawPowers evaluates:
|
|
19
|
+
โข Is this within your spend cap? ($5/tx limit โ โ
)
|
|
20
|
+
โข Is this on the allowlist? (api.example.com โ โ
)
|
|
21
|
+
โข Human approval required? (under $1 threshold โ auto)
|
|
22
|
+
โ
|
|
23
|
+
โผ
|
|
24
|
+
Payment sent โ API retried โ Result returned
|
|
25
|
+
โ
|
|
26
|
+
โผ
|
|
27
|
+
Outcome logged (for RSI analysis)
|
|
28
|
+
```
|
|
12
29
|
|
|
13
|
-
##
|
|
30
|
+
## Quick Start
|
|
14
31
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
| Self-improvement (RSI) | โ
| โ |
|
|
21
|
-
| Outcome tracking & metrics | โ
| โ |
|
|
22
|
-
| Agent payments (x402) | โ
| โ |
|
|
23
|
-
| Security scanning | โ
| โ |
|
|
24
|
-
| Content pipeline | โ
| โ |
|
|
25
|
-
| Market intelligence | โ
| โ |
|
|
26
|
-
| Resumable workflows | โ
| โ |
|
|
27
|
-
| Windows native support | โ
| โ |
|
|
28
|
-
| Zero dependencies | โ
| โ
|
|
|
32
|
+
```bash
|
|
33
|
+
npx clawpowers init # Set up ~/.clawpowers/ runtime
|
|
34
|
+
npx clawpowers demo x402 # See the full 402 โ pay โ 200 flow (no real money)
|
|
35
|
+
npx clawpowers status # Check what's running
|
|
36
|
+
```
|
|
29
37
|
|
|
30
|
-
|
|
38
|
+
## Human-Approval Mode (the default)
|
|
31
39
|
|
|
32
|
-
|
|
40
|
+
ClawPowers defaults to supervised payments โ your agent proposes, you approve. No funds move until you say so.
|
|
33
41
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
```typescript
|
|
43
|
+
import { createX402Client } from 'agentwallet-sdk';
|
|
44
|
+
import { createWallet, setSpendPolicy } from 'agentwallet-sdk';
|
|
45
|
+
import { createWalletClient, http } from 'viem';
|
|
46
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
47
|
+
import { base } from 'viem/chains';
|
|
37
48
|
|
|
38
|
-
|
|
39
|
-
|
|
49
|
+
const account = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY as `0x${string}`);
|
|
50
|
+
const walletClient = createWalletClient({ account, chain: base, transport: http() });
|
|
40
51
|
|
|
41
|
-
|
|
52
|
+
const wallet = createWallet({
|
|
53
|
+
accountAddress: process.env.AGENT_WALLET_ADDRESS as `0x${string}`,
|
|
54
|
+
chain: 'base',
|
|
55
|
+
walletClient,
|
|
56
|
+
});
|
|
42
57
|
|
|
43
|
-
|
|
58
|
+
// Spend policy โ enforced on-chain, not in application code
|
|
59
|
+
await setSpendPolicy(wallet, {
|
|
60
|
+
token: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', // USDC on Base
|
|
61
|
+
perTxLimit: 1_000_000n, // $1 auto-approved per transaction
|
|
62
|
+
periodLimit: 10_000_000n, // $10/day hard cap
|
|
63
|
+
periodLength: 86400,
|
|
64
|
+
});
|
|
44
65
|
|
|
45
|
-
|
|
46
|
-
|
|
66
|
+
const x402 = createX402Client(wallet, {
|
|
67
|
+
supportedNetworks: ['base:8453'],
|
|
68
|
+
globalDailyLimit: 10_000_000n, // matches spend policy
|
|
69
|
+
globalPerRequestMax: 1_000_000n, // $1 per request
|
|
70
|
+
requireApproval: true, // human-in-the-loop mode (default)
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// Agent hits a paid API
|
|
74
|
+
const response = await x402.fetch('https://api.example.com/premium-data');
|
|
75
|
+
// If cost < $1: auto-approved and paid
|
|
76
|
+
// If cost > $1: queued โ you get a notification to approve or reject
|
|
77
|
+
const data = await response.json();
|
|
47
78
|
```
|
|
48
79
|
|
|
49
|
-
|
|
80
|
+
## Simulation Mode
|
|
50
81
|
|
|
51
|
-
|
|
82
|
+
Test the full payment flow before enabling live payments.
|
|
52
83
|
|
|
53
84
|
```bash
|
|
54
|
-
|
|
85
|
+
# Run a local mock x402 merchant โ full 402 โ pay โ 200 cycle
|
|
86
|
+
npx clawpowers demo x402
|
|
55
87
|
```
|
|
56
88
|
|
|
57
|
-
|
|
89
|
+
In code:
|
|
58
90
|
|
|
59
|
-
```
|
|
60
|
-
|
|
91
|
+
```typescript
|
|
92
|
+
const x402 = createX402Client(wallet, {
|
|
93
|
+
supportedNetworks: ['base:8453'],
|
|
94
|
+
globalDailyLimit: 10_000_000n,
|
|
95
|
+
globalPerRequestMax: 1_000_000n,
|
|
96
|
+
dryRun: true, // logs exactly what would happen, no funds move
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const response = await x402.fetch('https://api.example.com/premium-data');
|
|
100
|
+
// Response includes: { simulated: true, wouldHavePaid: '0.50 USDC', withinLimits: true }
|
|
61
101
|
```
|
|
62
102
|
|
|
63
|
-
|
|
103
|
+
## Explicit Spend Caps
|
|
64
104
|
|
|
65
|
-
|
|
105
|
+
Caps are enforced by smart contract, not application code. Even a prompt injection or jailbreak can't bypass them.
|
|
66
106
|
|
|
67
|
-
```bash
|
|
68
|
-
/plugin install clawpowers@claude-plugins-official
|
|
69
107
|
```
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
/plugin marketplace add up2itnow0822/clawpowers-marketplace
|
|
75
|
-
/plugin install clawpowers@clawpowers-marketplace
|
|
108
|
+
Agent wants to spend $0.50 โ โ
Auto-approved (under $1/tx cap)
|
|
109
|
+
Agent wants to spend $5.00 โ โณ Queued for your approval
|
|
110
|
+
Agent spent $9.00 today โ ๐ Next tx blocked ($10/day cap hit)
|
|
76
111
|
```
|
|
77
112
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
113
|
+
```bash
|
|
114
|
+
# Check what your agent has spent
|
|
115
|
+
npx clawpowers store get agent-payments:daily-total
|
|
116
|
+
# โ "2.50 USDC spent today, $7.50 remaining"
|
|
81
117
|
|
|
82
|
-
|
|
83
|
-
|
|
118
|
+
# Review and approve queued payments
|
|
119
|
+
npx clawpowers payments queue
|
|
120
|
+
# โ [1] $5.00 USDC โ api.example.com/premium-report โ approve? (y/n)
|
|
84
121
|
```
|
|
85
122
|
|
|
86
|
-
|
|
123
|
+
## Why Supervised, Not Autonomous
|
|
87
124
|
|
|
88
|
-
|
|
125
|
+
Fully autonomous agent payments sound great until an agent in a loop runs up $500 in API calls overnight. ClawPowers is built around three constraints:
|
|
89
126
|
|
|
90
|
-
|
|
127
|
+
1. **Caps enforced on-chain** โ the agent *cannot* exceed them, full stop
|
|
128
|
+
2. **Human approval by default** โ auto-approve only below thresholds you set
|
|
129
|
+
3. **Full audit trail** โ every payment logged at `~/.clawpowers/metrics/`
|
|
91
130
|
|
|
92
|
-
|
|
93
|
-
Fetch and follow instructions from https://raw.githubusercontent.com/up2itnow0822/clawpowers/main/.codex/INSTALL.md
|
|
94
|
-
```
|
|
131
|
+
When you've verified the agent behaves correctly, raise the auto-approve threshold. Start low.
|
|
95
132
|
|
|
96
|
-
|
|
133
|
+
## Installation
|
|
97
134
|
|
|
98
|
-
|
|
135
|
+
### Universal (Windows, macOS, Linux)
|
|
99
136
|
|
|
100
|
-
```
|
|
101
|
-
|
|
137
|
+
```bash
|
|
138
|
+
npx clawpowers init
|
|
102
139
|
```
|
|
103
140
|
|
|
104
|
-
###
|
|
141
|
+
### OpenClaw
|
|
105
142
|
|
|
106
143
|
```bash
|
|
107
|
-
|
|
144
|
+
openclaw skills install clawpowers
|
|
145
|
+
# or from GitHub
|
|
146
|
+
openclaw skills install github:up2itnow0822/clawpowers
|
|
108
147
|
```
|
|
109
148
|
|
|
110
|
-
###
|
|
149
|
+
### Claude Code
|
|
111
150
|
|
|
112
151
|
```bash
|
|
113
|
-
|
|
114
|
-
cd clawpowers
|
|
115
|
-
node bin/clawpowers.js init # Windows, macOS, Linux
|
|
116
|
-
# or
|
|
117
|
-
bash bin/clawpowers.sh init # macOS, Linux only
|
|
152
|
+
/plugin install clawpowers@claude-plugins-official
|
|
118
153
|
```
|
|
119
154
|
|
|
120
|
-
###
|
|
121
|
-
|
|
122
|
-
Start a new session in your chosen platform and ask for something that triggers a skill โ for example, "help me plan this feature" or "let's debug this issue." The agent should automatically apply the relevant ClawPowers skill.
|
|
123
|
-
|
|
124
|
-
Check runtime status anytime:
|
|
155
|
+
### Cursor
|
|
125
156
|
|
|
126
|
-
```
|
|
127
|
-
|
|
157
|
+
```text
|
|
158
|
+
/add-plugin clawpowers
|
|
128
159
|
```
|
|
129
160
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
### 1. Skills That Execute, Not Just Instruct
|
|
161
|
+
### Codex / OpenCode
|
|
133
162
|
|
|
134
|
-
|
|
163
|
+
```text
|
|
164
|
+
Fetch and follow instructions from https://raw.githubusercontent.com/up2itnow0822/clawpowers/main/.codex/INSTALL.md
|
|
165
|
+
```
|
|
135
166
|
|
|
136
|
-
|
|
137
|
-
- The **systematic-debugging** skill doesn't just list debugging steps โ it maintains a persistent hypothesis tree across sessions so you never re-investigate the same dead end
|
|
138
|
-
- The **verification-before-completion** skill doesn't just say "verify" โ it runs the actual verification suite and blocks completion until it passes
|
|
167
|
+
### Manual
|
|
139
168
|
|
|
140
|
-
|
|
169
|
+
```bash
|
|
170
|
+
git clone https://github.com/up2itnow0822/clawpowers.git
|
|
171
|
+
cd clawpowers
|
|
172
|
+
node bin/clawpowers.js init
|
|
173
|
+
```
|
|
141
174
|
|
|
142
|
-
|
|
175
|
+
## All 26 Skills
|
|
176
|
+
|
|
177
|
+
### Core Development (14)
|
|
178
|
+
|
|
179
|
+
| Skill | What It Does |
|
|
180
|
+
|-------|-------------|
|
|
181
|
+
| `subagent-driven-development` | Orchestrate parallel subagents โ persistent execution DB, resumable checkpoints |
|
|
182
|
+
| `test-driven-development` | RED-GREEN-REFACTOR with mutation analysis to verify tests actually catch bugs |
|
|
183
|
+
| `writing-plans` | Spec โ implementation plan with historical estimation and dependency validation |
|
|
184
|
+
| `executing-plans` | Execute plans with interruption recovery and milestone tracking |
|
|
185
|
+
| `brainstorming` | Structured ideation with cross-session idea persistence |
|
|
186
|
+
| `systematic-debugging` | Persistent hypothesis tree so you never re-investigate the same dead end |
|
|
187
|
+
| `verification-before-completion` | Pre-merge quality gates that actually run the verification suite |
|
|
188
|
+
| `finishing-a-development-branch` | Branch cleanup, changelog, merge prep |
|
|
189
|
+
| `requesting-code-review` | Reviewer match scoring, review history |
|
|
190
|
+
| `receiving-code-review` | Feedback pattern tracking, common issues database |
|
|
191
|
+
| `using-git-worktrees` | Isolated branch development with conflict prediction |
|
|
192
|
+
| `using-clawpowers` | Meta-skill: how to use ClawPowers |
|
|
193
|
+
| `writing-skills` | Create new skills via TDD with quality scoring |
|
|
194
|
+
| `dispatching-parallel-agents` | Fan-out with load balancing, failure isolation, result aggregation |
|
|
195
|
+
|
|
196
|
+
### Extended Capabilities (6)
|
|
197
|
+
|
|
198
|
+
| Skill | What It Does |
|
|
199
|
+
|-------|-------------|
|
|
200
|
+
| `agent-payments` | x402 payment protocol โ supervised, capped, human-in-the-loop by default |
|
|
201
|
+
| `security-audit` | Automated vulnerability scanning (Trivy, gitleaks, npm audit) |
|
|
202
|
+
| `content-pipeline` | Write โ humanize โ format โ publish with platform-specific formatting |
|
|
203
|
+
| `learn-how-to-learn` | Metacognitive protocols, anti-pattern detection, confidence calibration |
|
|
204
|
+
| `market-intelligence` | Competitive research, trend detection, opportunity scoring |
|
|
205
|
+
| `prospecting` | Lead generation, contact enrichment, CRM sync (Exa + Apollo) |
|
|
206
|
+
|
|
207
|
+
### RSI Intelligence Layer (4)
|
|
208
|
+
|
|
209
|
+
Skills that require runtime execution and persistent state โ not available in static frameworks.
|
|
210
|
+
|
|
211
|
+
| Skill | What It Does |
|
|
212
|
+
|-------|-------------|
|
|
213
|
+
| `meta-skill-evolution` | Every 50 tasks: analyzes outcomes, identifies weakest skill, rewrites its methodology |
|
|
214
|
+
| `self-healing-code` | On test failure: hypothesis tree โ 2+ patches โ applies best โ auto-commits |
|
|
215
|
+
| `cross-project-knowledge` | Pattern library across all repos โ bug fixes and solutions transfer between projects |
|
|
216
|
+
| `formal-verification-lite` | Property-based testing (fast-check/Hypothesis/QuickCheck) โ 1000+ examples per property |
|
|
217
|
+
|
|
218
|
+
## Cross-Session Memory
|
|
219
|
+
|
|
220
|
+
Skills persist state across sessions. Your agent's debugging hypotheses, payment outcomes, and learned patterns survive session restarts.
|
|
143
221
|
|
|
144
222
|
```
|
|
145
223
|
~/.clawpowers/
|
|
146
|
-
โโโ state/
|
|
147
|
-
โโโ metrics/
|
|
148
|
-
โโโ checkpoints/
|
|
149
|
-
โโโ feedback/
|
|
150
|
-
|
|
151
|
-
โโโ logs/ # Execution logs
|
|
224
|
+
โโโ state/ # Key-value store
|
|
225
|
+
โโโ metrics/ # Outcome tracking per skill (JSONL)
|
|
226
|
+
โโโ checkpoints/ # Resumable workflow state
|
|
227
|
+
โโโ feedback/ # RSI self-improvement data
|
|
228
|
+
โโโ logs/ # Execution logs
|
|
152
229
|
```
|
|
153
230
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
ClawPowers tracks what works and what doesn't. After every skill execution:
|
|
157
|
-
|
|
158
|
-
1. **Measure** โ Was the outcome successful? How long did it take? What went wrong?
|
|
159
|
-
2. **Analyze** โ Are there patterns in failures? Which task types need different approaches?
|
|
160
|
-
3. **Adapt** โ Adjust skill parameters, decomposition strategies, and review thresholds
|
|
231
|
+
## CLI Reference
|
|
161
232
|
|
|
162
233
|
```bash
|
|
163
|
-
#
|
|
164
|
-
npx clawpowers
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
npx clawpowers
|
|
234
|
+
npx clawpowers init # Set up runtime
|
|
235
|
+
npx clawpowers status # Health check
|
|
236
|
+
npx clawpowers demo x402 # Payment demo (no real money)
|
|
237
|
+
npx clawpowers metrics record --skill <name> --outcome success|failure
|
|
238
|
+
npx clawpowers metrics summary # Per-skill stats
|
|
239
|
+
npx clawpowers analyze # RSI performance analysis
|
|
240
|
+
npx clawpowers store get <key> # Read persistent state
|
|
241
|
+
npx clawpowers store set <key> <value> # Write persistent state
|
|
242
|
+
npx clawpowers payments queue # Review pending approvals
|
|
168
243
|
```
|
|
169
244
|
|
|
170
|
-
This isn't theoretical โ it's the same RSI framework running in production trading systems with 268+ measured outcomes.
|
|
171
|
-
|
|
172
|
-
### 4. Agent Payments (x402)
|
|
173
|
-
|
|
174
|
-
Your agent can pay for premium APIs, compute resources, and services autonomously โ within smart-contract-enforced spending limits. No wallet draining. No surprise bills. Built on the payment infrastructure [integrated into NVIDIA's official NeMo Agent Toolkit](https://github.com/NVIDIA/NeMo-Agent-Toolkit-Examples/pull/17).
|
|
175
|
-
|
|
176
|
-
### 5. Beyond Software Development
|
|
177
|
-
|
|
178
|
-
Static frameworks stop at coding methodology. ClawPowers includes skills for:
|
|
179
|
-
|
|
180
|
-
- **Security auditing** โ Automated vulnerability scanning with Trivy, dependency checks, secret detection
|
|
181
|
-
- **Content pipeline** โ Write, humanize, and publish technical content with platform-specific formatting
|
|
182
|
-
- **Market intelligence** โ Research competitors, track trends, analyze opportunities
|
|
183
|
-
- **Prospecting** โ Find leads matching your ICP, enrich contacts, output to CRM
|
|
184
|
-
|
|
185
|
-
## Skills Reference
|
|
186
|
-
|
|
187
|
-
### Core Development (14 skills)
|
|
188
|
-
|
|
189
|
-
| Skill | What It Does | Runtime Enhancement |
|
|
190
|
-
|-------|-------------|---------------------|
|
|
191
|
-
| `subagent-driven-development` | Orchestrate parallel subagents per task | Persistent execution DB, resumable checkpoints, outcome metrics |
|
|
192
|
-
| `test-driven-development` | RED-GREEN-REFACTOR enforcement | Mutation analysis, test portfolio management, effectiveness scoring |
|
|
193
|
-
| `writing-plans` | Spec โ implementation plan | Historical task estimation, dependency validation, plan quality scoring |
|
|
194
|
-
| `executing-plans` | Execute plans with verification | Progress persistence, interruption recovery, milestone tracking |
|
|
195
|
-
| `brainstorming` | Structured ideation | Cross-session idea persistence, convergence tracking |
|
|
196
|
-
| `systematic-debugging` | Hypothesis-driven debugging | Persistent hypothesis tree, pattern matching against known issues |
|
|
197
|
-
| `verification-before-completion` | Pre-merge quality gates | Automated verification suite, historical pass rate tracking |
|
|
198
|
-
| `finishing-a-development-branch` | Branch cleanup and merge prep | Automated changelog, squash strategy optimization |
|
|
199
|
-
| `requesting-code-review` | Prepare and request review | Reviewer match scoring, review history |
|
|
200
|
-
| `receiving-code-review` | Process and implement feedback | Feedback pattern tracking, common issues database |
|
|
201
|
-
| `using-git-worktrees` | Isolated branch development | Worktree lifecycle management, conflict prediction |
|
|
202
|
-
| `using-clawpowers` | Meta-skill: how to use ClawPowers | Adaptive onboarding based on user skill level |
|
|
203
|
-
| `writing-skills` | Create new skills via TDD | Skill quality scoring, anti-pattern detection |
|
|
204
|
-
| `dispatching-parallel-agents` | Fan-out parallel execution | Load balancing, failure isolation, result aggregation |
|
|
205
|
-
|
|
206
|
-
### Extended Capabilities (6 skills)
|
|
207
|
-
|
|
208
|
-
| Skill | What It Does | Why Static Frameworks Can't |
|
|
209
|
-
|-------|-------------|----------------------------|
|
|
210
|
-
| `agent-payments` | x402 payment protocol, spending limits, autonomous transactions | Requires runtime wallet interaction, smart contract calls |
|
|
211
|
-
| `security-audit` | Vulnerability scanning, secret detection, dependency audits | Requires tool execution (Trivy, gitleaks, npm audit) |
|
|
212
|
-
| `content-pipeline` | Write โ humanize โ format โ publish | Requires API calls, platform auth, content transformation |
|
|
213
|
-
| `learn-how-to-learn` | Metacognitive protocols, anti-pattern detection, confidence calibration | Requires persistent learning state, outcome correlation |
|
|
214
|
-
| `market-intelligence` | Competitive analysis, trend detection, opportunity scoring | Requires web access, data aggregation, persistent tracking |
|
|
215
|
-
| `prospecting` | Lead generation, contact enrichment, CRM sync | Requires API calls (Exa, Apollo), structured output |
|
|
216
|
-
|
|
217
|
-
### RSI Intelligence Layer (4 skills)
|
|
218
|
-
|
|
219
|
-
These skills don't exist in any other framework. They require runtime execution, persistent state, and self-modification capabilities that static prompt collections can never deliver.
|
|
220
|
-
|
|
221
|
-
| Skill | What It Does | Why This Changes Everything |
|
|
222
|
-
|-------|-------------|----------------------------|
|
|
223
|
-
| `meta-skill-evolution` | Every 50 tasks, analyzes outcome patterns, identifies the weakest skill, surgically rewrites its methodology, version bumps | Your agent's coding discipline improves autonomously over time. After 30 days it's measurably better than any static install |
|
|
224
|
-
| `self-healing-code` | On test failure: captures error โ builds hypothesis tree โ generates 2+ patches โ applies with coverage guard โ auto-commits winner | 3-cycle max with rollback. Turns red tests into green tests without human intervention |
|
|
225
|
-
| `cross-project-knowledge` | Persistent pattern library across ALL repos. Bug fixes, architecture decisions, and performance optimizations transfer between projects | Agent working on Project B benefits from everything learned on Projects A, C, D. Knowledge compounds |
|
|
226
|
-
| `formal-verification-lite` | Property-based testing with fast-check (JS), Hypothesis (Python), QuickCheck (Haskell). 5 property templates, 1000+ examples per property | Goes beyond "tests pass" to "tests actually prove correctness." Catches edge cases unit tests miss |
|
|
227
|
-
| `economic-code-optimization` | Autonomously spends micro-budgets on premium models, cloud GPUs, expert reviews when ROI justifies it. Tracks every cent and learns optimal spend ratios | Agents literally invest in their own performance. Spending efficiency improves over time via RSI feedback loop |
|
|
228
|
-
|
|
229
|
-
## Architecture
|
|
230
|
-
|
|
231
|
-
```
|
|
232
|
-
clawpowers/
|
|
233
|
-
โโโ skills/ # 26 skill directories, each with SKILL.md
|
|
234
|
-
โโโ runtime/
|
|
235
|
-
โ โโโ persistence/ # Cross-session state (store.js + store.sh)
|
|
236
|
-
โ โโโ metrics/ # Outcome tracking (collector.js + collector.sh)
|
|
237
|
-
โ โโโ feedback/ # RSI self-improvement (analyze.js + analyze.sh)
|
|
238
|
-
โ โโโ init.js # Cross-platform runtime setup
|
|
239
|
-
โ โโโ init.sh # Unix-native runtime setup
|
|
240
|
-
โโโ hooks/
|
|
241
|
-
โ โโโ session-start # Bash session hook (macOS/Linux)
|
|
242
|
-
โ โโโ session-start.js # Node.js session hook (all platforms)
|
|
243
|
-
โ โโโ session-start.cmd # Windows batch wrapper
|
|
244
|
-
โโโ bin/
|
|
245
|
-
โ โโโ clawpowers.js # Cross-platform CLI (Windows/macOS/Linux)
|
|
246
|
-
โ โโโ clawpowers.sh # Unix-native CLI (macOS/Linux)
|
|
247
|
-
โโโ plugins/ # Platform-specific plugin manifests
|
|
248
|
-
โ โโโ .claude-plugin/ # Claude Code
|
|
249
|
-
โ โโโ .cursor-plugin/ # Cursor
|
|
250
|
-
โ โโโ .codex/ # Codex
|
|
251
|
-
โ โโโ .opencode/ # OpenCode
|
|
252
|
-
โ โโโ gemini-extension.json # Gemini CLI
|
|
253
|
-
โโโ tests/ # 366 test assertions
|
|
254
|
-
โโโ docs/ # Documentation
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
**Dual runtime:** Every runtime script exists in both bash (`.sh`) and Node.js (`.js`). Unix users get native bash performance. Windows users get full functionality via Node.js. `npx clawpowers` auto-detects the best runtime for your platform.
|
|
258
|
-
|
|
259
245
|
## Platform Support
|
|
260
246
|
|
|
261
247
|
| Platform | Windows | macOS | Linux | WSL2 |
|
|
262
|
-
|
|
248
|
+
|----------|:-------:|:-----:|:-----:|:----:|
|
|
263
249
|
| Claude Code | โ
| โ
| โ
| โ
|
|
|
264
250
|
| Cursor | โ
| โ
| โ
| โ
|
|
|
265
251
|
| Codex | โ
| โ
| โ
| โ
|
|
|
266
252
|
| OpenCode | โ
| โ
| โ
| โ
|
|
|
267
253
|
| Gemini CLI | โ
| โ
| โ
| โ
|
|
|
268
254
|
|
|
269
|
-
##
|
|
270
|
-
|
|
271
|
-
```bash
|
|
272
|
-
npx clawpowers init # Set up ~/.clawpowers/
|
|
273
|
-
npx clawpowers status # Runtime health check
|
|
274
|
-
npx clawpowers metrics record --skill <name> --outcome success|failure # Track outcome
|
|
275
|
-
npx clawpowers metrics show # View recent metrics
|
|
276
|
-
npx clawpowers metrics summary # Per-skill stats
|
|
277
|
-
npx clawpowers analyze # RSI performance analysis
|
|
278
|
-
npx clawpowers analyze --skill <name> # Analyze specific skill
|
|
279
|
-
npx clawpowers store set <key> <value> # Store persistent state
|
|
280
|
-
npx clawpowers store get <key> # Retrieve state
|
|
281
|
-
npx clawpowers store list [prefix] # List stored keys
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
## Payments Are Optional (and Safe by Default)
|
|
285
|
-
|
|
286
|
-
ClawPowers works without any wallet.
|
|
287
|
-
|
|
288
|
-
When you hit a paid boundary (HTTP 402 "Payment Required", premium tools, or agent-to-agent settlements), ClawPowers can pay **only if** you enable it and set spending limits.
|
|
289
|
-
|
|
290
|
-
**Default mode: Dry Run**
|
|
291
|
-
- We detect payment requirements.
|
|
292
|
-
- We evaluate your spending policy (limits + allowlist).
|
|
293
|
-
- We log exactly what would happen.
|
|
294
|
-
- **No funds move until you explicitly enable live payments.**
|
|
295
|
-
|
|
296
|
-
### Enable payments (2 minutes)
|
|
297
|
-
|
|
298
|
-
```bash
|
|
299
|
-
npx clawpowers init
|
|
300
|
-
npx clawpowers payments setup
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
Choose:
|
|
304
|
-
- Keep disabled
|
|
305
|
-
- Enable Dry Run (observe what would happen)
|
|
306
|
-
- Enable Live Payments (set per-tx and daily limits)
|
|
307
|
-
|
|
308
|
-
All logs are local at `~/.clawpowers/` (never share this directory).
|
|
309
|
-
|
|
310
|
-
### Try it risk-free
|
|
311
|
-
|
|
312
|
-
```bash
|
|
313
|
-
npx clawpowers demo x402
|
|
314
|
-
```
|
|
255
|
+
## Requirements
|
|
315
256
|
|
|
316
|
-
|
|
257
|
+
- **Node.js >= 16** (for cross-platform runtime)
|
|
258
|
+
- **OR bash** (for Unix-native runtime)
|
|
259
|
+
- **Zero runtime dependencies** โ `package.json` has an empty `dependencies` object
|
|
317
260
|
|
|
318
261
|
## Security Model
|
|
319
262
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
- **State directory** (`~/.clawpowers/`) uses `700` permissions โ owner-only access
|
|
325
|
-
- **Path traversal blocked** โ keys containing `/` or `\` are rejected at the store level
|
|
326
|
-
- **No network access** โ runtime scripts (store, metrics, analyze) are fully offline
|
|
327
|
-
- **No eval** โ zero use of `eval()`, `Function()`, or dynamic code execution in any runtime script
|
|
328
|
-
|
|
329
|
-
### Agent Payment Guardrails
|
|
330
|
-
|
|
331
|
-
The `agent-payments` skill uses `agentwallet-sdk` with hard on-chain spending limits:
|
|
332
|
-
|
|
333
|
-
```
|
|
334
|
-
Agent wants to spend $15 โ โ
Auto-approved (under $25/tx limit)
|
|
335
|
-
Agent wants to spend $500 โ โณ Queued for owner approval
|
|
336
|
-
Agent spent $490 today โ ๐ Next tx blocked ($500/day limit hit)
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
- **Non-custodial** โ your private key, your wallet. No third-party custody.
|
|
340
|
-
- **ERC-6551 token-bound accounts** โ wallet is tied to an NFT. Portable, auditable, on-chain.
|
|
341
|
-
- **Smart-contract enforced** โ spending policies live on-chain. The agent literally *cannot* bypass them, even with a prompt injection.
|
|
342
|
-
- **Owner override** โ you can revoke, pause, or adjust limits at any time.
|
|
343
|
-
|
|
344
|
-
### What This Means in Practice
|
|
345
|
-
|
|
346
|
-
Even if an agent is compromised (prompt injection, jailbreak, malicious skill), it cannot:
|
|
347
|
-
1. Spend more than the per-transaction limit you set
|
|
348
|
-
2. Exceed the daily/weekly spending cap you configured
|
|
349
|
-
3. Access funds outside its ERC-6551 token-bound account
|
|
350
|
-
4. Modify its own spending policy (only the owner wallet can)
|
|
351
|
-
|
|
352
|
-
**Recommendation:** Start with low limits ($5/tx, $25/day) and increase as you build confidence. The SDK supports per-token policies โ set tighter limits on volatile assets, looser on stablecoins.
|
|
353
|
-
|
|
354
|
-
## Agent Payment Demo
|
|
355
|
-
|
|
356
|
-
Here's a complete example of an agent autonomously paying for a premium API:
|
|
357
|
-
|
|
358
|
-
### 1. Set Up the Wallet (One-Time)
|
|
359
|
-
|
|
360
|
-
```typescript
|
|
361
|
-
import { createWallet, setSpendPolicy, NATIVE_TOKEN } from 'agentwallet-sdk';
|
|
362
|
-
import { createWalletClient, http } from 'viem';
|
|
363
|
-
import { privateKeyToAccount } from 'viem/accounts';
|
|
364
|
-
import { base } from 'viem/chains';
|
|
365
|
-
|
|
366
|
-
// Create wallet on Base (cheapest gas for agent operations)
|
|
367
|
-
const account = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY as `0x${string}`);
|
|
368
|
-
const walletClient = createWalletClient({ account, chain: base, transport: http() });
|
|
369
|
-
|
|
370
|
-
const wallet = createWallet({
|
|
371
|
-
accountAddress: '0xYourAgentWallet',
|
|
372
|
-
chain: 'base',
|
|
373
|
-
walletClient,
|
|
374
|
-
});
|
|
375
|
-
|
|
376
|
-
// Set spending guardrails: $5 per request, $50/day max
|
|
377
|
-
await setSpendPolicy(wallet, {
|
|
378
|
-
token: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', // USDC on Base
|
|
379
|
-
perTxLimit: 5_000_000n, // 5 USDC per transaction
|
|
380
|
-
periodLimit: 50_000_000n, // 50 USDC per day
|
|
381
|
-
periodLength: 86400, // 24 hours
|
|
382
|
-
});
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
### 2. Agent Pays for Premium Data (Autonomous)
|
|
386
|
-
|
|
387
|
-
```typescript
|
|
388
|
-
import { createX402Client } from 'agentwallet-sdk';
|
|
389
|
-
|
|
390
|
-
const x402 = createX402Client(wallet, {
|
|
391
|
-
supportedNetworks: ['base:8453'],
|
|
392
|
-
globalDailyLimit: 50_000_000n, // matches spend policy
|
|
393
|
-
globalPerRequestMax: 5_000_000n,
|
|
394
|
-
});
|
|
395
|
-
|
|
396
|
-
// Agent encounters a 402 Payment Required response โ pays automatically
|
|
397
|
-
const response = await x402.fetch('https://api.premium-data.com/market-analysis');
|
|
398
|
-
const data = await response.json();
|
|
399
|
-
// Cost: $0.50 USDC, auto-approved (under $5 limit)
|
|
400
|
-
// Owner sees: tx hash on Base, fully auditable
|
|
401
|
-
```
|
|
402
|
-
|
|
403
|
-
### 3. Track Payment Outcomes (RSI Loop)
|
|
404
|
-
|
|
405
|
-
```bash
|
|
406
|
-
# ClawPowers tracks every payment outcome
|
|
407
|
-
npx clawpowers metrics record \
|
|
408
|
-
--skill agent-payments \
|
|
409
|
-
--outcome success \
|
|
410
|
-
--duration 3 \
|
|
411
|
-
--notes "Paid $0.50 for market analysis API โ data quality 9/10"
|
|
412
|
-
|
|
413
|
-
# After 10+ payments, analyze ROI
|
|
414
|
-
npx clawpowers analyze --skill agent-payments
|
|
415
|
-
# Output: success rate, avg cost, cost-per-successful-outcome
|
|
416
|
-
```
|
|
263
|
+
- State directory (`~/.clawpowers/`) uses `700` permissions โ owner-only
|
|
264
|
+
- No network access in runtime scripts โ store, metrics, and analyze are fully offline
|
|
265
|
+
- No `eval()`, `Function()`, or dynamic code execution anywhere in the runtime
|
|
266
|
+
- Payment guardrails enforced by smart contract โ application code cannot override them
|
|
417
267
|
|
|
418
268
|
## Credential
|
|
419
269
|
|
|
420
|
-
Built by [AI Agent Economy](https://github.com/up2itnow0822)
|
|
421
|
-
|
|
270
|
+
Built by [AI Agent Economy](https://github.com/up2itnow0822):
|
|
422
271
|
- Payment infrastructure in [NVIDIA's official NeMo Agent Toolkit](https://github.com/NVIDIA/NeMo-Agent-Toolkit-Examples/pull/17)
|
|
423
|
-
- [agentwallet-sdk](https://www.npmjs.com/package/agentwallet-sdk) โ
|
|
424
|
-
- [agentpay-mcp](https://github.com/up2itnow0822/agentpay-mcp) โ MCP payment server
|
|
425
|
-
- Production trading systems with RSI self-improvement (268+ measured outcomes)
|
|
426
|
-
|
|
427
|
-
## Contributing
|
|
428
|
-
|
|
429
|
-
We welcome contributions. Unlike some frameworks, we don't dismiss legitimate skill proposals with one-word responses. Open an issue or PR โ every submission gets a genuine technical review.
|
|
272
|
+
- [agentwallet-sdk](https://www.npmjs.com/package/agentwallet-sdk) โ 741+ downloads/week
|
|
273
|
+
- [agentpay-mcp](https://github.com/up2itnow0822/agentpay-mcp) โ MCP payment server
|
|
430
274
|
|
|
431
275
|
## Patent Notice
|
|
432
276
|
|
|
433
277
|
**Patent Pending** โ The underlying financial infrastructure (agentwallet-sdk, agentpay-mcp) is covered by USPTO provisional patent application filed March 2026: "Non-Custodial Multi-Chain Financial Infrastructure System for Autonomous AI Agents."
|
|
434
278
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
We support the open x402 standard and encourage interoperable implementations. Our [provisional patent filing](https://github.com/up2itnow0822) is defensive โ intended to prevent hostile monopolization and protect builders' ability to use open payment rails. Our goal is to be the safest, fastest, most complete implementation, and to help the ecosystem adopt secure agent payments.
|
|
279
|
+
We support the open x402 standard. Our provisional filing is defensive โ intended to prevent hostile monopolization of open payment rails, not to restrict builders.
|
|
438
280
|
|
|
439
281
|
## Disclaimer
|
|
440
282
|
|
|
441
|
-
ClawPowers and agentwallet-sdk are non-custodial developer tooling. You control your own keys and set your own spending limits. You are responsible for compliance with applicable laws in your jurisdiction. This software is provided as-is under the MIT license. Nothing
|
|
283
|
+
ClawPowers and agentwallet-sdk are non-custodial developer tooling. You control your own keys and set your own spending limits. You are responsible for compliance with applicable laws in your jurisdiction. This software is provided as-is under the MIT license. Nothing here constitutes financial advice, custody services, or money transmission.
|
|
442
284
|
|
|
443
285
|
## License
|
|
444
286
|
|
package/bin/clawpowers.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
const fs = require('fs');
|
|
10
10
|
const path = require('path');
|
|
11
11
|
const os = require('os');
|
|
12
|
-
const {
|
|
12
|
+
const { spawnSync } = require('child_process');
|
|
13
13
|
|
|
14
14
|
// __dirname is the bin/ directory; repo root is one level up
|
|
15
15
|
const SCRIPT_DIR = __dirname;
|
|
@@ -162,7 +162,7 @@ function cmdInject() {
|
|
|
162
162
|
* @param {string[]} args - Remaining argv after 'metrics'.
|
|
163
163
|
*/
|
|
164
164
|
function cmdMetrics(args) {
|
|
165
|
-
const
|
|
165
|
+
const _collector = requireModule(COLLECTOR_JS);
|
|
166
166
|
const [subcmd, ...rest] = args;
|
|
167
167
|
|
|
168
168
|
// No subcommand or explicit help request: print metrics-specific usage
|
|
@@ -12,7 +12,7 @@ Two paths โ pick the one that matches your stack.
|
|
|
12
12
|
|
|
13
13
|
1. **Testnet wallet** โ any EOA private key (generate one with `cast wallet new` from Foundry, or MetaMask)
|
|
14
14
|
2. **Deployed AgentAccountV2** โ run `npx clawpowers payments setup` for the interactive wizard
|
|
15
|
-
3. **Base Sepolia ETH (gas)** โ free from [
|
|
15
|
+
3. **Base Sepolia ETH (gas)** โ free from the [Coinbase Base Sepolia Faucet](https://www.coinbase.com/faucets/base-ethereum-goerli-faucet)
|
|
16
16
|
|
|
17
17
|
---
|
|
18
18
|
|
|
@@ -94,7 +94,7 @@ node first-tx.mjs
|
|
|
94
94
|
3. `agentExecute()` called `agentExecute()` on the smart contract, which checked
|
|
95
95
|
the native ETH policy and sent 1 wei to the burn address.
|
|
96
96
|
4. The tx hash was returned immediately โ you can verify it on
|
|
97
|
-
[
|
|
97
|
+
View on [Base Sepolia Explorer](https://sepolia.basescan.org/tx/{txHash}).
|
|
98
98
|
|
|
99
99
|
---
|
|
100
100
|
|
|
@@ -157,7 +157,7 @@ python first_tx.py
|
|
|
157
157
|
which the server translated into an `agentTransferToken()` call on your
|
|
158
158
|
`AgentAccountV2` smart wallet.
|
|
159
159
|
3. The server returned the transaction hash, which you can verify at
|
|
160
|
-
[
|
|
160
|
+
View on [Base Sepolia Explorer](https://sepolia.basescan.org).
|
|
161
161
|
|
|
162
162
|
> **Python + MCP** is ideal when your agent framework is Python-based
|
|
163
163
|
> (LangChain, AutoGen, CrewAI) and you want to avoid writing viem/TypeScript.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clawpowers",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "The skills framework that actually does something โ runtime execution, persistent memory, self-improvement, and autonomous payments for coding agents.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "AI Agent Economy <https://github.com/up2itnow0822>",
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"init": "node bin/clawpowers.js init",
|
|
33
|
-
"test": "bash tests/run_all.sh"
|
|
33
|
+
"test": "bash tests/run_all.sh",
|
|
34
|
+
"lint": "eslint bin/ runtime/"
|
|
34
35
|
},
|
|
35
36
|
"files": [
|
|
36
37
|
"bin/",
|
|
@@ -51,5 +52,8 @@
|
|
|
51
52
|
"engines": {
|
|
52
53
|
"node": ">=16.0.0"
|
|
53
54
|
},
|
|
54
|
-
"
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"eslint": "10.1.0",
|
|
57
|
+
"globals": "17.4.0"
|
|
58
|
+
}
|
|
55
59
|
}
|
package/runtime/init.sh
CHANGED
|
@@ -132,7 +132,7 @@ EOF
|
|
|
132
132
|
# The sed command replaces the version= line in place; .bak is cleaned up immediately.
|
|
133
133
|
run_migrations() {
|
|
134
134
|
local current_version
|
|
135
|
-
current_version=$(grep "^version=" "$CLAWPOWERS_DIR/.version" 2>/dev/null | cut -d= -f2 || echo "0.0.0")
|
|
135
|
+
# current_version=$(grep "^version=" "$CLAWPOWERS_DIR/.version" 2>/dev/null | cut -d= -f2 || echo "0.0.0")
|
|
136
136
|
|
|
137
137
|
# Future migration hooks go here, e.g.:
|
|
138
138
|
# if [[ "$current_version" < "2.0.0" ]]; then
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
const fs = require('fs');
|
|
22
22
|
const path = require('path');
|
|
23
23
|
const os = require('os');
|
|
24
|
-
const { logPaymentDecision
|
|
24
|
+
const { logPaymentDecision } = require('./ledger');
|
|
25
25
|
|
|
26
26
|
// โโโ Config paths โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
27
27
|
|
|
@@ -103,11 +103,7 @@ function isAllowlisted(recipient, allowlist) {
|
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
105
|
* Returns an ISO 8601 timestamp without milliseconds.
|
|
106
|
-
* @returns {string}
|
|
107
106
|
*/
|
|
108
|
-
function isoNow() {
|
|
109
|
-
return new Date().toISOString().replace(/\.\d{3}Z$/, 'Z');
|
|
110
|
-
}
|
|
111
107
|
|
|
112
108
|
// โโโ Core pipeline โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
113
109
|
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: validator
|
|
3
|
+
description: Multi-round automated validation pipeline for any software project. Runs 14 rounds of checks โ compile gates, lint, tests, security scanning, documentation, secrets detection, link verification, spelling, cross-platform compatibility, dependency health, and PR-readiness. Auto-detects project language. Use before publish, deploy, merge, or external PR submission.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
requires:
|
|
6
|
+
tools: [bash, node, npm]
|
|
7
|
+
optional_tools: [trivy, gitleaks, codespell, markdownlint-cli2, eslint, cargo, go, python3]
|
|
8
|
+
runtime: false
|
|
9
|
+
metrics:
|
|
10
|
+
tracks: [rounds_passed, rounds_failed, rounds_warned, total_issues, critical_issues, test_count, test_pass_rate, type_coverage_pct, vulnerability_count]
|
|
11
|
+
improves: [code_quality, security_posture, documentation_completeness, publish_readiness]
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Validator
|
|
15
|
+
|
|
16
|
+
## When to Use
|
|
17
|
+
|
|
18
|
+
- Before `npm publish` / `cargo publish` / any package release
|
|
19
|
+
- Before merging a PR to your own repo
|
|
20
|
+
- Before submitting a PR to an external repo (NVIDIA, Google, CNCF, etc.)
|
|
21
|
+
- After a major refactor or dependency update
|
|
22
|
+
- On any project โ auto-detects language from marker files
|
|
23
|
+
|
|
24
|
+
**Skip when:**
|
|
25
|
+
- Trivial docs-only changes (run rounds 5, 8 only)
|
|
26
|
+
- Quick iteration cycles (run round 0 + 2 only: compile + test)
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
Run the Validator on ~/DevDrive/my-project
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Target specific rounds:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
Run Validator round 0-2 on my-project (compile + lint + test only)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
PR-readiness for external submission:
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
Run Validator PR-readiness checks on my-project for NVIDIA/NeMo-Agent-Toolkit-Examples
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Language Auto-Detection
|
|
47
|
+
|
|
48
|
+
Detect project type from marker files. When multiple markers exist, run checks for ALL detected languages.
|
|
49
|
+
|
|
50
|
+
| Marker File(s) | Language | Compile | Lint | Test | Security |
|
|
51
|
+
|---|---|---|---|---|---|
|
|
52
|
+
| `package.json` + `tsconfig.json` | TypeScript | `tsc --noEmit` | ESLint | `npm test` | `npm audit` |
|
|
53
|
+
| `package.json` (no tsconfig) | JavaScript | `node --check *.js` | ESLint | `npm test` | `npm audit` |
|
|
54
|
+
| `Cargo.toml` | Rust | `cargo check` | Clippy + rustfmt | `cargo test` | `cargo audit` |
|
|
55
|
+
| `go.mod` | Go | `go build ./...` | golangci-lint | `go test ./...` | `govulncheck` |
|
|
56
|
+
| `pyproject.toml` / `setup.py` | Python | `py_compile` | Ruff + Bandit | pytest | Bandit |
|
|
57
|
+
| `Dockerfile` | Docker | `docker build --check` | Hadolint | โ | Trivy |
|
|
58
|
+
| `foundry.toml` | Solidity | `forge build` | `forge fmt --check` | `forge test` | Slither |
|
|
59
|
+
| `*.sh` | Shell | `bash -n` | ShellCheck | โ | โ |
|
|
60
|
+
|
|
61
|
+
## The 14 Rounds
|
|
62
|
+
|
|
63
|
+
Execute in order. Round 0 is a **blocking gate** โ if it fails, stop everything.
|
|
64
|
+
|
|
65
|
+
### Round 0 โ Compile Gate (BLOCKING)
|
|
66
|
+
|
|
67
|
+
If this fails, ALL subsequent rounds are blocked. Fix compile errors first.
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# TypeScript
|
|
71
|
+
npx tsc --noEmit
|
|
72
|
+
|
|
73
|
+
# JavaScript
|
|
74
|
+
find . -name "*.js" -not -path "*/node_modules/*" -exec node --check {} \;
|
|
75
|
+
|
|
76
|
+
# Rust
|
|
77
|
+
cargo check
|
|
78
|
+
|
|
79
|
+
# Python
|
|
80
|
+
python3 -m py_compile <each .py file>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Pass criteria:** Zero compile errors.
|
|
84
|
+
|
|
85
|
+
### Round 1 โ Lint
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# TypeScript/JavaScript
|
|
89
|
+
npx eslint . --ext .ts,.js,.tsx,.jsx 2>&1
|
|
90
|
+
|
|
91
|
+
# Rust
|
|
92
|
+
cargo clippy -- -D warnings
|
|
93
|
+
|
|
94
|
+
# Python
|
|
95
|
+
ruff check . 2>&1
|
|
96
|
+
|
|
97
|
+
# Go
|
|
98
|
+
golangci-lint run ./...
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Pass criteria:** Zero errors. Warnings are advisory.
|
|
102
|
+
|
|
103
|
+
### Round 2 โ Test Suite
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Node.js
|
|
107
|
+
npm test
|
|
108
|
+
|
|
109
|
+
# Rust
|
|
110
|
+
cargo test
|
|
111
|
+
|
|
112
|
+
# Python
|
|
113
|
+
pytest -v
|
|
114
|
+
|
|
115
|
+
# Go
|
|
116
|
+
go test ./...
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Pass criteria:** All tests pass. Report total count and pass rate.
|
|
120
|
+
|
|
121
|
+
### Round 3 โ Security Audit
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Node.js
|
|
125
|
+
npm audit --audit-level=high
|
|
126
|
+
|
|
127
|
+
# Rust
|
|
128
|
+
cargo audit
|
|
129
|
+
|
|
130
|
+
# Python
|
|
131
|
+
pip-audit
|
|
132
|
+
|
|
133
|
+
# Container
|
|
134
|
+
trivy fs --severity HIGH,CRITICAL .
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Pass criteria:** Zero HIGH or CRITICAL vulnerabilities. LOW/MODERATE are advisory.
|
|
138
|
+
|
|
139
|
+
### Round 4 โ Type Coverage
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
# TypeScript
|
|
143
|
+
npx type-coverage --at-least 90
|
|
144
|
+
|
|
145
|
+
# JavaScript (JSDoc)
|
|
146
|
+
# Count @param, @returns, @type annotations
|
|
147
|
+
grep -r "@param\|@returns\|@type" --include="*.js" -l | wc -l
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Pass criteria:** โฅ90% for TypeScript. For JS, report JSDoc annotation count.
|
|
151
|
+
|
|
152
|
+
### Round 5 โ Documentation
|
|
153
|
+
|
|
154
|
+
Check that these exist and are non-trivial:
|
|
155
|
+
- [ ] README.md (โฅ50 lines)
|
|
156
|
+
- [ ] Version mentioned in README or badge
|
|
157
|
+
- [ ] Installation instructions
|
|
158
|
+
- [ ] Usage examples with real code
|
|
159
|
+
- [ ] License declared (package.json or LICENSE file)
|
|
160
|
+
- [ ] CHANGELOG.md (if versioned package)
|
|
161
|
+
|
|
162
|
+
**Pass criteria:** All items checked.
|
|
163
|
+
|
|
164
|
+
### Round 6 โ Changelog
|
|
165
|
+
|
|
166
|
+
- [ ] CHANGELOG.md exists
|
|
167
|
+
- [ ] Current version has an entry
|
|
168
|
+
- [ ] Entry describes what changed (not just "bug fixes")
|
|
169
|
+
|
|
170
|
+
**Pass criteria:** Current version documented.
|
|
171
|
+
|
|
172
|
+
### Round 7 โ Secrets Detection
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# gitleaks (git history)
|
|
176
|
+
gitleaks detect --source . -v 2>&1
|
|
177
|
+
|
|
178
|
+
# detect-secrets (current files)
|
|
179
|
+
detect-secrets scan . 2>&1
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**Pass criteria:** Zero real secrets. Document false positives (contract addresses, example values) and recommend `.gitleaksignore` entries.
|
|
183
|
+
|
|
184
|
+
### Round 8 โ Spelling
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
codespell --skip="node_modules,dist,.git,package-lock.json,*.min.js" .
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Pass criteria:** Zero typos in source code and documentation.
|
|
191
|
+
|
|
192
|
+
### Round 9 โ Link Verification
|
|
193
|
+
|
|
194
|
+
Check all URLs in README.md and documentation:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# Extract URLs and test each
|
|
198
|
+
grep -oP 'https?://[^\s\)\"]+' README.md | while read url; do
|
|
199
|
+
code=$(curl -o /dev/null -s -w "%{http_code}" "$url")
|
|
200
|
+
if [ "$code" != "200" ] && [ "$code" != "301" ]; then
|
|
201
|
+
echo "BROKEN: $url โ $code"
|
|
202
|
+
fi
|
|
203
|
+
done
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**Pass criteria:** All links return 200 or 301. Flag example.com/placeholder URLs as advisory.
|
|
207
|
+
|
|
208
|
+
### Round 10 โ PR-Readiness (for external submissions)
|
|
209
|
+
|
|
210
|
+
- [ ] Conventional commit messages (`feat:`, `fix:`, `docs:`, etc.)
|
|
211
|
+
- [ ] DCO sign-off on commits (`git commit -s`)
|
|
212
|
+
- [ ] SPDX license headers in source files
|
|
213
|
+
- [ ] No merge commits (rebase-clean history)
|
|
214
|
+
- [ ] Branch is up-to-date with target
|
|
215
|
+
|
|
216
|
+
**Pass criteria:** All items for external PR targets. DCO/SPDX are advisory for own repos.
|
|
217
|
+
|
|
218
|
+
### Round 11 โ Cross-Platform Compatibility
|
|
219
|
+
|
|
220
|
+
- [ ] No hardcoded absolute paths
|
|
221
|
+
- [ ] No macOS-only or Linux-only commands without guards
|
|
222
|
+
- [ ] No case-sensitive filename conflicts
|
|
223
|
+
- [ ] `engines` field in package.json (Node.js)
|
|
224
|
+
- [ ] `.env.example` exists if `.env` is used
|
|
225
|
+
|
|
226
|
+
**Pass criteria:** Works on macOS, Linux, and CI runners.
|
|
227
|
+
|
|
228
|
+
### Round 12 โ Dependency Health
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# All deps pinned (no * or latest)
|
|
232
|
+
grep -E '"[\*]"|"latest"' package.json
|
|
233
|
+
|
|
234
|
+
# Lock file committed
|
|
235
|
+
ls package-lock.json || ls yarn.lock || ls pnpm-lock.yaml
|
|
236
|
+
|
|
237
|
+
# Clean install
|
|
238
|
+
npm ci --dry-run
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
**Pass criteria:** Deps pinned, lock file committed, clean install works.
|
|
242
|
+
|
|
243
|
+
### Round 13 โ Summary & Verdict
|
|
244
|
+
|
|
245
|
+
Compile results from all rounds:
|
|
246
|
+
|
|
247
|
+
```
|
|
248
|
+
## Validator Report โ [Project] v[Version]
|
|
249
|
+
|
|
250
|
+
| Round | Check | Result |
|
|
251
|
+
|-------|-------|--------|
|
|
252
|
+
| 0 | Compile | โ
/โ |
|
|
253
|
+
| 1 | Lint | โ
/โ ๏ธ/โ |
|
|
254
|
+
| ... | ... | ... |
|
|
255
|
+
|
|
256
|
+
**Verdict:** PASS โ
/ WARN โ ๏ธ / FAIL โ
|
|
257
|
+
**Score:** X/14 rounds clean
|
|
258
|
+
|
|
259
|
+
Blocking issues: [list or "none"]
|
|
260
|
+
Advisory warnings: [list or "none"]
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Verdicts
|
|
264
|
+
|
|
265
|
+
| Verdict | Meaning |
|
|
266
|
+
|---------|---------|
|
|
267
|
+
| **PASS โ
** | All rounds clean. Safe to publish/merge. |
|
|
268
|
+
| **WARN โ ๏ธ** | No blockers but advisory issues exist. Safe to publish, address warnings when convenient. |
|
|
269
|
+
| **FAIL โ** | Blocking issues in Round 0-3. Fix before proceeding. |
|
|
270
|
+
|
|
271
|
+
## Output
|
|
272
|
+
|
|
273
|
+
Save the full report to `ops/reports/validator-YYYY-MM-DD-HH-<project>.md` in the workspace.
|
|
274
|
+
|
|
275
|
+
## Tips
|
|
276
|
+
|
|
277
|
+
- Run rounds 0-2 frequently during development (fast feedback)
|
|
278
|
+
- Run full 14 rounds before any publish or external PR
|
|
279
|
+
- Round 7 (secrets) is critical before pushing to public repos
|
|
280
|
+
- Round 10 (PR-readiness) only matters for external repo submissions
|
|
281
|
+
- Use `--skip-round N` to skip specific rounds when re-running after fixes
|