clawpowers 1.1.4 → 2.0.0
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/CHANGELOG.md +94 -0
- package/LICENSE +44 -0
- package/README.md +204 -228
- package/SECURITY.md +72 -0
- package/dist/index.d.ts +844 -0
- package/dist/index.js +2536 -0
- package/dist/index.js.map +1 -0
- package/package.json +50 -44
- package/.claude-plugin/manifest.json +0 -19
- package/.codex/INSTALL.md +0 -36
- package/.cursor-plugin/manifest.json +0 -21
- package/.opencode/INSTALL.md +0 -52
- package/ARCHITECTURE.md +0 -69
- package/bin/clawpowers.js +0 -625
- package/bin/clawpowers.sh +0 -91
- package/docs/demo/clawpowers-demo.cast +0 -197
- package/docs/demo/clawpowers-demo.gif +0 -0
- package/docs/launch-images/25-skills-breakdown.jpg +0 -0
- package/docs/launch-images/clawpowers-vs-superpowers.jpg +0 -0
- package/docs/launch-images/economic-code-optimization.jpg +0 -0
- package/docs/launch-images/native-vs-bridge-2.jpg +0 -0
- package/docs/launch-images/native-vs-bridge.jpg +0 -0
- package/docs/launch-images/post1-hero-lobster.jpg +0 -0
- package/docs/launch-images/post2-dashboard.jpg +0 -0
- package/docs/launch-images/post3-superpowers.jpg +0 -0
- package/docs/launch-images/post4-before-after.jpg +0 -0
- package/docs/launch-images/post5-install-now.jpg +0 -0
- package/docs/launch-images/ultimate-stack.jpg +0 -0
- package/docs/launch-posts.md +0 -76
- package/docs/quickstart-first-transaction.md +0 -204
- package/gemini-extension.json +0 -32
- package/hooks/session-start +0 -205
- package/hooks/session-start.cmd +0 -43
- package/hooks/session-start.js +0 -163
- package/runtime/demo/README.md +0 -78
- package/runtime/demo/x402-mock-server.js +0 -230
- package/runtime/feedback/analyze.js +0 -621
- package/runtime/feedback/analyze.sh +0 -546
- package/runtime/init.js +0 -210
- package/runtime/init.sh +0 -178
- package/runtime/metrics/collector.js +0 -361
- package/runtime/metrics/collector.sh +0 -308
- package/runtime/payments/ledger.js +0 -305
- package/runtime/payments/ledger.sh +0 -262
- package/runtime/payments/pipeline.js +0 -455
- package/runtime/persistence/store.js +0 -433
- package/runtime/persistence/store.sh +0 -303
- package/skill.json +0 -106
- package/skills/agent-bounties/SKILL.md +0 -553
- package/skills/agent-payments/SKILL.md +0 -479
- package/skills/brainstorming/SKILL.md +0 -233
- package/skills/content-pipeline/SKILL.md +0 -282
- package/skills/cross-project-knowledge/SKILL.md +0 -345
- package/skills/dispatching-parallel-agents/SKILL.md +0 -305
- package/skills/economic-code-optimization/SKILL.md +0 -265
- package/skills/executing-plans/SKILL.md +0 -255
- package/skills/finishing-a-development-branch/SKILL.md +0 -260
- package/skills/formal-verification-lite/SKILL.md +0 -441
- package/skills/learn-how-to-learn/SKILL.md +0 -235
- package/skills/market-intelligence/SKILL.md +0 -323
- package/skills/meta-skill-evolution/SKILL.md +0 -325
- package/skills/prospecting/SKILL.md +0 -454
- package/skills/receiving-code-review/SKILL.md +0 -225
- package/skills/requesting-code-review/SKILL.md +0 -206
- package/skills/security-audit/SKILL.md +0 -353
- package/skills/self-healing-code/SKILL.md +0 -369
- package/skills/subagent-driven-development/SKILL.md +0 -244
- package/skills/systematic-debugging/SKILL.md +0 -355
- package/skills/test-driven-development/SKILL.md +0 -416
- package/skills/using-clawpowers/SKILL.md +0 -160
- package/skills/using-git-worktrees/SKILL.md +0 -261
- package/skills/validator/SKILL.md +0 -281
- package/skills/verification-before-completion/SKILL.md +0 -254
- package/skills/writing-plans/SKILL.md +0 -276
- package/skills/writing-skills/SKILL.md +0 -260
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to ClawPowers are documented here.
|
|
4
|
+
|
|
5
|
+
## [2.0.0] - 2026-04-03
|
|
6
|
+
|
|
7
|
+
### Breaking Changes
|
|
8
|
+
|
|
9
|
+
- **Complete TypeScript rewrite.** The v1.x shell-script runtime has been replaced with a fully typed TypeScript library.
|
|
10
|
+
- **No agent control loop.** ClawPowers is now a pure capability library — bring your own agent framework.
|
|
11
|
+
- **ESM-only.** Requires Node.js 20+.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **Payments module** — x402 detection (`detect402`), `SpendingPolicy` enforcement, `PaymentExecutor` with append-only audit log. Fees: 0.77% tx / 0.30% swap.
|
|
16
|
+
- **Memory module** — `WorkingMemoryManager` (in-process, token-budgeted), `EpisodicMemory` (JSONL append-only), `ProceduralMemory` (atomic JSON), `CheckpointManager` (crash recovery), `ContextInjector` (relevant memory selection).
|
|
17
|
+
- **RSI module** — `MetricsCollector`, `HypothesisEngine`, `MutationEngine`, `ABTestManager`, `RSIAuditLog`, `AutoResearcher`. Full measure → hypothesize → mutate → A/B test → promote/rollback cycle.
|
|
18
|
+
- **Wallet module** — `WalletManager`, `generateWallet`, `importWallet`, `signMessage` with AES-256-GCM encryption at rest.
|
|
19
|
+
- **Skills module** — `discoverSkills`, `loadSkillManifest`, `SkillExecutor` with outcome tracking.
|
|
20
|
+
- **Config module** — Zod-validated config, dot-notation access, profile support.
|
|
21
|
+
- **Framework demos** — LangChain (`demos/langchain.ts`), Claude Code (`demos/claude-code.md`), ElizaOS (`demos/elizaos.ts`).
|
|
22
|
+
- **231 TypeScript tests** — full coverage across all modules.
|
|
23
|
+
- **BSL 1.1 license** with Change Date April 3, 2030.
|
|
24
|
+
- **SECURITY.md** with vulnerability reporting policy and security design principles.
|
|
25
|
+
|
|
26
|
+
### Compatibility
|
|
27
|
+
|
|
28
|
+
Drop-in library for: LangChain, LangGraph, Claude Code, Cursor, ElizaOS, AutoGen, CrewAI, Agent Zero, any MCP-compatible host.
|
|
29
|
+
|
|
30
|
+
### Removed
|
|
31
|
+
|
|
32
|
+
- Shell-script runtime (v1.x skills)
|
|
33
|
+
- CLI binary (`clawpowers` command)
|
|
34
|
+
- Agent control loop (use ClawPowers-Agent for that)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## [1.1.3] - 2026-03-22
|
|
38
|
+
|
|
39
|
+
### Added
|
|
40
|
+
|
|
41
|
+
- **Unified Payment Decision Pipeline** (`runtime/payments/pipeline.js`) — 8-step flow for evaluating payment boundaries across all skills
|
|
42
|
+
- **Agent-to-Agent Bounties skill** (`skills/agent-bounties/`) — 6-phase escrow lifecycle for agent hiring
|
|
43
|
+
- **Premium enrichment** in prospecting skill — x402-aware paid data sources
|
|
44
|
+
- **5-minute transaction quickstart** (`docs/quickstart-first-transaction.md`) — JS + Python paths
|
|
45
|
+
- **Demo README** (`runtime/demo/README.md`) — x402 flow walkthrough with curl examples
|
|
46
|
+
- **30 natural language triggers** in skill.json — purchase intents, payment management, demo commands
|
|
47
|
+
- "Payments are optional" README section with regulatory disclaimer and patent positioning
|
|
48
|
+
- Smart `update` command — detects npm vs git install
|
|
49
|
+
|
|
50
|
+
## [1.1.2] - 2026-03-22
|
|
51
|
+
|
|
52
|
+
### Added
|
|
53
|
+
|
|
54
|
+
- **Config.json on init** — payments disabled by default, dry-run mode, $0 limits
|
|
55
|
+
- **Payment ledger** (`~/.clawpowers/logs/payments.jsonl`) — full audit trail
|
|
56
|
+
- **Wallet activation wizard** (`npx clawpowers payments setup`) — interactive, non-scary
|
|
57
|
+
- **x402 Mock Merchant** (`npx clawpowers demo x402`) — test payments with zero risk
|
|
58
|
+
- **Dry-run mode** documentation in agent-payments skill
|
|
59
|
+
- **Payment moment hooks** in market-intelligence + security-audit skills
|
|
60
|
+
- Updated using-clawpowers trigger map
|
|
61
|
+
- Standardized `.env.example` across all projects
|
|
62
|
+
|
|
63
|
+
## [1.1.1] - 2026-03-22
|
|
64
|
+
|
|
65
|
+
### Added
|
|
66
|
+
|
|
67
|
+
- **economic-code-optimization skill** (25th skill) — ROI-tracked micro-budget spending
|
|
68
|
+
- 4 RSI intelligence skills: meta-skill-evolution, self-healing-code, cross-project-knowledge, formal-verification-lite
|
|
69
|
+
- 2 skills enhanced: test-driven-development (+mutation testing), systematic-debugging (+hypothesis memory)
|
|
70
|
+
|
|
71
|
+
### Changed
|
|
72
|
+
|
|
73
|
+
- README rewritten (381 lines)
|
|
74
|
+
- +994 lines inline JSDoc comments across 12 code files
|
|
75
|
+
|
|
76
|
+
## [1.1.0] - 2026-03-21
|
|
77
|
+
|
|
78
|
+
### Added
|
|
79
|
+
|
|
80
|
+
- agent-payments skill rewritten for agentwallet-sdk v6.0.0
|
|
81
|
+
- OpenClaw skill.json manifest
|
|
82
|
+
- Security Model section in README
|
|
83
|
+
- Agent Payment Demo (3-step walkthrough)
|
|
84
|
+
- Demo GIF (asciinema recording, 621KB)
|
|
85
|
+
|
|
86
|
+
## [1.0.0] - 2026-03-21
|
|
87
|
+
|
|
88
|
+
### Added
|
|
89
|
+
|
|
90
|
+
- Initial release — 20 core skills
|
|
91
|
+
- Dual runtime (bash + Node.js)
|
|
92
|
+
- Session hooks for Claude Code, Cursor, Codex, OpenCode, Gemini CLI
|
|
93
|
+
- Metrics collection and RSI feedback loop
|
|
94
|
+
- 366 tests passing
|
package/LICENSE
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
Parameters
|
|
4
|
+
|
|
5
|
+
Licensor: AI Agent Economy
|
|
6
|
+
Licensed Work: ClawPowers v2.0.0
|
|
7
|
+
The Licensed Work is (c) 2026 AI Agent Economy.
|
|
8
|
+
Additional Use Grant: Non-production use (development, testing, personal
|
|
9
|
+
projects, academic research) is permitted without a
|
|
10
|
+
commercial license.
|
|
11
|
+
Change Date: April 3, 2030
|
|
12
|
+
Change License: Apache License, Version 2.0
|
|
13
|
+
|
|
14
|
+
-----------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
Terms
|
|
17
|
+
|
|
18
|
+
The Licensor grants you the right to copy, modify, create derivative works,
|
|
19
|
+
redistribute, and make non-production use of the Licensed Work. The Licensor
|
|
20
|
+
may make an Additional Use Grant permitting limited production use.
|
|
21
|
+
|
|
22
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
23
|
+
available distribution of a specific version of the Licensed Work under this
|
|
24
|
+
License, whichever comes first, the Licensor grants you rights under the terms
|
|
25
|
+
of the Change License, and the rights granted above terminate.
|
|
26
|
+
|
|
27
|
+
If your use of the Licensed Work does not comply with the requirements in this
|
|
28
|
+
License, you must purchase a commercial license from the Licensor or refrain
|
|
29
|
+
from using the Licensed Work.
|
|
30
|
+
|
|
31
|
+
All copies of the original and modified Licensed Work, and derivative works,
|
|
32
|
+
are subject to this License. This License applies separately for each version
|
|
33
|
+
of the Licensed Work.
|
|
34
|
+
|
|
35
|
+
You must conspicuously display this License on each original or modified copy
|
|
36
|
+
of the Licensed Work.
|
|
37
|
+
|
|
38
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
39
|
+
terminate your rights under this License.
|
|
40
|
+
|
|
41
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
42
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
43
|
+
EXPRESS OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
44
|
+
PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
package/README.md
CHANGED
|
@@ -1,287 +1,263 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ClawPowers
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Skills library for AI agents — payments, memory, RSI, wallet.** Drop-in capability layer for any agent framework.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
9
|
-
## The Pay-to-Complete Flow
|
|
10
|
-
|
|
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
|
-
```
|
|
29
|
-
|
|
30
|
-
## Quick Start
|
|
5
|
+
[](https://www.npmjs.com/package/clawpowers)
|
|
6
|
+
[](LICENSE)
|
|
31
7
|
|
|
32
8
|
```bash
|
|
33
|
-
|
|
34
|
-
npx clawpowers demo x402 # See the full 402 → pay → 200 flow (no real money)
|
|
35
|
-
npx clawpowers status # Check what's running
|
|
9
|
+
npm install clawpowers
|
|
36
10
|
```
|
|
37
11
|
|
|
38
|
-
|
|
12
|
+
> **⚠️ Patent Pending:** The x402 payment detection, autonomous spending policy enforcement, and recursive self-improvement (RSI) systems described in this library are subject to pending patent applications. Use is governed by the BSL 1.1 license.
|
|
39
13
|
|
|
40
|
-
|
|
14
|
+
---
|
|
41
15
|
|
|
42
|
-
|
|
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';
|
|
48
|
-
|
|
49
|
-
const account = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY as `0x${string}`);
|
|
50
|
-
const walletClient = createWalletClient({ account, chain: base, transport: http() });
|
|
16
|
+
## What Is This?
|
|
51
17
|
|
|
52
|
-
|
|
53
|
-
accountAddress: process.env.AGENT_WALLET_ADDRESS as `0x${string}`,
|
|
54
|
-
chain: 'base',
|
|
55
|
-
walletClient,
|
|
56
|
-
});
|
|
18
|
+
ClawPowers extracts the core capabilities from [ClawPowers-Agent](https://github.com/up2itnow0822/ClawPowers-Agent) into a standalone library. **No agent control loop** — bring your own agent framework and get:
|
|
57
19
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
periodLength: 86400,
|
|
64
|
-
});
|
|
20
|
+
- **x402 Payments** — Detect HTTP 402 responses, enforce spending policies, execute payments
|
|
21
|
+
- **Three-Tier Memory** — Working, episodic, procedural memory with crash recovery
|
|
22
|
+
- **RSI Engine** — Metrics collection, hypothesis generation, mutation, A/B testing
|
|
23
|
+
- **Wallet** — Generate, import, and sign with Ethereum-compatible wallets
|
|
24
|
+
- **Skills** — Discover, load, and track skill execution outcomes
|
|
65
25
|
|
|
66
|
-
|
|
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
|
-
});
|
|
26
|
+
## x402 Payment Flow
|
|
72
27
|
|
|
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();
|
|
78
28
|
```
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
29
|
+
┌─────────┐ ┌──────────────┐ ┌───────────────┐ ┌──────────┐
|
|
30
|
+
│ Agent │────▶│ API Server │────▶│ detect402() │────▶│ Spending │
|
|
31
|
+
│ │ │ returns 402 │ │ parse x402 │ │ Policy │
|
|
32
|
+
└─────────┘ └──────────────┘ │ headers │ │ check │
|
|
33
|
+
└───────────────┘ └────┬─────┘
|
|
34
|
+
│
|
|
35
|
+
┌─────────────────▼─────────────────┐
|
|
36
|
+
│ PaymentExecutor │
|
|
37
|
+
│ ┌───────────┐ ┌─────────────┐ │
|
|
38
|
+
│ │ MCP Client │ │ Audit Log │ │
|
|
39
|
+
│ │ (agentpay) │ │ (append-only│ │
|
|
40
|
+
│ └─────┬─────┘ └─────────────┘ │
|
|
41
|
+
└───────┬───────────────────────────┘
|
|
42
|
+
│
|
|
43
|
+
┌───────▼───────┐
|
|
44
|
+
│ Base Network │
|
|
45
|
+
│ USDC Payment │
|
|
46
|
+
└───────────────┘
|
|
87
47
|
```
|
|
88
48
|
|
|
89
|
-
|
|
49
|
+
## Framework Compatibility
|
|
90
50
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
51
|
+
| Framework | Integration | Example |
|
|
52
|
+
|-----------|------------|---------|
|
|
53
|
+
| **LangChain** | `DynamicStructuredTool` | [`demos/langchain.ts`](demos/langchain.ts) |
|
|
54
|
+
| **Claude Code** | `CLAUDE.md` config | [`demos/claude-code.md`](demos/claude-code.md) |
|
|
55
|
+
| **ElizaOS** | Plugin pattern | [`demos/elizaos.ts`](demos/elizaos.ts) |
|
|
56
|
+
| **AutoGPT** | Direct import | See examples below |
|
|
57
|
+
| **CrewAI** | Tool wrapper | See examples below |
|
|
58
|
+
| **Custom** | Direct TypeScript import | See examples below |
|
|
98
59
|
|
|
99
|
-
|
|
100
|
-
// Response includes: { simulated: true, wouldHavePaid: '0.50 USDC', withinLimits: true }
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
## Explicit Spend Caps
|
|
60
|
+
## Quick Start
|
|
104
61
|
|
|
105
|
-
|
|
62
|
+
### Payments
|
|
106
63
|
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
Agent wants to spend $5.00 → ⏳ Queued for your approval
|
|
110
|
-
Agent spent $9.00 today → 🛑 Next tx blocked ($10/day cap hit)
|
|
111
|
-
```
|
|
64
|
+
```typescript
|
|
65
|
+
import { SpendingPolicy, PaymentExecutor, detect402 } from 'clawpowers';
|
|
112
66
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
67
|
+
// Configure spending limits
|
|
68
|
+
const policy = new SpendingPolicy({
|
|
69
|
+
dailyLimit: 25, // $25/day
|
|
70
|
+
transactionLimit: 10, // $10 per tx
|
|
71
|
+
allowedDomains: ['api.example.com'],
|
|
72
|
+
});
|
|
117
73
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
74
|
+
// Create executor with your MCP client
|
|
75
|
+
const executor = new PaymentExecutor(policy, mcpClient);
|
|
76
|
+
|
|
77
|
+
// Detect and handle 402 responses
|
|
78
|
+
const payment = detect402({ status: 402, headers: responseHeaders });
|
|
79
|
+
if (payment) {
|
|
80
|
+
const result = await executor.executePayment({
|
|
81
|
+
amount: payment.amount,
|
|
82
|
+
currency: payment.currency,
|
|
83
|
+
recipient: payment.recipient,
|
|
84
|
+
domain: 'api.example.com',
|
|
85
|
+
x402Headers: payment.x402Headers,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
121
88
|
```
|
|
122
89
|
|
|
123
|
-
|
|
124
|
-
|
|
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:
|
|
126
|
-
|
|
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/`
|
|
130
|
-
|
|
131
|
-
When you've verified the agent behaves correctly, raise the auto-approve threshold. Start low.
|
|
90
|
+
### Memory
|
|
132
91
|
|
|
133
|
-
|
|
92
|
+
```typescript
|
|
93
|
+
import { EpisodicMemory, ProceduralMemory, ContextInjector } from 'clawpowers';
|
|
94
|
+
|
|
95
|
+
// Episodic: Task history (append-only JSONL)
|
|
96
|
+
const episodic = new EpisodicMemory('~/.clawpowers/memory/episodic.jsonl');
|
|
97
|
+
await episodic.append({
|
|
98
|
+
taskId: 'task-1',
|
|
99
|
+
timestamp: new Date().toISOString(),
|
|
100
|
+
description: 'Built authentication module',
|
|
101
|
+
outcome: 'success',
|
|
102
|
+
lessonsLearned: ['Always test edge cases'],
|
|
103
|
+
skillsUsed: ['tdd'],
|
|
104
|
+
durationMs: 5000,
|
|
105
|
+
tags: ['auth'],
|
|
106
|
+
});
|
|
134
107
|
|
|
135
|
-
|
|
108
|
+
// Procedural: Skill effectiveness tracking
|
|
109
|
+
const procedural = new ProceduralMemory('~/.clawpowers/memory/procedural.json');
|
|
110
|
+
await procedural.update('tdd', { succeeded: true, durationMs: 5000, taskId: 'task-1' });
|
|
136
111
|
|
|
137
|
-
|
|
138
|
-
|
|
112
|
+
// Context injection: Relevant memories for new tasks
|
|
113
|
+
const injector = new ContextInjector(episodic, procedural);
|
|
114
|
+
const context = await injector.inject(goal, 2000); // 2000 token budget
|
|
139
115
|
```
|
|
140
116
|
|
|
141
|
-
###
|
|
117
|
+
### RSI (Recursive Self-Improvement)
|
|
142
118
|
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
119
|
+
```typescript
|
|
120
|
+
import { MetricsCollector, HypothesisEngine, MutationEngine, ABTestManager } from 'clawpowers';
|
|
121
|
+
|
|
122
|
+
// Collect metrics
|
|
123
|
+
const metrics = new MetricsCollector('task-metrics.jsonl', 'skill-metrics.jsonl');
|
|
124
|
+
await metrics.recordTaskMetrics({ taskId: 'task-1', outcome: 'success', /* ... */ });
|
|
125
|
+
|
|
126
|
+
// Generate improvement hypotheses
|
|
127
|
+
const hypothesis = new HypothesisEngine();
|
|
128
|
+
const hypotheses = hypothesis.analyze(skillStats, taskHistory);
|
|
129
|
+
|
|
130
|
+
// Create and test mutations
|
|
131
|
+
const mutations = new MutationEngine('mutations.jsonl');
|
|
132
|
+
const mutation = mutations.createMutation(hypotheses[0]);
|
|
133
|
+
|
|
134
|
+
// A/B test mutations
|
|
135
|
+
const ab = new ABTestManager();
|
|
136
|
+
const test = ab.startTest(mutation, baselineStats);
|
|
137
|
+
ab.recordResult(test.testId, newTaskMetrics);
|
|
138
|
+
const result = ab.evaluateTest(test.testId);
|
|
139
|
+
// result.decision: 'promote' | 'rollback' | 'continue'
|
|
147
140
|
```
|
|
148
141
|
|
|
149
|
-
###
|
|
142
|
+
### Wallet
|
|
150
143
|
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
```
|
|
144
|
+
```typescript
|
|
145
|
+
import { WalletManager } from 'clawpowers';
|
|
154
146
|
|
|
155
|
-
|
|
147
|
+
const wallet = new WalletManager({
|
|
148
|
+
chain: 'base',
|
|
149
|
+
dataDir: '~/.clawpowers/wallet',
|
|
150
|
+
});
|
|
156
151
|
|
|
157
|
-
|
|
158
|
-
|
|
152
|
+
const info = await wallet.generate();
|
|
153
|
+
console.log(info.address); // 0x...
|
|
159
154
|
```
|
|
160
155
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
```text
|
|
164
|
-
Fetch and follow instructions from https://raw.githubusercontent.com/up2itnow0822/clawpowers/main/.codex/INSTALL.md
|
|
165
|
-
```
|
|
156
|
+
## Memory Module
|
|
166
157
|
|
|
167
|
-
|
|
158
|
+
| Layer | Storage | Purpose |
|
|
159
|
+
|-------|---------|---------|
|
|
160
|
+
| **Working** | In-process | Current task context with token budget |
|
|
161
|
+
| **Episodic** | JSONL file | Task history, searchable by keywords |
|
|
162
|
+
| **Procedural** | JSON file | Skill effectiveness tracking with atomic writes |
|
|
163
|
+
| **Checkpoint** | JSON files | Crash recovery, stale detection |
|
|
164
|
+
| **Context Injector** | Computed | Selects relevant memories for new tasks |
|
|
168
165
|
|
|
169
|
-
|
|
170
|
-
git clone https://github.com/up2itnow0822/clawpowers.git
|
|
171
|
-
cd clawpowers
|
|
172
|
-
node bin/clawpowers.js init
|
|
173
|
-
```
|
|
166
|
+
## RSI Module
|
|
174
167
|
|
|
175
|
-
|
|
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.
|
|
168
|
+
The RSI engine implements a continuous improvement loop:
|
|
221
169
|
|
|
222
170
|
```
|
|
223
|
-
|
|
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
|
|
171
|
+
measure → hypothesize → mutate → A/B test → promote/rollback → repeat
|
|
229
172
|
```
|
|
230
173
|
|
|
231
|
-
|
|
174
|
+
**Tier Safety:**
|
|
175
|
+
- **T1** (Parameter Tuning) — Can auto-apply
|
|
176
|
+
- **T2** (Strategy Evolution) — Can auto-apply with notification
|
|
177
|
+
- **T3** (Skill Composition) — Requires testing gate
|
|
178
|
+
- **T4** (Architecture Proposals) — **ALWAYS requires human approval**
|
|
232
179
|
|
|
233
|
-
|
|
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
|
|
243
|
-
```
|
|
180
|
+
Safety invariants (spending limits, identity, RSI definitions, sandbox boundaries, credentials) can **NEVER** be modified by RSI.
|
|
244
181
|
|
|
245
|
-
##
|
|
182
|
+
## Fee Structure
|
|
246
183
|
|
|
247
|
-
|
|
|
248
|
-
|
|
249
|
-
|
|
|
250
|
-
|
|
|
251
|
-
| Codex | ✅ | ✅ | ✅ | ✅ |
|
|
252
|
-
| OpenCode | ✅ | ✅ | ✅ | ✅ |
|
|
253
|
-
| Gemini CLI | ✅ | ✅ | ✅ | ✅ |
|
|
184
|
+
| Operation | Fee |
|
|
185
|
+
|-----------|-----|
|
|
186
|
+
| Transaction | 0.77% |
|
|
187
|
+
| Token Swap | 0.30% |
|
|
254
188
|
|
|
255
|
-
|
|
189
|
+
Fees are applied at the payment execution layer and are included in the transaction amount.
|
|
256
190
|
|
|
257
|
-
|
|
258
|
-
- **OR bash** (for Unix-native runtime)
|
|
259
|
-
- **Zero runtime dependencies** — `package.json` has an empty `dependencies` object
|
|
191
|
+
## Python Integration
|
|
260
192
|
|
|
261
|
-
|
|
193
|
+
```python
|
|
194
|
+
import subprocess
|
|
195
|
+
import json
|
|
262
196
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
-
|
|
266
|
-
|
|
197
|
+
# Call ClawPowers via Node.js subprocess
|
|
198
|
+
result = subprocess.run(
|
|
199
|
+
['node', '-e', '''
|
|
200
|
+
import { detect402, SpendingPolicy } from "clawpowers";
|
|
201
|
+
const policy = new SpendingPolicy({ dailyLimit: 25, transactionLimit: 10, allowedDomains: [] });
|
|
202
|
+
const decision = policy.checkTransaction(5.00, "api.example.com");
|
|
203
|
+
console.log(JSON.stringify(decision));
|
|
204
|
+
'''],
|
|
205
|
+
capture_output=True, text=True
|
|
206
|
+
)
|
|
207
|
+
decision = json.loads(result.stdout)
|
|
208
|
+
```
|
|
267
209
|
|
|
268
|
-
##
|
|
210
|
+
## API Reference
|
|
211
|
+
|
|
212
|
+
### Payments
|
|
213
|
+
- `detect402(response)` — Parse x402 headers from 402 response
|
|
214
|
+
- `isPaymentRequired(error)` — Type guard for 402 errors
|
|
215
|
+
- `SpendingPolicy` — Enforce daily/transaction/domain limits
|
|
216
|
+
- `PaymentExecutor` — Execute payments via MCP client
|
|
217
|
+
|
|
218
|
+
### Memory
|
|
219
|
+
- `WorkingMemoryManager` — In-process context management
|
|
220
|
+
- `EpisodicMemory` — JSONL task history
|
|
221
|
+
- `ProceduralMemory` — Skill effectiveness tracking
|
|
222
|
+
- `CheckpointManager` — Crash recovery
|
|
223
|
+
- `ContextInjector` — Memory-to-context selection
|
|
224
|
+
|
|
225
|
+
### RSI
|
|
226
|
+
- `MetricsCollector` — Task/skill metrics in JSONL
|
|
227
|
+
- `HypothesisEngine` — Generate improvement hypotheses
|
|
228
|
+
- `MutationEngine` — Create/apply/revert mutations
|
|
229
|
+
- `ABTestManager` — A/B test mutations
|
|
230
|
+
- `RSIAuditLog` — Append-only audit trail
|
|
231
|
+
- `AutoResearcher` — Research solutions to failures
|
|
232
|
+
|
|
233
|
+
### Skills
|
|
234
|
+
- `discoverSkills(dir)` — Find skills in a directory
|
|
235
|
+
- `loadSkillManifest(dir)` — Load a single skill manifest
|
|
236
|
+
- `SkillExecutor` — Execute skills with outcome tracking
|
|
237
|
+
|
|
238
|
+
### Wallet
|
|
239
|
+
- `WalletManager` — High-level wallet operations
|
|
240
|
+
- `generateWallet(config)` — Generate new wallet
|
|
241
|
+
- `importWallet(key, config)` — Import existing wallet
|
|
242
|
+
- `signMessage(msg, keyFile, passphrase)` — Sign a message
|
|
243
|
+
|
|
244
|
+
### Config
|
|
245
|
+
- `loadConfig()` / `saveConfig()` — Zod-validated config CRUD
|
|
246
|
+
- `initConfig()` — Create default config
|
|
247
|
+
- `getConfigValue()` / `setConfigValue()` — Dot-notation access
|
|
269
248
|
|
|
270
|
-
|
|
271
|
-
- Payment infrastructure in [NVIDIA's official NeMo Agent Toolkit](https://github.com/NVIDIA/NeMo-Agent-Toolkit-Examples/pull/17)
|
|
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
|
|
249
|
+
## License
|
|
274
250
|
|
|
275
|
-
|
|
251
|
+
**Business Source License 1.1 (BSL 1.1)**
|
|
276
252
|
|
|
277
|
-
|
|
253
|
+
This software is licensed under the BSL 1.1. You may use it for non-production purposes freely. Production use requires a commercial license until the Change Date, after which the software converts to the Apache 2.0 license.
|
|
278
254
|
|
|
279
|
-
|
|
255
|
+
See [LICENSE](LICENSE) for full terms.
|
|
280
256
|
|
|
281
|
-
##
|
|
257
|
+
## Patent Notice
|
|
282
258
|
|
|
283
|
-
|
|
259
|
+
⚠️ **Patent Pending:** The autonomous payment detection, spending policy enforcement, recursive self-improvement engine, and multi-tier memory systems implemented in this library are subject to pending patent applications filed by AI Agent Economy. Unauthorized commercial use may constitute patent infringement.
|
|
284
260
|
|
|
285
|
-
|
|
261
|
+
---
|
|
286
262
|
|
|
287
|
-
|
|
263
|
+
Built by [AI Agent Economy](https://github.com/up2itnow0822) 🦅
|