claws-code 0.8.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 (180) hide show
  1. package/.claude/commands/claws-auto.md +90 -0
  2. package/.claude/commands/claws-bin.md +28 -0
  3. package/.claude/commands/claws-cleanup.md +28 -0
  4. package/.claude/commands/claws-do.md +82 -0
  5. package/.claude/commands/claws-fix.md +40 -0
  6. package/.claude/commands/claws-goal.md +111 -0
  7. package/.claude/commands/claws-help.md +54 -0
  8. package/.claude/commands/claws-plan.md +103 -0
  9. package/.claude/commands/claws-report.md +29 -0
  10. package/.claude/commands/claws-status.md +37 -0
  11. package/.claude/commands/claws-update.md +32 -0
  12. package/.claude/commands/claws.md +64 -0
  13. package/.claude/rules/claws-default-behavior.md +76 -0
  14. package/.claude/settings.json +112 -0
  15. package/.claude/settings.local.json +19 -0
  16. package/.claude/skills/claws-auto-engine/SKILL.md +97 -0
  17. package/.claude/skills/claws-goal-tracker/SKILL.md +106 -0
  18. package/.claude/skills/claws-prompt-templates/SKILL.md +203 -0
  19. package/.claude/skills/claws-wave-lead/SKILL.md +126 -0
  20. package/.claude/skills/claws-wave-subworker/SKILL.md +60 -0
  21. package/CHANGELOG.md +1949 -0
  22. package/LICENSE +21 -0
  23. package/README.md +420 -0
  24. package/bin/cli.js +84 -0
  25. package/cli.js +223 -0
  26. package/docs/ARCHITECTURE.md +511 -0
  27. package/docs/event-protocol.md +588 -0
  28. package/docs/features.md +562 -0
  29. package/docs/guide.md +891 -0
  30. package/docs/index.html +716 -0
  31. package/docs/protocol.md +323 -0
  32. package/extension/.vscodeignore +15 -0
  33. package/extension/CHANGELOG.md +1906 -0
  34. package/extension/LICENSE +21 -0
  35. package/extension/README.md +137 -0
  36. package/extension/docs/features.md +424 -0
  37. package/extension/docs/protocol.md +197 -0
  38. package/extension/esbuild.mjs +25 -0
  39. package/extension/icon.png +0 -0
  40. package/extension/native/.metadata.json +10 -0
  41. package/extension/native/node-pty/LICENSE +69 -0
  42. package/extension/native/node-pty/README.md +165 -0
  43. package/extension/native/node-pty/lib/conpty_console_list_agent.js +16 -0
  44. package/extension/native/node-pty/lib/conpty_console_list_agent.js.map +1 -0
  45. package/extension/native/node-pty/lib/eventEmitter2.js +47 -0
  46. package/extension/native/node-pty/lib/eventEmitter2.js.map +1 -0
  47. package/extension/native/node-pty/lib/index.js +52 -0
  48. package/extension/native/node-pty/lib/index.js.map +1 -0
  49. package/extension/native/node-pty/lib/interfaces.js +7 -0
  50. package/extension/native/node-pty/lib/interfaces.js.map +1 -0
  51. package/extension/native/node-pty/lib/shared/conout.js +11 -0
  52. package/extension/native/node-pty/lib/shared/conout.js.map +1 -0
  53. package/extension/native/node-pty/lib/terminal.js +190 -0
  54. package/extension/native/node-pty/lib/terminal.js.map +1 -0
  55. package/extension/native/node-pty/lib/types.js +7 -0
  56. package/extension/native/node-pty/lib/types.js.map +1 -0
  57. package/extension/native/node-pty/lib/unixTerminal.js +346 -0
  58. package/extension/native/node-pty/lib/unixTerminal.js.map +1 -0
  59. package/extension/native/node-pty/lib/utils.js +39 -0
  60. package/extension/native/node-pty/lib/utils.js.map +1 -0
  61. package/extension/native/node-pty/lib/windowsConoutConnection.js +125 -0
  62. package/extension/native/node-pty/lib/windowsConoutConnection.js.map +1 -0
  63. package/extension/native/node-pty/lib/windowsPtyAgent.js +320 -0
  64. package/extension/native/node-pty/lib/windowsPtyAgent.js.map +1 -0
  65. package/extension/native/node-pty/lib/windowsTerminal.js +199 -0
  66. package/extension/native/node-pty/lib/windowsTerminal.js.map +1 -0
  67. package/extension/native/node-pty/lib/worker/conoutSocketWorker.js +22 -0
  68. package/extension/native/node-pty/lib/worker/conoutSocketWorker.js.map +1 -0
  69. package/extension/native/node-pty/package.json +64 -0
  70. package/extension/native/node-pty/prebuilds/darwin-arm64/pty.node +0 -0
  71. package/extension/native/node-pty/prebuilds/darwin-arm64/spawn-helper +0 -0
  72. package/extension/native/node-pty/prebuilds/darwin-x64/pty.node +0 -0
  73. package/extension/native/node-pty/prebuilds/darwin-x64/spawn-helper +0 -0
  74. package/extension/native/node-pty/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
  75. package/extension/native/node-pty/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
  76. package/extension/native/node-pty/prebuilds/win32-arm64/conpty.node +0 -0
  77. package/extension/native/node-pty/prebuilds/win32-arm64/conpty_console_list.node +0 -0
  78. package/extension/native/node-pty/prebuilds/win32-arm64/pty.node +0 -0
  79. package/extension/native/node-pty/prebuilds/win32-arm64/winpty-agent.exe +0 -0
  80. package/extension/native/node-pty/prebuilds/win32-arm64/winpty.dll +0 -0
  81. package/extension/native/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
  82. package/extension/native/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
  83. package/extension/native/node-pty/prebuilds/win32-x64/conpty.node +0 -0
  84. package/extension/native/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
  85. package/extension/native/node-pty/prebuilds/win32-x64/pty.node +0 -0
  86. package/extension/native/node-pty/prebuilds/win32-x64/winpty-agent.exe +0 -0
  87. package/extension/native/node-pty/prebuilds/win32-x64/winpty.dll +0 -0
  88. package/extension/package-lock.json +605 -0
  89. package/extension/package.json +343 -0
  90. package/extension/scripts/bundle-native.mjs +104 -0
  91. package/extension/scripts/deploy-dev.mjs +60 -0
  92. package/extension/src/ansi-strip.ts +52 -0
  93. package/extension/src/backends/vscode/claws-pty.ts +483 -0
  94. package/extension/src/backends/vscode/status-bar.ts +99 -0
  95. package/extension/src/backends/vscode/vscode-backend.ts +282 -0
  96. package/extension/src/capture-store.ts +125 -0
  97. package/extension/src/event-log.ts +629 -0
  98. package/extension/src/event-schemas.ts +478 -0
  99. package/extension/src/extension.js +492 -0
  100. package/extension/src/extension.ts +873 -0
  101. package/extension/src/lifecycle-engine.ts +60 -0
  102. package/extension/src/lifecycle-rules.ts +171 -0
  103. package/extension/src/lifecycle-store.ts +506 -0
  104. package/extension/src/peer-registry.ts +176 -0
  105. package/extension/src/pipeline-registry.ts +82 -0
  106. package/extension/src/platform.ts +64 -0
  107. package/extension/src/protocol.ts +532 -0
  108. package/extension/src/server-config.ts +98 -0
  109. package/extension/src/server.ts +2210 -0
  110. package/extension/src/task-registry.ts +51 -0
  111. package/extension/src/terminal-backend.ts +211 -0
  112. package/extension/src/terminal-manager.ts +395 -0
  113. package/extension/src/topic-registry.ts +70 -0
  114. package/extension/src/topic-utils.ts +46 -0
  115. package/extension/src/transport.ts +45 -0
  116. package/extension/src/uninstall-cleanup.ts +232 -0
  117. package/extension/src/wave-registry.ts +314 -0
  118. package/extension/src/websocket-transport.ts +153 -0
  119. package/extension/tsconfig.json +23 -0
  120. package/lib/capabilities.js +145 -0
  121. package/lib/dry-run.js +43 -0
  122. package/lib/install.js +1018 -0
  123. package/lib/mcp-setup.js +92 -0
  124. package/lib/platform.js +240 -0
  125. package/lib/preflight.js +152 -0
  126. package/lib/shell-hook.js +343 -0
  127. package/lib/uninstall.js +162 -0
  128. package/lib/verify.js +166 -0
  129. package/mcp_server.js +3529 -0
  130. package/package.json +48 -0
  131. package/rules/claws-default-behavior.md +72 -0
  132. package/scripts/_helpers/atomic-file.mjs +137 -0
  133. package/scripts/_helpers/fix-repair.js +64 -0
  134. package/scripts/_helpers/json-safe.mjs +218 -0
  135. package/scripts/bump-version.sh +84 -0
  136. package/scripts/codegen/gen-docs.mjs +61 -0
  137. package/scripts/codegen/gen-json-schema.mjs +62 -0
  138. package/scripts/codegen/gen-mcp-tools.mjs +358 -0
  139. package/scripts/codegen/gen-types.mjs +172 -0
  140. package/scripts/codegen/index.mjs +42 -0
  141. package/scripts/dev-hooks/check-extension-dirs.js +77 -0
  142. package/scripts/dev-hooks/check-open-claws-terminals.js +70 -0
  143. package/scripts/dev-hooks/check-stale-main.js +55 -0
  144. package/scripts/dev-hooks/check-tag-pushed.js +51 -0
  145. package/scripts/dev-hooks/check-tag-vs-main.js +56 -0
  146. package/scripts/dev-vsix-install.sh +60 -0
  147. package/scripts/fix.sh +702 -0
  148. package/scripts/gen-client-types.mjs +81 -0
  149. package/scripts/git-hooks/pre-commit +31 -0
  150. package/scripts/hooks/lifecycle-state.js +61 -0
  151. package/scripts/hooks/package.json +4 -0
  152. package/scripts/hooks/post-tool-use-claws.js +292 -0
  153. package/scripts/hooks/pre-bash-no-verify-block.js +72 -0
  154. package/scripts/hooks/pre-tool-use-claws.js +206 -0
  155. package/scripts/hooks/session-start-claws.js +97 -0
  156. package/scripts/hooks/stop-claws.js +88 -0
  157. package/scripts/inject-claude-md.js +205 -0
  158. package/scripts/inject-dev-hooks.js +96 -0
  159. package/scripts/inject-global-claude-md.js +140 -0
  160. package/scripts/inject-settings-hooks.js +370 -0
  161. package/scripts/install.ps1 +146 -0
  162. package/scripts/install.sh +1729 -0
  163. package/scripts/monitor-arm-watch.js +155 -0
  164. package/scripts/rebuild-node-pty.sh +245 -0
  165. package/scripts/report.sh +232 -0
  166. package/scripts/shell-hook.fish +164 -0
  167. package/scripts/shell-hook.ps1 +33 -0
  168. package/scripts/shell-hook.sh +232 -0
  169. package/scripts/stream-events.js +399 -0
  170. package/scripts/terminal-wrapper.sh +36 -0
  171. package/scripts/test-enforcement.sh +132 -0
  172. package/scripts/test-install.sh +174 -0
  173. package/scripts/test-installer-parity.sh +135 -0
  174. package/scripts/test-template-enforcement.sh +76 -0
  175. package/scripts/uninstall.sh +143 -0
  176. package/scripts/update.sh +337 -0
  177. package/scripts/verify-release.sh +323 -0
  178. package/scripts/verify-wrapped.sh +194 -0
  179. package/templates/CLAUDE.global.md +135 -0
  180. package/templates/CLAUDE.project.md +37 -0
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: claws
3
+ description: Master command for Claws terminal orchestration. Shows live status or routes to /claws-do.
4
+ ---
5
+
6
+ ## MANDATORY cold-start sequence — execute in order, no deliberation
7
+
8
+ 1. **Acknowledge in 1 line.** "Got it — <one-sentence task summary>." No more.
9
+ 2. **Do NOT enter plan mode.** This is an ACTION command. If the task is complex
10
+ enough to need a plan, redirect to `/claws-plan` and stop.
11
+ 3. **Do NOT call TodoWrite for the task itself.** Single-MCP-call command.
12
+ 4. **Do NOT pre-verify the sidecar, Monitor, or hooks.** Guaranteed by
13
+ SessionStart in v0.7.13+. Trust the system.
14
+ 5. **Classify the task in 1 sentence.** If you cannot, default to Bucket 2
15
+ (single worker via `claws_worker`).
16
+ 6. **Make the spawn call IMMEDIATELY.** ONE MCP tool call. No prelude.
17
+ 7. **Use the `monitor_arm_command` from the spawn response verbatim.** This MUST
18
+ be the very next tool call after the spawn returns. Any other tool call
19
+ between the spawn and the Monitor arming is a bug — abort and arm the
20
+ Monitor first. (This is Bug 6 Layer 0 — server-side enforcement coming in
21
+ Layers 1+2.)
22
+ 8. **Wait. Don't poll.** When Monitor returns, read output, report, close
23
+ terminal.
24
+
25
+ If a PreToolUse hook denies a call, READ the error message — it tells you what's
26
+ wrong. Don't loop or work around. Almost always: sidecar missing, advise user
27
+ to reload VS Code rather than trying to start it manually.
28
+
29
+ If you find yourself deliberating between steps, you've already failed cold
30
+ start. Just classify and act.
31
+
32
+ ---
33
+
34
+ # /claws [task]
35
+
36
+ ## What this does
37
+ Context-aware master command. With no arguments it shows a live dashboard of all active terminals and the Claws version. With arguments it forwards the request to /claws-do so you never need to remember which command to use.
38
+
39
+ ## Behavior
40
+
41
+ **No arguments — show status dashboard:**
42
+ - Call `claws_list` to enumerate all active terminals
43
+ - Read the first version line from CHANGELOG.md for the Claws version
44
+ - Format terminals as a table: ID | Name | Wrapped | PID
45
+ - End with: "Type /claws-do '<task>' to do anything. /claws-help for the full reference."
46
+
47
+ **If `.claws/claws.sock` is absent:**
48
+ - "Claws is not active. Reload VS Code: Cmd+Shift+P → Developer: Reload Window."
49
+ - If `~/.claws-src` is missing: "Claws is not installed — contact your project owner."
50
+
51
+ **With arguments:**
52
+ - Treat the arguments as a task and execute /claws-do behavior directly.
53
+ - Do not ask clarifying questions — classify and act.
54
+
55
+ ## Examples
56
+ ```
57
+ /claws
58
+ /claws fix the failing test in auth.test.ts
59
+ /claws run npm test and show me the output
60
+ ```
61
+
62
+ ## When NOT to use
63
+ If you want the full command reference, use /claws-help.
64
+ If you want to close terminals, use /claws-cleanup.
@@ -0,0 +1,76 @@
1
+ > **Scope note**: This file is loaded by the ECC plugin's `SessionStart` hook as a system-reminder.
2
+ > It is NOT auto-loaded by stock Claude Code. The canonical imperative rules that every Claude
3
+ > session sees are in the `CLAWS:BEGIN` block injected into `CLAUDE.md` by `scripts/inject-claude-md.js`.
4
+ > This file is a supplement for ECC users — do not rely on it as the sole enforcement layer.
5
+
6
+ ---
7
+
8
+ # Claws — Terminal Behavior Override
9
+
10
+ > Auto-installed by Claws. This rule OVERRIDES default terminal behavior.
11
+
12
+ ## Never block the orchestrator
13
+
14
+ `claws_fleet` and `claws_worker` are **non-blocking by default** — they spawn terminals and return `terminal_ids` within seconds. The MCP stdio transport cannot safely hold a response open for more than a few seconds; blocking the socket stalls the entire orchestrator session. Always fire-and-return, then poll completion via `claws_workers_wait` or by reading `.local/audits/` files on disk. Blocking modes (`wait:true` / `detach:false`) are opt-in and flagged unsafe.
15
+
16
+ ## MANDATORY: when the user invokes any /claws command, you MUST use Claws terminals
17
+
18
+ When the user types `/claws-do`, `/claws-go`, or any `/claws-*` command, you are REQUIRED to create visible terminals via the Claws socket. Do NOT fall back to the Bash tool. Do NOT say "this isn't a Claws task." EVERYTHING asked through a /claws command IS a Claws task.
19
+
20
+ **If MCP tools (claws_list, claws_create, etc.) are available**: use them directly.
21
+
22
+ **If MCP tools are NOT loaded** (new session, MCP not registered): use raw socket calls via `node -e` with `require('net').createConnection('.claws/claws.sock')`. The socket commands are documented in every /claws-* slash command file.
23
+
24
+ **If the socket doesn't exist**: tell the user to reload VS Code (Cmd+Shift+P → Developer: Reload Window).
25
+
26
+ ## For all other work (no /claws prefix), use this behavior:
27
+
28
+ **DO**: run visible work in Claws terminals — builds, tests, deploys, servers, AI workers, refactoring, audits. The user watches it happen live in their VS Code terminal panel.
29
+
30
+ **DO**: use `claws_worker` when the user asks to "fix", "refactor", "audit", or any complex task. This spawns a Claude Code session with full permissions that the user can watch.
31
+
32
+ **DO**: spawn parallel terminals for independent tasks. "lint + test + build" = 3 terminals, all running simultaneously.
33
+
34
+ **DO**: always create wrapped terminals (`wrapped=true`). Always close them when done.
35
+
36
+ **USE BASH DIRECTLY FOR**: quick lookups — `ls`, `cat`, `git status`, `grep`, file reads. No terminal needed.
37
+
38
+ ## Pattern matching — what the user says → what you do
39
+
40
+ "run tests" / "run the build" / "lint the code"
41
+ → `claws_create` wrapped → `claws_send` the command → `claws_read_log` → report → `claws_close`
42
+
43
+ "run lint, test, and build" / "do these in parallel"
44
+ → 3x `claws_create` → send all 3 commands → monitor all 3 → close all → aggregate report
45
+
46
+ "fix the bug" / "refactor this" / "audit the code" / "write tests for X"
47
+ → `claws_worker` with the mission → monitor via `claws_read_log` → report → close
48
+
49
+ "start the server" / "watch for crashes"
50
+ → `claws_create` wrapped → send start command → monitor → restart if crash detected
51
+
52
+ "spawn a worker" / "launch claude in a terminal"
53
+ → `claws_worker` — auto-launches Claude Code with `--dangerously-skip-permissions`
54
+
55
+ "what's running" / "show me the terminals"
56
+ → `claws_list` → format as dashboard
57
+
58
+ "clean up" / "close the workers"
59
+ → `claws_list` → close all worker terminals → confirm
60
+
61
+ ## Terminal naming
62
+
63
+ Always descriptive: `worker-tests`, `worker-lint`, `build-server`, `ai-refactor`, `deploy-staging`.
64
+ Never generic: `terminal`, `shell`, `worker-1`.
65
+
66
+ ## Cleanup is non-negotiable
67
+
68
+ Every `claws_create` must have a matching `claws_close`. At the end of any orchestration, run `claws_list` and close anything you own that's still open. Stale terminals are a bug.
69
+
70
+ ## Never headless
71
+
72
+ When spawning Claude Code in a worker terminal:
73
+ - ALWAYS: `claude --dangerously-skip-permissions` (interactive, visible TUI)
74
+ - NEVER: `claude -p "..."` (headless, invisible)
75
+
76
+ The user must see every AI worker in their terminal panel.
@@ -0,0 +1,112 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/claude-code-settings.json",
3
+ "permissions": {
4
+ "allow": [
5
+ "Read",
6
+ "Write",
7
+ "Edit",
8
+ "MultiEdit",
9
+ "Bash",
10
+ "Glob",
11
+ "Grep"
12
+ ]
13
+ },
14
+ "hooks": {
15
+ "SessionStart": [
16
+ {
17
+ "_source": "claws-dev-hooks",
18
+ "matcher": "*",
19
+ "hooks": [
20
+ {
21
+ "type": "command",
22
+ "command": "node \"/Users/ANISH.NEUNAHA/Desktop/Claws/.claws-bin/dev-hooks/check-stale-main.js\""
23
+ }
24
+ ]
25
+ },
26
+ {
27
+ "_source": "claws-dev-hooks",
28
+ "matcher": "*",
29
+ "hooks": [
30
+ {
31
+ "type": "command",
32
+ "command": "node \"/Users/ANISH.NEUNAHA/Desktop/Claws/.claws-bin/dev-hooks/check-extension-dirs.js\""
33
+ }
34
+ ]
35
+ }
36
+ ],
37
+ "PostToolUse": [
38
+ {
39
+ "_source": "claws-dev-hooks",
40
+ "matcher": "Bash",
41
+ "hooks": [
42
+ {
43
+ "type": "command",
44
+ "command": "node \"/Users/ANISH.NEUNAHA/Desktop/Claws/.claws-bin/dev-hooks/check-tag-pushed.js\""
45
+ }
46
+ ]
47
+ },
48
+ {
49
+ "_source": "claws-dev-hooks",
50
+ "matcher": "Bash",
51
+ "hooks": [
52
+ {
53
+ "type": "command",
54
+ "command": "node \"/Users/ANISH.NEUNAHA/Desktop/Claws/.claws-bin/dev-hooks/check-tag-vs-main.js\""
55
+ }
56
+ ]
57
+ },
58
+ {
59
+ "_source": "claws",
60
+ "matcher": "mcp__claws__claws_create",
61
+ "hooks": [
62
+ {
63
+ "type": "command",
64
+ "command": "node \"/Users/ANISH.NEUNAHA/.claws-src/scripts/hooks/post-tool-use-claws.js\""
65
+ }
66
+ ]
67
+ },
68
+ {
69
+ "_source": "claws",
70
+ "matcher": "mcp__claws__claws_worker",
71
+ "hooks": [
72
+ {
73
+ "type": "command",
74
+ "command": "node \"/Users/ANISH.NEUNAHA/.claws-src/scripts/hooks/post-tool-use-claws.js\""
75
+ }
76
+ ]
77
+ },
78
+ {
79
+ "_source": "claws",
80
+ "matcher": "mcp__claws__claws_fleet",
81
+ "hooks": [
82
+ {
83
+ "type": "command",
84
+ "command": "node \"/Users/ANISH.NEUNAHA/.claws-src/scripts/hooks/post-tool-use-claws.js\""
85
+ }
86
+ ]
87
+ },
88
+ {
89
+ "_source": "claws",
90
+ "matcher": "mcp__claws__claws_dispatch_subworker",
91
+ "hooks": [
92
+ {
93
+ "type": "command",
94
+ "command": "node \"/Users/ANISH.NEUNAHA/.claws-src/scripts/hooks/post-tool-use-claws.js\""
95
+ }
96
+ ]
97
+ }
98
+ ],
99
+ "Stop": [
100
+ {
101
+ "_source": "claws-dev-hooks",
102
+ "matcher": "*",
103
+ "hooks": [
104
+ {
105
+ "type": "command",
106
+ "command": "node \"/Users/ANISH.NEUNAHA/Desktop/Claws/.claws-bin/dev-hooks/check-open-claws-terminals.js\""
107
+ }
108
+ ]
109
+ }
110
+ ]
111
+ }
112
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Read(//Users/ANISH.NEUNAHA/.claude/**)",
5
+ "Bash(git checkout *)",
6
+ "Bash(HOME=/tmp/claws-verify-fakehome rm -rf /tmp/claws-verify-fakehome)",
7
+ "Bash(mkdir -p /tmp/claws-verify-fakehome/.claude)",
8
+ "Bash(HOME=/tmp/claws-verify-fakehome node /Users/ANISH.NEUNAHA/Desktop/Claws/scripts/inject-settings-hooks.js)",
9
+ "Read(//tmp/claws-verify-fakehome/.claude/**)",
10
+ "Bash(mv /Users/ANISH.NEUNAHA/.vscode/extensions/neunaha.claws-0.7.2 /Users/ANISH.NEUNAHA/.vscode/extensions/neunaha.claws-0.7.3)",
11
+ "Read(//Users/ANISH.NEUNAHA/.vscode/extensions/**)",
12
+ "Bash(node -e \"console.log\\(require\\('/Users/ANISH.NEUNAHA/.vscode/extensions/neunaha.claws-0.7.3/package.json'\\).version\\)\")",
13
+ "Bash(node -e ' *)"
14
+ ]
15
+ },
16
+ "enabledMcpjsonServers": [
17
+ "claws"
18
+ ]
19
+ }
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: claws-auto-engine
3
+ description: Autonomous orchestration loop engine used by /claws-auto. Wave dispatch, inter-wave audit, failure recovery, time-budget tracking.
4
+ type: skill
5
+ ---
6
+
7
+ # Skill: claws-auto-engine
8
+
9
+ The engine that powers `/claws-auto`. Describes the wave loop, dispatch protocol, inter-wave audit, failure recovery, and budget tracking.
10
+
11
+ ## Wave loop (top-level algorithm)
12
+
13
+ ```
14
+ startedAt = now()
15
+ waveNum = 1
16
+ budget = { maxWaves: 6, maxMinutes: 90 }
17
+
18
+ while not goalMet and not budgetExhausted:
19
+ workers = planWave(waveNum, goalState) // max 4 workers
20
+ results = dispatchAndWait(workers) // see dispatch protocol
21
+ goalState = auditWave(results) // inter-wave audit
22
+ updateProgress(waveNum, goalState) // write PROGRESS.md
23
+ if hasFatalFailure(results): recoverOrSurface() // at most 1 recovery wave
24
+ waveNum++
25
+ budgetExhausted = (waveNum > budget.maxWaves)
26
+ or (elapsedMin() > budget.maxMinutes)
27
+
28
+ writeFinalSection(goalState) // DONE or BLOCKED section in PROGRESS.md
29
+ ```
30
+
31
+ ## Dispatch protocol
32
+
33
+ For each worker in a wave:
34
+ 1. `claws_worker(name=..., mission=..., detach=true)` → response includes `terminal_id` + `monitor_arm_command`
35
+ 2. `Monitor(command=response.monitor_arm_command, ...)` — MUST be the very next tool call after step 1
36
+ 3. After all dispatches + arms: wait for all Monitors to return (all workers signal completion)
37
+ 4. `claws_close(id)` for any terminal that did not auto-close
38
+
39
+ **Max concurrent workers per wave: 4.** Exceeding this limit is a hard violation.
40
+
41
+ ## Mission constraints (enforced every wave)
42
+
43
+ - Mission text < 500 words (`[[Compact missions]]`)
44
+ - No literal completion marker in mission body (`[[Don't put literal marker in mission]]`)
45
+ - Code-touching missions include: "this change must work identically on darwin, linux, and win32" (`[[Tri-platform first]]`)
46
+ - Workers that push must `git pull --rebase origin <branch>` before push
47
+
48
+ ## Inter-wave audit
49
+
50
+ After every wave, before planning the next:
51
+ 1. Read `.claws/events.log` for any ERROR events from workers
52
+ 2. Read worker pty logs (via `claws_read_log`) for failure signals if any worker did not complete cleanly
53
+ 3. Check that expected commits landed: `git log --oneline -10`
54
+ 4. Run `npx tsc --noEmit` if any `.ts` files were edited
55
+ 5. Write audit summary to `PROGRESS.md` under the completed wave
56
+
57
+ Audit is synchronous and non-blocking — do NOT ask the user to confirm.
58
+
59
+ ## Failure recovery protocol
60
+
61
+ On wave failure:
62
+ 1. Classify: is this a **transient** failure (network, timing) or a **structural** failure (design ambiguity, missing credentials)?
63
+ 2. **Transient**: spawn a recovery wave (max 1 recovery per original wave) that targets only the failed worker's scope
64
+ 3. **Structural**: surface to user with a specific question and the evidence trail from the logs
65
+ 4. Log the failure + recovery attempt in `PROGRESS.md`
66
+
67
+ Never silently swallow a failure. Every ERROR event must appear in `PROGRESS.md`.
68
+
69
+ ## PROGRESS.md structure
70
+
71
+ ```markdown
72
+ # Auto run: <goal>
73
+ **Started**: ISO-8601 **Budget**: 6 waves / 90 min
74
+
75
+ ## Wave 1 — <name>
76
+ **Dispatched**: <worker names>
77
+ **Result**: green | partial | failed
78
+ **Commits**: <git log --oneline output>
79
+ **Audit notes**: <key findings>
80
+
81
+ ## Wave 2 — ...
82
+
83
+ ## DONE / BLOCKED
84
+ <summary of outcome>
85
+ ```
86
+
87
+ ## Time-budget tracking
88
+
89
+ Track elapsed time from `startedAt`. At each inter-wave audit:
90
+ - If `elapsedMin() > 75`: warn in `PROGRESS.md` — "approaching budget, will stop after this wave"
91
+ - If `elapsedMin() > 90` OR `waveNum > 6`: write BLOCKED section and stop
92
+
93
+ ## References
94
+
95
+ - `.claude/commands/claws-auto.md` — the slash command that invokes this skill
96
+ - `.claude/skills/claws-wave-lead/SKILL.md` — LEAD dispatch protocol (used for Bucket 4 waves)
97
+ - `.claude/skills/claws-prompt-templates/SKILL.md` — mission text patterns
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: claws-goal-tracker
3
+ description: Goal decomposition + tracking skill used by /claws-goal. Breakdown heuristics, clarifying-question pattern, task-status protocol.
4
+ type: skill
5
+ ---
6
+
7
+ # Skill: claws-goal-tracker
8
+
9
+ The engine that powers `/claws-goal`. Describes how to decompose a goal, when to ask clarifying questions, and how to manage task status throughout execution.
10
+
11
+ ## Goal classification
12
+
13
+ Classify every incoming goal into one of these types before decomposing:
14
+
15
+ | Type | Signals | Typical subtask count |
16
+ |------|---------|----------------------|
17
+ | bug-fix | "fix", "broken", "regression", error trace | 3–5 |
18
+ | feature | "add", "implement", "build", "support" | 4–7 |
19
+ | refactor | "clean up", "restructure", "extract", "rename" | 3–5 |
20
+ | release | "ship", "publish", "tag", "release" | 5–7 |
21
+ | audit | "audit", "review", "analyse", "check all" | 3–5 |
22
+ | docs | "document", "update README", "write guide" | 3–4 |
23
+
24
+ If the goal spans two types, pick the dominant one and note the secondary in the root task description.
25
+
26
+ ## Decomposition heuristics
27
+
28
+ Break the goal into 3–7 subtasks. Each subtask must be:
29
+ - **Atomic** — completable in one work session without sub-decomposition
30
+ - **Verifiable** — has a clear done-signal (tests green, file exists, command exits 0)
31
+ - **Scoped** — touches a named file, module, or output
32
+
33
+ Prefer this ordering:
34
+ 1. Read/understand first (if needed) — no edits
35
+ 2. Prerequisite changes (types, schemas, config) before consumer changes
36
+ 3. Core implementation
37
+ 4. Tests — write before or alongside core (TDD preferred)
38
+ 5. Documentation / changelog (if required)
39
+ 6. Smoke/validation step last
40
+
41
+ **Never** create a subtask like "do the rest" or "clean up" — be specific.
42
+
43
+ ## Clarifying-question pattern
44
+
45
+ Ask clarifying questions ONLY when both conditions are true:
46
+ - The scope cannot be determined from the goal text + reading the codebase
47
+ - Two or more valid approaches exist with meaningfully different file or API surfaces
48
+
49
+ Format: numbered list, one sentence each. Example:
50
+ ```
51
+ Two things to clarify before I start:
52
+ 1. Should the WebSocket transport run alongside the Unix socket, or replace it?
53
+ 2. Is token auth required in this phase, or deferred to Phase 4?
54
+ ```
55
+
56
+ Absolute cap: 2 questions. If you need more than 2, you're over-scoping — narrow the goal first.
57
+
58
+ After the user answers (or if no questions are needed), begin Subtask 1 immediately.
59
+
60
+ ## Task-status protocol
61
+
62
+ Every subtask follows this lifecycle:
63
+
64
+ ```
65
+ pending → in_progress → completed
66
+
67
+ blocked (if question needed)
68
+
69
+ in_progress (after user answers)
70
+ ```
71
+
72
+ Tool calls:
73
+ - `TaskCreate(title=..., status="pending")` — on decomposition
74
+ - `TaskUpdate(id=..., status="in_progress")` — when you start the subtask
75
+ - `TaskUpdate(id=..., status="completed", notes="<one-line summary>")` — when done and verified
76
+ - `TaskUpdate(id=..., status="blocked", notes="<specific question>")` — when blocked
77
+
78
+ Never mark a subtask `completed` before verification (tests pass, no type errors).
79
+
80
+ ## User checkpoint protocol
81
+
82
+ Pause for user confirmation before moving to the next subtask when the completed subtask:
83
+ - Made commits to the local branch
84
+ - Deleted or renamed files
85
+ - Ran a destructive shell command
86
+ - Called an external API or service
87
+
88
+ For non-destructive subtasks (read-only analysis, adding new files, editing without committing), proceed to the next subtask without a checkpoint.
89
+
90
+ Report format after each subtask:
91
+ ```
92
+ Subtask N complete: <one-sentence result>. Proceed to subtask N+1?
93
+ ```
94
+
95
+ ## Failure inside a subtask
96
+
97
+ If a subtask cannot be completed:
98
+ 1. Try up to 2 approaches within the same subtask (log each attempt)
99
+ 2. If still blocked: `TaskUpdate(status="blocked")`, surface the specific obstacle to the user
100
+ 3. Never silently skip a blocked subtask — always surface it
101
+
102
+ ## References
103
+
104
+ - `.claude/commands/claws-goal.md` — the slash command that invokes this skill
105
+ - `.claude/commands/claws-plan.md` — use for pre-work context engineering on complex features
106
+ - `.claude/skills/claws-prompt-templates/SKILL.md` — if the subtask spawns a worker, use these templates
@@ -0,0 +1,203 @@
1
+ ---
2
+ name: claws-prompt-templates
3
+ description: Production-grade prompt templates for crafting Claws worker missions. Patterns for mission text, completion markers, and hard gates.
4
+ type: skill
5
+ ---
6
+
7
+ # Claws Prompt Templates
8
+
9
+ Patterns for crafting mission text sent to Claws workers. The boot mechanics are handled by `claws_worker` / `claws_fleet` — these templates are about what you put in the `mission` field.
10
+
11
+ ## NEVER write the literal completion marker inside mission text
12
+
13
+ **Hard rule:** the literal all-caps `__CLAWS` + `_DONE__` string must not appear anywhere inside the `mission` field you pass to `claws_worker` / `claws_fleet` / `claws_dispatch_subworker`. The pty marker scanner can fire on those bytes during the bracketed-paste of the mission itself, closing the worker terminal before Claude has read the mission. Wave L (`_sendAndSubmitMission` post-paste `markerScanFrom` snapshot) makes this much less likely, but the protocol-level rule remains universal.
14
+
15
+ **Safe placements** (these run AFTER the mission is delivered, so the scanner is past the paste window):
16
+ - F4 shell command: `printf '%s\n' '__CLAWS_DONE__'` — Bash command, not pasted text.
17
+ - F5 chat-narration final line — emitted by Claude after the worker has fully processed the mission.
18
+
19
+ **Inside the mission body, always paraphrase**: "the standard Claws completion sentinel", "the all-caps completion marker", "the `__CLAWS` prefix + `_DONE__` suffix", "the canonical worker-done marker". Templates below use those paraphrases.
20
+
21
+ ## Core rules for every mission
22
+
23
+ 1. **End with a paraphrased completion-marker instruction**: `print the standard Claws completion sentinel when done. go.`
24
+ 2. **Include F1–F5 final actions** for missions that commit code:
25
+ - F1: `git status --short` — verify clean working tree
26
+ - F2: `git log --oneline -5` — verify commits landed
27
+ - F3 (PRIMARY): `claws_done()` — zero-arg MCP completion (publishes system.worker.completed and closes terminal)
28
+ - F4 (BACKUP): `printf '%s\n' '__CLAWS_DONE__'` — shell command (executes after mission, so the marker bytes appear post-paste; safe)
29
+ - F5 (BACKUP): end final assistant message with the all-caps completion marker on its own line
30
+ 3. **Set hard gates**: "all tests must pass before commit", "zero tsc errors", "no --no-verify"
31
+ 4. **Scope constraints explicitly**: list what files are off-limits
32
+
33
+ ---
34
+
35
+ ## Template 1 — Single Mission Worker
36
+
37
+ ```
38
+ new mission. one task, one deliverable, exit when done.
39
+
40
+ context: [2-3 sentences the worker needs]
41
+
42
+ your job: [clear, specific objective in one sentence]
43
+
44
+ steps:
45
+ 1. [first concrete action]
46
+ 2. [second concrete action]
47
+ 3. [verification — npm test or equivalent; must be green]
48
+ 4. [commit with conventional commit message — no --no-verify]
49
+
50
+ final actions:
51
+ F1: git status --short
52
+ F2: git log --oneline -5
53
+ F3: claws_done()
54
+ F4: printf '%s\n' '__CLAWS_DONE__' ← shell command; safe (post-paste)
55
+ F5: end final message with the all-caps completion marker on its own line
56
+
57
+ constraints:
58
+ - do not edit files outside [scope]
59
+ - do not push
60
+ - all tests must pass before committing
61
+ - zero tsc errors after any .ts edit
62
+
63
+ print the standard Claws completion sentinel when done. go.
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Template 2 — Analysis / Audit (read-only)
69
+
70
+ ```
71
+ analysis mission. read-only except for the output file.
72
+
73
+ context: [what prompted this, what prior work exists]
74
+
75
+ your job: [specific question to answer]
76
+
77
+ method:
78
+ 1. [primary data source]
79
+ 2. [secondary source or comparison]
80
+ 3. [specific computation or comparison]
81
+
82
+ output: write findings to [output-path] with sections:
83
+ (a) [metrics table]
84
+ (b) [ranked recommendations]
85
+ (c) [evidence trail]
86
+
87
+ constraints:
88
+ - do not edit any file outside [output-path]
89
+ - do not commit
90
+ - numbers first, prose light
91
+
92
+ F1: git status --short
93
+ F2: git log --oneline -3
94
+ F3: claws_done()
95
+ F4: printf '%s\n' '__CLAWS_DONE__' ← shell command; safe (post-paste)
96
+ F5: end final message with the all-caps completion marker on its own line
97
+
98
+ print the standard Claws completion sentinel when done. go.
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Template 3 — Multi-Commit Implementation
104
+
105
+ ```
106
+ implementation mission. ship [N] commits in sequence.
107
+
108
+ context: [reference to the plan that produced these changes]
109
+
110
+ commit plan:
111
+ 1. [description] — edit [files] — message: "[exact message]"
112
+ 2. [description] — edit [files] — message: "[exact message]"
113
+
114
+ for each commit:
115
+ 1. make the edits
116
+ 2. npx tsc --noEmit — zero errors required
117
+ 3. npm test — zero failures required
118
+ 4. git add [specific files] && git commit -m "[message]"
119
+
120
+ if a commit fails verification after 3 retries, write [slug]-FAILED.status and stop.
121
+
122
+ F1: git status --short
123
+ F2: git log --oneline -5
124
+ F3: claws_done()
125
+ F4: printf '%s\n' '__CLAWS_DONE__' ← shell command; safe (post-paste)
126
+ F5: end final message with the all-caps completion marker on its own line
127
+
128
+ constraints:
129
+ - do not push
130
+ - no --no-verify
131
+
132
+ print the standard Claws completion sentinel when done. go.
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Template 4 — Parallel Fleet Worker
138
+
139
+ ```
140
+ worker [A/B/C] of [N]. do not coordinate with other workers.
141
+
142
+ your scope: [specific subset of the work]
143
+
144
+ shared context: [background all workers share]
145
+
146
+ your specific mission: [what THIS worker does]
147
+
148
+ output: write to [worker-specific-output-path]
149
+
150
+ constraints:
151
+ - edit ONLY files in your scope
152
+ - if you need to touch a shared file, write to a temp path and flag it for manual merge
153
+ - do not commit unless instructed
154
+
155
+ F1: git status --short
156
+ F2: git log --oneline -3
157
+ F3: claws_done()
158
+ F4: printf '%s\n' '__CLAWS_DONE__' ← shell command; safe (post-paste)
159
+ F5: end final message with the all-caps completion marker on its own line
160
+
161
+ print the standard Claws completion sentinel when done. go.
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Anti-patterns
167
+
168
+ **Vague objective** — worker wastes tokens exploring:
169
+ ```
170
+ # BAD
171
+ look at the codebase and suggest improvements
172
+
173
+ # GOOD
174
+ read extension/src/server.ts lines 120-180. identify which event handlers lack error boundaries. write findings to /tmp/audit.md as a table: handler × line × missing-guard.
175
+ ```
176
+
177
+ **Missing constraints** — worker may commit, push, or run expensive ops:
178
+ ```
179
+ # BAD
180
+ fix the bug in auth.ts
181
+
182
+ # GOOD
183
+ fix the KeyError at auth.ts:87. do not commit. do not push. edit only auth.ts.
184
+ ```
185
+
186
+ **Missing completion marker** — watcher cannot detect completion:
187
+ ```
188
+ # BAD
189
+ do the thing and tell me when done
190
+
191
+ # GOOD
192
+ ...print the standard Claws completion sentinel when done. go.
193
+ ```
194
+
195
+ **Literal marker in mission body** — pty scanner fires mid-paste, terminal closes before Claude reads the mission:
196
+ ```
197
+ # BAD
198
+ do the thing then print __CLAWS_DONE__ to exit. go.
199
+
200
+ # GOOD
201
+ do the thing then print the standard Claws completion sentinel to exit. go.
202
+ ```
203
+ Reason: the bracketed-paste of the mission echoes those bytes through the pty, and the marker scanner can match before `markerScanFrom` is updated post-paste. The literal marker is safe in F4 (shell command) and F5 (chat narration after mission processing) — never in the mission body itself.