clawpowers 1.1.1 → 1.1.3

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.
@@ -266,6 +266,147 @@ print(json.dumps(prospects, indent=2))
266
266
  "
267
267
  ```
268
268
 
269
+ ### Premium Enrichment (x402-Aware)
270
+
271
+ By default, the prospecting skill uses free public sources (GitHub, LinkedIn
272
+ search, Hunter.io free tier). When incomplete contact data is holding back
273
+ your campaign, x402-aware paid enrichment APIs can fill the gaps.
274
+
275
+ #### Three States
276
+
277
+ | State | Config | Behaviour |
278
+ |-------|--------|-----------|
279
+ | **disabled** | `payments.enabled: false` | Skip all paid enrichment, log a note, continue with free data |
280
+ | **dry-run** | `payments.mode: "dry_run"` | Log what _would_ be paid, show cost estimate, do NOT execute payment |
281
+ | **live** | `payments.mode: "live"` | Execute payment if within policy limits; queue for approval if over |
282
+
283
+ #### How It Works
284
+
285
+ After Phase 4 (Contact Enrichment), the skill checks how many contacts are
286
+ still missing key data (email, phone, LinkedIn URL) and offers to enrich them
287
+ via premium APIs that accept x402 micropayments.
288
+
289
+ ```bash
290
+ # After free enrichment — assess gaps
291
+ TOTAL_LEADS=15
292
+ INCOMPLETE=8 # missing email or key contact field
293
+
294
+ echo "Found $TOTAL_LEADS leads. $INCOMPLETE have incomplete data."
295
+ echo "Premium enrichment available for \$0.02/lead."
296
+ echo "Estimated cost: \$$(echo "$INCOMPLETE * 0.02" | bc) USDC"
297
+ ```
298
+
299
+ #### Payment Gate Flow
300
+
301
+ ```javascript
302
+ // runtime/payments/pipeline.js — called automatically when x402 enrichment is triggered
303
+ const { evaluatePayment } = require('../../runtime/payments/pipeline');
304
+
305
+ const result = await evaluatePayment({
306
+ skill: 'prospecting',
307
+ reason: 'premium contact enrichment',
308
+ amount_usd: incompleteCount * 0.02,
309
+ asset: 'USDC',
310
+ chain: 'base',
311
+ recipient: '0xENRICHMENT_API_RECIPIENT',
312
+ url: 'https://api.contactdb.example.com/enrich',
313
+ });
314
+
315
+ switch (result.action) {
316
+ case 'disabled':
317
+ console.log('[prospecting] Premium enrichment disabled — using free data only.');
318
+ break;
319
+
320
+ case 'dry_run':
321
+ console.log(
322
+ `[prospecting] DRY-RUN: would pay $${(incompleteCount * 0.02).toFixed(2)} USDC ` +
323
+ `to enrich ${incompleteCount} contacts via ${result.reason}. No payment made.`
324
+ );
325
+ break;
326
+
327
+ case 'queued':
328
+ console.log(
329
+ `[prospecting] Payment queued for owner approval: ` +
330
+ `$${(incompleteCount * 0.02).toFixed(2)} USDC for ${incompleteCount} enrichments.`
331
+ );
332
+ // → Enrichment pauses until owner approves pending tx
333
+ break;
334
+
335
+ case 'approved':
336
+ console.log(`[prospecting] Executing premium enrichment for ${incompleteCount} contacts...`);
337
+ await runPremiumEnrichment(incompleteContacts);
338
+ break;
339
+ }
340
+ ```
341
+
342
+ #### Enabling Premium Enrichment
343
+
344
+ ```bash
345
+ # ~/.clawpowers/config.json
346
+ {
347
+ "payments": {
348
+ "enabled": true,
349
+ "mode": "live",
350
+ "per_tx_limit": 0.50,
351
+ "daily_limit": 5.00,
352
+ "require_approval_above": 1.00
353
+ }
354
+ }
355
+ ```
356
+
357
+ ```bash
358
+ # .env additions for prospecting
359
+ AGENT_PRIVATE_KEY=0x...
360
+ AGENT_WALLET_ADDRESS=0x...
361
+ CHAIN_NAME=base
362
+ SPEND_LIMIT_PER_TX=0.50
363
+ SPEND_LIMIT_DAILY=5.00
364
+ ```
365
+
366
+ #### Supported Premium Enrichment Sources
367
+
368
+ | Source | Cost/lead | Data provided |
369
+ |--------|-----------|--------------|
370
+ | Apollo.io (paid tier) | ~$0.02 | Verified email, phone, LinkedIn |
371
+ | Clearbit Enrichment | ~$0.03 | Company firmographics, tech stack |
372
+ | Hunter.io Pro | ~$0.01 | Email verification, role signals |
373
+ | Proxycurl | ~$0.015 | LinkedIn profile scrape |
374
+ | Coresignal | ~$0.02 | Company employee headcount, tech |
375
+
376
+ All premium API calls go through the x402 client wrapper:
377
+
378
+ ```javascript
379
+ import { x402FromEnv } from 'agentwallet-sdk';
380
+
381
+ const wallet = walletFromEnv();
382
+ const client = x402FromEnv(wallet);
383
+
384
+ // Automatically pays any HTTP 402 responses from enrichment APIs
385
+ const response = await client.fetch(
386
+ `https://api.apollo.io/v1/people/enrich?email=${email}`,
387
+ { headers: { 'x-api-key': process.env.APOLLO_API_KEY } }
388
+ );
389
+ const enriched = await response.json();
390
+ ```
391
+
392
+ #### Dry-Run Output Example
393
+
394
+ When `payments.mode` is `"dry_run"`, the skill outputs a cost preview before
395
+ any action is taken:
396
+
397
+ ```
398
+ [prospecting] Enrichment summary:
399
+ Free sources: 7 / 15 contacts fully enriched
400
+ Incomplete: 8 / 15 contacts missing email or title
401
+
402
+ [prospecting] DRY-RUN: Premium enrichment would cost:
403
+ 8 contacts × $0.02/lead = $0.16 USDC
404
+ API: Apollo.io (paid), chain: base
405
+
406
+ To execute: set payments.mode = "live" in ~/.clawpowers/config.json
407
+ To approve this batch: clawpowers payments approve --skill prospecting
408
+ ```
409
+
269
410
  ## ClawPowers Enhancement
270
411
 
271
412
  When `~/.clawpowers/` runtime is initialized:
@@ -265,6 +265,51 @@ trivy fs . --severity HIGH,CRITICAL
265
265
  bandit -r src/ -ll
266
266
  ```
267
267
 
268
+ ### Premium Scanner Escalation
269
+
270
+ The default audit pipeline uses **free local scanners**: `npm audit`, `gitleaks`, `trivy`, `bandit`, and `semgrep`. These cover the vast majority of findings and require no payment.
271
+
272
+ When free scanners surface critical or high-severity findings, premium scanners can provide deeper analysis: broader CVE databases, behavioral analysis, license compliance, supply-chain attack detection, and exploit chain mapping.
273
+
274
+ **Payment gate logic for scanner escalation:**
275
+
276
+ | Config state | Behavior |
277
+ |-------------|---------|
278
+ | `payments.enabled = false` | Log the premium scanner option. Skip it. Proceed with free scan results only. |
279
+ | `payments.mode = "dry_run"` | Log what would happen: `[dry-run: would pay $0.05 for Snyk deep scan]`. No charge. |
280
+ | `payments.mode = "live"` | Evaluate cost vs. severity. If cost fits policy limits and severity is Critical/High, pay and run the premium scan. |
281
+
282
+ **Example escalation scenarios:**
283
+
284
+ ```
285
+ Trivy found 2 critical vulns in base image.
286
+ Premium scanner (Snyk container) available for $0.05.
287
+ [dry-run: would pay — severity=critical, cost=$0.05 < per_tx_limit=$0.10]
288
+ ```
289
+
290
+ ```
291
+ gitleaks found 0 secrets in current HEAD.
292
+ Premium deep-history scan available for $0.20.
293
+ [skipped — payments.enabled=false]
294
+ ```
295
+
296
+ **When to escalate:**
297
+ - `CRITICAL` findings from free scanners → always consider premium for exploit chain analysis
298
+ - `HIGH` findings with active CVEs → premium scanner may have fresher signature database
299
+ - Pre-production release gates → deep scan is worth the cost
300
+ - Compliance requirements (SOC 2, PCI) → premium scanners generate compliance-ready reports
301
+
302
+ **Check payment config before escalating:**
303
+
304
+ ```bash
305
+ cat ~/.clawpowers/config.json | grep -A8 '"payments"'
306
+
307
+ # After audit session, review any payment decisions made
308
+ npx clawpowers payments log
309
+ ```
310
+
311
+ **Escalation is always optional.** The free scanner suite is production-grade. Premium escalation improves coverage at the margin — it never replaces the free baseline.
312
+
268
313
  ## ClawPowers Enhancement
269
314
 
270
315
  When `~/.clawpowers/` runtime is initialized:
@@ -53,6 +53,9 @@ Skills activate automatically when you recognize a matching task pattern. You do
53
53
  | Need to create a new skill | `writing-skills` |
54
54
  | Multiple independent tasks that can run concurrently | `dispatching-parallel-agents` |
55
55
  | Making a payment or calling a paid API | `agent-payments` |
56
+ | "setup payments" / "enable wallet" / "configure spending" | `agent-payments` → `npx clawpowers payments setup` |
57
+ | "demo x402" / "test payments" / "mock merchant" | `npx clawpowers demo x402` |
58
+ | "payment log" / "spending history" | `npx clawpowers payments log` |
56
59
  | Checking code/containers for vulnerabilities | `security-audit` |
57
60
  | Writing blog posts, docs, or social content | `content-pipeline` |
58
61
  | Need to understand how to learn something effectively | `learn-how-to-learn` |
@@ -66,6 +69,8 @@ Skills activate automatically when you recognize a matching task pattern. You do
66
69
  | Need roundtrip/idempotence/commutativity tests for a pure function | `formal-verification-lite` |
67
70
  | Complex task where premium resources would improve quality | `economic-code-optimization` |
68
71
  | Deciding whether to pay for expert review or premium model | `economic-code-optimization` |
72
+ | Hiring another agent to complete a task with payment escrow | `agent-bounties` |
73
+ | Want skin-in-the-game guarantees before a multi-agent task | `agent-bounties` |
69
74
 
70
75
  ## Reading a Skill
71
76
 
@@ -147,6 +152,9 @@ You never need to check the mode. Skills detect it themselves and adapt their in
147
152
  24. `formal-verification-lite` — Property-based testing (fast-check/Hypothesis) after TDD GREEN; 1000+ iterations per invariant
148
153
  25. `economic-code-optimization` — Autonomously spend micro-budgets on premium models, compute, expert reviews when ROI justifies it
149
154
 
155
+ ### Agent Economy Layer (1) — NEW
156
+ 26. `agent-bounties` — Post tasks with USDC rewards, escrow both-party collateral via MutualStakeEscrow, verify with automation, release or dispute on-chain
157
+
150
158
  ## Session Initialization Complete
151
159
 
152
- ClawPowers is ready. 25 skills active. Skills activate on pattern recognition. Runtime enhancements available when `~/.clawpowers/` exists. RSI Intelligence Layer (meta-skill-evolution, self-healing-code, cross-project-knowledge, formal-verification-lite) provides persistent learning across sessions and projects.
160
+ ClawPowers is ready. 26 skills active. Skills activate on pattern recognition. Runtime enhancements available when `~/.clawpowers/` exists. RSI Intelligence Layer (meta-skill-evolution, self-healing-code, cross-project-knowledge, formal-verification-lite) provides persistent learning across sessions and projects. Agent Economy Layer (agent-bounties) enables autonomous agent-to-agent hiring with on-chain escrow.