clawpowers 1.1.4 → 2.2.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 (131) hide show
  1. package/CHANGELOG.md +126 -0
  2. package/COMPATIBILITY.md +13 -0
  3. package/KNOWN_LIMITATIONS.md +19 -0
  4. package/LICENSE +44 -0
  5. package/LICENSING.md +10 -0
  6. package/README.md +378 -210
  7. package/SECURITY.md +52 -0
  8. package/dist/index.d.ts +1477 -0
  9. package/dist/index.js +3464 -0
  10. package/dist/index.js.map +1 -0
  11. package/native/Cargo.lock +4863 -0
  12. package/native/Cargo.toml +73 -0
  13. package/native/crates/canonical/Cargo.toml +24 -0
  14. package/native/crates/canonical/src/lib.rs +673 -0
  15. package/native/crates/compression/Cargo.toml +20 -0
  16. package/native/crates/compression/benches/compression_bench.rs +42 -0
  17. package/native/crates/compression/src/lib.rs +393 -0
  18. package/native/crates/evm-eth/Cargo.toml +13 -0
  19. package/native/crates/evm-eth/src/lib.rs +105 -0
  20. package/native/crates/fee/Cargo.toml +15 -0
  21. package/native/crates/fee/src/lib.rs +281 -0
  22. package/native/crates/index/Cargo.toml +16 -0
  23. package/native/crates/index/src/lib.rs +277 -0
  24. package/native/crates/policy/Cargo.toml +17 -0
  25. package/native/crates/policy/src/lib.rs +614 -0
  26. package/native/crates/security/Cargo.toml +22 -0
  27. package/native/crates/security/src/lib.rs +478 -0
  28. package/native/crates/tokens/Cargo.toml +13 -0
  29. package/native/crates/tokens/src/lib.rs +534 -0
  30. package/native/crates/verification/Cargo.toml +23 -0
  31. package/native/crates/verification/src/lib.rs +333 -0
  32. package/native/crates/wallet/Cargo.toml +20 -0
  33. package/native/crates/wallet/src/lib.rs +261 -0
  34. package/native/crates/x402/Cargo.toml +30 -0
  35. package/native/crates/x402/src/lib.rs +423 -0
  36. package/native/ffi/Cargo.toml +34 -0
  37. package/native/ffi/build.rs +4 -0
  38. package/native/ffi/index.node +0 -0
  39. package/native/ffi/src/lib.rs +352 -0
  40. package/native/ffi/tests/integration.rs +354 -0
  41. package/native/pyo3/Cargo.toml +26 -0
  42. package/native/pyo3/pyproject.toml +16 -0
  43. package/native/pyo3/src/lib.rs +407 -0
  44. package/native/pyo3/tests/test_smoke.py +180 -0
  45. package/native/wasm/Cargo.toml +44 -0
  46. package/native/wasm/pkg/.gitignore +6 -0
  47. package/native/wasm/pkg/clawpowers_wasm.d.ts +208 -0
  48. package/native/wasm/pkg/clawpowers_wasm.js +872 -0
  49. package/native/wasm/pkg/clawpowers_wasm_bg.wasm +0 -0
  50. package/native/wasm/pkg/clawpowers_wasm_bg.wasm.d.ts +40 -0
  51. package/native/wasm/pkg/package.json +17 -0
  52. package/native/wasm/pkg-node/.gitignore +6 -0
  53. package/native/wasm/pkg-node/clawpowers_wasm.d.ts +143 -0
  54. package/native/wasm/pkg-node/clawpowers_wasm.js +798 -0
  55. package/native/wasm/pkg-node/clawpowers_wasm_bg.wasm +0 -0
  56. package/native/wasm/pkg-node/clawpowers_wasm_bg.wasm.d.ts +40 -0
  57. package/native/wasm/pkg-node/package.json +13 -0
  58. package/native/wasm/src/lib.rs +433 -0
  59. package/package.json +71 -44
  60. package/src/skills/catalog.ts +435 -0
  61. package/src/skills/executor.ts +56 -0
  62. package/src/skills/index.ts +3 -0
  63. package/src/skills/itp/SKILL.md +112 -0
  64. package/src/skills/loader.ts +193 -0
  65. package/.claude-plugin/manifest.json +0 -19
  66. package/.codex/INSTALL.md +0 -36
  67. package/.cursor-plugin/manifest.json +0 -21
  68. package/.opencode/INSTALL.md +0 -52
  69. package/ARCHITECTURE.md +0 -69
  70. package/bin/clawpowers.js +0 -625
  71. package/bin/clawpowers.sh +0 -91
  72. package/docs/demo/clawpowers-demo.cast +0 -197
  73. package/docs/demo/clawpowers-demo.gif +0 -0
  74. package/docs/launch-images/25-skills-breakdown.jpg +0 -0
  75. package/docs/launch-images/clawpowers-vs-superpowers.jpg +0 -0
  76. package/docs/launch-images/economic-code-optimization.jpg +0 -0
  77. package/docs/launch-images/native-vs-bridge-2.jpg +0 -0
  78. package/docs/launch-images/native-vs-bridge.jpg +0 -0
  79. package/docs/launch-images/post1-hero-lobster.jpg +0 -0
  80. package/docs/launch-images/post2-dashboard.jpg +0 -0
  81. package/docs/launch-images/post3-superpowers.jpg +0 -0
  82. package/docs/launch-images/post4-before-after.jpg +0 -0
  83. package/docs/launch-images/post5-install-now.jpg +0 -0
  84. package/docs/launch-images/ultimate-stack.jpg +0 -0
  85. package/docs/launch-posts.md +0 -76
  86. package/docs/quickstart-first-transaction.md +0 -204
  87. package/gemini-extension.json +0 -32
  88. package/hooks/session-start +0 -205
  89. package/hooks/session-start.cmd +0 -43
  90. package/hooks/session-start.js +0 -163
  91. package/runtime/demo/README.md +0 -78
  92. package/runtime/demo/x402-mock-server.js +0 -230
  93. package/runtime/feedback/analyze.js +0 -621
  94. package/runtime/feedback/analyze.sh +0 -546
  95. package/runtime/init.js +0 -210
  96. package/runtime/init.sh +0 -178
  97. package/runtime/metrics/collector.js +0 -361
  98. package/runtime/metrics/collector.sh +0 -308
  99. package/runtime/payments/ledger.js +0 -305
  100. package/runtime/payments/ledger.sh +0 -262
  101. package/runtime/payments/pipeline.js +0 -455
  102. package/runtime/persistence/store.js +0 -433
  103. package/runtime/persistence/store.sh +0 -303
  104. package/skill.json +0 -106
  105. package/skills/agent-bounties/SKILL.md +0 -553
  106. package/skills/agent-payments/SKILL.md +0 -479
  107. package/skills/brainstorming/SKILL.md +0 -233
  108. package/skills/content-pipeline/SKILL.md +0 -282
  109. package/skills/cross-project-knowledge/SKILL.md +0 -345
  110. package/skills/dispatching-parallel-agents/SKILL.md +0 -305
  111. package/skills/economic-code-optimization/SKILL.md +0 -265
  112. package/skills/executing-plans/SKILL.md +0 -255
  113. package/skills/finishing-a-development-branch/SKILL.md +0 -260
  114. package/skills/formal-verification-lite/SKILL.md +0 -441
  115. package/skills/learn-how-to-learn/SKILL.md +0 -235
  116. package/skills/market-intelligence/SKILL.md +0 -323
  117. package/skills/meta-skill-evolution/SKILL.md +0 -325
  118. package/skills/prospecting/SKILL.md +0 -454
  119. package/skills/receiving-code-review/SKILL.md +0 -225
  120. package/skills/requesting-code-review/SKILL.md +0 -206
  121. package/skills/security-audit/SKILL.md +0 -353
  122. package/skills/self-healing-code/SKILL.md +0 -369
  123. package/skills/subagent-driven-development/SKILL.md +0 -244
  124. package/skills/systematic-debugging/SKILL.md +0 -355
  125. package/skills/test-driven-development/SKILL.md +0 -416
  126. package/skills/using-clawpowers/SKILL.md +0 -160
  127. package/skills/using-git-worktrees/SKILL.md +0 -261
  128. package/skills/validator/SKILL.md +0 -281
  129. package/skills/verification-before-completion/SKILL.md +0 -254
  130. package/skills/writing-plans/SKILL.md +0 -276
  131. package/skills/writing-skills/SKILL.md +0 -260
package/runtime/init.js DELETED
@@ -1,210 +0,0 @@
1
- #!/usr/bin/env node
2
- // runtime/init.js — Initialize the ClawPowers runtime directory structure
3
- //
4
- // Creates ~/.clawpowers/ with all required subdirectories on first run.
5
- // Safe to run multiple times (idempotent).
6
- //
7
- // Usage:
8
- // node runtime/init.js
9
- // npx clawpowers init
10
- 'use strict';
11
-
12
- const fs = require('fs');
13
- const path = require('path');
14
- const os = require('os');
15
-
16
- const VERSION = '1.1.1';
17
-
18
- // Runtime root — override with CLAWPOWERS_DIR env var for testing or custom locations
19
- const CLAWPOWERS_DIR = process.env.CLAWPOWERS_DIR || path.join(os.homedir(), '.clawpowers');
20
-
21
- /**
22
- * Creates the full runtime directory tree under CLAWPOWERS_DIR.
23
- * Each directory is created with mode 0o700 (owner-only access) so
24
- * skill state and metrics aren't readable by other users on the system.
25
- * Directories that already exist are silently skipped.
26
- *
27
- * @returns {number} Count of directories actually created (0 if already initialized).
28
- */
29
- function createStructure() {
30
- const dirs = [
31
- CLAWPOWERS_DIR,
32
- path.join(CLAWPOWERS_DIR, 'state'), // Key-value persistence files
33
- path.join(CLAWPOWERS_DIR, 'metrics'), // JSONL outcome logs per month
34
- path.join(CLAWPOWERS_DIR, 'checkpoints'), // Resumable plan state (executing-plans skill)
35
- path.join(CLAWPOWERS_DIR, 'feedback'), // RSI analysis reports
36
- path.join(CLAWPOWERS_DIR, 'memory'), // Cross-session knowledge base
37
- path.join(CLAWPOWERS_DIR, 'logs'), // Debug and audit logs
38
- ];
39
-
40
- let created = 0;
41
- for (const dir of dirs) {
42
- if (!fs.existsSync(dir)) {
43
- fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
44
- created++;
45
- }
46
- }
47
- return created;
48
- }
49
-
50
- /**
51
- * Writes a .version file to CLAWPOWERS_DIR on first initialization.
52
- * The file contains the ClawPowers version and an ISO timestamp so we can
53
- * track when the runtime was first set up and run migrations in the future.
54
- * No-op if the file already exists.
55
- */
56
- function writeVersion() {
57
- const versionFile = path.join(CLAWPOWERS_DIR, '.version');
58
- if (!fs.existsSync(versionFile)) {
59
- const ts = new Date().toISOString().replace(/\.\d{3}Z$/, 'Z');
60
- const content = `version=${VERSION}\ninitialized=${ts}\n`;
61
- // 0o600 = owner read/write only — this file may contain version metadata
62
- fs.writeFileSync(versionFile, content, { mode: 0o600 });
63
- }
64
- }
65
-
66
- /**
67
- * Writes a human-readable README into CLAWPOWERS_DIR explaining its purpose.
68
- * Helps users who discover the directory understand what it is and that it is
69
- * safe to delete (ClawPowers will recreate it on next run).
70
- * No-op if the README already exists.
71
- */
72
- function writeReadme() {
73
- const readme = path.join(CLAWPOWERS_DIR, 'README');
74
- if (!fs.existsSync(readme)) {
75
- const content = [
76
- 'ClawPowers Runtime Directory',
77
- '============================',
78
- '',
79
- 'This directory is managed by ClawPowers (https://github.com/up2itnow0822/clawpowers).',
80
- '',
81
- 'Directory Structure:',
82
- ' state/ Key-value state store for skill data (managed by persistence/store.js)',
83
- ' metrics/ Skill execution outcome logs in JSONL format',
84
- ' checkpoints/ Resumable workflow state (created by executing-plans skill)',
85
- ' feedback/ RSI analysis output and recommendations',
86
- ' memory/ Cross-session knowledge base',
87
- ' logs/ Debug and audit logs',
88
- '',
89
- 'Safe to delete: Yes — ClawPowers recreates this directory on next init.',
90
- 'Never share: Contains agent state and potentially sensitive workflow data.',
91
- '',
92
- 'Manage with: npx clawpowers status',
93
- '',
94
- ].join('\n');
95
- fs.writeFileSync(readme, content, { mode: 0o600 });
96
- }
97
- }
98
-
99
- /**
100
- * Default configuration written to ~/.clawpowers/config.json on first init.
101
- * Users can edit this file to enable payments, telemetry, or change skill behavior.
102
- * Never overwritten once created — user settings are always preserved.
103
- */
104
- const DEFAULT_CONFIG = {
105
- version: VERSION,
106
- payments: {
107
- enabled: false,
108
- mode: 'dry_run',
109
- per_tx_limit_usd: 0,
110
- daily_limit_usd: 0,
111
- weekly_limit_usd: 0,
112
- allowlist: [],
113
- require_approval_above_usd: 0,
114
- },
115
- telemetry: {
116
- enabled: false,
117
- },
118
- skills: {
119
- auto_load: true,
120
- },
121
- };
122
-
123
- /**
124
- * Writes the default config.json to CLAWPOWERS_DIR on first initialization.
125
- * No-op if config.json already exists — user settings are always preserved.
126
- * The config file is written with mode 0o600 (owner read/write only).
127
- */
128
- function writeConfig() {
129
- const configFile = path.join(CLAWPOWERS_DIR, 'config.json');
130
- if (!fs.existsSync(configFile)) {
131
- const content = JSON.stringify(DEFAULT_CONFIG, null, 2) + '\n';
132
- fs.writeFileSync(configFile, content, { mode: 0o600 });
133
- }
134
- }
135
-
136
- /**
137
- * Updates the version stamp in .version after initialization.
138
- * Currently a no-op placeholder for actual schema migrations; the version
139
- * string is updated in place so future versions can detect and migrate old
140
- * runtime layouts.
141
- */
142
- function runMigrations() {
143
- const versionFile = path.join(CLAWPOWERS_DIR, '.version');
144
- if (!fs.existsSync(versionFile)) return;
145
-
146
- // Replace the version= line with the current version to keep .version current
147
- let content = fs.readFileSync(versionFile, 'utf8');
148
- content = content.replace(/^version=.*/m, `version=${VERSION}`);
149
- fs.writeFileSync(versionFile, content, { mode: 0o600 });
150
- }
151
-
152
- /**
153
- * Reads the stored version string from .version.
154
- * Used in the "already initialized" status message to show what version is
155
- * currently installed in the runtime directory.
156
- *
157
- * @returns {string} Stored version string, or the current VERSION if unreadable.
158
- */
159
- function getStoredVersion() {
160
- const versionFile = path.join(CLAWPOWERS_DIR, '.version');
161
- if (!fs.existsSync(versionFile)) return VERSION;
162
- const content = fs.readFileSync(versionFile, 'utf8');
163
- const match = content.match(/^version=(.+)$/m);
164
- return match ? match[1].trim() : VERSION;
165
- }
166
-
167
- /**
168
- * Main initialization sequence:
169
- * 1. Create directory structure (idempotent).
170
- * 2. Write .version file (first run only).
171
- * 3. Write README (first run only).
172
- * 4. Run migrations to update version stamp.
173
- * 5. Print status to stdout (suppressed when CLAWPOWERS_QUIET=1).
174
- */
175
- function main() {
176
- const created = createStructure();
177
- writeVersion();
178
- writeReadme();
179
- writeConfig();
180
-
181
- // Only run migrations when .version exists (i.e., after writeVersion)
182
- if (fs.existsSync(path.join(CLAWPOWERS_DIR, '.version'))) {
183
- runMigrations();
184
- }
185
-
186
- // CLAWPOWERS_QUIET=1 suppresses output when called from session-start hook
187
- // so the hook's JSON output isn't polluted with init messages
188
- if (process.env.CLAWPOWERS_QUIET !== '1') {
189
- if (created > 0) {
190
- console.log(`ClawPowers runtime initialized at ${CLAWPOWERS_DIR}`);
191
- console.log(` Directories created: ${created}`);
192
- console.log(` Version: ${VERSION}`);
193
- } else {
194
- console.log(`ClawPowers runtime already initialized at ${CLAWPOWERS_DIR}`);
195
- console.log(` Version: ${getStoredVersion()}`);
196
- }
197
- }
198
- }
199
-
200
- // Only run main() when executed directly; allow require() without side effects
201
- if (require.main === module) {
202
- try {
203
- main();
204
- } catch (err) {
205
- process.stderr.write(`Error: ${err.message}\n`);
206
- process.exit(1);
207
- }
208
- }
209
-
210
- module.exports = { main, CLAWPOWERS_DIR, VERSION, writeConfig, DEFAULT_CONFIG };
package/runtime/init.sh DELETED
@@ -1,178 +0,0 @@
1
- #!/usr/bin/env bash
2
- # runtime/init.sh — Initialize the ClawPowers runtime directory structure
3
- #
4
- # Creates ~/.clawpowers/ with all required subdirectories on first run.
5
- # Safe to run multiple times (idempotent).
6
- #
7
- # Usage:
8
- # bash runtime/init.sh
9
- # npx clawpowers init
10
- set -euo pipefail
11
-
12
- # Runtime root — override with CLAWPOWERS_DIR env var for testing or custom locations
13
- CLAWPOWERS_DIR="${CLAWPOWERS_DIR:-$HOME/.clawpowers}"
14
- VERSION="1.1.1"
15
-
16
- ## === Directory Setup ===
17
-
18
- # Creates all required runtime subdirectories.
19
- # Each directory is created with mode 700 (owner-only) so skill state
20
- # and metrics aren't readable by other users on the system.
21
- # Prints the count of newly created directories (0 if already initialized).
22
- create_structure() {
23
- local dirs=(
24
- "$CLAWPOWERS_DIR" # Root runtime directory
25
- "$CLAWPOWERS_DIR/state" # Key-value persistence (store.sh / store.js)
26
- "$CLAWPOWERS_DIR/metrics" # Skill outcome JSONL logs, rotated monthly
27
- "$CLAWPOWERS_DIR/checkpoints" # Resumable plan state (executing-plans skill)
28
- "$CLAWPOWERS_DIR/feedback" # RSI analysis reports (analyze.sh / analyze.js)
29
- "$CLAWPOWERS_DIR/memory" # Cross-session knowledge base
30
- "$CLAWPOWERS_DIR/logs" # Debug and audit logs
31
- )
32
-
33
- local created=0
34
- for dir in "${dirs[@]}"; do
35
- if [[ ! -d "$dir" ]]; then
36
- mkdir -p "$dir"
37
- chmod 700 "$dir"
38
- # Bash arithmetic in set -e contexts requires || true to suppress exit on 0-return
39
- ((created++)) || true
40
- fi
41
- done
42
-
43
- echo "$created"
44
- }
45
-
46
- ## === Version File ===
47
-
48
- # Writes .version on first initialization. Contains the ClawPowers version and
49
- # an ISO timestamp so we can track install date and run future migrations.
50
- # No-op if the file already exists.
51
- write_version() {
52
- local version_file="$CLAWPOWERS_DIR/.version"
53
- if [[ ! -f "$version_file" ]]; then
54
- cat > "$version_file" << EOF
55
- version=$VERSION
56
- initialized=$(date -u +%Y-%m-%dT%H:%M:%SZ)
57
- EOF
58
- # 0o600 = owner read/write only
59
- chmod 600 "$version_file"
60
- fi
61
- }
62
-
63
- ## === README ===
64
-
65
- # Writes a human-readable README into CLAWPOWERS_DIR explaining its purpose.
66
- # Helps users who discover the directory understand what it is and that it
67
- # is safe to delete (ClawPowers recreates it on next run).
68
- # No-op if the README already exists.
69
- write_readme() {
70
- local readme="$CLAWPOWERS_DIR/README"
71
- if [[ ! -f "$readme" ]]; then
72
- # Single-quoted heredoc prevents variable expansion inside the README
73
- cat > "$readme" << 'EOF'
74
- ClawPowers Runtime Directory
75
- ============================
76
-
77
- This directory is managed by ClawPowers (https://github.com/up2itnow0822/clawpowers).
78
-
79
- Directory Structure:
80
- state/ Key-value state store for skill data (managed by persistence/store.sh)
81
- metrics/ Skill execution outcome logs in JSONL format
82
- checkpoints/ Resumable workflow state (created by executing-plans skill)
83
- feedback/ RSI analysis output and recommendations
84
- memory/ Cross-session knowledge base
85
- logs/ Debug and audit logs
86
-
87
- Safe to delete: Yes — ClawPowers recreates this directory on next init.
88
- Never share: Contains agent state and potentially sensitive workflow data.
89
-
90
- Manage with: npx clawpowers status
91
- EOF
92
- chmod 600 "$readme"
93
- fi
94
- }
95
-
96
- ## === Config File ===
97
-
98
- # Writes the default config.json on first initialization.
99
- # No-op if config.json already exists — user settings are always preserved.
100
- # The file is written with mode 600 (owner read/write only).
101
- write_config() {
102
- local config_file="$CLAWPOWERS_DIR/config.json"
103
- if [[ ! -f "$config_file" ]]; then
104
- cat > "$config_file" << EOF
105
- {
106
- "version": "$VERSION",
107
- "payments": {
108
- "enabled": false,
109
- "mode": "dry_run",
110
- "per_tx_limit_usd": 0,
111
- "daily_limit_usd": 0,
112
- "weekly_limit_usd": 0,
113
- "allowlist": [],
114
- "require_approval_above_usd": 0
115
- },
116
- "telemetry": {
117
- "enabled": false
118
- },
119
- "skills": {
120
- "auto_load": true
121
- }
122
- }
123
- EOF
124
- chmod 600 "$config_file"
125
- fi
126
- }
127
-
128
- ## === Migrations ===
129
-
130
- # Updates the version stamp in .version to the current version.
131
- # Placeholder for future schema migrations (e.g., restructuring state/ layout).
132
- # The sed command replaces the version= line in place; .bak is cleaned up immediately.
133
- run_migrations() {
134
- local current_version
135
- # current_version=$(grep "^version=" "$CLAWPOWERS_DIR/.version" 2>/dev/null | cut -d= -f2 || echo "0.0.0")
136
-
137
- # Future migration hooks go here, e.g.:
138
- # if [[ "$current_version" < "2.0.0" ]]; then
139
- # migrate_v1_to_v2
140
- # fi
141
-
142
- # Always update the version stamp to reflect the currently running version
143
- sed -i.bak "s/^version=.*/version=$VERSION/" "$CLAWPOWERS_DIR/.version" 2>/dev/null || true
144
- rm -f "$CLAWPOWERS_DIR/.version.bak"
145
- }
146
-
147
- ## === Main ===
148
-
149
- main() {
150
- local created
151
- created=$(create_structure)
152
-
153
- write_version
154
- write_readme
155
- write_config
156
-
157
- # Migrations only apply when the version file exists (guaranteed after write_version)
158
- if [[ -f "$CLAWPOWERS_DIR/.version" ]]; then
159
- run_migrations
160
- fi
161
-
162
- # CLAWPOWERS_QUIET=1 suppresses all output when called from a hook or
163
- # another script that needs clean stdout (e.g., session-start emitting JSON)
164
- if [[ "${CLAWPOWERS_QUIET:-}" != "1" ]]; then
165
- if [[ $created -gt 0 ]]; then
166
- echo "ClawPowers runtime initialized at $CLAWPOWERS_DIR"
167
- echo " Directories created: $created"
168
- echo " Version: $VERSION"
169
- else
170
- echo "ClawPowers runtime already initialized at $CLAWPOWERS_DIR"
171
- local stored_version
172
- stored_version=$(grep "^version=" "$CLAWPOWERS_DIR/.version" | cut -d= -f2)
173
- echo " Version: $stored_version"
174
- fi
175
- fi
176
- }
177
-
178
- main "$@"