clawpowers 1.0.1 → 1.1.1
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 +15 -3
- 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-posts.md +76 -0
- package/package.json +1 -1
- package/skills/cross-project-knowledge/SKILL.md +345 -0
- package/skills/economic-code-optimization/SKILL.md +265 -0
- package/skills/formal-verification-lite/SKILL.md +441 -0
- package/skills/meta-skill-evolution/SKILL.md +325 -0
- package/skills/self-healing-code/SKILL.md +369 -0
- package/skills/systematic-debugging/SKILL.md +76 -0
- package/skills/test-driven-development/SKILL.md +117 -0
- package/skills/using-clawpowers/SKILL.md +20 -5
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ ClawPowers gives your coding agent superpowers that go beyond instructions. Whil
|
|
|
27
27
|
| Windows native support | ✅ | ❌ |
|
|
28
28
|
| Zero dependencies | ✅ | ✅ |
|
|
29
29
|
|
|
30
|
-
**
|
|
30
|
+
**25 skills.** 14 cover everything static frameworks do (TDD, subagent dev, debugging, planning, code review, git worktrees). 6 go where they can't — payments, security, content, prospecting, market intelligence, and metacognitive learning. 4 are things no other framework even attempts — self-healing code, agents that rewrite their own methodology, cross-project knowledge transfer, and property-based formal verification.
|
|
31
31
|
|
|
32
32
|
## Requirements
|
|
33
33
|
|
|
@@ -60,7 +60,7 @@ Or install from GitHub directly:
|
|
|
60
60
|
openclaw skills install github:up2itnow0822/clawpowers
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
ClawPowers registers as a native OpenClaw skill with session hooks, runtime init, and all
|
|
63
|
+
ClawPowers registers as a native OpenClaw skill with session hooks, runtime init, and all 24 skills auto-discoverable.
|
|
64
64
|
|
|
65
65
|
### Claude Code (Plugin Marketplace)
|
|
66
66
|
|
|
@@ -214,11 +214,23 @@ Static frameworks stop at coding methodology. ClawPowers includes skills for:
|
|
|
214
214
|
| `market-intelligence` | Competitive analysis, trend detection, opportunity scoring | Requires web access, data aggregation, persistent tracking |
|
|
215
215
|
| `prospecting` | Lead generation, contact enrichment, CRM sync | Requires API calls (Exa, Apollo), structured output |
|
|
216
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
|
+
|
|
217
229
|
## Architecture
|
|
218
230
|
|
|
219
231
|
```
|
|
220
232
|
clawpowers/
|
|
221
|
-
├── skills/ #
|
|
233
|
+
├── skills/ # 25 skill directories, each with SKILL.md
|
|
222
234
|
├── runtime/
|
|
223
235
|
│ ├── persistence/ # Cross-session state (store.js + store.sh)
|
|
224
236
|
│ ├── metrics/ # Outcome tracking (collector.js + collector.sh)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# ClawPowers Launch Posts — March 22, 2026
|
|
2
|
+
|
|
3
|
+
## Post 1 (4:00 AM CST) — Image: "Ready to Supercharge" (lobster crowd)
|
|
4
|
+
|
|
5
|
+
Your coding agent debugs the same bug every Monday because it can't remember what worked last Friday.
|
|
6
|
+
|
|
7
|
+
ClawPowers fixes that. 24 skills with persistent memory, outcome tracking, and self-improvement loops. Your agent learns from every session - not just follows instructions.
|
|
8
|
+
|
|
9
|
+
One command: npx clawpowers init
|
|
10
|
+
|
|
11
|
+
Works on Claude Code, Cursor, Codex, OpenCode, Gemini CLI. Zero dependencies.
|
|
12
|
+
|
|
13
|
+
github.com/up2itnow0822/clawpowers
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Post 2 (5:00 AM CST) — Image: "ClawPowers in Action" (dashboard/payments UI)
|
|
18
|
+
|
|
19
|
+
Most agent skills tell your agent what to do.
|
|
20
|
+
|
|
21
|
+
ClawPowers skills actually do things - run security scans, execute trades, pay for APIs, and persist state across sessions.
|
|
22
|
+
|
|
23
|
+
Your agent spent 4 hours debugging a CORS issue last week? With ClawPowers, it records the fix, tracks the outcome, and next time it encounters the same stack trace - it already knows the answer.
|
|
24
|
+
|
|
25
|
+
Payments, wallets, markets. All wired up.
|
|
26
|
+
|
|
27
|
+
npx clawpowers init
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Post 3 (6:00 AM CST) — Image: "Superpowers" (4 quadrants - wallets, payments, oracle, trading)
|
|
32
|
+
|
|
33
|
+
What can an agent do with ClawPowers?
|
|
34
|
+
|
|
35
|
+
- Non-custodial wallets with on-chain spending limits
|
|
36
|
+
- Pay for premium APIs autonomously (x402 protocol)
|
|
37
|
+
- Swap tokens across 4 chains via Uniswap V3
|
|
38
|
+
- Bridge USDC cross-chain including Solana
|
|
39
|
+
- On-chain identity and reputation (ERC-8004)
|
|
40
|
+
|
|
41
|
+
Built on the same payment infra merged into NVIDIA's official NeMo Agent Toolkit.
|
|
42
|
+
|
|
43
|
+
Smart-contract enforced limits mean even a compromised agent can't drain your wallet. Period.
|
|
44
|
+
|
|
45
|
+
github.com/up2itnow0822/clawpowers
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Post 4 (7:00 AM CST) — Image: "Before/After" (basic agent vs economic god mode)
|
|
50
|
+
|
|
51
|
+
Before ClawPowers: Your agent follows a checklist. Forgets everything between sessions. Can't pay for anything. Can't learn from mistakes.
|
|
52
|
+
|
|
53
|
+
After: Persistent memory across sessions. Self-improvement from tracked outcomes. Autonomous payments within hard limits. 24 skills that execute, not just instruct.
|
|
54
|
+
|
|
55
|
+
366 tests passing. Zero dependencies. MIT licensed.
|
|
56
|
+
|
|
57
|
+
npx clawpowers init
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Post 5 (8:00 AM CST — MAIN LAUNCH) — Image: "Financial Superpowers" (lobster with lightning)
|
|
62
|
+
|
|
63
|
+
ClawPowers is live.
|
|
64
|
+
|
|
65
|
+
24 skills for coding agents that go beyond static instructions. Persistent memory. Self-improvement loops. And the part nobody else has - autonomous agent payments with smart-contract spending limits.
|
|
66
|
+
|
|
67
|
+
Your agent can pay for APIs, swap tokens, bridge cross-chain, and build on-chain reputation. All within guardrails you set.
|
|
68
|
+
|
|
69
|
+
One install:
|
|
70
|
+
npx clawpowers init
|
|
71
|
+
|
|
72
|
+
Works on Claude Code, Cursor, Codex, OpenCode, Gemini CLI. Windows, macOS, Linux.
|
|
73
|
+
|
|
74
|
+
Built by @AgentEconoemy - the team behind NVIDIA NeMo's official payment integration.
|
|
75
|
+
|
|
76
|
+
github.com/up2itnow0822/clawpowers
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clawpowers",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
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>",
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cross-project-knowledge
|
|
3
|
+
description: Persistent knowledge base across all projects. Extract patterns after every fix or architecture decision; search before starting any task. Work on Project B benefits from everything learned on Projects A, C, D.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
requires:
|
|
6
|
+
tools: [bash, node]
|
|
7
|
+
runtime: true
|
|
8
|
+
metrics:
|
|
9
|
+
tracks: [patterns_stored, patterns_retrieved, cross_project_hits, success_count_increments, search_latency_ms]
|
|
10
|
+
improves: [search_relevance, pattern_categorization_accuracy, retrieval_recall]
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Cross-Project Knowledge
|
|
14
|
+
|
|
15
|
+
## When to Use
|
|
16
|
+
|
|
17
|
+
**Store a pattern after:**
|
|
18
|
+
- Successfully fixing a bug (store the root cause + fix)
|
|
19
|
+
- Making a significant architecture decision (store the decision + rationale)
|
|
20
|
+
- Discovering a performance optimization
|
|
21
|
+
- Completing a security fix or identifying a security pattern
|
|
22
|
+
- Writing a test strategy that proved effective
|
|
23
|
+
|
|
24
|
+
**Search before:**
|
|
25
|
+
- Starting any new task (30-second search to avoid re-solving known problems)
|
|
26
|
+
- Encountering an error message you haven't seen in this project
|
|
27
|
+
- Designing a new component or API
|
|
28
|
+
- Choosing between two implementation approaches
|
|
29
|
+
|
|
30
|
+
**Skip when:**
|
|
31
|
+
- The task is purely mechanical (rename a file, update a config value)
|
|
32
|
+
- The runtime directory `~/.clawpowers/` doesn't exist (no persistence available)
|
|
33
|
+
- The pattern is too project-specific to generalize (e.g., a business rule for one client)
|
|
34
|
+
|
|
35
|
+
**Decision tree:**
|
|
36
|
+
```
|
|
37
|
+
Starting a new task?
|
|
38
|
+
└── Yes → Search knowledge base first (30 seconds)
|
|
39
|
+
├── Hit found → apply known solution, update success_count
|
|
40
|
+
└── No hit → proceed with fresh investigation
|
|
41
|
+
└── After solving: store the pattern
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Core Methodology
|
|
45
|
+
|
|
46
|
+
### Knowledge Base Structure
|
|
47
|
+
|
|
48
|
+
All patterns live in `~/.clawpowers/memory/patterns.jsonl`. Each line is a JSON record:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"pattern_id": "bp-2024-auth-jwt-expiry",
|
|
53
|
+
"category": "bug-fix",
|
|
54
|
+
"description": "JWT tokens accepted after expiry when clock skew > 0",
|
|
55
|
+
"context": "Node.js + jsonwebtoken library, any project using JWT auth",
|
|
56
|
+
"solution": "Add clockTolerance: 0 to verify() options, or explicitly check exp claim",
|
|
57
|
+
"code_example": "jwt.verify(token, secret, { clockTolerance: 0 })",
|
|
58
|
+
"projects_used_in": ["auth-service", "api-gateway"],
|
|
59
|
+
"success_count": 3,
|
|
60
|
+
"tags": ["jwt", "auth", "expiry", "clock-skew"],
|
|
61
|
+
"created_at": "2024-03-15T10:00:00Z",
|
|
62
|
+
"last_used": "2024-11-02T14:30:00Z"
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Categories:**
|
|
67
|
+
- `bug-fix` — root cause + fix for a recurring class of bug
|
|
68
|
+
- `architecture` — structural patterns, component boundaries, integration decisions
|
|
69
|
+
- `performance` — optimizations with measured impact
|
|
70
|
+
- `security` — vulnerability patterns and mitigations
|
|
71
|
+
- `testing` — test strategies, fixture patterns, effective test designs
|
|
72
|
+
|
|
73
|
+
### Step 1: Search Before Starting
|
|
74
|
+
|
|
75
|
+
Before any non-trivial task, run a 30-second search:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Text search by keyword
|
|
79
|
+
PATTERNS_FILE=~/.clawpowers/memory/patterns.jsonl
|
|
80
|
+
|
|
81
|
+
search_patterns() {
|
|
82
|
+
local query="$1"
|
|
83
|
+
local category="$2" # optional filter
|
|
84
|
+
|
|
85
|
+
if [[ ! -f "$PATTERNS_FILE" ]]; then
|
|
86
|
+
echo "No knowledge base found. Initialize with: mkdir -p ~/.clawpowers/memory && touch ~/.clawpowers/memory/patterns.jsonl"
|
|
87
|
+
return
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
node - <<EOF
|
|
91
|
+
const fs = require('fs');
|
|
92
|
+
const query = '${query}'.toLowerCase();
|
|
93
|
+
const category = '${category}';
|
|
94
|
+
const lines = fs.readFileSync(process.env.HOME + '/.clawpowers/memory/patterns.jsonl', 'utf8')
|
|
95
|
+
.trim().split('\n').filter(Boolean).map(l => JSON.parse(l));
|
|
96
|
+
|
|
97
|
+
const results = lines.filter(p => {
|
|
98
|
+
const matchCat = !category || p.category === category;
|
|
99
|
+
const text = [p.description, p.context, p.solution, ...(p.tags||[])].join(' ').toLowerCase();
|
|
100
|
+
const matchQuery = query.split(' ').every(word => text.includes(word));
|
|
101
|
+
return matchCat && matchQuery;
|
|
102
|
+
}).sort((a, b) => b.success_count - a.success_count);
|
|
103
|
+
|
|
104
|
+
if (results.length === 0) {
|
|
105
|
+
console.log('No matching patterns found.');
|
|
106
|
+
} else {
|
|
107
|
+
results.slice(0, 5).forEach((p, i) => {
|
|
108
|
+
console.log(\`[\${i+1}] [\${p.category}] \${p.description}\`);
|
|
109
|
+
console.log(\` Solution: \${p.solution}\`);
|
|
110
|
+
if (p.code_example) console.log(\` Example: \${p.code_example}\`);
|
|
111
|
+
console.log(\` Used in: \${(p.projects_used_in||[]).join(', ')} | Success count: \${p.success_count}\`);
|
|
112
|
+
console.log('');
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
EOF
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
# Usage examples:
|
|
119
|
+
search_patterns "jwt expiry"
|
|
120
|
+
search_patterns "connection pool" "bug-fix"
|
|
121
|
+
search_patterns "react infinite render" "bug-fix"
|
|
122
|
+
search_patterns "database index" "performance"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**What to do with search results:**
|
|
126
|
+
- **Hit with high success_count (≥3):** Apply the documented solution directly. Update `success_count` and `last_used`.
|
|
127
|
+
- **Hit with low success_count (1-2):** Use as a starting hypothesis, not a guaranteed fix. Verify it applies.
|
|
128
|
+
- **No hit:** Proceed with fresh investigation. After solving, store the pattern.
|
|
129
|
+
|
|
130
|
+
### Step 2: Store a Pattern After Solving
|
|
131
|
+
|
|
132
|
+
After fixing a bug, making an architecture decision, or discovering a useful pattern:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
store_pattern() {
|
|
136
|
+
local category="$1" # bug-fix|architecture|performance|security|testing
|
|
137
|
+
local description="$2" # what problem this solves (1 sentence)
|
|
138
|
+
local context="$3" # when/where this pattern applies
|
|
139
|
+
local solution="$4" # the fix or decision
|
|
140
|
+
local code_example="$5" # optional code snippet
|
|
141
|
+
local tags="$6" # comma-separated keywords
|
|
142
|
+
|
|
143
|
+
local pattern_id="${category:0:2}-$(date +%Y%m%d)-$(echo "$description" | tr ' ' '-' | tr '[:upper:]' '[:lower:]' | cut -c1-30)"
|
|
144
|
+
local project=$(basename $(git rev-parse --show-toplevel 2>/dev/null) 2>/dev/null || echo "unknown")
|
|
145
|
+
|
|
146
|
+
mkdir -p ~/.clawpowers/memory
|
|
147
|
+
|
|
148
|
+
# Build JSON record
|
|
149
|
+
node - <<EOF >> "$PATTERNS_FILE"
|
|
150
|
+
console.log(JSON.stringify({
|
|
151
|
+
pattern_id: '$pattern_id',
|
|
152
|
+
category: '$category',
|
|
153
|
+
description: '$description',
|
|
154
|
+
context: '$context',
|
|
155
|
+
solution: '$solution',
|
|
156
|
+
code_example: '$code_example',
|
|
157
|
+
projects_used_in: ['$project'],
|
|
158
|
+
success_count: 1,
|
|
159
|
+
tags: '$tags'.split(',').map(t=>t.trim()).filter(Boolean),
|
|
160
|
+
created_at: new Date().toISOString(),
|
|
161
|
+
last_used: new Date().toISOString()
|
|
162
|
+
}));
|
|
163
|
+
EOF
|
|
164
|
+
echo "Pattern stored: $pattern_id"
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Store after these events (mandatory):**
|
|
169
|
+
|
|
170
|
+
| Event | Category | What to store |
|
|
171
|
+
|-------|---------|--------------|
|
|
172
|
+
| Bug fixed | `bug-fix` | Root cause + exact fix + how to detect this bug |
|
|
173
|
+
| Architecture decision made | `architecture` | Decision + alternatives considered + rationale |
|
|
174
|
+
| Performance improvement measured | `performance` | Optimization + measured delta (e.g., "50% latency reduction") |
|
|
175
|
+
| Security issue found/fixed | `security` | Vulnerability pattern + mitigation |
|
|
176
|
+
| Test strategy validated | `testing` | Test approach + what it caught that unit tests missed |
|
|
177
|
+
|
|
178
|
+
**Example stores:**
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# After fixing a React infinite re-render
|
|
182
|
+
store_pattern "bug-fix" \
|
|
183
|
+
"useEffect with object dependency causes infinite re-render" \
|
|
184
|
+
"React functional components, useEffect with object/array deps" \
|
|
185
|
+
"Memoize the object with useMemo or extract stable primitive values as deps" \
|
|
186
|
+
"const stableRef = useMemo(() => ({ id: user.id }), [user.id])" \
|
|
187
|
+
"react,useEffect,infinite-render,memoization"
|
|
188
|
+
|
|
189
|
+
# After an architecture decision
|
|
190
|
+
store_pattern "architecture" \
|
|
191
|
+
"Event sourcing for audit log instead of mutable records" \
|
|
192
|
+
"Any service requiring immutable audit trail, compliance requirements" \
|
|
193
|
+
"Append-only event log; derive current state by replaying events; never update in-place" \
|
|
194
|
+
"" \
|
|
195
|
+
"event-sourcing,audit-log,cqrs,immutable"
|
|
196
|
+
|
|
197
|
+
# After a performance fix
|
|
198
|
+
store_pattern "performance" \
|
|
199
|
+
"N+1 query on user.posts relation reduced latency from 800ms to 45ms" \
|
|
200
|
+
"ORM with lazy loading, list views fetching related records" \
|
|
201
|
+
"Use eager loading: User.includes(:posts) or SQL JOIN instead of per-row query" \
|
|
202
|
+
"User.includes(:posts).where(...)" \
|
|
203
|
+
"n+1,orm,eager-loading,sql,latency"
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Step 3: Update on Reuse
|
|
207
|
+
|
|
208
|
+
When a retrieved pattern successfully solves a new problem, increment its signal:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
update_pattern_success() {
|
|
212
|
+
local pattern_id="$1"
|
|
213
|
+
local project=$(basename $(git rev-parse --show-toplevel 2>/dev/null) 2>/dev/null || echo "unknown")
|
|
214
|
+
|
|
215
|
+
node - <<EOF > /tmp/patterns-updated.jsonl
|
|
216
|
+
const fs = require('fs');
|
|
217
|
+
const lines = fs.readFileSync(process.env.HOME + '/.clawpowers/memory/patterns.jsonl', 'utf8')
|
|
218
|
+
.trim().split('\n').filter(Boolean).map(l => JSON.parse(l));
|
|
219
|
+
const now = new Date().toISOString();
|
|
220
|
+
const updated = lines.map(p => {
|
|
221
|
+
if (p.pattern_id === '$pattern_id') {
|
|
222
|
+
const projects = Array.from(new Set([...(p.projects_used_in||[]), '$project']));
|
|
223
|
+
return { ...p, success_count: (p.success_count||0) + 1, last_used: now, projects_used_in: projects };
|
|
224
|
+
}
|
|
225
|
+
return p;
|
|
226
|
+
});
|
|
227
|
+
updated.forEach(p => console.log(JSON.stringify(p)));
|
|
228
|
+
EOF
|
|
229
|
+
mv /tmp/patterns-updated.jsonl "$PATTERNS_FILE"
|
|
230
|
+
echo "Updated success_count for $pattern_id"
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Step 4: Periodic Knowledge Base Maintenance
|
|
235
|
+
|
|
236
|
+
Every 100 patterns or monthly, prune and consolidate:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
# Knowledge base health report
|
|
240
|
+
node - <<'EOF'
|
|
241
|
+
const fs = require('fs');
|
|
242
|
+
const lines = fs.readFileSync(process.env.HOME + '/.clawpowers/memory/patterns.jsonl', 'utf8')
|
|
243
|
+
.trim().split('\n').filter(Boolean).map(l => JSON.parse(l));
|
|
244
|
+
|
|
245
|
+
// Count by category
|
|
246
|
+
const byCat = {};
|
|
247
|
+
lines.forEach(p => { byCat[p.category] = (byCat[p.category]||0) + 1; });
|
|
248
|
+
|
|
249
|
+
// High-value patterns (success_count ≥ 3)
|
|
250
|
+
const highValue = lines.filter(p => p.success_count >= 3).length;
|
|
251
|
+
|
|
252
|
+
// Stale patterns (not used in 6 months)
|
|
253
|
+
const sixMonthsAgo = new Date(Date.now() - 6*30*24*60*60*1000).toISOString();
|
|
254
|
+
const stale = lines.filter(p => (p.last_used||p.created_at) < sixMonthsAgo).length;
|
|
255
|
+
|
|
256
|
+
console.log('Knowledge Base Health:');
|
|
257
|
+
console.log(' Total patterns:', lines.length);
|
|
258
|
+
console.log(' By category:', JSON.stringify(byCat));
|
|
259
|
+
console.log(' High-value (≥3 successes):', highValue);
|
|
260
|
+
console.log(' Stale (>6 months unused):', stale);
|
|
261
|
+
console.log(' Cross-project patterns (≥2 projects):', lines.filter(p => (p.projects_used_in||[]).length >= 2).length);
|
|
262
|
+
EOF
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Step 5: Cross-Project Knowledge Transfer
|
|
266
|
+
|
|
267
|
+
When starting a project in a domain you've worked in before:
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
# Before starting on a new auth service
|
|
271
|
+
search_patterns "auth jwt token" "security"
|
|
272
|
+
search_patterns "auth session" "architecture"
|
|
273
|
+
search_patterns "auth rate limit" "security"
|
|
274
|
+
|
|
275
|
+
# Before debugging a Node.js memory issue
|
|
276
|
+
search_patterns "memory leak node" "bug-fix"
|
|
277
|
+
search_patterns "garbage collection" "performance"
|
|
278
|
+
search_patterns "heap snapshot" "bug-fix"
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
**The power:** An agent working on `project-d` that has seen the JWT clock skew bug on `project-a` will solve it in seconds on `project-d` — not hours.
|
|
282
|
+
|
|
283
|
+
## ClawPowers Enhancement
|
|
284
|
+
|
|
285
|
+
When `~/.clawpowers/` runtime is initialized:
|
|
286
|
+
|
|
287
|
+
**Full pipeline integration:**
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
# At the start of any task
|
|
291
|
+
bash runtime/persistence/store.sh set "knowledge:current-task:search-done" "false"
|
|
292
|
+
|
|
293
|
+
# Search step (always first)
|
|
294
|
+
RESULTS=$(node -e "/* search logic above */" 2>/dev/null)
|
|
295
|
+
bash runtime/persistence/store.sh set "knowledge:current-task:search-done" "true"
|
|
296
|
+
bash runtime/persistence/store.sh set "knowledge:current-task:search-results" "$RESULTS"
|
|
297
|
+
|
|
298
|
+
# After task completion — store if new pattern discovered
|
|
299
|
+
if [[ "$NEW_PATTERN_FOUND" == "true" ]]; then
|
|
300
|
+
store_pattern "$CATEGORY" "$DESCRIPTION" "$CONTEXT" "$SOLUTION" "$CODE_EXAMPLE" "$TAGS"
|
|
301
|
+
fi
|
|
302
|
+
|
|
303
|
+
# Record metrics
|
|
304
|
+
bash runtime/metrics/collector.sh record \
|
|
305
|
+
--skill cross-project-knowledge \
|
|
306
|
+
--outcome success \
|
|
307
|
+
--notes "search: $SEARCH_HITS hits, stored: $STORED_PATTERNS new patterns"
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
**Analyze knowledge base effectiveness:**
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
bash runtime/feedback/analyze.sh --filter cross-project-knowledge
|
|
314
|
+
# Reports: search hit rate, most-used patterns, cross-project transfer count,
|
|
315
|
+
# average time saved vs. fresh investigation
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
**Export / import for team sharing:**
|
|
319
|
+
```bash
|
|
320
|
+
# Export your knowledge base (redact sensitive data)
|
|
321
|
+
cat ~/.clawpowers/memory/patterns.jsonl | \
|
|
322
|
+
node -e "
|
|
323
|
+
const lines = require('fs').readFileSync('/dev/stdin','utf8').trim().split('\n').map(JSON.parse);
|
|
324
|
+
// Keep only high-value, generic patterns
|
|
325
|
+
const shareable = lines.filter(p => p.success_count >= 2 && !p.tags?.includes('internal'));
|
|
326
|
+
shareable.forEach(p => console.log(JSON.stringify(p)));
|
|
327
|
+
" > shared-patterns.jsonl
|
|
328
|
+
|
|
329
|
+
# Import from a teammate's export
|
|
330
|
+
cat shared-patterns.jsonl >> ~/.clawpowers/memory/patterns.jsonl
|
|
331
|
+
echo "Imported $(wc -l < shared-patterns.jsonl) patterns"
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
## Anti-Patterns
|
|
335
|
+
|
|
336
|
+
| Anti-Pattern | Why It Fails | Correct Approach |
|
|
337
|
+
|-------------|-------------|-----------------|
|
|
338
|
+
| Skip pre-task search | Re-solve known problems; waste time | Always search first, even if you think you know the answer |
|
|
339
|
+
| Store patterns too specifically | Pattern only matches one exact situation | Generalize: describe the class of problem, not the instance |
|
|
340
|
+
| Store without code_example | Pattern is hard to apply without template | Always include a minimal code example |
|
|
341
|
+
| Forget to update success_count | High-value patterns look the same as single-use | Update every time a pattern is successfully applied |
|
|
342
|
+
| Store negative results ("this didn't work") | Pollutes the knowledge base with noise | Only store successful patterns; capture failures in debugging logs |
|
|
343
|
+
| Never prune stale patterns | Old patterns may suggest deprecated approaches | Monthly maintenance pass; archive patterns unused for 6+ months |
|
|
344
|
+
| Search with overly broad terms | Too many irrelevant hits; signal buried | Search with 2-3 specific keywords from the error or domain |
|
|
345
|
+
| Treat cross-project patterns as gospel | Context differs; blind application fails | Use as a strong starting hypothesis, then verify it fits |
|