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.
Files changed (75) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/LICENSE +44 -0
  3. package/README.md +204 -228
  4. package/SECURITY.md +72 -0
  5. package/dist/index.d.ts +844 -0
  6. package/dist/index.js +2536 -0
  7. package/dist/index.js.map +1 -0
  8. package/package.json +50 -44
  9. package/.claude-plugin/manifest.json +0 -19
  10. package/.codex/INSTALL.md +0 -36
  11. package/.cursor-plugin/manifest.json +0 -21
  12. package/.opencode/INSTALL.md +0 -52
  13. package/ARCHITECTURE.md +0 -69
  14. package/bin/clawpowers.js +0 -625
  15. package/bin/clawpowers.sh +0 -91
  16. package/docs/demo/clawpowers-demo.cast +0 -197
  17. package/docs/demo/clawpowers-demo.gif +0 -0
  18. package/docs/launch-images/25-skills-breakdown.jpg +0 -0
  19. package/docs/launch-images/clawpowers-vs-superpowers.jpg +0 -0
  20. package/docs/launch-images/economic-code-optimization.jpg +0 -0
  21. package/docs/launch-images/native-vs-bridge-2.jpg +0 -0
  22. package/docs/launch-images/native-vs-bridge.jpg +0 -0
  23. package/docs/launch-images/post1-hero-lobster.jpg +0 -0
  24. package/docs/launch-images/post2-dashboard.jpg +0 -0
  25. package/docs/launch-images/post3-superpowers.jpg +0 -0
  26. package/docs/launch-images/post4-before-after.jpg +0 -0
  27. package/docs/launch-images/post5-install-now.jpg +0 -0
  28. package/docs/launch-images/ultimate-stack.jpg +0 -0
  29. package/docs/launch-posts.md +0 -76
  30. package/docs/quickstart-first-transaction.md +0 -204
  31. package/gemini-extension.json +0 -32
  32. package/hooks/session-start +0 -205
  33. package/hooks/session-start.cmd +0 -43
  34. package/hooks/session-start.js +0 -163
  35. package/runtime/demo/README.md +0 -78
  36. package/runtime/demo/x402-mock-server.js +0 -230
  37. package/runtime/feedback/analyze.js +0 -621
  38. package/runtime/feedback/analyze.sh +0 -546
  39. package/runtime/init.js +0 -210
  40. package/runtime/init.sh +0 -178
  41. package/runtime/metrics/collector.js +0 -361
  42. package/runtime/metrics/collector.sh +0 -308
  43. package/runtime/payments/ledger.js +0 -305
  44. package/runtime/payments/ledger.sh +0 -262
  45. package/runtime/payments/pipeline.js +0 -455
  46. package/runtime/persistence/store.js +0 -433
  47. package/runtime/persistence/store.sh +0 -303
  48. package/skill.json +0 -106
  49. package/skills/agent-bounties/SKILL.md +0 -553
  50. package/skills/agent-payments/SKILL.md +0 -479
  51. package/skills/brainstorming/SKILL.md +0 -233
  52. package/skills/content-pipeline/SKILL.md +0 -282
  53. package/skills/cross-project-knowledge/SKILL.md +0 -345
  54. package/skills/dispatching-parallel-agents/SKILL.md +0 -305
  55. package/skills/economic-code-optimization/SKILL.md +0 -265
  56. package/skills/executing-plans/SKILL.md +0 -255
  57. package/skills/finishing-a-development-branch/SKILL.md +0 -260
  58. package/skills/formal-verification-lite/SKILL.md +0 -441
  59. package/skills/learn-how-to-learn/SKILL.md +0 -235
  60. package/skills/market-intelligence/SKILL.md +0 -323
  61. package/skills/meta-skill-evolution/SKILL.md +0 -325
  62. package/skills/prospecting/SKILL.md +0 -454
  63. package/skills/receiving-code-review/SKILL.md +0 -225
  64. package/skills/requesting-code-review/SKILL.md +0 -206
  65. package/skills/security-audit/SKILL.md +0 -353
  66. package/skills/self-healing-code/SKILL.md +0 -369
  67. package/skills/subagent-driven-development/SKILL.md +0 -244
  68. package/skills/systematic-debugging/SKILL.md +0 -355
  69. package/skills/test-driven-development/SKILL.md +0 -416
  70. package/skills/using-clawpowers/SKILL.md +0 -160
  71. package/skills/using-git-worktrees/SKILL.md +0 -261
  72. package/skills/validator/SKILL.md +0 -281
  73. package/skills/verification-before-completion/SKILL.md +0 -254
  74. package/skills/writing-plans/SKILL.md +0 -276
  75. package/skills/writing-skills/SKILL.md +0 -260
@@ -1,325 +0,0 @@
1
- ---
2
- name: meta-skill-evolution
3
- description: RSI for coding methodology itself. After every 50 completed tasks, analyze outcome patterns, identify the weakest skill, surgically improve it, and commit the evolution. Agents that literally improve their own methodology over time.
4
- version: 1.0.0
5
- requires:
6
- tools: [bash, git, node]
7
- runtime: true
8
- metrics:
9
- tracks: [evolutions_triggered, skills_improved, success_rate_delta, version_bumps, evolution_duration]
10
- improves: [skill_selection_accuracy, weakest_skill_identification, surgical_edit_quality]
11
- ---
12
-
13
- # Meta-Skill Evolution
14
-
15
- ## When to Use
16
-
17
- Apply this skill when:
18
-
19
- - The task counter reaches a multiple of 50 (tracked in `~/.clawpowers/state/task-counter.json`)
20
- - A skill consistently shows < 70% success rate over the last 20 uses
21
- - `runtime/feedback/analyze.sh` surfaces a skill with declining trend
22
- - Bill explicitly requests "evolve the skills" or "improve methodology"
23
- - A cluster of related task failures points to a methodology gap
24
-
25
- **Skip when:**
26
- - Fewer than 50 total tasks have been completed (insufficient signal)
27
- - The runtime directory `~/.clawpowers/` doesn't exist (static mode)
28
- - A previous evolution cycle completed within the last 10 tasks (cooling period)
29
-
30
- **Decision tree:**
31
- ```
32
- Has task counter hit a multiple of 50?
33
- ├── No → continue working; check counter at next task completion
34
- └── Yes → Run evolution cycle
35
- └── Does weakest skill have < 80% success rate?
36
- ├── No → log "all skills healthy", increment counter, skip
37
- └── Yes → identify weakest section → surgical edit → version bump → commit
38
- ```
39
-
40
- ## Core Methodology
41
-
42
- ### Step 1: Trigger and Task Counter
43
-
44
- Every completed task increments a persistent counter. After each task:
45
-
46
- ```bash
47
- # Increment task counter
48
- COUNTER_FILE=~/.clawpowers/state/task-counter.json
49
- CURRENT=$(cat "$COUNTER_FILE" 2>/dev/null | node -e "const d=require('/dev/stdin');console.log(d.count||0)" 2>/dev/null || echo 0)
50
- NEXT=$((CURRENT + 1))
51
- echo "{\"count\": $NEXT, \"last_updated\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" > "$COUNTER_FILE"
52
-
53
- # Check if evolution cycle is due
54
- if (( NEXT % 50 == 0 )); then
55
- echo "Evolution cycle triggered at task $NEXT"
56
- # → proceed to Step 2
57
- fi
58
- ```
59
-
60
- **Recording task completion (run this after every task):**
61
- ```bash
62
- bash runtime/metrics/collector.sh record \
63
- --skill <active-skill-name> \
64
- --outcome success|failure \
65
- --duration <seconds> \
66
- --notes "<brief description>"
67
- ```
68
-
69
- ### Step 2: Outcome Pattern Analysis
70
-
71
- Pull the last 50 task records and compute per-skill success rates:
72
-
73
- ```bash
74
- # Analyze outcomes for the last 50 tasks
75
- METRICS_FILE=~/.clawpowers/metrics/outcomes.jsonl
76
-
77
- # Per-skill success rate (requires jq or node)
78
- node - <<'EOF'
79
- const fs = require('fs');
80
- const lines = fs.readFileSync(process.env.HOME + '/.clawpowers/metrics/outcomes.jsonl', 'utf8')
81
- .trim().split('\n').filter(Boolean).slice(-50)
82
- .map(l => JSON.parse(l));
83
-
84
- const stats = {};
85
- for (const rec of lines) {
86
- const s = rec.skill || 'unknown';
87
- if (!stats[s]) stats[s] = { success: 0, failure: 0, durations: [] };
88
- stats[s][rec.outcome === 'success' ? 'success' : 'failure']++;
89
- if (rec.duration) stats[s].durations.push(rec.duration);
90
- }
91
-
92
- const report = Object.entries(stats).map(([skill, d]) => {
93
- const total = d.success + d.failure;
94
- const rate = total > 0 ? (d.success / total) : null;
95
- const avgDuration = d.durations.length > 0
96
- ? Math.round(d.durations.reduce((a,b)=>a+b,0) / d.durations.length)
97
- : null;
98
- return { skill, success_rate: rate, total_tasks: total, avg_duration_s: avgDuration };
99
- }).sort((a, b) => (a.success_rate ?? 1) - (b.success_rate ?? 1));
100
-
101
- console.log(JSON.stringify(report, null, 2));
102
- EOF
103
- ```
104
-
105
- **What to look for:**
106
- - Lowest `success_rate` → weakest skill candidate
107
- - Rising `avg_duration_s` → methodology is too slow or unclear
108
- - High failure count on a single skill → systemic gap, not random noise
109
-
110
- ### Step 3: Identify the Weakest Skill
111
-
112
- ```bash
113
- # Get weakest skill (lowest success rate with ≥ 3 data points)
114
- WEAKEST=$(node - <<'EOF'
115
- const fs = require('fs');
116
- const lines = fs.readFileSync(process.env.HOME + '/.clawpowers/metrics/outcomes.jsonl', 'utf8')
117
- .trim().split('\n').filter(Boolean).slice(-50).map(l => JSON.parse(l));
118
- const stats = {};
119
- for (const rec of lines) {
120
- const s = rec.skill || 'unknown';
121
- if (!stats[s]) stats[s] = { success: 0, failure: 0 };
122
- stats[s][rec.outcome === 'success' ? 'success' : 'failure']++;
123
- }
124
- const ranked = Object.entries(stats)
125
- .filter(([_, d]) => (d.success + d.failure) >= 3)
126
- .map(([skill, d]) => ({ skill, rate: d.success / (d.success + d.failure) }))
127
- .sort((a, b) => a.rate - b.rate);
128
- console.log(ranked[0]?.skill || '');
129
- EOF
130
- )
131
-
132
- echo "Weakest skill: $WEAKEST"
133
-
134
- # Read the skill file
135
- SKILL_FILE="skills/$WEAKEST/SKILL.md"
136
- if [[ ! -f "$SKILL_FILE" ]]; then
137
- echo "Skill file not found: $SKILL_FILE — skipping evolution"
138
- exit 0
139
- fi
140
- ```
141
-
142
- ### Step 4: Diagnose the Specific Weakness
143
-
144
- Before editing, analyze *why* the skill is failing. Read the failure notes:
145
-
146
- ```bash
147
- # Extract failure notes for the weakest skill
148
- node - <<EOF
149
- const fs = require('fs');
150
- const skill = '$WEAKEST';
151
- const lines = fs.readFileSync(process.env.HOME + '/.clawpowers/metrics/outcomes.jsonl', 'utf8')
152
- .trim().split('\n').filter(Boolean).slice(-50)
153
- .map(l => JSON.parse(l))
154
- .filter(r => r.skill === skill && r.outcome === 'failure' && r.notes);
155
- lines.forEach(r => console.log(r.timestamp, '|', r.notes));
156
- EOF
157
- ```
158
-
159
- **Diagnosis patterns:**
160
-
161
- | Failure note pattern | Likely weak section | Fix strategy |
162
- |---------------------|-------------------|-------------|
163
- | "step X was unclear" | Core Methodology step X | Add concrete example, remove ambiguity |
164
- | "forgot to check Y" | Anti-Patterns table | Add the missed check as an explicit anti-pattern |
165
- | "didn't know when to apply" | When to Use decision tree | Sharpen the decision tree with new branch |
166
- | "ClawPowers commands failed" | ClawPowers Enhancement | Fix command syntax or add error handling |
167
- | "took too long on Z" | Core Methodology step Z | Add shortcut or restructure step ordering |
168
-
169
- ### Step 5: Surgical Edit (Not Wholesale Replacement)
170
-
171
- **Critical rule:** Edit specific sections, not the entire file. Wholesale rewrites lose working methodology.
172
-
173
- ```bash
174
- # Read the current skill version
175
- CURRENT_VERSION=$(grep '^version:' "$SKILL_FILE" | head -1 | awk '{print $2}' | tr -d '"')
176
- MAJOR=$(echo $CURRENT_VERSION | cut -d. -f1)
177
- MINOR=$(echo $CURRENT_VERSION | cut -d. -f2)
178
- PATCH=$(echo $CURRENT_VERSION | cut -d. -f3)
179
- NEW_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
180
-
181
- echo "Evolving $WEAKEST from v$CURRENT_VERSION → v$NEW_VERSION"
182
- ```
183
-
184
- **Surgical edit guidelines:**
185
- - If the "When to Use" decision tree is wrong → edit only that block
186
- - If a Core Methodology step is incomplete → add one concrete example under that step
187
- - If an Anti-Pattern is missing → append one row to the table
188
- - If ClawPowers commands are broken → fix only the broken command block
189
- - Never touch sections that aren't implicated in the failures
190
- - Max lines changed per evolution cycle: 30 (forces focus)
191
-
192
- **Apply the edit and bump version:**
193
- ```bash
194
- # After making the targeted edit in SKILL_FILE:
195
- sed -i "s/^version: $CURRENT_VERSION/version: $NEW_VERSION/" "$SKILL_FILE"
196
- ```
197
-
198
- ### Step 6: Commit the Evolution
199
-
200
- ```bash
201
- # Stage and commit
202
- git add "$SKILL_FILE"
203
- git commit -m "skill-evolution: $WEAKEST v$CURRENT_VERSION → v$NEW_VERSION
204
-
205
- Triggered at task $TASK_COUNT. Success rate was $RATE%.
206
- Section edited: $SECTION_EDITED
207
- Root cause: $ROOT_CAUSE
208
-
209
- [meta-skill-evolution]"
210
-
211
- # Copy evolved skill to ~/.clawpowers/skills/ if exists
212
- MANAGED_SKILLS_DIR=~/.clawpowers/skills
213
- if [[ -d "$MANAGED_SKILLS_DIR" ]]; then
214
- mkdir -p "$MANAGED_SKILLS_DIR/$WEAKEST"
215
- cp "$SKILL_FILE" "$MANAGED_SKILLS_DIR/$WEAKEST/SKILL.md"
216
- fi
217
- ```
218
-
219
- ### Step 7: Log Evolution History
220
-
221
- Every evolution is appended to a persistent log:
222
-
223
- ```bash
224
- EVOLUTION_LOG=~/.clawpowers/feedback/evolution-log.jsonl
225
- mkdir -p "$(dirname $EVOLUTION_LOG)"
226
-
227
- cat >> "$EVOLUTION_LOG" <<EOF
228
- {"timestamp":"$(date -u +%Y-%m-%dT%H:%M:%SZ)","task_count":$TASK_COUNT,"skill":"$WEAKEST","version_from":"$CURRENT_VERSION","version_to":"$NEW_VERSION","success_rate_before":$RATE,"section_edited":"$SECTION_EDITED","root_cause":"$ROOT_CAUSE","commit":"$(git rev-parse --short HEAD)"}
229
- EOF
230
- ```
231
-
232
- **Review evolution history:**
233
- ```bash
234
- # See all past evolutions
235
- cat ~/.clawpowers/feedback/evolution-log.jsonl | node -e "
236
- const lines = require('fs').readFileSync('/dev/stdin','utf8').trim().split('\n').map(JSON.parse);
237
- lines.forEach(e => console.log(e.timestamp.slice(0,10), e.skill, e.version_from, '→', e.version_to, 'rate:', (e.success_rate_before*100).toFixed(0)+'%'));
238
- "
239
-
240
- # Check if an evolution helped (compare rate before vs after)
241
- # Re-run outcome analysis after 10 more tasks to measure improvement
242
- ```
243
-
244
- ### Step 8: Validate the Evolution
245
-
246
- After 10 more tasks using the evolved skill, check if the success rate improved:
247
-
248
- ```bash
249
- # Post-evolution check (run after 10+ tasks)
250
- NEW_RATE=$(node -e "
251
- const fs = require('fs');
252
- const lines = fs.readFileSync(process.env.HOME + '/.clawpowers/metrics/outcomes.jsonl','utf8')
253
- .trim().split('\n').filter(Boolean).slice(-10)
254
- .map(l => JSON.parse(l))
255
- .filter(r => r.skill === '$WEAKEST');
256
- const success = lines.filter(r => r.outcome === 'success').length;
257
- console.log((success/lines.length).toFixed(2));
258
- ")
259
- echo "Post-evolution success rate for $WEAKEST: $NEW_RATE"
260
-
261
- # If rate dropped: revert the evolution
262
- if node -e "process.exit(parseFloat('$NEW_RATE') < parseFloat('$RATE') ? 1 : 0)"; then
263
- echo "Evolution improved the skill. Rate: $RATE → $NEW_RATE"
264
- else
265
- echo "WARNING: Evolution did not help. Consider reverting."
266
- git revert HEAD --no-edit
267
- fi
268
- ```
269
-
270
- ## ClawPowers Enhancement
271
-
272
- When `~/.clawpowers/` runtime is initialized:
273
-
274
- **Full evolution pipeline:**
275
-
276
- ```bash
277
- # Store evolution state for resumability
278
- bash runtime/persistence/store.sh set "meta-evolution:current:task_count" "$TASK_COUNT"
279
- bash runtime/persistence/store.sh set "meta-evolution:current:weakest_skill" "$WEAKEST"
280
- bash runtime/persistence/store.sh set "meta-evolution:current:phase" "diagnosis|editing|committed|validated"
281
-
282
- # Record the evolution outcome
283
- bash runtime/metrics/collector.sh record \
284
- --skill meta-skill-evolution \
285
- --outcome success \
286
- --duration "$DURATION" \
287
- --notes "$WEAKEST v$CURRENT_VERSION→v$NEW_VERSION rate:$RATE→$NEW_RATE"
288
- ```
289
-
290
- **Analyze evolution effectiveness over time:**
291
-
292
- ```bash
293
- bash runtime/feedback/analyze.sh --filter meta-skill-evolution
294
- # Shows: how many evolutions triggered, average rate improvement per evolution,
295
- # which skills have been evolved most, correlation between evolution and task success
296
- ```
297
-
298
- **Track cumulative improvement:**
299
- ```bash
300
- # Evolution impact report
301
- cat ~/.clawpowers/feedback/evolution-log.jsonl | node -e "
302
- const lines = require('fs').readFileSync('/dev/stdin','utf8').trim().split('\n').map(JSON.parse);
303
- const bySkill = {};
304
- lines.forEach(e => {
305
- if (!bySkill[e.skill]) bySkill[e.skill] = [];
306
- bySkill[e.skill].push(e);
307
- });
308
- Object.entries(bySkill).forEach(([skill, evos]) => {
309
- console.log(skill + ': ' + evos.length + ' evolutions, versions: ' + evos.map(e=>e.version_to).join(', '));
310
- });
311
- "
312
- ```
313
-
314
- ## Anti-Patterns
315
-
316
- | Anti-Pattern | Why It Fails | Correct Approach |
317
- |-------------|-------------|-----------------|
318
- | Rewrite the whole skill | Destroys working methodology, no signal on what improved | Surgical edits only — max 30 lines changed |
319
- | Evolve based on < 3 data points | Statistical noise triggers false evolution | Require ≥ 3 uses before a skill is eligible |
320
- | Evolve on a cooling period | Too-frequent changes create instability | Enforce 10-task cooldown between evolutions |
321
- | Skip the validation step | Bad evolutions compound over time | Always measure rate before vs after |
322
- | Edit non-implicated sections | Changes unrelated things, pollutes signal | Only edit sections linked to failure notes |
323
- | Forget to bump version | Can't track evolution history | Version bump is mandatory before commit |
324
- | No evolution log entry | History is lost; can't audit what improved | Always append to evolution-log.jsonl |
325
- | Evolve the meta-skill-evolution skill first | Circular improvement without baseline | Evolve leaf skills first; evolve this skill only after 5+ other evolutions |