clawpowers 1.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.
Files changed (42) hide show
  1. package/.claude-plugin/manifest.json +19 -0
  2. package/.codex/INSTALL.md +36 -0
  3. package/.cursor-plugin/manifest.json +21 -0
  4. package/.opencode/INSTALL.md +52 -0
  5. package/ARCHITECTURE.md +69 -0
  6. package/README.md +381 -0
  7. package/bin/clawpowers.js +390 -0
  8. package/bin/clawpowers.sh +91 -0
  9. package/gemini-extension.json +32 -0
  10. package/hooks/session-start +205 -0
  11. package/hooks/session-start.cmd +43 -0
  12. package/hooks/session-start.js +163 -0
  13. package/package.json +54 -0
  14. package/runtime/feedback/analyze.js +621 -0
  15. package/runtime/feedback/analyze.sh +546 -0
  16. package/runtime/init.js +172 -0
  17. package/runtime/init.sh +145 -0
  18. package/runtime/metrics/collector.js +361 -0
  19. package/runtime/metrics/collector.sh +308 -0
  20. package/runtime/persistence/store.js +433 -0
  21. package/runtime/persistence/store.sh +303 -0
  22. package/skill.json +74 -0
  23. package/skills/agent-payments/SKILL.md +411 -0
  24. package/skills/brainstorming/SKILL.md +233 -0
  25. package/skills/content-pipeline/SKILL.md +282 -0
  26. package/skills/dispatching-parallel-agents/SKILL.md +305 -0
  27. package/skills/executing-plans/SKILL.md +255 -0
  28. package/skills/finishing-a-development-branch/SKILL.md +260 -0
  29. package/skills/learn-how-to-learn/SKILL.md +235 -0
  30. package/skills/market-intelligence/SKILL.md +288 -0
  31. package/skills/prospecting/SKILL.md +313 -0
  32. package/skills/receiving-code-review/SKILL.md +225 -0
  33. package/skills/requesting-code-review/SKILL.md +206 -0
  34. package/skills/security-audit/SKILL.md +308 -0
  35. package/skills/subagent-driven-development/SKILL.md +244 -0
  36. package/skills/systematic-debugging/SKILL.md +279 -0
  37. package/skills/test-driven-development/SKILL.md +299 -0
  38. package/skills/using-clawpowers/SKILL.md +137 -0
  39. package/skills/using-git-worktrees/SKILL.md +261 -0
  40. package/skills/verification-before-completion/SKILL.md +254 -0
  41. package/skills/writing-plans/SKILL.md +276 -0
  42. package/skills/writing-skills/SKILL.md +260 -0
@@ -0,0 +1,411 @@
1
+ ---
2
+ name: agent-payments
3
+ description: Enable agents to transact autonomously across a full multi-chain financial stack — x402 payments, Uniswap V3 swaps, CCTP bridging, ERC-8004 identity, mutual stake escrow, spending policies, and agent-to-agent delegation (AP2). Activate when an agent needs to pay for an API, swap tokens, bridge assets, escrow funds for a task, or establish on-chain identity.
4
+ version: 6.0.0
5
+ requires:
6
+ tools: [bash, node]
7
+ runtime: true
8
+ metrics:
9
+ tracks: [payments_attempted, payments_succeeded, swaps_executed, bridges_initiated, escrows_created, spending_per_session, limit_enforcement_hits]
10
+ improves: [payment_routing, limit_calibration, retry_strategy, swap_routing, bridge_selection]
11
+ ---
12
+
13
+ # Agent Payments
14
+
15
+ ## When to Use
16
+
17
+ Apply this skill when:
18
+
19
+ - An HTTP request returns `402 Payment Required`
20
+ - You need to call a premium API that requires per-request payment
21
+ - You're accessing a paid AI model, compute resource, or data service
22
+ - You need to purchase a resource (storage, credits, bandwidth) autonomously
23
+ - An agent-to-agent payment or task delegation is required (AP2 protocol)
24
+ - You need to swap tokens across Base, Arbitrum, Optimism, or Polygon
25
+ - You need to bridge USDC between EVM chains or to Solana (CCTP V2)
26
+ - You need to establish or verify on-chain agent identity (ERC-8004)
27
+ - You need to escrow funds for a multi-agent task (mutual stake or optimistic)
28
+ - Gas sponsorship is needed for a gasless user experience
29
+
30
+ **Skip when:**
31
+ - The service requires human authorization for payment (no wallet configured)
32
+ - The payment would exceed the configured spending limit (surface to operator)
33
+ - The service uses subscription billing (not per-request x402)
34
+ - The payment is above threshold for autonomous authorization (see limits)
35
+
36
+ **Decision tree:**
37
+ ```
38
+ Is the response HTTP 402?
39
+ ├── No → Does the task require swap/bridge/escrow/identity?
40
+ │ ├── No → This skill doesn't apply
41
+ │ └── Yes → Jump to the relevant section below
42
+ └── Yes → Is a wallet configured?
43
+ ├── No → Run setup (see Setup section)
44
+ └── Yes → Does this payment fit within spending limits?
45
+ ├── No → Queue via agentExecute or request human auth
46
+ └── Yes → Proceed with autonomous payment
47
+ ```
48
+
49
+ ## Background: x402 Protocol
50
+
51
+ The x402 protocol is a standard for machine-to-machine payments embedded in HTTP. When a server requires payment it returns:
52
+
53
+ ```http
54
+ HTTP/1.1 402 Payment Required
55
+ X-Payment-Required: {"scheme":"exact","network":"base","maxAmountRequired":"1000000","asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","payTo":"0xMERCHANT","resource":"https://api.example.com/premium-endpoint","description":"1 API call"}
56
+ ```
57
+
58
+ The agent then:
59
+ 1. Constructs a payment matching the requirement
60
+ 2. Submits the payment (on-chain or via payment channel)
61
+ 3. Includes payment proof in the retry request
62
+ 4. Server validates and processes the original request
63
+
64
+ Reference implementation: [agentpay-mcp](https://github.com/up2itnow0822/agentpay-mcp) (integrated into NVIDIA NeMo Agent Toolkit)
65
+
66
+ ## Setup
67
+
68
+ ### Install agentwallet-sdk
69
+
70
+ ```bash
71
+ npm install agentwallet-sdk viem
72
+ ```
73
+
74
+ ### Supported Chains
75
+
76
+ Base, Ethereum, Arbitrum, Polygon, Optimism, Avalanche, Unichain, Linea, Sonic, World Chain, Base Sepolia (testnet). Solana is supported for CCTP V2 bridging.
77
+
78
+ ## Core Methodology
79
+
80
+ ### 1. Create Wallet + Set Spending Policy
81
+
82
+ Non-custodial ERC-6551 token-bound wallets are available on all 11 supported EVM chains. Spending limits are enforced by smart contract — the agent cannot override them.
83
+
84
+ ```typescript
85
+ import { createWallet, setSpendPolicy, agentExecute, NATIVE_TOKEN } from 'agentwallet-sdk';
86
+
87
+ const wallet = createWallet({
88
+ accountAddress: '0x...',
89
+ chain: 'base',
90
+ walletClient, // viem WalletClient
91
+ });
92
+
93
+ // Set per-token, per-period on-chain spending limits
94
+ await setSpendPolicy(wallet, {
95
+ token: NATIVE_TOKEN,
96
+ perTxLimit: 25000000000000000n, // 0.025 ETH per transaction
97
+ periodLimit: 500000000000000000n, // 0.5 ETH per period
98
+ periodLength: 86400, // 24-hour rolling period
99
+ });
100
+
101
+ // agentExecute auto-approves within limits, queues if over
102
+ const result = await agentExecute(wallet, {
103
+ to: '0x...',
104
+ value: 10000000000000000n, // 0.01 ETH
105
+ });
106
+ ```
107
+
108
+ **`agentExecute` behavior:**
109
+ - Within limits → executes immediately, returns transaction receipt
110
+ - Over limits → queues the payment, returns queue ID for human review
111
+ - Exceeded daily cap → returns `LIMIT_EXCEEDED` with details
112
+
113
+ ### 2. x402 Payments (Multi-Chain)
114
+
115
+ ```typescript
116
+ import { createX402Client } from 'agentwallet-sdk';
117
+
118
+ const x402 = createX402Client(wallet, {
119
+ supportedNetworks: ['base:8453', 'arbitrum:42161'],
120
+ globalDailyLimit: 10_000_000n, // 10 USDC daily cap (6 decimals)
121
+ });
122
+
123
+ // Auto-detects network, handles 402 → pay → retry transparently
124
+ const response = await x402.fetch('https://api.example.com/premium');
125
+ const data = await response.json();
126
+ ```
127
+
128
+ The client automatically:
129
+ - Parses the `X-Payment-Required` header
130
+ - Selects the cheapest supported network
131
+ - Constructs and submits the payment
132
+ - Retries the original request with proof
133
+
134
+ ### 3. Token Swaps (Uniswap V3)
135
+
136
+ Available on Base, Arbitrum, Optimism, Polygon. Use the chain-specific token registries: `BASE_TOKENS`, `ARBITRUM_TOKENS`, `OPTIMISM_TOKENS`, `POLYGON_TOKENS`.
137
+
138
+ ```typescript
139
+ import { attachSwap } from 'agentwallet-sdk/swap';
140
+ import { BASE_TOKENS } from 'agentwallet-sdk';
141
+
142
+ const swap = attachSwap(wallet, { chain: 'base' });
143
+
144
+ await swap.swap(
145
+ BASE_TOKENS.WETH,
146
+ BASE_TOKENS.USDC,
147
+ amount,
148
+ { slippageBps: 50 }, // 0.5% slippage tolerance
149
+ );
150
+ ```
151
+
152
+ Token registries expose canonical addresses for all major tokens on each chain. Always use registry constants rather than hardcoding addresses.
153
+
154
+ ### 4. CCTP V2 Bridge (EVM ↔ EVM and EVM ↔ Solana)
155
+
156
+ Bridge USDC across any supported chain pair, including to/from Solana.
157
+
158
+ ```typescript
159
+ import { CCTPBridge } from 'agentwallet-sdk';
160
+
161
+ const bridge = new CCTPBridge({ sourceChain: 'base', walletClient });
162
+
163
+ const { transferId } = await bridge.transfer({
164
+ destinationChain: 'arbitrum', // or 'solana' for cross-ecosystem
165
+ amount: 100_000_000n, // 100 USDC (6 decimals)
166
+ recipient: '0x...',
167
+ });
168
+
169
+ // Poll for settlement
170
+ const status = await bridge.getStatus(transferId);
171
+ ```
172
+
173
+ ### 5. ERC-8004 On-Chain Agent Identity
174
+
175
+ Register and manage verifiable on-chain identity for agents. Three registries: Identity, Reputation, Validation.
176
+
177
+ ```typescript
178
+ import { AgentIdentity } from 'agentwallet-sdk';
179
+
180
+ const identity = new AgentIdentity({ chain: 'base', walletClient });
181
+
182
+ // Register agent identity
183
+ const { agentId } = await identity.register({
184
+ name: 'my-agent',
185
+ capabilities: ['payments', 'swaps', 'data-fetch'],
186
+ metadataURI: 'ipfs://...',
187
+ });
188
+
189
+ // Verify another agent's identity before task delegation
190
+ const isValid = await identity.validate('0xAgentAddress');
191
+ ```
192
+
193
+ ### 6. Mutual Stake Escrow
194
+
195
+ Reciprocal collateral for agent-to-agent tasks. Both parties stake before work begins; funds release on verified completion.
196
+
197
+ ```typescript
198
+ import { MutualStakeEscrow } from 'agentwallet-sdk';
199
+
200
+ const escrow = new MutualStakeEscrow({ chain: 'base', walletClient });
201
+
202
+ const { escrowId } = await escrow.create({
203
+ counterparty: '0x...',
204
+ token: '0xUSDC',
205
+ stakeAmount: 100_000_000n, // 100 USDC (6 decimals)
206
+ taskHash: '0x...',
207
+ deadline: Math.floor(Date.now() / 1000) + 86400,
208
+ });
209
+
210
+ // Release on verified completion
211
+ await escrow.release(escrowId, proofOfWork);
212
+ ```
213
+
214
+ ### 7. Optimistic Escrow
215
+
216
+ Time-locked escrow with challenge window. Funds release automatically after the lock period unless disputed.
217
+
218
+ ```typescript
219
+ import { OptimisticEscrow } from 'agentwallet-sdk';
220
+
221
+ const escrow = new OptimisticEscrow({ chain: 'base', walletClient });
222
+
223
+ const { escrowId } = await escrow.create({
224
+ beneficiary: '0x...',
225
+ token: '0xUSDC',
226
+ amount: 50_000_000n,
227
+ lockPeriod: 3600, // 1-hour challenge window
228
+ taskHash: '0x...',
229
+ });
230
+ ```
231
+
232
+ ### 8. AP2 Protocol — Agent-to-Agent Task Delegation
233
+
234
+ Delegate tasks to sub-agents with automatic payment on completion.
235
+
236
+ ```typescript
237
+ import { AP2Client } from 'agentwallet-sdk';
238
+
239
+ const ap2 = new AP2Client({ chain: 'base', walletClient });
240
+
241
+ const { taskId } = await ap2.delegate({
242
+ agent: '0xSubAgentAddress',
243
+ task: { type: 'data-fetch', params: { url: 'https://...' } },
244
+ maxPayment: 5_000_000n, // 5 USDC ceiling
245
+ escrowType: 'mutual-stake',
246
+ });
247
+
248
+ const result = await ap2.awaitCompletion(taskId);
249
+ ```
250
+
251
+ ### 9. Gas Sponsorship (ERC-4337 Paymaster)
252
+
253
+ Sponsor gas for agent transactions so end users never hold ETH.
254
+
255
+ ```typescript
256
+ import { createWallet } from 'agentwallet-sdk';
257
+
258
+ const wallet = createWallet({
259
+ accountAddress: '0x...',
260
+ chain: 'base',
261
+ walletClient,
262
+ gasSponsorship: {
263
+ enabled: true,
264
+ paymasterUrl: 'https://...', // ERC-4337 paymaster endpoint
265
+ },
266
+ });
267
+ ```
268
+
269
+ ### 10. Fiat Onramp
270
+
271
+ Opt-in fiat-to-crypto conversion for wallets that need funding without manual crypto transfers.
272
+
273
+ ```typescript
274
+ import { FiatOnramp } from 'agentwallet-sdk';
275
+
276
+ const onramp = new FiatOnramp({ chain: 'base', walletClient });
277
+
278
+ const { sessionUrl } = await onramp.createSession({
279
+ targetToken: 'USDC',
280
+ targetAmount: 100, // USD
281
+ walletAddress: wallet.address,
282
+ });
283
+ // Redirect agent operator to sessionUrl for KYC/payment
284
+ ```
285
+
286
+ ### 11. On-Chain Settlement
287
+
288
+ Finalize multi-party payment flows with cryptographic settlement proof.
289
+
290
+ ```typescript
291
+ import { Settlement } from 'agentwallet-sdk';
292
+
293
+ const settlement = new Settlement({ chain: 'base', walletClient });
294
+
295
+ await settlement.finalize({
296
+ taskId: '0x...',
297
+ parties: ['0xAgent1', '0xAgent2'],
298
+ amounts: [80_000_000n, 20_000_000n],
299
+ proofHash: '0x...',
300
+ });
301
+ ```
302
+
303
+ ## ClawPowers Enhancement
304
+
305
+ When `~/.clawpowers/` runtime is initialized, agent-payments gains persistent tracking across all transaction types.
306
+
307
+ **Persistent Payment Ledger:**
308
+
309
+ ```bash
310
+ bash runtime/persistence/store.sh set "ledger:total_spent_today" "$(date +%Y-%m-%d):0.047"
311
+ bash runtime/persistence/store.sh list "payment:*:amount" | awk -F: '{sum += $NF} END {print "Total: $" sum}'
312
+ ```
313
+
314
+ **Multi-Metric Session Tracking:**
315
+
316
+ ```bash
317
+ bash runtime/metrics/collector.sh record \
318
+ --skill agent-payments \
319
+ --outcome success \
320
+ --notes "payments: 3, swaps: 1, bridges: 0, session_spend: $0.047, limit: $5.00"
321
+ ```
322
+
323
+ **Spending Analytics:**
324
+
325
+ `runtime/feedback/analyze.sh` computes:
326
+ - Total spend per day/week/month across all transaction types
327
+ - Most expensive APIs (payment frequency × amount)
328
+ - Swap slippage vs. configured tolerance
329
+ - Bridge utilization and latency
330
+ - Escrow open/close ratio
331
+ - Limit hit rate (how often limits block payments)
332
+ - Payment success rate (failed on-chain transactions)
333
+
334
+ ## Security
335
+
336
+ **Private Key Security:**
337
+ - Keys are encrypted at rest via the ERC-6551 NFT-bound wallet
338
+ - Never printed to logs or surfaces
339
+ - Passphrase required to decrypt
340
+
341
+ **Spending Limit Enforcement:**
342
+ - `setSpendPolicy()` writes limits to the smart contract — the agent cannot override them
343
+ - `agentExecute()` queries the contract before submitting any transaction
344
+ - Over-limit transactions are queued, not silently dropped
345
+
346
+ **Audit Trail:**
347
+ - Every transaction generates an on-chain hash
348
+ - Payment logs in `~/.clawpowers/state/` are append-only
349
+ - Session spend is tracked against daily/session limits
350
+
351
+ ## Anti-Patterns
352
+
353
+ | Anti-Pattern | Why It Fails | Correct Approach |
354
+ |-------------|-------------|-----------------|
355
+ | No spending limits configured | Unlimited liability, potential wallet drain | Always call `setSpendPolicy()` before `agentExecute()` |
356
+ | Hardcoding token addresses | Chain upgrades break integrations | Use `BASE_TOKENS`, `ARBITRUM_TOKENS`, etc. from the SDK |
357
+ | Skipping identity validation before AP2 delegation | Funds sent to unverified agent | Call `identity.validate()` before delegating tasks |
358
+ | Using optimistic escrow for high-value tasks | Challenge window may be too short | Use mutual stake escrow for tasks above risk threshold |
359
+ | Retrying failed payments without human review | Double-charge or infinite payment loop | Manual review required for any payment failure |
360
+ | Paying without verifying server response | Payment sent, service not rendered | Always check response status after x402 payment |
361
+ | Not logging swap/bridge transactions | No audit trail for reconciliation | Log every transaction hash via runtime persistence |
362
+ | Swapping with default slippage on volatile pairs | Front-run or excessive slippage | Set explicit `slippageBps` based on pair volatility |
363
+
364
+ ## Protocol Fees (ClawPowers Only)
365
+
366
+ **These fees apply ONLY when using agent-payments through ClawPowers.** The standalone [agentwallet-sdk](https://www.npmjs.com/package/agentwallet-sdk) on npm is free with zero fees. You always have the choice to use the SDK directly.
367
+
368
+ ClawPowers agent-payments provides auto-configured wallets, guided payment flows, spending analytics, and runtime tracking. A transparent protocol fee applies:
369
+
370
+ | Monthly Volume | Fee |
371
+ |---------------|-----|
372
+ | $0 - $1,000 | 0.77% |
373
+ | $1,001 - $10,000 | 0.50% |
374
+ | $10,001 - $100,000 | 0.25% |
375
+ | $100,000+ | Custom |
376
+
377
+ Fees are:
378
+ - Applied at the protocol level (smart contract), not application level
379
+ - Visible in every transaction before confirmation
380
+ - Competitive with alternatives (MetaMask 0.875%, Stripe 2.9%, Nory 1%)
381
+ - Zero if you don't use agent-payments — the rest of ClawPowers is completely free
382
+
383
+ Fee collector: `0xff86829393C6C26A4EC122bE0Cc3E466Ef876AdD` (all EVM chains)
384
+
385
+ ## References
386
+
387
+ - [agentwallet-sdk on npm](https://www.npmjs.com/package/agentwallet-sdk)
388
+ - [agentpay-mcp on GitHub](https://github.com/up2itnow0822/agentpay-mcp)
389
+ - [x402 protocol specification](https://x402.org)
390
+ - [ERC-6551 Token Bound Accounts](https://eips.ethereum.org/EIPS/eip-6551)
391
+ - [ERC-4337 Account Abstraction](https://eips.ethereum.org/EIPS/eip-4337)
392
+ - [CCTP V2 Documentation](https://developers.circle.com/stablecoins/cctp-getting-started)
393
+ - [NVIDIA NeMo Agent Toolkit integration](https://github.com/NVIDIA/NeMo-Agent-Toolkit-Examples/pull/17)
394
+
395
+ ## Underlying Infrastructure
396
+
397
+ This skill is powered by [agentwallet-sdk v6.0](https://www.npmjs.com/package/agentwallet-sdk) — full multi-chain agent wallet stack:
398
+
399
+ - **ERC-6551 Non-custodial wallets** — Agent owns its keys via NFT-bound wallet on 11 chains
400
+ - **Smart-contract spending policies** — Per-token, per-period limits enforced at contract level
401
+ - **x402 multi-chain payments** — Auto network detection across Base, Arbitrum, Optimism, and more
402
+ - **Uniswap V3 swaps** — Base, Arbitrum, Optimism, Polygon with chain-specific token registries
403
+ - **CCTP V2 bridge** — EVM↔EVM and EVM↔Solana USDC bridging
404
+ - **ERC-8004 Agent Identity** — Identity, Reputation, and Validation registries
405
+ - **Mutual Stake & Optimistic Escrow** — Reciprocal and time-locked collateral for agent tasks
406
+ - **AP2 Protocol** — Agent-to-agent task delegation and payment
407
+ - **ERC-4337 Gas Sponsorship** — Paymaster integration for gasless transactions
408
+ - **Fiat Onramp** — Opt-in fiat-to-crypto conversion
409
+ - **On-chain Settlement** — Cryptographic finalization of multi-party payment flows
410
+
411
+ Integrated into [NVIDIA's official NeMo Agent Toolkit](https://github.com/NVIDIA/NeMo-Agent-Toolkit-Examples/pull/17).
@@ -0,0 +1,233 @@
1
+ ---
2
+ name: brainstorming
3
+ description: Structured ideation with convergence protocol. Activate when exploring solutions, designing architecture, or choosing between approaches.
4
+ version: 1.0.0
5
+ requires:
6
+ tools: []
7
+ runtime: false
8
+ metrics:
9
+ tracks: [ideas_generated, ideas_pursued, convergence_time, decision_quality]
10
+ improves: [ideation_breadth, convergence_threshold, idea_linking]
11
+ ---
12
+
13
+ # Brainstorming
14
+
15
+ ## When to Use
16
+
17
+ Apply this skill when:
18
+
19
+ - A problem has multiple valid solution approaches and you need to choose
20
+ - You're designing architecture and haven't committed to a direction
21
+ - Someone asks "what should we do?" or "what are our options?"
22
+ - You've been executing in one direction and need to verify it's still the right one
23
+ - A constraint has changed and the previous approach may no longer be optimal
24
+ - Creative solutions are needed (not just standard patterns)
25
+
26
+ **Skip when:**
27
+ - The solution is already determined and execution is what's needed
28
+ - There's only one viable approach given the constraints
29
+ - You need to converge immediately — brainstorming requires divergence time
30
+
31
+ **Decision tree:**
32
+ ```
33
+ Is the right approach known?
34
+ ├── Yes → execute it
35
+ └── No → Is this a known problem pattern?
36
+ ├── Yes → Apply known solution, validate fit with constraints
37
+ └── No → brainstorming ← YOU ARE HERE
38
+ ```
39
+
40
+ ## Core Methodology
41
+
42
+ Brainstorming has two phases: **diverge** (generate many ideas without judgment) and **converge** (evaluate, select, refine). Never mix them — evaluating during generation kills ideas before they can combine into something better.
43
+
44
+ ### Phase 1: Diverge
45
+
46
+ **Rule:** No evaluation during divergence. Every idea is noted, even obviously bad ones.
47
+
48
+ **Seed the space with different lenses:**
49
+
50
+ 1. **First-principles lens** — "If we built this from scratch knowing only the requirements, what would we build?"
51
+ 2. **Constraint-removal lens** — "If [constraint] didn't exist, what's the best solution? Now how do we get closer to it?"
52
+ 3. **Analogy lens** — "How does [analogous problem domain] solve this?"
53
+ 4. **Inversion lens** — "What would make this maximally bad? Now invert each item."
54
+ 5. **Extreme lens** — "What's the simplest possible approach? What's the most powerful?"
55
+ 6. **Time lens** — "What solution would we regret not choosing in 2 years?"
56
+
57
+ **Target:** 6-12 distinct ideas before evaluation. If you have fewer than 5, you've stopped too early.
58
+
59
+ **Divergence output format:**
60
+
61
+ ```markdown
62
+ ## Idea 1: [Name]
63
+ [2-3 sentences: what it is, how it works, why it might be good]
64
+ Rough feasibility: [High/Medium/Low]
65
+
66
+ ## Idea 2: [Name]
67
+ ...
68
+ ```
69
+
70
+ ### Phase 2: Rapid Pre-Filter
71
+
72
+ After divergence, apply a quick filter before full evaluation:
73
+
74
+ **Pre-filter criteria:**
75
+ - Feasible within current constraints? (Hard blocker: eliminate)
76
+ - Reversible if wrong? (Irreversible = higher bar to choose)
77
+ - Team can execute? (Skill gap = risk, not elimination)
78
+
79
+ Eliminate only ideas that fail hard feasibility. Keep everything else — your "bad" ideas might combine with your "good" ones.
80
+
81
+ ### Phase 3: Evaluate Remaining Ideas
82
+
83
+ For each surviving idea, score on:
84
+
85
+ | Criterion | Weight | Description |
86
+ |-----------|--------|-------------|
87
+ | Correctness | 30% | Solves the actual problem completely |
88
+ | Maintainability | 20% | Team can reason about and change it |
89
+ | Performance | 15% | Meets performance requirements |
90
+ | Reversibility | 15% | Can be undone if wrong |
91
+ | Time to implement | 10% | Fits within timeline constraint |
92
+ | Risk | 10% | Known unknowns and failure modes |
93
+
94
+ **Scoring:** 1-5 per criterion. Weighted total = decision score.
95
+
96
+ This scoring is a forcing function, not a formula. If the scores conflict with your gut, investigate the gut feeling — it may be capturing a criterion you haven't named.
97
+
98
+ ### Phase 4: Convergence Decision
99
+
100
+ **Select the highest-scoring idea** unless:
101
+ - The second-highest is within 10% and significantly more reversible
102
+ - The highest-scoring idea has an unmitigated risk that could invalidate the entire effort
103
+ - The team has strong capability gaps that make the highest-scoring idea genuinely infeasible
104
+
105
+ **Convergence output:**
106
+
107
+ ```markdown
108
+ ## Decision: [Idea Name]
109
+
110
+ **Rationale:** [Why this over the alternatives]
111
+ **Key trade-off accepted:** [What we're giving up and why that's okay]
112
+ **Reversibility:** [Can we change this later? At what cost?]
113
+ **Risk mitigations:**
114
+ - [Risk 1]: [Mitigation]
115
+ - [Risk 2]: [Mitigation]
116
+
117
+ ## Discarded Alternatives
118
+ - [Idea N]: Eliminated because [specific reason]
119
+ ```
120
+
121
+ The discarded alternatives section is important — it prevents re-litigating the same options in future discussions.
122
+
123
+ ### Phase 5: Spike Plan (if needed)
124
+
125
+ If the winning idea has a technical unknown, plan a spike (time-boxed experiment):
126
+
127
+ ```markdown
128
+ ## Spike: Validate [unknown assumption]
129
+
130
+ **Question:** [Specific question this spike answers]
131
+ **Method:** [How to test it]
132
+ **Time box:** [Maximum time, then decide based on results]
133
+ **Pass criteria:** [What result confirms the approach is viable]
134
+ **Fail criteria:** [What result means we choose the fallback]
135
+ **Fallback:** [Idea #2 from the evaluation]
136
+ ```
137
+
138
+ Spikes that don't have a fallback are bets, not spikes.
139
+
140
+ ## ClawPowers Enhancement
141
+
142
+ When `~/.clawpowers/` runtime is initialized:
143
+
144
+ **Cross-Session Idea Persistence:**
145
+
146
+ Ideas don't disappear when the session ends:
147
+
148
+ ```bash
149
+ # Save ideas from session
150
+ bash runtime/persistence/store.sh set "brainstorm:auth-rate-limiting:idea1" "Token bucket with Redis"
151
+ bash runtime/persistence/store.sh set "brainstorm:auth-rate-limiting:idea2" "Fixed window with DB"
152
+ bash runtime/persistence/store.sh set "brainstorm:auth-rate-limiting:decision" "Token bucket with Redis"
153
+ bash runtime/persistence/store.sh set "brainstorm:auth-rate-limiting:discarded" "Fixed window: stale at window boundary"
154
+
155
+ # Recall in future session
156
+ bash runtime/persistence/store.sh list "brainstorm:auth-rate-limiting:*"
157
+ ```
158
+
159
+ This prevents re-debating decisions already made and provides context when the approach needs revisiting.
160
+
161
+ **Pattern Linking:**
162
+
163
+ After 10+ brainstorming sessions, `runtime/feedback/analyze.sh` identifies:
164
+ - Which lenses generate the most pursued ideas (your most productive divergence strategies)
165
+ - Common discarded idea reasons (helps pre-filter faster)
166
+ - Idea-to-outcome correlation (were your decisions good?)
167
+
168
+ **Idea Quality Tracking:**
169
+
170
+ ```bash
171
+ bash runtime/metrics/collector.sh record \
172
+ --skill brainstorming \
173
+ --outcome success \
174
+ --notes "rate-limiting: 7 ideas, 1 spike, decision in 25 min"
175
+ ```
176
+
177
+ After execution, mark whether the brainstorming decision held up:
178
+ ```bash
179
+ bash runtime/persistence/store.sh set "brainstorm:auth-rate-limiting:outcome" "decision_held"
180
+ # or
181
+ bash runtime/persistence/store.sh set "brainstorm:auth-rate-limiting:outcome" "pivoted:reason"
182
+ ```
183
+
184
+ This feeds the RSI loop — which ideas look good in brainstorming but fail in practice?
185
+
186
+ ## Anti-Patterns
187
+
188
+ | Anti-Pattern | Why It Fails | Correct Approach |
189
+ |-------------|-------------|-----------------|
190
+ | Evaluating during divergence | Kills combination ideas before they form | Strict phase separation |
191
+ | Stopping at 2-3 ideas | First ideas are obvious; breakthroughs are later | Force 6-12 before evaluating |
192
+ | Skipping the spike | Unknown assumption bites you mid-implementation | Spike anything technically uncertain |
193
+ | No fallback on spike | If spike fails, you're stuck | Always name the fallback before spiking |
194
+ | Consensus brainstorming | Group thinks converges to average | Diverge individually, converge together |
195
+ | Re-opening decided questions | Litigating old decisions halts progress | Document discarded alternatives with reasons |
196
+ | Brainstorming without constraints | Unconstrained ideas aren't implementable | State constraints at the start of divergence |
197
+
198
+ ## Examples
199
+
200
+ ### Example 1: Architecture Decision
201
+
202
+ **Question:** How should we handle cross-service communication?
203
+
204
+ **Divergence:**
205
+ 1. REST HTTP calls (synchronous, direct)
206
+ 2. Message queue (async, decoupled) — Kafka, RabbitMQ, Redis Streams
207
+ 3. gRPC (typed, fast, binary protocol)
208
+ 4. GraphQL federation
209
+ 5. Event sourcing + event bus
210
+ 6. Shared database (anti-pattern but option)
211
+ 7. Service mesh with mTLS (Istio)
212
+
213
+ **Pre-filter:** Option 6 (shared DB) eliminated — violates service isolation. All others survive.
214
+
215
+ **Evaluation scores:** REST: 72pts | Message queue: 85pts | gRPC: 78pts | Others < 70pts
216
+
217
+ **Decision:** Message queue (Kafka) — highest score, fully decoupled, reversible per service.
218
+
219
+ **Spike:** Can our team operate Kafka? → 2-hour spike → yes, managed Confluent resolves ops burden.
220
+
221
+ ### Example 2: Feature Design
222
+
223
+ **Question:** How should users specify recurring events?
224
+
225
+ **Divergence (constraint-removal):**
226
+ 1. cron syntax (powerful, opaque to non-technical users)
227
+ 2. Natural language parser ("every Monday at 9am")
228
+ 3. Visual calendar picker (intuitive, limited power)
229
+ 4. RRULE (RFC 5545 standard, complex)
230
+ 5. Predefined presets + custom exception
231
+ 6. Wizard with structured questions
232
+
233
+ **Convergence:** Option 5 (presets + exceptions) — covers 90% of cases simply, 10% with power.