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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Anish Neunaha
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,420 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/neunaha/claws/main/docs/images/social-preview.png" alt="Claws" width="720">
3
+ </p>
4
+
5
+ <h1 align="center">Claws</h1>
6
+
7
+ <p align="center">
8
+ <strong>Your AI just got terminal superpowers.</strong>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License">
13
+ <img src="https://img.shields.io/badge/VS%20Code-1.93+-007ACC.svg" alt="VS Code">
14
+ <img src="https://img.shields.io/badge/dependencies-zero-brightgreen.svg" alt="Zero Deps">
15
+ <img src="https://img.shields.io/badge/Node.js-only-339933.svg" alt="Node.js">
16
+ <img src="https://img.shields.io/badge/Python-not%20required-lightgrey.svg" alt="No Python">
17
+ <img src="https://img.shields.io/github/stars/neunaha/claws?style=social" alt="Stars">
18
+ </p>
19
+
20
+ ---
21
+
22
+ ## The Problem → The Solution
23
+
24
+ <p align="center">
25
+ <img src="https://raw.githubusercontent.com/neunaha/claws/main/docs/images/before-after.png" alt="Before and After Claws" width="720">
26
+ </p>
27
+
28
+ **Before Claws**: copy a command from Claude → paste in terminal → copy the output → paste it back → repeat 47 times. One terminal. No visibility. No parallelism.
29
+
30
+ **After Claws**: your AI controls every terminal directly. Spawns workers. Runs tests, builds, deploys — all in parallel, all visible. You just watch.
31
+
32
+ ---
33
+
34
+ ## Get Started in 3 Steps
35
+
36
+ <p align="center">
37
+ <img src="https://raw.githubusercontent.com/neunaha/claws/main/docs/images/install-flow.png" alt="Install Flow" width="720">
38
+ </p>
39
+
40
+ ### Step 1 — Install into your project
41
+
42
+ **Four paths — choose what fits your setup:**
43
+
44
+ > **One universal command** for macOS + Windows: `npx claws-code@alpha install` — platform-aware, auto-detects OS + arch + VS Code variant. Linux support coming in v0.8.1.
45
+
46
+ ```bash
47
+ # Option 1 — npm (recommended, requires Node.js 18+)
48
+ npx claws-code@alpha install
49
+ ```
50
+
51
+ ```bash
52
+ # Option 2 — macOS one-liner
53
+ curl -fsSL https://raw.githubusercontent.com/neunaha/claws/main/scripts/install.sh | bash
54
+ ```
55
+
56
+ ```powershell
57
+ # Option 3 — Windows (PowerShell, run from project root)
58
+ iwr https://raw.githubusercontent.com/neunaha/claws/main/scripts/install.ps1 | iex
59
+ ```
60
+
61
+ **Option 4 — VS Code Marketplace**: Open the Extensions panel (`Cmd+Shift+X` / `Ctrl+Shift+X`), search **Claws**, and install `neunaha.claws`. After the extension installs, reload VS Code and run `npx claws-code@alpha install` from your project root to set up the project-local config.
62
+
63
+ The installer is **project-local** — it writes `.mcp.json`, `.claws-bin/mcp_server.js`, and `.claude/{commands,rules,skills}/` into the project you're in. Each project gets its own configurable Claws setup. Re-run it in any other project to enable Claws there.
64
+
65
+ **Zero build dependencies.** Just Node.js (ships with VS Code). v0.8 supports **macOS and Windows** with pre-built `node-pty` binaries for darwin (x64 + arm64) and win32 (x64 + arm64) — no Python, MSVC, or compilation required. A pure-Node pipe-mode fallback is still available when native PTY isn't needed.
66
+
67
+ > **Linux support coming in v0.8.1.** The shell installer technically runs on linux today (with python3 + make + g++ for the from-source node-pty build) but is not officially supported until v0.8.1 ships pre-built linux binaries.
68
+
69
+ ### Step 2 — Reload VS Code
70
+
71
+ `Cmd+Shift+P` → `Developer: Reload Window`
72
+
73
+ ### Step 3 — Restart Claude Code in this project
74
+
75
+ Exit your current Claude Code session and re-open `claude` from the project root so it picks up the project-local `.mcp.json` and registers the 39 Claws tools. If the tools don't appear, run `/claws-fix`.
76
+
77
+ ### Step 4 — You're ready
78
+
79
+ Type `/claws` to see the dashboard. Type `/claws-do run my tests` to see it work.
80
+
81
+ ---
82
+
83
+ ## What You'll See
84
+
85
+ <p align="center">
86
+ <img src="https://raw.githubusercontent.com/neunaha/claws/main/docs/images/what-you-see.png" alt="What You See" width="720">
87
+ </p>
88
+
89
+ After install, your VS Code terminal panel transforms:
90
+ - **CLAWS banner** appears in every new terminal with live bridge status
91
+ - **"Claws Wrapped Terminal"** appears in the terminal dropdown — click it for full pty capture
92
+ - **Multiple worker tabs** appear when AI spawns parallel terminals
93
+ - **Shell commands** (`claws-ls`, `claws-new`, `claws-run`, `claws-log`) work in any terminal
94
+
95
+ ---
96
+
97
+ ## The Commands
98
+
99
+ <p align="center">
100
+ <img src="https://raw.githubusercontent.com/neunaha/claws/main/docs/images/slash-commands.png" alt="Slash Commands" width="720">
101
+ </p>
102
+
103
+ One command to remember: **`/claws`**
104
+
105
+ | Command | What it does |
106
+ |---|---|
107
+ | `/claws` | Status — live dashboard; forwards to `/claws-do` |
108
+ | `/claws-do <task>` | Universal verb — classifies into shell / worker / fleet / wave |
109
+ | `/claws-plan` | Read task context, audit deps, produce a structured plan doc |
110
+ | `/claws-auto <goal>` | Autonomous loop — plan → dispatch waves → audit → repeat until goal met |
111
+ | `/claws-goal <goal>` | Break a goal into tasks, track progress, surface blockers |
112
+ | `/claws-status` | Live terminal + lifecycle dashboard |
113
+ | `/claws-help` | Full command and tool reference |
114
+ | `/claws-cleanup` | Close all worker terminals |
115
+ | `/claws-fix` | Diagnose and auto-repair a broken Claws install |
116
+ | `/claws-report` | Bundle logs and diagnostics for a bug report |
117
+ | `/claws-update` | Pull latest version |
118
+
119
+ ### Talk naturally — examples:
120
+
121
+ ```
122
+ /claws-do run my tests → single terminal, runs tests, reports
123
+ /claws-do lint test and build in parallel → 3 terminals, all running simultaneously
124
+ /claws-do fix the bug in auth.ts → spawns a Claude worker to fix it
125
+ /claws-do audit this codebase for security issues → spawns a Claude worker to audit
126
+ /claws-plan refactor the auth module → reads code, audits deps, writes plan doc
127
+ /claws-auto ship v0.8 → autonomous wave loop until goal reached
128
+ /claws-goal add OAuth login → breaks into tasks, tracks progress
129
+ /claws-status → shows all terminals + lifecycle state
130
+ /claws-cleanup → closes all worker terminals
131
+ ```
132
+
133
+ ---
134
+
135
+ ## How It Works
136
+
137
+ <p align="center">
138
+ <img src="https://raw.githubusercontent.com/neunaha/claws/main/docs/images/architecture.png" alt="Architecture" width="720">
139
+ </p>
140
+
141
+ Claws runs a socket server inside VS Code. Any process connects and controls terminals via JSON commands.
142
+
143
+ **Wrapped terminals** are the key feature — as of v0.4 they use VS Code's native `Pseudoterminal` API (backed by `node-pty`, with a `child_process` pipe-mode fallback). No `script(1)` wrapping means **zero rendering corruption** for TUI apps like Claude Code, vim, htop, k9s. Every byte the shell emits flows through the extension's own `onDidWrite` event and into an in-memory ring buffer — readable via `readLog` with ANSI escapes stripped, giving you clean text of everything that happened.
144
+
145
+ A **status bar item** (right side, `$(terminal) Claws (N)`) shows live socket + terminal count at a glance; click it to run Health Check. Color shifts to warning-yellow in pipe-mode and error-red when no server is running.
146
+
147
+ <p align="center">
148
+ <img src="https://raw.githubusercontent.com/neunaha/claws/main/docs/images/wrapped-terminal.png" alt="Wrapped Terminal Data Flow" width="720">
149
+ </p>
150
+
151
+ ---
152
+
153
+ ## Capabilities
154
+
155
+ ### Terminal Management
156
+ <p align="center">
157
+ <img src="https://raw.githubusercontent.com/neunaha/claws/main/docs/images/cap-terminal-mgmt.png" alt="Terminal Management" width="720">
158
+ </p>
159
+
160
+ List all terminals with PID, name, status. Create new ones with custom names. Focus, show, close programmatically. Every terminal gets a stable numeric ID.
161
+
162
+ ### Full Pty Capture
163
+ <p align="center">
164
+ <img src="https://raw.githubusercontent.com/neunaha/claws/main/docs/images/cap-pty-capture.png" alt="Pty Capture" width="720">
165
+ </p>
166
+
167
+ Read back anything — Claude Code conversations, vim sessions, build logs, REPL outputs. The terminal looks and behaves normally. The capture layer is invisible.
168
+
169
+ ### Command Execution
170
+ <p align="center">
171
+ <img src="https://raw.githubusercontent.com/neunaha/claws/main/docs/images/cap-exec.png" alt="Command Execution" width="720">
172
+ </p>
173
+
174
+ Run commands with captured stdout + stderr + exit code. File-based capture works in every terminal type without shell integration.
175
+
176
+ ### Safety Gate
177
+ <p align="center">
178
+ <img src="https://raw.githubusercontent.com/neunaha/claws/main/docs/images/cap-safety.png" alt="Safety Gate" width="720">
179
+ </p>
180
+
181
+ Detects TUI vs shell. Warns before sending text into vim/claude instead of a shell prompt. Non-blocking by default.
182
+
183
+ ### Self-Diagnosis & Cleanup
184
+
185
+ Every install ships with a first-class diagnostic surface — no external tools, no guesswork.
186
+
187
+ - **Status bar item** — live `$(terminal) Claws (N)` with socket + node-pty state in the tooltip. Click to run Health Check. Warning-yellow in pipe-mode, error-red when no server is running.
188
+ - **Health Check** (`cmd+alt+c h` / palette → `Claws: Health Check`) — one-shot introspection snapshot: extension version, Node + Electron ABI, platform, `node-pty` load path (or fallback reason), every active socket, MCP server version, uptime.
189
+ - **Show Log** (`cmd+alt+c l`) — focuses the `Claws` Output channel with the full runtime trace.
190
+ - **Show Status** (`cmd+alt+c s`) — markdown-formatted runtime block, copy-pasteable into a bug report.
191
+ - **List Terminals** — QuickPick of every Claws-known terminal (`id · name · wrapped/unwrapped · pid`); selecting one focuses it.
192
+ - **Rebuild Native PTY** — runs `@electron/rebuild` against the bundled `node-pty`. Use after a VS Code major upgrade if pipe-mode fallback kicks in.
193
+ - **Uninstall Cleanup** — scans open workspace folders, inventories every Claws-installed file (`.mcp.json` entry, `.claws-bin/`, `.claude/commands/claws-*`, skill dirs, `.vscode/extensions.json` recommendation, fenced block in `CLAUDE.md`), shows a per-folder confirmation, removes only what was installed, and writes a summary to the Output channel.
194
+
195
+ All seven commands are also reachable from the command palette under the `Claws:` category.
196
+
197
+ ### MCP Server — Native Claude Code Integration (project-local)
198
+ <p align="center">
199
+ <img src="https://raw.githubusercontent.com/neunaha/claws/main/docs/images/cap-mcp.png" alt="MCP Server" width="720">
200
+ </p>
201
+
202
+ As of v0.4, every project you install into gets its own `.mcp.json` pointing at a vendored `mcp_server.js` under `.claws-bin/`. Each project's Claws setup is independent — customize per-project, commit with the repo, or gitignore it. The installer handles this automatically.
203
+
204
+ ```json
205
+ // <project>/.mcp.json (generated at install time — absolute paths, machine-specific)
206
+ {
207
+ "mcpServers": {
208
+ "claws": {
209
+ "command": "/absolute/path/to/node",
210
+ "args": ["/absolute/path/to/.claws-bin/mcp_server.js"],
211
+ "cwd": "/absolute/path/to/project",
212
+ "env": { "CLAWS_SOCKET": "/absolute/path/to/.claws/claws.sock" }
213
+ }
214
+ }
215
+ }
216
+ ```
217
+
218
+ The installer pins absolute paths at install time so the server resolves correctly regardless of which directory Claude Code is launched from.
219
+
220
+ **41 tools across 9 groups:**
221
+
222
+ | Group | Tools |
223
+ |---|---|
224
+ | Terminal control (8) | `claws_list` · `claws_create` · `claws_send` · `claws_exec` · `claws_read_log` · `claws_poll` · `claws_close` · `claws_done` |
225
+ | Worker spawn (4) | `claws_worker` · `claws_fleet` · `claws_dispatch_subworker` · `claws_workers_wait` |
226
+ | Worker config (2) | `claws_get_bin` · `claws_set_bin` |
227
+ | Pub/sub (7) | `claws_hello` · `claws_subscribe` · `claws_publish` · `claws_broadcast` · `claws_ping` · `claws_peers` · `claws_drain_events` |
228
+ | Tasks (5) | `claws_task_assign` · `claws_task_update` · `claws_task_complete` · `claws_task_cancel` · `claws_task_list` |
229
+ | Lifecycle (4) | `claws_lifecycle_plan` · `claws_lifecycle_advance` · `claws_lifecycle_snapshot` · `claws_lifecycle_reflect` |
230
+ | Waves (3) | `claws_wave_create` · `claws_wave_status` · `claws_wave_complete` |
231
+ | Pipelines (3) | `claws_pipeline_create` · `claws_pipeline_list` · `claws_pipeline_close` |
232
+ | RPC / schemas (5) | `claws_schema_list` · `claws_schema_get` · `claws_rpc_call` · `claws_deliver_cmd` · `claws_cmd_ack` |
233
+
234
+ ### Claws/2 — Multi-Agent Orchestration Protocol
235
+
236
+ As of v0.6, Claws includes a built-in coordination layer so an **orchestrator Claude** can spawn and manage a **fleet of worker Claudes** over the same socket — no extra infrastructure required.
237
+
238
+ - **Peer identity** — each agent registers with `claws_hello` (role: orchestrator | worker | observer) and gets a stable `peerId` for the session
239
+ - **Pub/sub message bus** — `claws_subscribe` / `claws_publish` / `claws_broadcast` with `*` and `**` wildcard topic patterns; server-push frames delivered without polling
240
+ - **Task registry** — orchestrator assigns tasks via `claws_task_assign`; workers report progress with `claws_task_update` and `claws_task_complete`; full lifecycle: pending → running → succeeded / failed / skipped
241
+ - **Backward compatible** — all claws/1 terminal-control commands continue to work unchanged
242
+
243
+ Quick start: type `/claws-v2-orchestrate` in an orchestrator Claude session to see the step-by-step bootstrap guide.
244
+
245
+ ### AI Worker Orchestration
246
+ <p align="center">
247
+ <img src="https://raw.githubusercontent.com/neunaha/claws/main/docs/images/ai-orchestration.png" alt="AI Orchestration" width="720">
248
+ </p>
249
+
250
+ `claws_worker` uses a **mode-aware detach default**: in mission-mode (pass `mission=…`) it returns immediately with `terminal_id` + `correlation_id` — non-blocking by default. In command-mode (pass `command=…`) it blocks until the command exits. Override either direction with `detach: true|false`.
251
+
252
+ ```json
253
+ {
254
+ "name": "claws_worker",
255
+ "arguments": {
256
+ "name": "refactor-auth",
257
+ "mission": "Refactor auth.ts to use bcrypt. Call claws_done() when done.",
258
+ "timeout_ms": 900000,
259
+ "harvest_lines": 300
260
+ }
261
+ }
262
+ ```
263
+
264
+ Returns `{ status: "completed" | "failed" | "timeout", terminal_id, correlation_id, duration_ms, harvest, cleaned_up }`. Poll completion with `claws_workers_wait(terminal_ids=[…])`, or arm the per-worker `monitor_arm_command` from the spawn response for event-driven notification.
265
+
266
+ ### claws_done() — the completion primitive
267
+
268
+ Zero-arg MCP tool. Reads `CLAWS_TERMINAL_ID` from the worker's environment (set by the extension at spawn time), publishes `system.worker.completed` with marker `__CLAWS_DONE__`, and closes the terminal. This is **F3** — the primary close trigger in the 5-layer worker-completion convention.
269
+
270
+ ```json
271
+ { "name": "claws_done", "arguments": {} }
272
+ ```
273
+
274
+ No arguments. No peerId needed. No prior `claws_hello` required. The extension injects `CLAWS_TERMINAL_ID` into every worker terminal at boot, so `claws_done()` always knows which terminal to close and which correlation to signal.
275
+
276
+ Wave D fallback: if a worker exits without calling `claws_done()`, VS Code's `onDidCloseTerminal` fires → the extension publishes `system.worker.terminated` → the server upgrades it to `system.worker.completed` with `completion_signal: 'terminated'`. Workers that die still get accounted for.
277
+
278
+ ### Wave Army — coordinated multi-worker missions
279
+
280
+ Spawn a fleet of parallel Claude workers for independent or coordinated tasks.
281
+
282
+ - **`claws_fleet(workers=[…])`** — launch N independent jobs in parallel (lint / test / build). Each gets its own terminal and mission; returns `terminal_ids` immediately.
283
+ - **`claws_dispatch_subworker(waveId, role, mission)`** — wave-discipline sub-worker with heartbeat protocol (publish `worker.<peerId>.heartbeat` every 20 s, phase events on each transition, complete event as final act).
284
+ - **`claws_workers_wait(terminal_ids=[…])`** — poll completion across a fleet. Blocks until all workers signal done or timeout.
285
+
286
+ Use cases: parallel test/build/lint pipelines; multi-role audits with a LEAD orchestrator managing specialist sub-workers; any task that benefits from visible progress in multiple terminal tabs.
287
+
288
+ ### Behavioral injection enforcement
289
+
290
+ Five-layer chain that auto-loads Claws lifecycle context into every Claude session — no manual configuration required:
291
+
292
+ 1. **`~/.claude/CLAUDE.md` global block** — written by `inject-global-claude-md.js` from `templates/CLAUDE.global.md`; always loaded by Claude Code.
293
+ 2. **`<project>/CLAUDE.md` CLAWS:BEGIN block** — written by `inject-claude-md.js` from `templates/CLAUDE.project.md`; loaded whenever Claude opens this project.
294
+ 3. **SessionStart hook** — fires when `.claws/claws.sock` is detected; auto-spawns the sidecar (`stream-events.js --auto-sidecar`) and emits a lifecycle reminder.
295
+ 4. **PreToolUse hook** — gates spawn-class MCP calls (`claws_create`, `claws_worker`, `claws_fleet`, `claws_dispatch_subworker`); refuses if no Monitor process is detected (5 s grace).
296
+ 5. **Stop hook** — kills the sidecar cleanly at session end via `pgrep` + `kill -TERM`.
297
+
298
+ All injectors are versioned, regex-matched, and atomic-write safe. All hooks are tagged `_source: "claws"` for clean removal. The chain ensures that even a fresh Claude session in this project has the full operating contract loaded before the first tool call.
299
+
300
+ ### Cross-Device Control (planned)
301
+ <p align="center">
302
+ <img src="https://raw.githubusercontent.com/neunaha/claws/main/docs/images/cap-crossdevice.png" alt="Cross-Device" width="720">
303
+ </p>
304
+
305
+ WebSocket transport with token auth + TLS. SSH tunnel works today:
306
+ ```bash
307
+ ssh -L 9999:/remote/.claws/claws.sock user@remote
308
+ ```
309
+
310
+ ---
311
+
312
+ ## What Gets Installed
313
+
314
+ The installer writes files in **two scopes**: the machine (once) and the project you ran it in (per-project, re-run for each project you want Claws in).
315
+
316
+ ### Machine-level (written once, shared by all projects)
317
+
318
+ | What | Where | Purpose |
319
+ |---|---|---|
320
+ | Cloned source | `~/.claws-src/` | Full repo clone — used by `/claws-update` |
321
+ | VS Code extension | `~/.vscode/extensions/neunaha.claws-0.8.0` | Symlink → `~/.claws-src/extension` |
322
+ | Extension bundle | `~/.claws-src/extension/dist/extension.js` | Built from TypeScript on install |
323
+ | Bundled native PTY | `~/.claws-src/extension/native/node-pty/` | Self-contained `node-pty` — keeps wrapped terminals glitch-free without a global install |
324
+ | Shell hook | `~/.zshrc`, `~/.bashrc`, `~/.bash_profile`, `~/.config/fish/conf.d/claws.fish` | CLAWS banner + `claws-*` shell commands |
325
+
326
+ ### Project-level (written into the project you installed from)
327
+
328
+ | What | Where | Purpose |
329
+ |---|---|---|
330
+ | MCP registration | `<project>/.mcp.json` | Registers Claws MCP for this project |
331
+ | Self-contained MCP | `<project>/.claws-bin/mcp_server.js` | Vendored copy — relative-path registration |
332
+ | Slash commands | `<project>/.claude/commands/claws-*.md` | 8 commands: `/claws`, `/claws-do`, `/claws-status`, `/claws-help`, `/claws-cleanup`, `/claws-fix`, `/claws-report`, `/claws-update` |
333
+ | Behavior rule | `<project>/.claude/rules/claws-default-behavior.md` | Claude prefers visible terminals in this project |
334
+ | Prompt templates skill | `<project>/.claude/skills/claws-prompt-templates/` | 7 mission templates |
335
+ | Dynamic CLAUDE.md block | `<project>/CLAUDE.md` (fenced `<!-- CLAWS:BEGIN -->` … `<!-- CLAWS:END -->`) | Tool list + operating principles (generated at install time) |
336
+ | Workspace recommendation | `<project>/.vscode/extensions.json` | Adds `neunaha.claws` to `recommendations` so teammates are prompted to install on open |
337
+
338
+ ### Opt-in: global install
339
+
340
+ Set `CLAWS_GLOBAL_CONFIG=1` to mirror the per-project config into `~/.claude/`. Set `CLAWS_GLOBAL_MCP=1` to also register the MCP globally in `~/.claude/settings.json`. Both default to off.
341
+
342
+ ### Uninstall
343
+
344
+ Run the uninstall script (from any project you have Claws installed in):
345
+
346
+ ```bash
347
+ bash ~/.claws-src/scripts/uninstall.sh
348
+ ```
349
+
350
+ Then uninstall the VS Code extension manually:
351
+
352
+ ```bash
353
+ code --uninstall-extension neunaha.claws
354
+ ```
355
+
356
+ The uninstall script removes: lifecycle hooks from `~/.claude/settings.json`, the `CLAWS:BEGIN` block from `CLAUDE.md`, the shell hook line from `.zshrc`/`.bashrc`, and `.claws-bin/` and `.claws/` from the project root. It is idempotent — safe to re-run.
357
+
358
+ ### Windows
359
+
360
+ **Native install** (v0.8+):
361
+
362
+ ```powershell
363
+ # Run from your project root in PowerShell
364
+ iwr https://raw.githubusercontent.com/neunaha/claws/main/scripts/install.ps1 | iex
365
+ ```
366
+
367
+ No Python, no MSVC, no WSL2 required. Pre-built `node-pty` binaries for Win32/x64 and Win32/arm64 are bundled. Requires Node.js 18+ and VS Code 1.93+.
368
+
369
+ **WSL2 alternative**: `wsl --install` in an elevated PowerShell, open a WSL terminal, then follow the Mac/Linux steps above.
370
+
371
+ ---
372
+
373
+ ## Documentation
374
+
375
+ | Resource | Description |
376
+ |---|---|
377
+ | [Complete Guide](docs/guide.md) | 12-chapter course, install to fleet orchestration |
378
+ | [Feature Reference](docs/features.md) | Every command, parameter, edge case |
379
+ | [Protocol Spec](docs/protocol.md) | Full JSON socket protocol |
380
+ | [Prompt Templates](.claude/skills/prompt-templates/SKILL.md) | 7 mission prompt patterns |
381
+ | [Landing Page](https://neunaha.github.io/claws/) | Website with visuals + case studies |
382
+ | [Contributing](CONTRIBUTING.md) | Dev setup + how to contribute |
383
+
384
+ ---
385
+
386
+ ## Powered by Claude
387
+
388
+ Claws worker terminals boot with `claude-sonnet-4-6` by default — the best coding model for orchestration missions. Pass `model=` to `claws_worker` or `claws_fleet` to override per-worker.
389
+
390
+ ---
391
+
392
+ ## Roadmap
393
+
394
+ - **v0.3** ✅ Zero dependencies — Node.js only
395
+ - **v0.4** ✅ TypeScript rewrite, Pseudoterminal (no glitching), project-local install, dynamic CLAUDE.md, automatic legacy migration
396
+ - **v0.5** ✅ Hardening sweep — status bar item, Health Check / Uninstall Cleanup, chord keybindings, hot-reloadable config, bundled `node-pty`, 57 automated checks
397
+ - **v0.6** ✅ Agentic SDLC Protocol — claws/2 peer registry, pub/sub message bus, task assignment engine, 6 new MCP tools, 33 new automated checks
398
+ - **v0.7.x** ✅ Fleet & completion overhaul:
399
+ - `claws_done()` — zero-arg completion primitive (F3 of the 5-layer convention)
400
+ - Wave Army — `claws_fleet` / `claws_dispatch_subworker` / `claws_workers_wait`
401
+ - `/claws-do` — universal verb, classifies any task into shell / worker / fleet / wave (8-command consolidation)
402
+ - Non-blocking workers by default in mission-mode (`detach: true`), mode-aware detach
403
+ - Behavioral injection enforcement — 5-layer chain auto-loads on every session
404
+ - LH-9 TTL watchdog — idle/max timeouts on every worker
405
+ - Lifecycle engine — 10-phase state machine with auto-advance and FAILED recovery
406
+ - 39 MCP tools total
407
+ - **v0.8** ✅ Tri-platform native support + autonomous orchestration:
408
+ - Pre-built `node-pty` binaries for darwin/linux/win32 — no Python, MSVC, or build toolchain
409
+ - Event-driven mission submit with 4-layer defense (no polling, ConPTY/WSL/macOS-compatible)
410
+ - Windows native install via `install.ps1`
411
+ - VS Code Marketplace publish
412
+ - Lifecycle hardening: 120 s boot ceiling, early-abort on terminal close, installer orphan cleanup
413
+ - Three new commands: `/claws-plan`, `/claws-auto`, `/claws-goal`
414
+ - **v0.9** — WebSocket transport, cross-device control, web dashboard
415
+
416
+ ---
417
+
418
+ ## License
419
+
420
+ [MIT](LICENSE) · [Anish Neunaha](https://github.com/neunaha) · [Website](https://neunaha.github.io/claws/)
package/bin/cli.js ADDED
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const { parseArgs } = require('util');
5
+
6
+ const { values, positionals } = parseArgs({
7
+ args: process.argv.slice(2),
8
+ options: {
9
+ force: { type: 'boolean', short: 'f' },
10
+ 'dry-run': { type: 'boolean' },
11
+ 'no-hooks': { type: 'boolean' },
12
+ 'vscode-cli': { type: 'string' },
13
+ version: { type: 'boolean', short: 'v' },
14
+ help: { type: 'boolean', short: 'h' },
15
+ },
16
+ allowPositionals: true,
17
+ });
18
+
19
+ if (values.version) {
20
+ const pkg = require('../package.json');
21
+ process.stdout.write(`claws-code ${pkg.version}\n`);
22
+ process.exit(0);
23
+ }
24
+
25
+ if (values.help) {
26
+ _printHelp();
27
+ process.exit(0);
28
+ }
29
+
30
+ const cmd = positionals[0] || 'install';
31
+
32
+ const opts = {
33
+ force: values.force || false,
34
+ dryRun: values['dry-run'] || false,
35
+ noHooks: values['no-hooks'] === true || process.env.CLAWS_NO_GLOBAL_HOOKS === '1',
36
+ vscodeCli: values['vscode-cli'] || null,
37
+ };
38
+
39
+ switch (cmd) {
40
+ case 'install':
41
+ case 'i':
42
+ require('../lib/install').run(opts);
43
+ break;
44
+
45
+ case 'update':
46
+ case 'u':
47
+ require('../lib/install').run({ ...opts, force: true });
48
+ break;
49
+
50
+ case 'uninstall':
51
+ require('../lib/uninstall').run(opts);
52
+ break;
53
+
54
+ case 'status':
55
+ case 's':
56
+ require('../lib/verify').status();
57
+ break;
58
+
59
+ default:
60
+ process.stderr.write(`Unknown command: ${cmd}\n`);
61
+ _printHelp();
62
+ process.exit(1);
63
+ }
64
+
65
+ function _printHelp() {
66
+ process.stdout.write(`
67
+ Usage: claws-code <command> [options]
68
+
69
+ Commands:
70
+ install Install Claws into the current project (default)
71
+ update Re-run install with --force
72
+ uninstall Remove Claws from the current project
73
+ status Show installation status
74
+
75
+ Options:
76
+ --force, -f Re-run all steps even if up-to-date
77
+ --dry-run Print every step without executing
78
+ --no-hooks Skip ~/.claude/settings.json hook registration
79
+ --vscode-cli <path> Override VS Code CLI path (env: CLAWS_VSCODE_CLI)
80
+ --version, -v Print version and exit
81
+ --help, -h Show this help
82
+
83
+ `);
84
+ }