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,90 @@
1
+ ---
2
+ name: claws-auto
3
+ description: Autonomous orchestration loop. Plans, dispatches waves, audits between waves, self-corrects on failures, stops when goal met or budget exhausted.
4
+ ---
5
+
6
+ ## MANDATORY cold-start sequence — execute in order, no deliberation
7
+
8
+ 1. **Acknowledge in 1 line.** "Autonomous run: <one-sentence goal summary>." No more.
9
+ 2. **Do NOT enter plan mode.** This command acts immediately after internal planning.
10
+ 3. **Save start time.** Record `startedAt` as ISO timestamp.
11
+ 4. **Create progress doc first.** Write `.local/audits/<goal-slug>/PROGRESS.md` before the first spawn.
12
+ 5. **Dispatch WAVE 1 immediately after the progress doc is written.** No deliberation.
13
+ 6. **Monitor armed within 1 tool call of every spawn.** `monitor_arm_command` from each spawn response MUST be the very next tool call. No exceptions.
14
+
15
+ See `[[Arm Monitor at spawn]]` memory. Violation is a sequencing bug.
16
+
17
+ ---
18
+
19
+ # /claws-auto <goal>
20
+
21
+ ## What this does
22
+ Autonomous orchestration loop. Internally runs `/claws-plan` logic, then dispatches waves of workers, audits between each wave, self-corrects failures, and loops until the goal is met or the time/wave budget is exhausted. Surfaces only genuine blockers as user questions.
23
+
24
+ See skill: `.claude/skills/claws-auto-engine/SKILL.md` for the full loop spec.
25
+
26
+ ## Behavior
27
+
28
+ ### Boot sequence
29
+ ```
30
+ 1. slugify the goal → <goal-slug>
31
+ 2. mkdir -p .local/audits/<goal-slug>/
32
+ 3. write .local/audits/<goal-slug>/PROGRESS.md (header + Wave 1 plan)
33
+ 4. internal /claws-plan logic — read relevant files, decompose into waves
34
+ 5. dispatch Wave 1
35
+ ```
36
+
37
+ ### Wave dispatch protocol
38
+ Each wave:
39
+ 1. Decide workers for this wave (max 4 concurrent)
40
+ 2. For each worker: `claws_worker(name=..., mission=..., detach=true)` → arm Monitor immediately
41
+ 3. Wait for all Monitors (all workers done)
42
+ 4. Run inter-wave audit (read logs, check test output, verify commits)
43
+ 5. Update `PROGRESS.md` with wave result
44
+ 6. If failures: attempt auto-recovery (spawn fix workers) — max 1 recovery wave per failure
45
+ 7. If goal met: write DONE section in `PROGRESS.md`, report to user, stop
46
+ 8. If budget exceeded: write BLOCKED section, surface to user, stop
47
+ 9. Otherwise: dispatch next wave
48
+
49
+ ### User surfacing
50
+ Only stop to ask the user when:
51
+ - A blocker cannot be resolved by a fix wave (e.g., missing credentials, ambiguous design decision)
52
+ - A destructive action is required (force push, drop table, delete non-recoverable data)
53
+ - Budget exhausted without goal completion
54
+
55
+ For all other failures: attempt recovery autonomously.
56
+
57
+ ### Budget
58
+ Default: 6 waves, 90 min wall-clock. After either limit, write the BLOCKED section and stop.
59
+
60
+ ## Mission discipline (enforced)
61
+
62
+ Per `[[Compact missions]]`: every worker mission MUST be under 500 words. Cite file:line references instead of quoting code inline.
63
+
64
+ Per `[[Don't put literal marker in mission]]`: never write the literal completion marker in mission body — paraphrase as "the standard Claws completion sentinel".
65
+
66
+ Per `[[Tri-platform first]]`: every mission dispatched to workers that touch code MUST include a tri-platform constraint line: "this change must work identically on darwin, linux, and win32."
67
+
68
+ ## Hard rules
69
+
70
+ - NEVER block on a read-only inter-wave audit — run it, don't wait for user
71
+ - NEVER skip Monitor arming — the very next tool call after every spawn MUST be `Monitor(...)`
72
+ - NEVER exceed 4 concurrent workers in a single wave
73
+ - NEVER use Bash to run user's task — use `claws_exec` or `claws_worker`
74
+ - ALWAYS write progress to `.local/audits/<goal-slug>/PROGRESS.md` between waves
75
+ - ALWAYS pull `--rebase` from origin before workers push
76
+
77
+ ## Examples
78
+
79
+ ```
80
+ /claws-auto ship the v0.8.0 release (docs + CI + npm pack dry-run)
81
+ /claws-auto fix all TypeScript errors across the extension
82
+ /claws-auto audit and resolve the 4 open bugs in .local/blueprints/v0714-bug-tracker.md
83
+ /claws-auto write and green all missing tests for mcp_server.js
84
+ ```
85
+
86
+ ## When NOT to use
87
+
88
+ For a single task (not a multi-wave goal), use `/claws-do`.
89
+ For planning only (no execution), use `/claws-plan`.
90
+ For human-in-the-loop goal tracking with checkpoints, use `/claws-goal`.
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: claws-bin
3
+ description: View or change the worker binary used for spawns (multi-account / alias support).
4
+ ---
5
+
6
+ # /claws-bin [<binary-name> | reset]
7
+
8
+ Sets or reports the binary used by `claws_worker` / `claws_fleet` /
9
+ `claws_dispatch_subworker` to spawn worker terminals. Useful for teams using
10
+ multiple Claude accounts via shell aliases.
11
+
12
+ ## Usage
13
+
14
+ - `/claws-bin claude-neu` → sets worker binary to `claude-neu`. Persists in
15
+ `.claws/claude-bin` (gitignored). Takes effect immediately — next spawn uses it.
16
+ - `/claws-bin reset` → clears the file, reverts to default (`claude`) or
17
+ `CLAWS_CLAUDE_BIN` env var if set.
18
+ - `/claws-bin` (no arg) → reports current binary and source (file/env/default).
19
+
20
+ ## How to act
21
+
22
+ 1. If user passed `<binary-name>` → call `claws_set_bin(name: "<name>")`,
23
+ confirm in chat with the returned message.
24
+ 2. If user passed `reset` → call `claws_set_bin()` (no args), confirm.
25
+ 3. If no arg → call `claws_get_bin()`, show result.
26
+
27
+ This is a single MCP tool call. No deliberation, no pre-verification. Trust the
28
+ result.
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: claws-cleanup
3
+ description: Close all worker terminals after a fleet run. Leaves user-created terminals untouched.
4
+ ---
5
+
6
+ # /claws-cleanup
7
+
8
+ ## What this does
9
+ Finds all terminals with worker-style names (prefixed with "worker-") and closes them via `claws_close`. Confirms the count with the user if there are any before proceeding. Idempotent — safe to run multiple times.
10
+
11
+ ## Behavior
12
+ - Call `claws_list` to enumerate all terminals
13
+ - Identify terminals whose name starts with "worker-" or matches ones you created this session
14
+ - If 0 found: "Nothing to clean up — terminal panel is already clear."
15
+ - If N found: confirm "Close N worker terminals? (Y to proceed)" then call `claws_close` for each
16
+ - Call `claws_list` again to confirm removal
17
+ - Report: "Closed N terminals. Your terminals are untouched."
18
+
19
+ ## Examples
20
+ ```
21
+ /claws-cleanup
22
+ clean up all worker terminals
23
+ close everything after the fleet run
24
+ ```
25
+
26
+ ## When NOT to use
27
+ Do not use to close specific terminals by ID — call `claws_close(id=N)` directly.
28
+ Do not use if you want to close ALL terminals including user ones — that requires explicit confirmation.
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: claws-do
3
+ description: Universal verb — classifies any task into the right execution shape and runs it.
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.** This command makes ONE MCP call.
12
+ 4. **Do NOT pre-verify the sidecar, Monitor, or hooks.** Guaranteed by
13
+ SessionStart in v0.7.13+. Trust the system.
14
+ 5. **Monitor arming is time-critical.** `monitor_arm_command` from the spawn
15
+ response MUST be your very next tool call after spawn returns. Any tool call
16
+ between spawn and Monitor arm is a sequencing bug — abort what you were
17
+ doing and arm the Monitor first.
18
+
19
+ Classify and act. The routing tree below handles the rest.
20
+
21
+ ---
22
+
23
+ # /claws-do <task>
24
+
25
+ ## What this does
26
+ Classifies the user's request into one of four execution buckets and routes it to the right MCP tool. Never falls back to the Bash tool. Never manually boots a worker via terminal send sequences.
27
+
28
+ ## Routing decision tree
29
+
30
+ Classify the request BEFORE creating anything:
31
+
32
+ **Bucket 1 — One-shot shell command**
33
+ Signals: "run npm test", "build the project", "git status", any single shell invocation needing output + exitCode.
34
+ Action: `claws_exec(command="<cmd>", timeout_ms=120000)` — read output and exitCode, report to user. Done.
35
+
36
+ **Bucket 2 — Single autonomous Claude task** (default when ambiguous)
37
+ Signals: "fix the auth bug", "refactor X", "audit Y", "write tests for Z", any mission-shaped task.
38
+ Action:
39
+ ```
40
+ claws_worker(
41
+ name="worker-<short-slug>",
42
+ mission="<full mission text ending with: print __CLAWS_DONE__ when done. go.>",
43
+ complete_marker="__CLAWS_DONE__",
44
+ timeout_ms=600000
45
+ )
46
+ ```
47
+ After spawn, arm the per-worker Monitor using `monitor_arm_command` from the response. Wait for the Monitor notification. Then `claws_close` the terminal.
48
+
49
+ **Bucket 3 — Independent parallel tasks**
50
+ Signals: "run lint AND test AND typecheck", "audit modules A, B, C in parallel", explicit concurrency.
51
+ Action:
52
+ ```
53
+ claws_fleet(workers=[
54
+ {name:"worker-lint", mission:"...print MARK_LINT_OK when done. go."},
55
+ {name:"worker-test", mission:"...print MARK_TEST_OK when done. go."},
56
+ ], detach=true)
57
+ ```
58
+ Arm one Monitor per `terminal_id` from the fleet response. Wait for all. Close all.
59
+
60
+ **Bucket 4 — Coordinated multi-stage with sub-decomposition**
61
+ Signals: "5-worker audit then synthesize", explicit "wave" or "army" terminology, N sub-workers + a coordinator.
62
+ Action: spawn a LEAD via `claws_worker` whose mission uses `claws_wave_create` + `claws_dispatch_subworker` calls internally.
63
+
64
+ ## Hard rules
65
+
66
+ - NEVER use the Bash tool to run the user's task — use `claws_exec` or `claws_worker`
67
+ - NEVER manually sequence `claws_create` + `claws_send` to boot a Claude worker — `claws_worker` handles it
68
+ - NEVER skip arming the Monitor after spawn — `monitor_arm_command` MUST be the very next
69
+ tool call after spawn; any intervening call is a sequencing bug
70
+ - NEVER leave terminals open — auto-close on marker is the default
71
+ - NEVER use raw socket node -e fallbacks — if MCP tools are absent, tell the user to reload VS Code
72
+
73
+ ## Examples
74
+ ```
75
+ /claws-do run npm test
76
+ /claws-do fix the failing test in auth.test.ts
77
+ /claws-do run lint, test, and typecheck in parallel
78
+ /claws-do launch a 4-worker audit wave with a LEAD
79
+ ```
80
+
81
+ ## When NOT to use
82
+ For status, use /claws-status. For cleanup, use /claws-cleanup. For install issues, use /claws-fix.
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: claws-fix
3
+ description: Diagnose and auto-repair a broken Claws installation in one command.
4
+ ---
5
+
6
+ ## MANDATORY — read before running
7
+
8
+ 1. **Acknowledge in 1 line.** "Running Claws repair script." No more.
9
+ 2. **Do NOT enter plan mode.** This is a single Bash call.
10
+ 3. **Run the repair script via Bash — one call, no sub-steps. No worker spawn.**
11
+
12
+ ---
13
+
14
+ # /claws-fix
15
+
16
+ ## What this does
17
+ Runs `$CLAWS_DIR/scripts/fix.sh` which checks every piece of the install chain — extension bundle, editor symlink, `.mcp.json`, socket liveness, shell hooks — auto-repairs what it can, and reports what still needs a VS Code reload or Claude Code restart. All repair logic lives in the script so new checks activate on the next `git pull`.
18
+
19
+ ## Behavior
20
+ - Run this single shell command:
21
+ ```bash
22
+ CLAWS_DIR="${CLAWS_DIR:-$HOME/.claws-src}"
23
+ bash "$CLAWS_DIR/scripts/fix.sh" "$(pwd)"
24
+ ```
25
+ - Do not break into multiple steps — let the script's `[check] ✓ / → / ✗` output speak
26
+ - If the script prints "All checks passed":
27
+ > Everything is wired up. Activate: (1) Reload VS Code, (2) Restart Claude Code in this project.
28
+ - If the script reports unresolved issues:
29
+ > Some issues need manual attention. Run /claws-report to bundle diagnostics for a GitHub issue.
30
+
31
+ ## Examples
32
+ ```
33
+ /claws-fix
34
+ claws tools aren't showing up
35
+ fix the claws installation
36
+ ```
37
+
38
+ ## When NOT to use
39
+ If Claws is working but you want to update it, use /claws-update.
40
+ If you need a shareable diagnostic file, use /claws-report.
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: claws-goal
3
+ description: Goal tracker (Codex / Claude Code agent loop pattern). Breaks a goal into subtasks, tracks progress, asks the user before destructive actions.
4
+ ---
5
+
6
+ ## MANDATORY cold-start sequence — execute in order, no deliberation
7
+
8
+ 1. **Acknowledge in 1 line.** "Goal received: <one-sentence summary>." No more.
9
+ 2. **Do NOT enter plan mode.** Classify immediately and create the root task.
10
+ 3. **Classify the goal** — one of: bug-fix, feature, refactor, release, audit, docs. State it in one sentence.
11
+ 4. **Create root task** — `TaskCreate` with the goal as title.
12
+ 5. **Decompose into 3–7 subtasks** — create each via `TaskCreate` with the root as parent.
13
+ 6. **Ask 0–2 clarifying questions** if scope is genuinely ambiguous, then begin the first subtask.
14
+
15
+ Do not deliberate. Classify, decompose, begin.
16
+
17
+ ---
18
+
19
+ # /claws-goal <goal description>
20
+
21
+ ## What this does
22
+ Human-in-the-loop goal tracker. Breaks a high-level goal into 3–7 subtasks via `TaskCreate`, tracks completion via `TaskUpdate`, surfaces clarifying questions when blocked, and always asks the user before taking destructive actions. This is the human-checkpointed alternative to `/claws-auto`.
23
+
24
+ See skill: `.claude/skills/claws-goal-tracker/SKILL.md` for breakdown heuristics and task-status protocol.
25
+
26
+ ## Behavior
27
+
28
+ ### Step 1 — Root task + decomposition
29
+ ```
30
+ TaskCreate(title="<goal>", description="root goal", status="in_progress")
31
+ TaskCreate(title="Subtask 1: ...", parent_id=<root>, status="pending")
32
+ TaskCreate(title="Subtask 2: ...", parent_id=<root>, status="pending")
33
+ ...
34
+ ```
35
+ Print the task tree to the user. Then ask 0–2 clarifying questions (if any). Then start Subtask 1.
36
+
37
+ ### Step 2 — Execute subtasks in order
38
+ For each subtask:
39
+ 1. `TaskUpdate(id=<id>, status="in_progress")`
40
+ 2. Execute the work (read files, make edits, run `claws_exec` for shell ops)
41
+ 3. Verify: tests pass, no type errors after `.ts` edits
42
+ 4. `TaskUpdate(id=<id>, status="completed")`
43
+ 5. Report to user: "Subtask N done — <one-sentence summary>."
44
+ 6. Pause for user confirmation before proceeding if the subtask made destructive or user-visible changes (commits, file deletions, API calls)
45
+
46
+ ### Step 3 — Blocked subtask protocol
47
+ If a subtask cannot proceed without information or a decision:
48
+ 1. `TaskUpdate(id=<id>, status="blocked", notes="<specific question>")`
49
+ 2. Surface the question to the user with context
50
+ 3. Wait for user answer before resuming
51
+
52
+ ### Step 4 — Goal completion
53
+ When all subtasks are `completed`:
54
+ 1. `TaskUpdate(id=<root>, status="completed")`
55
+ 2. Print summary: "Goal complete. <N> subtasks done. What changed: ..."
56
+ 3. If commits were made, show `git log --oneline -N`
57
+
58
+ ## Clarifying questions — when and how many
59
+
60
+ Ask clarifying questions ONLY when:
61
+ - Scope genuinely cannot be inferred from the goal text + codebase
62
+ - Two valid approaches exist with meaningfully different outcomes
63
+
64
+ Never ask:
65
+ - Questions answerable by reading the code
66
+ - Questions about style, formatting, or conventions (follow existing patterns)
67
+ - More than 2 questions at once
68
+
69
+ Format: numbered list, each question in one sentence. After user answers, begin work immediately.
70
+
71
+ ## Destructive action gate
72
+
73
+ Before any of these, stop and ask for explicit confirmation:
74
+ - `git push --force` or `git reset --hard`
75
+ - Deleting files that are not obviously temporary
76
+ - Dropping or truncating data
77
+ - Publishing to npm or VS Code Marketplace
78
+
79
+ For non-destructive actions (edits, new files, commits to local branch), proceed without asking.
80
+
81
+ ## Hard rules
82
+
83
+ - NEVER skip `TaskUpdate` — every subtask transitions `pending → in_progress → completed|blocked`
84
+ - NEVER take destructive actions without user confirmation
85
+ - NEVER exceed 7 subtasks — if the goal needs more, ask the user to break it into two goals
86
+ - ALWAYS show the task tree before starting work
87
+ - ALWAYS report completion of each subtask before moving to the next
88
+
89
+ ## Examples
90
+
91
+ ```
92
+ /claws-goal add WebSocket transport to Claws (Phase 3)
93
+ /claws-goal fix the 4 bugs in .local/blueprints/v0714-bug-tracker.md
94
+ /claws-goal get the extension test suite to 100% green
95
+ /claws-goal prepare Claws 0.8.0 for marketplace publish
96
+ ```
97
+
98
+ ## Difference from /claws-auto
99
+
100
+ | `/claws-auto` | `/claws-goal` |
101
+ |---------------|--------------|
102
+ | Fully autonomous | Human-in-the-loop |
103
+ | Asks user only when blocked | Reports after each subtask |
104
+ | Wave-based dispatch | Sequential subtask execution |
105
+ | Best for: long runs you walk away from | Best for: guided work you want to review |
106
+
107
+ ## When NOT to use
108
+
109
+ For fully autonomous execution, use `/claws-auto`.
110
+ For planning only (no execution), use `/claws-plan`.
111
+ For a single task, use `/claws-do`.
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: claws-help
3
+ description: Complete reference for Claws slash commands and MCP tools.
4
+ ---
5
+
6
+ ## MANDATORY — read before running
7
+
8
+ 1. **Acknowledge in 1 line.** No more.
9
+ 2. **Do NOT enter plan mode.** This command prints reference content, not spawns workers.
10
+ 3. **Do NOT pre-verify the sidecar, Monitor, or hooks.** Not needed here.
11
+
12
+ ---
13
+
14
+ # /claws-help
15
+
16
+ ## What this does
17
+ Prints the complete Claws command and tool reference. Use this when you want to know what's available and how to use it.
18
+
19
+ ## Commands (8 total)
20
+
21
+ | Command | Description |
22
+ |---|---|
23
+ | `/claws` | Master: show live terminal dashboard or forward a task |
24
+ | `/claws-do <task>` | Universal verb: classify and execute any task |
25
+ | `/claws-help` | This reference |
26
+ | `/claws-status` | Dashboard of active terminals with lifecycle state |
27
+ | `/claws-cleanup` | Close all worker terminals after a fleet run |
28
+ | `/claws-update` | Pull latest Claws and re-run installer |
29
+ | `/claws-fix` | Diagnose and auto-repair a broken installation |
30
+ | `/claws-report` | Bundle diagnostics into a shareable bug report |
31
+
32
+ ## MCP Tools (available via tool use)
33
+
34
+ | Tool | Description |
35
+ |---|---|
36
+ | `claws_worker` | Spawn a single Claude Code worker with auto-boot |
37
+ | `claws_fleet` | Spawn N parallel workers; returns terminal_ids immediately |
38
+ | `claws_dispatch_subworker` | Dispatch a sub-worker from within a Wave LEAD |
39
+ | `claws_exec` | Run a one-shot shell command; returns output + exitCode |
40
+ | `claws_list` | List all active terminals |
41
+ | `claws_create` | Create a terminal (wrapped or unwrapped) |
42
+ | `claws_send` | Send text into a terminal |
43
+ | `claws_read_log` | Read pty log from a wrapped terminal |
44
+ | `claws_close` | Close a terminal |
45
+ | `claws_drain_events` | Block-wait for pub/sub events (use in LEAD workers) |
46
+ | `claws_lifecycle_plan` | Log a lifecycle plan (required gate before create) |
47
+
48
+ ## User mental model
49
+
50
+ **5 daily commands**: `/claws-do` for tasks, `/claws` for status, `/claws-status` for details, `/claws-cleanup` after fleet runs, `/claws-help` when lost.
51
+
52
+ **3 system commands**: `/claws-update` to update, `/claws-fix` when broken, `/claws-report` to file a bug.
53
+
54
+ **Power users**: call MCP tools directly. Claws is just terminals over a Unix socket — bend it however you want.
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: claws-plan
3
+ description: Context engineering for a user's task. Reads relevant code, audits dependencies, identifies risks, produces a structured plan doc.
4
+ ---
5
+
6
+ ## MANDATORY cold-start sequence — execute in order, no deliberation
7
+
8
+ 1. **Acknowledge in 1 line.** "Planning: <one-sentence task summary>." No more.
9
+ 2. **Do NOT enter plan mode.** Output is a structured text plan, not an interactive plan session.
10
+ 3. **Do NOT dispatch workers.** Planning only — zero action taken. Reading files and writing one plan doc is the entire job.
11
+ 4. **Do NOT call TodoWrite.** This command produces one output: a `.local/plans/<slug>-<date>.md` file.
12
+ 5. **Read before proposing.** Every referenced file must be read before it appears in the plan. No speculation.
13
+
14
+ ---
15
+
16
+ # /claws-plan <task description>
17
+
18
+ ## What this does
19
+ Context engineering: reads the codebase relevant to the user's task, audits dependencies and risks, then writes a structured plan document to `.local/plans/<slug>-YYYY-MM-DD.md`. The plan is the deliverable — no code is written, no workers are spawned.
20
+
21
+ ## Behavior
22
+
23
+ ### Step 1 — Classify the task
24
+ Determine scope from the task description:
25
+ - What files are likely touched? (search for symbols, filenames, or patterns the task mentions)
26
+ - What features/modules are involved?
27
+ - Is this a bug fix, a new feature, a refactor, a release task, or an audit?
28
+
29
+ ### Step 2 — Clarify if needed
30
+ If the scope is ambiguous, ask 1–3 targeted clarifying questions before proceeding. Questions must be specific and actionable:
31
+ - "Which transport layer — Unix socket or WebSocket?"
32
+ - "Should this change the install.sh path, the VS Code extension, or both?"
33
+ - Do NOT ask vague questions like "Can you tell me more?"
34
+ Cap at 3 questions. If scope is clear, skip to Step 3.
35
+
36
+ ### Step 3 — Read relevant code
37
+ Read every file likely touched by the task. For each file:
38
+ - Identify the relevant functions, classes, or blocks (cite `file.ts:line`)
39
+ - Note existing patterns the plan must match
40
+ - Flag anything that looks like a dependency on another module
41
+
42
+ ### Step 4 — Write the plan doc
43
+ Output to `.local/plans/<slug>-<date>.md` with these sections:
44
+
45
+ ```markdown
46
+ # Plan: <task description>
47
+ **Date**: YYYY-MM-DD **Status**: DRAFT
48
+
49
+ ## Objective
50
+ One paragraph: what success looks like.
51
+
52
+ ## Scope
53
+ Files and modules in scope. Files explicitly out of scope.
54
+
55
+ ## Phased steps
56
+ ### Phase 1 — <name>
57
+ - [ ] Step (file.ts:line — what changes and why)
58
+
59
+ ### Phase 2 — <name>
60
+ ...
61
+
62
+ ## Risk register
63
+ | Risk | Likelihood | Impact | Mitigation |
64
+ |------|-----------|--------|-----------|
65
+ | ... | ... | ... | ... |
66
+
67
+ ## Dependencies
68
+ - External: npm packages, VS Code APIs used
69
+ - Internal: modules that must not break
70
+
71
+ ## Test plan
72
+ - [ ] Unit test: <what>
73
+ - [ ] Integration test: <what>
74
+ - [ ] Manual smoke: <what>
75
+
76
+ ## Open questions
77
+ - [ ] <question that needs user or codebase answer before phase N>
78
+ ```
79
+
80
+ ### Step 5 — Surface to user
81
+ Print the plan (inline in chat) and note where the file was saved. End with: "Run `/claws-do '<task>'` or `/claws-auto '<task>'` to execute."
82
+
83
+ ## Hard rules
84
+
85
+ - NEVER propose a change without first reading the relevant file
86
+ - ALWAYS cite `file:line` for every referenced function or pattern
87
+ - NEVER over-engineer — if 1 file change solves it, don't propose 5
88
+ - NEVER create worker terminals — this command is read-only + write-one-file
89
+ - If the `.local/plans/` directory does not exist, create it silently
90
+
91
+ ## Examples
92
+
93
+ ```
94
+ /claws-plan add a --quiet flag to claws_exec that suppresses pty echo
95
+ /claws-plan fix the autoclose regression from commit e960601
96
+ /claws-plan design the WebSocket transport for Phase 3
97
+ /claws-plan audit why workers miss __CLAWS_DONE__ on Windows
98
+ ```
99
+
100
+ ## When NOT to use
101
+
102
+ To execute a plan, use `/claws-auto` (autonomous) or `/claws-do` (single action).
103
+ To track a multi-step goal with human checkpoints, use `/claws-goal`.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: claws-report
3
+ description: Bundle logs and diagnostics into a shareable file for bug reports.
4
+ ---
5
+
6
+ # /claws-report
7
+
8
+ ## What this does
9
+ Runs `scripts/report.sh` which captures OS info, Claws source state, extension state, socket status, MCP handshake test, shell hook state, recent install logs, and VS Code extension host logs — all into a single redacted text file you can attach to a GitHub issue.
10
+
11
+ ## Behavior
12
+ - Run from the project root where the issue is occurring:
13
+ ```bash
14
+ bash ~/.claws-src/scripts/report.sh "$(pwd)"
15
+ ```
16
+ - The file path is printed at the top of the output (e.g. `~/claws-report-<timestamp>.txt`)
17
+ - The report redacts `$HOME` paths and strips 32+ character tokens — review before sharing
18
+ - Tell the user the file path and offer to help write a GitHub issue title
19
+
20
+ ## Examples
21
+ ```
22
+ /claws-report
23
+ generate a diagnostic report
24
+ something is broken — help me file a bug
25
+ ```
26
+
27
+ ## When NOT to use
28
+ If Claws is not installed at all, nothing to report — point to the install docs.
29
+ If the issue is just an outdated version, use /claws-update first.
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: claws-status
3
+ description: Show a live dashboard of all active Claws terminals and their lifecycle state.
4
+ ---
5
+
6
+ ## MANDATORY — read before running
7
+
8
+ 1. **Acknowledge in 1 line.** No more.
9
+ 2. **Do NOT enter plan mode.** This command prints reference content, not spawns workers.
10
+ 3. **Do NOT pre-verify the sidecar, Monitor, or hooks.** Not needed here.
11
+
12
+ ---
13
+
14
+ # /claws-status
15
+
16
+ ## What this does
17
+ Calls `claws_list` and formats all active terminals as a readable table. Optionally reads `.claws/lifecycle-state.json` to add a lifecycle status column. Quick health check before starting orchestration work.
18
+
19
+ ## Behavior
20
+ - Call `claws_list` to get all terminals
21
+ - Read `.claws/lifecycle-state.json` if it exists (best-effort, ignore if missing)
22
+ - Format as a table with columns: ID | Name | Wrapped | Age | Lifecycle State
23
+ - Report total counts: N terminals, N wrapped
24
+ - If no terminals: "No active terminals. Claws is connected and idle."
25
+ - If socket absent: "Claws socket not found. Reload VS Code to activate."
26
+
27
+ ## Examples
28
+ ```
29
+ /claws-status
30
+ what terminals are open?
31
+ show me the terminal dashboard
32
+ ```
33
+
34
+ ## When NOT to use
35
+ To run a task or spawn a worker, use /claws-do.
36
+ To close terminals, use /claws-cleanup.
37
+ To diagnose a broken install, use /claws-fix.
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: claws-update
3
+ description: Update Claws to the latest version by running the upstream update script.
4
+ ---
5
+
6
+ # /claws-update
7
+
8
+ ## What this does
9
+ Pulls the latest Claws source and re-runs the installer. All update logic lives in `$CLAWS_DIR/scripts/update.sh` — new migration steps added to that script activate automatically without re-installing this command.
10
+
11
+ ## Behavior
12
+ - Run this single shell command (do not break into steps):
13
+ ```bash
14
+ CLAWS_DIR="${CLAWS_DIR:-$HOME/.claws-src}"
15
+ bash "$CLAWS_DIR/scripts/update.sh" "$(pwd)"
16
+ ```
17
+ - Let the script print its own status — do not interleave commentary
18
+ - After the script finishes, tell the user exactly:
19
+ > Update complete. Two things to activate:
20
+ > 1. Reload VS Code — Cmd+Shift+P → Developer: Reload Window
21
+ > 2. Restart Claude Code in this project so the new `.mcp.json` is picked up.
22
+
23
+ ## Examples
24
+ ```
25
+ /claws-update
26
+ update claws to the latest version
27
+ pull the newest claws
28
+ ```
29
+
30
+ ## When NOT to use
31
+ If MCP tools are missing (not just outdated), use /claws-fix first.
32
+ If you want a full diagnostic bundle, use /claws-report.