shadow-claw 1.28.0 → 1.29.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 (194) hide show
  1. package/.well-known/mcp/server-card.json +1 -1
  2. package/.well-known/mcp.json +1 -1
  3. package/README.md +96 -278
  4. package/bin/cli.mjs +4 -0
  5. package/bin/commands/mcp.mjs +409 -125
  6. package/bin/commands/mcp.test.mjs +151 -18
  7. package/bin/utils/control-client.mjs +338 -103
  8. package/bin/utils/control-client.test.mjs +14 -0
  9. package/dist/electron/main.cjs +179 -179
  10. package/dist/lib/components/index.js +21 -21
  11. package/dist/lib/components/settings/shadow-claw-channel-config.js +1 -1
  12. package/dist/lib/components/settings/shadow-claw-control-plane.js +1 -1
  13. package/dist/lib/components/settings/shadow-claw-git.js +1 -1
  14. package/dist/lib/components/settings/shadow-claw-llm.js +1 -1
  15. package/dist/lib/components/settings/shadow-claw-networking.js +1 -1
  16. package/dist/lib/components/settings/shadow-claw-notifications.js +1 -1
  17. package/dist/lib/components/settings/shadow-claw-peerjs.js +1 -1
  18. package/dist/lib/components/settings/shadow-claw-storage.js +1 -1
  19. package/dist/lib/components/settings/shadow-claw-task-server.js +1 -1
  20. package/dist/lib/components/settings/shadow-claw-webvm.js +1 -1
  21. package/dist/lib/components/shadow-claw-channel-config.js +1 -1
  22. package/dist/lib/components/shadow-claw-channels.js +1 -1
  23. package/dist/lib/components/shadow-claw-chat.js +1 -1
  24. package/dist/lib/components/shadow-claw-control-plane.js +1 -1
  25. package/dist/lib/components/shadow-claw-conversations.js +1 -1
  26. package/dist/lib/components/shadow-claw-file-viewer.js +1 -1
  27. package/dist/lib/components/shadow-claw-files.js +1 -1
  28. package/dist/lib/components/shadow-claw-git.js +1 -1
  29. package/dist/lib/components/shadow-claw-llm.js +1 -1
  30. package/dist/lib/components/shadow-claw-networking.js +1 -1
  31. package/dist/lib/components/shadow-claw-notifications.js +1 -1
  32. package/dist/lib/components/shadow-claw-pages.js +1 -1
  33. package/dist/lib/components/shadow-claw-peerjs.js +1 -1
  34. package/dist/lib/components/shadow-claw-settings.js +1 -1
  35. package/dist/lib/components/shadow-claw-storage.js +1 -1
  36. package/dist/lib/components/shadow-claw-task-server.js +1 -1
  37. package/dist/lib/components/shadow-claw-tasks.js +1 -1
  38. package/dist/lib/components/shadow-claw-terminal.js +1 -1
  39. package/dist/lib/components/shadow-claw-tools.js +1 -1
  40. package/dist/lib/components/shadow-claw-webvm.js +1 -1
  41. package/dist/lib/components/shadow-claw.js +1 -1
  42. package/dist/lib/{configurePeerJs-D8Ph0-A9.js → configurePeerJs-DG4hliKp.js} +2 -2
  43. package/dist/lib/{configurePeerJs-D8Ph0-A9.js.map → configurePeerJs-DG4hliKp.js.map} +1 -1
  44. package/dist/lib/index.js +21 -21
  45. package/dist/lib/{initControlPlane-BIrWmpzc.js → initControlPlane-DnpAzphg.js} +8 -8
  46. package/dist/lib/{initControlPlane-BIrWmpzc.js.map → initControlPlane-DnpAzphg.js.map} +1 -1
  47. package/dist/lib/{markdown-DEUoM1c6.js → markdown-DgdSt2GD.js} +2 -2
  48. package/dist/lib/{markdown-DEUoM1c6.js.map → markdown-DgdSt2GD.js.map} +1 -1
  49. package/dist/lib/{orchestrator-CFCW-l1O.js → orchestrator-CjEau_RG.js} +5 -5
  50. package/dist/lib/{orchestrator-CFCW-l1O.js.map → orchestrator-CjEau_RG.js.map} +1 -1
  51. package/dist/lib/{orchestrator-BtVj9bBB.js → orchestrator-ClXbJ4Mb.js} +2 -2
  52. package/dist/lib/{orchestrator-BtVj9bBB.js.map → orchestrator-ClXbJ4Mb.js.map} +1 -1
  53. package/dist/lib/{peerjs-BoBkx9DJ.js → peerjs-BdfpltIe.js} +3 -3
  54. package/dist/lib/{peerjs-BoBkx9DJ.js.map → peerjs-BdfpltIe.js.map} +1 -1
  55. package/dist/lib/{push-client-D6hbzDNV.js → push-client-DjwKknNg.js} +9 -3
  56. package/dist/lib/push-client-DjwKknNg.js.map +1 -0
  57. package/dist/lib/{shadow-claw-Cuf2O5bZ.js → shadow-claw-DcPGKenn.js} +4 -4
  58. package/dist/lib/{shadow-claw-Cuf2O5bZ.js.map → shadow-claw-DcPGKenn.js.map} +1 -1
  59. package/dist/lib/{shadow-claw-channel-config-BDPKt6Bd.js → shadow-claw-channel-config-DEL-aZ7N.js} +3 -3
  60. package/dist/lib/{shadow-claw-channel-config-BDPKt6Bd.js.map → shadow-claw-channel-config-DEL-aZ7N.js.map} +1 -1
  61. package/dist/lib/{shadow-claw-channels-BsP5JABM.js → shadow-claw-channels-BgaJiPdE.js} +2 -2
  62. package/dist/lib/{shadow-claw-channels-BsP5JABM.js.map → shadow-claw-channels-BgaJiPdE.js.map} +1 -1
  63. package/dist/lib/{shadow-claw-chat-Cam2lX4k.js → shadow-claw-chat-mXPQZbwT.js} +4 -4
  64. package/dist/lib/{shadow-claw-chat-Cam2lX4k.js.map → shadow-claw-chat-mXPQZbwT.js.map} +1 -1
  65. package/dist/lib/{shadow-claw-control-plane-DB2qcCFs.js → shadow-claw-control-plane-DO6foOLV.js} +6 -6
  66. package/dist/lib/{shadow-claw-control-plane-DB2qcCFs.js.map → shadow-claw-control-plane-DO6foOLV.js.map} +1 -1
  67. package/dist/lib/{shadow-claw-conversations-C9Vf4XGx.js → shadow-claw-conversations-BLwHTwdW.js} +2 -2
  68. package/dist/lib/{shadow-claw-conversations-C9Vf4XGx.js.map → shadow-claw-conversations-BLwHTwdW.js.map} +1 -1
  69. package/dist/lib/{shadow-claw-file-viewer-B4HYiI0v.js → shadow-claw-file-viewer-BSbZvSl-.js} +3 -3
  70. package/dist/lib/{shadow-claw-file-viewer-B4HYiI0v.js.map → shadow-claw-file-viewer-BSbZvSl-.js.map} +1 -1
  71. package/dist/lib/{shadow-claw-files-DVROUESO.js → shadow-claw-files-BLVr9Pua.js} +2 -2
  72. package/dist/lib/{shadow-claw-files-DVROUESO.js.map → shadow-claw-files-BLVr9Pua.js.map} +1 -1
  73. package/dist/lib/{shadow-claw-git-BqrO7cHJ.js → shadow-claw-git-CHC1H86J.js} +3 -3
  74. package/dist/lib/{shadow-claw-git-BqrO7cHJ.js.map → shadow-claw-git-CHC1H86J.js.map} +1 -1
  75. package/dist/lib/{shadow-claw-llm-BexUQdYo.js → shadow-claw-llm-CKXfxd3D.js} +2 -2
  76. package/dist/lib/{shadow-claw-llm-BexUQdYo.js.map → shadow-claw-llm-CKXfxd3D.js.map} +1 -1
  77. package/dist/lib/{shadow-claw-networking-CfXRGpUD.js → shadow-claw-networking-dpYvfchh.js} +2 -2
  78. package/dist/lib/{shadow-claw-networking-CfXRGpUD.js.map → shadow-claw-networking-dpYvfchh.js.map} +1 -1
  79. package/dist/lib/{shadow-claw-notifications-C9KPMgx_.js → shadow-claw-notifications-_YeAVPga.js} +2 -2
  80. package/dist/lib/{shadow-claw-notifications-C9KPMgx_.js.map → shadow-claw-notifications-_YeAVPga.js.map} +1 -1
  81. package/dist/lib/{shadow-claw-pages-CGzGXmrI.js → shadow-claw-pages-DVzZriZ7.js} +3 -3
  82. package/dist/lib/{shadow-claw-pages-CGzGXmrI.js.map → shadow-claw-pages-DVzZriZ7.js.map} +1 -1
  83. package/dist/lib/{shadow-claw-peerjs-B0ZB7yhB.js → shadow-claw-peerjs-BvixjeBz.js} +3 -3
  84. package/dist/lib/{shadow-claw-peerjs-B0ZB7yhB.js.map → shadow-claw-peerjs-BvixjeBz.js.map} +1 -1
  85. package/dist/lib/{shadow-claw-settings-DBfMZdDS.js → shadow-claw-settings-DV9-gD4Q.js} +2 -2
  86. package/dist/lib/{shadow-claw-settings-DBfMZdDS.js.map → shadow-claw-settings-DV9-gD4Q.js.map} +1 -1
  87. package/dist/lib/{shadow-claw-storage-CM-w6mgG.js → shadow-claw-storage-Bv__kXG6.js} +2 -2
  88. package/dist/lib/{shadow-claw-storage-CM-w6mgG.js.map → shadow-claw-storage-Bv__kXG6.js.map} +1 -1
  89. package/dist/lib/{shadow-claw-task-server-DV4b1g2-.js → shadow-claw-task-server-DNOe8PWK.js} +2 -2
  90. package/dist/lib/{shadow-claw-task-server-DV4b1g2-.js.map → shadow-claw-task-server-DNOe8PWK.js.map} +1 -1
  91. package/dist/lib/{shadow-claw-tasks-K-foOHSE.js → shadow-claw-tasks-qmcDT4PU.js} +3 -3
  92. package/dist/lib/{shadow-claw-tasks-K-foOHSE.js.map → shadow-claw-tasks-qmcDT4PU.js.map} +1 -1
  93. package/dist/lib/{shadow-claw-terminal-CpAknKyA.js → shadow-claw-terminal-0QUWP8of.js} +2 -2
  94. package/dist/lib/{shadow-claw-terminal-CpAknKyA.js.map → shadow-claw-terminal-0QUWP8of.js.map} +1 -1
  95. package/dist/lib/{shadow-claw-tools-D98XZ0Ep.js → shadow-claw-tools-Bs_bmI6-.js} +3 -3
  96. package/dist/lib/{shadow-claw-tools-D98XZ0Ep.js.map → shadow-claw-tools-Bs_bmI6-.js.map} +1 -1
  97. package/dist/lib/{shadow-claw-webvm-DLOb8dMI.js → shadow-claw-webvm-DYaoL7QY.js} +2 -2
  98. package/dist/lib/{shadow-claw-webvm-DLOb8dMI.js.map → shadow-claw-webvm-DYaoL7QY.js.map} +1 -1
  99. package/dist/lib/{syncWebMcpRegistration-NspKefOI.js → syncWebMcpRegistration-BhbqI6R2.js} +2 -2
  100. package/dist/lib/{syncWebMcpRegistration-NspKefOI.js.map → syncWebMcpRegistration-BhbqI6R2.js.map} +1 -1
  101. package/dist/public/.well-known/mcp/server-card.json +1 -1
  102. package/dist/public/.well-known/mcp.json +1 -1
  103. package/dist/public/AGENTS.md +22 -3
  104. package/dist/public/README.md +96 -278
  105. package/dist/public/agent.worker.js +50 -50
  106. package/dist/public/{base-task-model-CYkpwnvU-DDfHUUIS.js → base-task-model-CYkpwnvU-DrXr4G1R.js} +1 -1
  107. package/dist/public/{configurePeerJs-BhBokQlC.js → configurePeerJs-B470pdeU.js} +1 -1
  108. package/dist/public/docs/README.md +31 -31
  109. package/dist/public/docs/architecture/context-management.md +7 -0
  110. package/dist/public/docs/architecture/storage.md +10 -1
  111. package/dist/public/docs/decisions/bundled-typescript-architecture.md +0 -1
  112. package/dist/public/docs/decisions/native-web-components-and-signals.md +0 -1
  113. package/dist/public/docs/example/article/index.html +1 -1
  114. package/dist/public/docs/guides/publishing-to-github-pages.md +334 -0
  115. package/dist/public/docs/guides/server-development-configuration.md +15 -0
  116. package/dist/public/docs/publishing/index.html +1 -1
  117. package/dist/public/docs/skill-creator/index.html +1 -1
  118. package/dist/public/docs/subsystems/cli.md +10 -2
  119. package/dist/public/docs/subsystems/control-plane.md +9 -8
  120. package/dist/public/docs/subsystems/crypto.md +9 -0
  121. package/dist/public/docs/subsystems/custom-element-security.md +2 -0
  122. package/dist/public/docs/subsystems/mcp-server.md +31 -16
  123. package/dist/public/docs/subsystems/notifications.md +8 -5
  124. package/dist/public/docs/subsystems/providers.md +9 -0
  125. package/dist/public/docs/subsystems/share-target.md +107 -0
  126. package/dist/public/docs/subsystems/webmcp.md +43 -0
  127. package/dist/public/e2e/README.md +4 -2
  128. package/dist/public/{e2e-bridge-DcBoeFvd.js → e2e-bridge-CSW0S5Yz.js} +1 -1
  129. package/dist/public/{file-viewer-CKtVC9Ix.js → file-viewer-Cs-riNvy.js} +1 -1
  130. package/dist/public/{firebase-OSDX3viP.js → firebase-cwAl_ABm.js} +1 -1
  131. package/dist/public/{git-CkhCJonj.js → git-GD09WATp.js} +25 -25
  132. package/dist/public/index.html +1 -1
  133. package/dist/public/index.js +1 -1
  134. package/dist/public/{initControlPlane-Bi8ouFEb.js → initControlPlane-BqCY0NQy.js} +1 -1
  135. package/dist/public/initControlPlane-C-IXaKYX.js +1 -0
  136. package/dist/public/{language-detector-BRKrlra0.js → language-detector-CIeEuQFk.js} +1 -1
  137. package/dist/public/llms.txt +4 -2
  138. package/dist/public/main/index.html +1 -1
  139. package/dist/public/main/memory/index.html +1 -1
  140. package/dist/public/{markdown-C-hCVJtc.js → markdown-Cw7vCtTg.js} +1 -1
  141. package/dist/public/{openai-Bpd71Oja.js → openai-BJIb2c5j.js} +3 -3
  142. package/dist/public/{orchestrator-8qNGfw8r.js → orchestrator-BWkHHO9Y.js} +1 -1
  143. package/dist/public/{orchestrator-BT3Ks5ip.js → orchestrator-DpkkeD6T.js} +1 -1
  144. package/dist/public/{peerjs-DfhwEiiq.js → peerjs-tf2EmWjB.js} +1 -1
  145. package/dist/public/{prompt-api-polyfill-Dl1kbJhR.js → prompt-api-polyfill-CXd75leW.js} +1 -1
  146. package/dist/public/{push-client-BVLrE9pK.js → push-client-CHjSbrWs.js} +1 -1
  147. package/dist/public/{rewriter-j6D9LDER.js → rewriter-BEHn9gll.js} +1 -1
  148. package/dist/public/service-worker.js +1 -1
  149. package/dist/public/{shadow-claw-DCjxNDCX.js → shadow-claw-BBPV_9X8.js} +2 -2
  150. package/dist/public/{shadow-claw-channels-CITDrqMl.js → shadow-claw-channels-BJvrKQjg.js} +1 -1
  151. package/dist/public/{shadow-claw-chat-BQrSgSKF.js → shadow-claw-chat-BG2EaRaw.js} +1 -1
  152. package/dist/public/{shadow-claw-control-plane-Cp001OY0.js → shadow-claw-control-plane-BBa7WbTg.js} +2 -2
  153. package/dist/public/{shadow-claw-conversations-EhX4RvIj.js → shadow-claw-conversations-CFaWFmkm.js} +1 -1
  154. package/dist/public/{shadow-claw-file-viewer-DiQXIjZD.js → shadow-claw-file-viewer-Z-GIKaE9.js} +1 -1
  155. package/dist/public/{shadow-claw-files-lkTnSJsn.js → shadow-claw-files-BBx4iMsk.js} +1 -1
  156. package/dist/public/{shadow-claw-git-BlcA_z8x.js → shadow-claw-git-vTOKatwd.js} +2 -2
  157. package/dist/public/{shadow-claw-llm-CW16X9Rg.js → shadow-claw-llm-Ce1Ax6-x.js} +1 -1
  158. package/dist/public/{shadow-claw-networking-ySsMBY_i.js → shadow-claw-networking-q4XIzdB5.js} +1 -1
  159. package/dist/public/{shadow-claw-notifications-CyV2zCQ8.js → shadow-claw-notifications-D2cz0gmm.js} +1 -1
  160. package/dist/public/{shadow-claw-pages-Cx7cF9ah.js → shadow-claw-pages-3335lmSC.js} +1 -1
  161. package/dist/public/{shadow-claw-settings-zm4PHHGi.js → shadow-claw-settings-4ptYuJwO.js} +2 -2
  162. package/dist/public/{shadow-claw-storage-dy9JAEGd.js → shadow-claw-storage-bIrPKFhF.js} +1 -1
  163. package/dist/public/{shadow-claw-task-server-Bleww48s.js → shadow-claw-task-server-5yqVBxy1.js} +1 -1
  164. package/dist/public/{shadow-claw-tasks-CTI5oaLN.js → shadow-claw-tasks-DcqYHPLZ.js} +1 -1
  165. package/dist/public/{shadow-claw-terminal-mZ3i4HaQ.js → shadow-claw-terminal-fARaDONr.js} +1 -1
  166. package/dist/public/{shadow-claw-tools-B_nuk8Zl.js → shadow-claw-tools-paEAhcJr.js} +1 -1
  167. package/dist/public/{shadow-claw-webvm-Vl_jH5YL.js → shadow-claw-webvm-CbzH_vyX.js} +1 -1
  168. package/dist/public/{summarizer-VJNr-7xG.js → summarizer-BT3AuFed.js} +1 -1
  169. package/dist/public/{syncWebMcpRegistration-n2vAMJ4w.js → syncWebMcpRegistration-CWSYaHex.js} +1 -1
  170. package/dist/public/{transformers-BhQMWQG5.js → transformers-1VTxqKjT.js} +1 -1
  171. package/dist/public/{translator-DEQXb7ZL.js → translator-B50RYlFt.js} +1 -1
  172. package/dist/public/{webllm-CHN5H-Sy.js → webllm-FmyJWWpt.js} +1 -1
  173. package/dist/public/{writer-CD9oN2pq.js → writer-Bhb4YYRE.js} +1 -1
  174. package/dist/server.js +205 -203
  175. package/package.json +1 -1
  176. package/src/components/settings/shadow-claw-llm/shadow-claw-llm.test.ts +2 -0
  177. package/src/core/orchestrator/utils/configurePeerJs.test.ts +2 -0
  178. package/src/server/client-registry.test.ts +9 -0
  179. package/src/server/client-registry.ts +14 -0
  180. package/src/server/mcp/mcp-integration.test.ts +68 -16
  181. package/src/server/mcp/tools/built-in-tools.ts +125 -34
  182. package/src/server/mcp/tools/client-tool-relay.ts +81 -44
  183. package/src/server/mcp/tools/mcp-tools.test.ts +103 -13
  184. package/src/server/mcp/types.ts +3 -0
  185. package/src/server/openapi/paths/push.ts +48 -0
  186. package/src/server/server.ts +30 -0
  187. package/src/subsystems/notifications/push-client.test.ts +17 -0
  188. package/src/subsystems/notifications/push-client.ts +22 -2
  189. package/src/subsystems/notifications/push-routes.test.ts +31 -0
  190. package/src/subsystems/notifications/push-routes.ts +10 -0
  191. package/src/subsystems/notifications/push-store.test.ts +49 -0
  192. package/src/subsystems/notifications/push-store.ts +45 -0
  193. package/src/worker/worker.test.ts +2 -0
  194. package/dist/lib/push-client-D6hbzDNV.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://modelcontextprotocol.io/schemas/server-card/v1.json",
3
3
  "name": "shadow-claw",
4
- "version": "1.28.0",
4
+ "version": "1.29.0",
5
5
  "description": "Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution.",
6
6
  "title": "ShadowClaw MCP Server",
7
7
  "websiteUrl": "https://xt-ml.github.io/shadow-claw/",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://modelcontextprotocol.io/schemas/server-card/v1.json",
3
3
  "name": "shadow-claw",
4
- "version": "1.28.0",
4
+ "version": "1.29.0",
5
5
  "description": "Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution.",
6
6
  "title": "ShadowClaw MCP Server",
7
7
  "websiteUrl": "https://xt-ml.github.io/shadow-claw/",
package/README.md CHANGED
@@ -1,11 +1,16 @@
1
1
  # 🦞 [ShadowClaw](https://xt-ml.github.io/shadow-claw/)
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/shadow-claw.svg)](https://www.npmjs.com/package/shadow-claw)
3
4
  [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/xt-ml/shadow-claw)
4
5
 
5
- A browser-native, fully-featured AI assistant whose core orchestration and tool-use loop run client-side in the browser. Deployable as a PWA or native Electron desktop app, backed by a Node.js service layer (local proxying, control plane, MCP), and driven via the `shadow-claw` CLI.
6
+ ShadowClaw is a browser-native AI assistant whose core orchestration, state machine, dynamic context windowing, and tool-execution loop run client-side off the main thread in a Web Worker. Sandboxed local execution uses the `just-bash` POSIX emulator by default (with optional WebVM Alpine Linux) backed by OPFS storage, with UI reactivity powered by native Web Components and TC39 Signals. Inference routes across in-browser models (defaulting to the Prompt API with polyfill support, alongside LiteRT WebGPU), local servers, and cloud providers, backed by a Node.js control plane and Stateless MCP server connecting over SSE, WebSockets, or WebRTC DataChannels.
6
7
 
7
8
  [![ShadowClaw Screenshot](https://xt-ml.github.io/shadow-claw/assets/screenshots/shadow-claw-screenshot-1920x1052.png)](https://xt-ml.github.io/shadow-claw/)
8
9
 
10
+ _Watch a demo:_ [Peer-to-peer Browser Native Agents in action (YouTube)](https://www.youtube.com/watch?v=h1les1A3gcg)
11
+
12
+ ---
13
+
9
14
  ## Quick Start
10
15
 
11
16
  ### 1. Launch ShadowClaw instantly without cloning the repo
@@ -14,7 +19,7 @@ A browser-native, fully-featured AI assistant whose core orchestration and tool-
14
19
  npx shadow-claw dev --open
15
20
  ```
16
21
 
17
- Open Settings, select your AI provider (or use the in-browser Prompt API / local models), and start chatting.
22
+ Open Settings, configure your preferred provider (or run with the default Prompt API), and start chatting.
18
23
 
19
24
  ### 2. Scaffold a Project or Knowledge Hub
20
25
 
@@ -34,43 +39,35 @@ cd shadow-claw
34
39
  npm install && npm run dev # Dev server → http://localhost:8888
35
40
  ```
36
41
 
37
- **Desktop App:** `npm run electron` or `npm run electron:build` for distributable installer.
38
-
39
- ## What is ShadowClaw?
40
-
41
- A fully-functional agent runtime built on browser-native technology — the orchestration and tool-use loop run entirely client-side in the browser, with AI inference routing to remote APIs, local servers, or in-browser models depending on your configuration. Built with TypeScript, it provides:
42
-
43
- - **Client-side orchestration**: The agent decision loop, system prompt building, and tool execution run off the main thread in a Web Worker inside the browser
44
- - **Multi-model support**: OpenRouter, Anthropic, Google Gemini, AWS Bedrock, Ollama, Llamafile, Mesh LLM, Transformers.js, and browser-native Prompt API
45
- - **Web Components UI**: Native Custom Elements + TC39 Signals for reactive updates across mobile PWA and Electron Desktop
46
- - **Persistent storage**: IndexedDB for messages/config, OPFS for files (namespaced per deployment subpath with automated legacy migration)
47
- - **Agent tools**: File I/O, shell (with optional WebVM), Git, HTTP, JavaScript execution
48
- - **Multi-conversation support**: Each conversation has isolated chat history, file workspace, and scheduled tasks
49
- - **Messaging channels**: Browser chat, PeerJS, Telegram Bot API, iMessage bridge (configurable)
50
- - **PWA + offline**: Service Worker, Web Push notifications, scheduled task execution even when closed
51
- - **Desktop app**: Electron wrapper with full parity to the web version
52
- - **CLI & Control Plane**: Command-line interface (`commander`) and dev server with task scheduling, backups, and an MCP server relaying CLI commands and browser tools
53
-
54
- ## Key Features
55
-
56
- - **Streaming responses** — Token-by-token text updates with live chat bubble
57
- - **Dynamic context windowing** — Token-aware message history (not fixed-size window)
58
- - **Tool profiles** Per-model/provider tool customization and system prompt overrides
59
- - **Conversation-scoped subagent policy** Per-conversation subagent mode (`automatic` or `manual`) with optional pinned provider/model
60
- - **Conversation-scoped agent token budget** Optional per-conversation max output tokens override (clamped to selected model limits)
61
- - **Conversation-scoped provider runtime overrides** Per-conversation runtime overrides for Bedrock proxy and Llamafile (auth/profile/region/host/mode/offline/port)
62
- - **Model registry** Dynamic metadata fetch (context window, modality support)
63
- - **Attachment capabilities** Native multimodal delivery with automatic text fallback
64
- - **Remote MCP** — Discover and execute tools from external MCP servers
65
- - **Stateless MCP server** — Expose ShadowClaw CLI commands and live browser tools to external agent hosts (Claude Desktop, Cursor, Goose) via STDIO (`npx shadow-claw mcp`) or Streamable HTTP (`POST /mcp`), featuring multi-client tool targeting (`shadowclaw_set_active_client`), per-tool client capability validation, client-side execution guards, and interactive `ask_user` relaying
66
- - **A2UI interactive surfaces** — Render responsive UI components (Text, Button, TextField, Row/Column layouts) from agents via PeerJS WebRTC with two-way data binding
67
- - **Multi-Agent Shared State** — Synchronize agent knowledge across participants using `STATE_SNAPSHOT` and `STATE_DELTA` events
68
- - **Email integration** — IMAP/SMTP support with encrypted credentials
69
- - **Web Share Target** — Receive files/URLs directly from OS share sheet
70
- - **Scheduled tasks** — Cron expressions with server-side persistence and Web Push
71
- - **Git integration** — Clone, branch, merge (with conflict reports), push/pull
72
- - **File viewer** — Syntax highlighting (locally bundled CSS, no CDN), PDF preview, media playback, Web Share, native/fallback fullscreen, relative image workspace resolving, and configurable iframe embed sanitization; hardened opaque-origin iframe sandbox (no `allow-same-origin`) with transparent `postMessage` storage proxy bridge (`IndexedDB`/`localStorage`), programmatic navigation interception (`location.href`, `assign()`, `replace()`), `showOpenFilePicker`/`showSaveFilePicker` polyfills, and declarative `BroadcastChannel` proxying
73
- - **Files browser** — Clipboard-driven Cut/Copy/Paste actions, hidden Paste button when empty, folder self-paste protection, inter-group transfers, and conflict resolution (rename/overwrite)
42
+ **Desktop App:** `npm run electron` or `npm run electron:build` for a distributable installer.
43
+
44
+ ---
45
+
46
+ ## Table of Contents
47
+
48
+ - [Core Capabilities](#core-capabilities)
49
+ - [Architecture](#architecture)
50
+ - [Multi-Conversation Support](#multi-conversation-support)
51
+ - [Providers & Models](#providers--models)
52
+ - [Agent Tools & WebMCP](#agent-tools--webmcp)
53
+ - [Conversations & Messaging Channels](#conversations--messaging-channels)
54
+ - [Documentation Index](#documentation-index)
55
+ - [Development](#development)
56
+ - [CLI Runtime Commands](#cli-runtime-commands)
57
+ - [License](#license)
58
+
59
+ ---
60
+
61
+ ## Core Capabilities
62
+
63
+ - **Client-Side Worker Orchestration:** The agent decision loop, system prompt building, and tool execution run off the main thread in a dedicated Web Worker to keep the UI smooth and responsive.
64
+ - **In-Browser Inference by Default:** Uses the Prompt API (`window.LanguageModel`) by default (`DEFAULT_PROVIDER = "prompt_api"`). When native support is not present, integrated polyfills (`prompt-api-polyfill` and `built-in-ai-task-apis-polyfills` backed by Transformers.js / ONNX) enable cross-browser execution.
65
+ - **Multi-Model Routing:** Route queries to Cloud providers (OpenRouter, Anthropic, Gemini, AWS Bedrock), local engines (Ollama, Llamafile, Transformers.js), or in-browser WebGPU models (LiteRT-LM).
66
+ - **Sandboxed Execution & Storage:** Client-side compute via sandboxed JavaScript and the default `just-bash` POSIX shell emulator (with optional WebVM Alpine Linux), backed by Origin Private File System (OPFS) and IndexedDB namespaced per deployment subpath.
67
+ - **PWA & Electron Desktop Parity:** Deployable as a progressive web app with Service Worker and Web Push, or as a native desktop application with full feature parity.
68
+ - **Control Plane, CLI & Native MCP Server:** Backed by a Node.js service layer and CLI (`shadow-claw`) that provides background cron scheduling, remote backups, direct WebRTC DataChannel connectivity, and a Stateless MCP server featuring both native server management tools and dynamic browser tool relaying to external agent hosts (Claude Desktop, Cursor, Goose).
69
+
70
+ ---
74
71
 
75
72
  ## Architecture
76
73
 
@@ -102,59 +99,63 @@ ShadowClaw follows a **worker-isolated runtime** pattern:
102
99
 
103
100
  **Key design principles:**
104
101
 
105
- - **Agent in Web Worker** — LLM calls, tool execution, and WebVM all run off-main-thread to keep UI responsive
106
- - **Message-based protocol** — Strict `postMessage` boundaries between main thread and worker
107
- - **Reactive signals** — TC39 Signals (via `signal-polyfill`) drive all UI updates
108
- - **Storage isolation** — Each conversation gets a workspace (`shadowclaw/<groupId>/workspace/`); shared config in IndexedDB
102
+ - **Agent in Web Worker** — LLM calls, tool execution, and WebVM all run off-main-thread to keep the UI responsive.
103
+ - **Message-based protocol** — Strict `postMessage` boundaries between the main thread and worker.
104
+ - **Reactive signals** — TC39 Signals (via `signal-polyfill`) drive all UI updates.
105
+ - **Storage isolation** — Each conversation gets a dedicated workspace (`shadowclaw/<groupId>/workspace/`); shared configuration lives in IndexedDB.
109
106
 
110
- **Full architecture docs**: See [Architecture Overview](docs/architecture/overview.md) and [Worker-Isolated Agent Runtime](docs/decisions/worker-isolated-agent-runtime.md) for orchestrator state machine, worker protocol, storage system, context management, and streaming.
107
+ **Full architecture docs:** See [System Overview](docs/architecture/overview.md) and [Worker-Isolated Agent Runtime](docs/decisions/worker-isolated-agent-runtime.md) for orchestrator state machine, worker protocol, storage system, context management, and streaming.
108
+
109
+ ---
111
110
 
112
111
  ## Multi-Conversation Support
113
112
 
114
113
  Each conversation has:
115
114
 
116
- - Independent chat history
117
- - Isolated file workspace
118
- - Scheduled tasks
119
- - Editable `MEMORY.md` (loaded as system context)
120
- - Optional per-conversation tool tagging
121
- - Optional per-conversation pinned provider/model and max output tokens
122
- - Accessible sidebar with drag-and-drop reordering and clone support
123
- - Unread indicators with pulsing highlights
115
+ - Independent chat history and token-aware context windowing
116
+ - Isolated file workspace in OPFS with clipboard safeguards and conflict resolution
117
+ - Scheduled tasks and cron automations
118
+ - Editable `MEMORY.md` (loaded automatically as system context)
119
+ - Optional per-conversation tool tagging and declarative tool overrides
120
+ - Optional per-conversation pinned provider/model and token budget limits
121
+ - Accessible sidebar with drag-and-drop reordering, clone support, and unread indicators
124
122
 
125
123
  Last-active conversation persists across reloads. On first launch, a default "Main" conversation is auto-created.
126
124
 
127
- **Full guide**: [docs/architecture/orchestrator.md](docs/architecture/orchestrator.md)
125
+ **Full guide:** [docs/architecture/orchestrator.md](docs/architecture/orchestrator.md)
126
+
127
+ ---
128
128
 
129
129
  ## Providers & Models
130
130
 
131
131
  ShadowClaw supports multiple LLM providers with a unified adapter pattern:
132
132
 
133
- | Category | Examples | Notes |
134
- | ----------- | -------------------------------------------------------------------- | ---------------------------------- |
135
- | **Cloud** | OpenRouter, OpenAI, Anthropic, Google Gemini, AWS Bedrock, Vertex AI | API key required |
136
- | **Local** | Ollama, Llamafile, Mesh LLM, Transformers.js | Runs on local server or in-browser |
137
- | **Browser** | Prompt API (`window.LanguageModel`), LiteRT | Experimental, keyless, Gemini Nano |
133
+ | Category | Examples | Notes |
134
+ | :---------- | :------------------------------------------------------------------- | :------------------------------------------------------------------- |
135
+ | **Browser** | Prompt API (`window.LanguageModel`), LiteRT | Default provider (`prompt_api`) with polyfill support; LiteRT WebGPU |
136
+ | **Local** | Ollama, Llamafile, Mesh LLM, Transformers.js | Runs on local server or in-browser |
137
+ | **Cloud** | OpenRouter, OpenAI, Anthropic, Google Gemini, AWS Bedrock, Vertex AI | API key required |
138
138
 
139
- **Features:**
139
+ **Provider Highlights:**
140
140
 
141
- - Streaming responses (OpenAI + Anthropic formats)
142
- - Adaptive rate limiting with `retry-after` support and 30-second auto-closing, ARIA-accessible countdown dialogs for fatal errors and throttling
143
- - Dynamic model registry with capability metadata (context, modalities, tool support)
144
- - Multi-format support (OpenAI, Anthropic, Prompt API)
145
- - Prompt API session retry loop & hardware feature probing — automatically probes WebGPU adapter capabilities (requiring `shader-f16` support), retries `LanguageModel.create()` during downloads, and dynamically falls back to WebAssembly CPU (`device: "wasm"`, `dtype: "q4"`) if WebGPU initialization fails or software emulation is detected.
146
- - Polyfill model cache — Service Worker `CacheFirst` caching strategy stores Hugging Face polyfill model binaries (`.onnx`, `.onnx_data`) for offline performance
141
+ - **Prompt API Default & Polyfill Fallbacks:** Uses `prompt_api` by default. When native `window.LanguageModel` is absent, built-in polyfills (`prompt-api-polyfill` and `built-in-ai-task-apis-polyfills` backed by Transformers.js / ONNX) enable execution across browsers.
142
+ - **Hardware Feature Probing & Fallbacks:** Probes WebGPU adapter capabilities (`shader-f16`), retries during downloads, and dynamically falls back to WebAssembly CPU (`device: "wasm"`, `dtype: "q4"`) if WebGPU initialization fails or software emulation is detected.
143
+ - **Polyfill Model Cache:** Service Worker `CacheFirst` caching strategy stores Hugging Face polyfill model binaries (`.onnx`, `.onnx_data`) for offline performance.
144
+ - **Streaming & Resilience:** Streaming responses across OpenAI and Anthropic formats; adaptive rate limiting with `retry-after` handling and 30-second auto-closing, ARIA-accessible countdown dialogs for fatal errors and throttling.
145
+ - **Model Registry:** Dynamic metadata fetch (context window, modality support, tool support).
147
146
 
148
- **Setup & details**: [docs/guides/adding-a-provider.md](docs/guides/adding-a-provider.md) | [docs/subsystems/providers.md](docs/subsystems/providers.md)
147
+ **Setup & details:** [docs/guides/adding-a-provider.md](docs/guides/adding-a-provider.md) | [docs/subsystems/providers.md](docs/subsystems/providers.md)
149
148
 
150
- ## Agent Tools
149
+ ---
150
+
151
+ ## Agent Tools & WebMCP
151
152
 
152
153
  The agent has access to **50+ tools** including:
153
154
 
154
155
  | Category | Tools |
155
- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
156
+ | :-------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
156
157
  | **Files** | `read_file`, `write_file`, `patch_file`, `delete_file`, `move_file`, `copy_file`, `create_directory`, `list_files`, `open_file`, `attach_file_to_chat`, `send_file`, `search_files`, `diff_files` |
157
- | **Shell** | `bash` (WebVM or just-bash emulator) |
158
+ | **Shell** | `bash` (default `just-bash` emulator, optional WebVM) |
158
159
  | **Built-in AI** | `summarize_text`, `write_text`, `rewrite_text`, `proofread_text`, `detect_language`, `translate_text` (defaults to Active Conversation LLM backend with opt-in local browser Task API polyfill) |
159
160
  | **Git** | `git_clone`, `git_init`, `git_add`, `git_unstage`, `git_commit`, `git_push`, `git_pull`, `git_fetch`, `git_merge`, `git_diff`, and more |
160
161
  | **Web** | `fetch_url`, `fetch_file`, `web_search` (DuckDuckGo via configurable CORS search proxy and URL templates) |
@@ -169,44 +170,13 @@ The agent has access to **50+ tools** including:
169
170
  | **Rooms** | `create_room`, `invite_to_room`, `leave_room`, `list_room_members` |
170
171
  | **A2UI** | `list_components`, `render_component` |
171
172
 
172
- ### Testing WebMCP Integration
173
-
174
- **WebMCP integration**: When `document.modelContext` is available (with `navigator.modelContext` fallback for Chrome < 152), tools are also registered through the browser's Model Context Protocol (`@mcp-b/webmcp-polyfill` v3). ShadowClaw provides `parseWebMcpInputSchema` to normalize input schemas across Chrome 154+ (native object) and Chrome < 154 (DOMString JSON) versions, and `getWebMcpTools()` to safely query registered tools with graceful degradation.
175
-
176
- ```ts
177
- // get available tools (safely normalizes input schemas across Chrome versions)
178
- var tools = await document.modelContext.getTools();
179
-
180
- // format the tool list
181
- var formattedToolsJSON = JSON.stringify(
182
- tools.map(
183
- ({ annotations, description, inputSchema, name, origin, title }) => ({
184
- annotations,
185
- description,
186
- inputSchema,
187
- name,
188
- origin,
189
- title,
190
- }),
191
- ),
192
- null,
193
- 2,
194
- );
195
-
196
- // list available tools
197
- console.log(formattedToolsJSON);
198
-
199
- // get the toast tool
200
- var [toastTool] = tools.filter((v) => v.description.includes("Show a toast"));
201
-
202
- // run the toast tool
203
- await document.modelContext.executeTool(
204
- toastTool,
205
- '{ "message": "Hello from 🦞 Shadow Claw!"}',
206
- );
207
- ```
173
+ ### WebMCP Integration
208
174
 
209
- **Full reference**: [docs/subsystems/tools.md](docs/subsystems/tools.md) | [docs/subsystems/webmcp.md](docs/subsystems/webmcp.md)
175
+ When running in browsers supporting the Model Context Protocol (or via `@mcp-b/webmcp-polyfill`), ShadowClaw automatically registers its tool catalog on `document.modelContext` with normalized input schemas across Chrome versions and signal-based abort handling, routing tool execution safely through the Web Worker.
176
+
177
+ **Full reference:** [docs/subsystems/tools.md](docs/subsystems/tools.md) | [docs/subsystems/webmcp.md](docs/subsystems/webmcp.md)
178
+
179
+ ---
210
180
 
211
181
  ## Conversations & Messaging Channels
212
182
 
@@ -219,184 +189,27 @@ ShadowClaw supports **four messaging channels** by default:
219
189
 
220
190
  Each channel creates isolated conversations with their own message history and workspace.
221
191
 
222
- **Setup & architecture**: [docs/guides/configuring-messaging-channels.md](docs/guides/configuring-messaging-channels.md) (setup) | [docs/subsystems/channels.md](docs/subsystems/channels.md) (architecture + custom channels)
223
-
224
- ## Pages System
225
-
226
- ShadowClaw includes a **Pages sidebar** for organizing and viewing workspace content.
227
-
228
- - **Render markdown & HTML** — Save any markdown or HTML file as a page for structured preview, including optional visible YAML frontmatter metadata
229
- - **Workspace-relative links** — Links and images in pages resolve relative to the workspace
230
- - **Page sidebar** — Persistent list of saved pages with drag-and-drop reordering and responsive mobile sidebar collapse
231
- - **Static Main Site Seeding** — Automatically seeds default main pages from the `pages/main/` manifest, respecting page suppression rules; when `pages/` is absent, built-in `index.html` and `MEMORY.md` defaults are used
232
- - **Static Pretty Paths & DSD Pre-rendering** — Build-time pre-rendering for `routes.json` (usually `pages/routes.json`) generates static HTML with Declarative Shadow DOM templates for clean URLs across Node.js, Electron, and GitHub Pages; missing routes are skipped, pages flagged for purge are excluded from the output manifest, and same-origin links are validated via `isPossibleAppRoute` so non-app paths fall back to native browser navigation
233
- - **Page Suppression** — Deleting pages suppresses auto-reseeding (`SUPPRESSED_PAGES_LIST`) until re-added
234
- - **Safe iframe embeds** — HTML previews use a configurable iframe host allowlist in Settings, with safe defaults for common embedded content hosts
235
- - **Ebook-Style Navigation** — Functional Previous/Next pagination controls with HTML-entity decoded frontmatter headers, seamless page transitions, `ArrowLeft`/`ArrowRight` keyboard navigation, touch/mouse swipe gestures, and `aria-live` screen reader announcements
236
- - **Pre-rendered Content Override** — Optional setting (`OVERRIDE_PRERENDER_SKELETON`) suppresses Declarative Shadow DOM (DSD) pre-rendered content during boot to eliminate hydration flash
237
- - **Declarative Configuration** — Support for `shadow-claw.config.json` (with backward compatibility for `site-config.json`) enabling template repositories to customize metadata, branding, custom theme stylesheets, custom element security allowlists, navigation visibility, and server/cache storage (`cacheDir`) without modifying core source
238
- - **Dynamic Sidebar Navigation Visibility** — Runtime toggling of Pages, Chat, Tasks, and Files sidebar tabs via Settings, with automatic fallback routing and build-time DSD navigation attribute synchronization
239
- - **Content-Only Publishing** — Supports GitHub Pages publishing via the [`shadow-claw-template` template repository](https://github.com/xt-ml/shadow-claw-template) that pulls ShadowClaw as a CI-time build dependency; see the [publishing guide](pages/main/~/docs/publishing-to-github-pages.md) for root-level `shadow-claw.config.json` and optional `pages/` behavior.
240
-
241
- Pages complement the **main group MEMORY** (auto-created as `MEMORY.md` on first setup) which serves as a workspace-scoped system context for the agent. An `index.html` is also auto-created as the default home page.
242
-
243
- ## Agent Skills and Declarative Tools
244
-
245
- - **Workspace Agent Skills** — Discovers `.agents/skills/**/SKILL.md` instruction packages, presents model-invocable skill descriptions in the system prompt, and loads instructions plus bundled resources through `activate_skill`. Default bundled skills include `skill-creator`.
246
- - **Agent Skills Discovery Index** — Automatically indexes skills, tools, and scripts into `/.well-known/agent-skills/index.json` complying with Agent Skills Discovery RFC v0.2.0, computing SHA-256 digests and RFC 3986 relative URLs. Integrated into static builds (`bin/build/build.mjs`) and runnable via `npx shadow-claw skills:index [dir]` (alias `agent-skills`).
247
- - **Slash Commands & Declarative Execution Pipelines** — User-invocable skills support `/skill-name` slash-command triggers. Skills with `execution: { type: "tools", tools: [...] }` execute tool pipelines directly on the worker thread via `executeToolChain` without scheduling Tasks or invoking LLM prompts. Supports `$pipe` output chaining and step-level or cascaded `suppressToast: true` and `suppressOutput: true` options.
248
- - **Declarative Tools** — Content repositories can define executable tools as JSON under `.agents/tools/main/` using sandboxed Bash or JavaScript, or delegate to existing tools without changing ShadowClaw source (e.g. `generate_random_number` in the starter template repository).
249
- - **Enhanced JS Tool Expression Evaluation** — The `javascript` tool automatically evaluates single expressions without explicit `return` statements by wrapping them in `return (<expression>);`.
250
-
251
- ## Web Components & Component Workbench
252
-
253
- ShadowClaw packages its UI components as standard Web Components built on TC39 Signals and native Custom Elements:
254
-
255
- - **Modular Package Exports** — Import pre-bundled components and utilities directly via `shadow-claw/components` (e.g. `ShadowClawToast`, `ShadowClawCard`, `ShadowClawDialog`, `ShadowClawEmptyState`, `ShadowClawPageHeader`) and `shadow-claw/utils` (e.g. `namespacedStorage`, `ulid`). TypeScript declaration files (`.d.ts`) are provided out of the box.
256
- - **Storybook Workbench** — Interactive visual development environment powered by Storybook (`@storybook/web-components-vite`) with dark mode default, live controls, and isolated component testing (`npm run storybook`), including all 18 A2UI catalog components and UI primitives.
257
- - **Reactive Element Lifecycle** — Custom elements extending `ShadowClawElement` observe attributes (`observedAttributes`) for declarative reactive DOM updates.
258
-
259
- ## WebVM (Optional Alpine Linux)
260
-
261
- For advanced `bash` operations, ShadowClaw includes an optional **WebVM** (`v86` Alpine Linux) that runs in the Web Worker.
262
-
263
- - **Boot modes**: `auto` (9p, lighter weight), `ext2` (full filesystem), or `disabled` (fallback to JavaScript shell)
264
- - **Coordination**: Terminal sessions and tool execution share exclusive access with graceful handoffs
265
- - **Workspace sync**: 9p mode syncs VM `/workspace` changes back to OPFS so Files view stays in sync
266
- - **Interactive terminal**: Full shell access via `<shadow-claw-terminal>` component
267
-
268
- **Full guide**: [docs/subsystems/vm.md](docs/subsystems/vm.md)
269
-
270
- ## Storage & Security
271
-
272
- ShadowClaw uses **IndexedDB** for structured data (messages, config, tasks) and **OPFS** for files.
273
-
274
- **Security:**
275
-
276
- - **AES-256-GCM encryption** for API keys at rest
277
- - **TC39 private fields** to prevent accidental leakage via console
278
- - **30-second key expiry** for plaintext operations
279
- - **No plaintext secrets on disk** — encrypted before storage
280
- - **Trusted Types enforcement** — idempotent `"default"` policy (`src/security/default-trusted-types-policy.ts`) registered at boot via `theme-init.ts`; `getPolicy()` fallback prevents duplicate-creation errors on module reload
281
- - **Custom element security guards** — `installCustomElementsRegistryGuard` and `installCustomElementDomGuard` prevent unauthorized custom element registration and dynamic DOM injection, strictly enforcing allowlists from `shadow-claw.config.json` (or `site-config.json`) or storage. Script declarations support URLs and `{ src, hasInit }` descriptors (standardized on `src`), invoking `init()` exclusively when `hasInit: true` is configured.
282
- - **Iframe sandbox & CSP hardening** — sandboxed preview iframes omit `allow-same-origin` by default to enforce opaque-origin (`null`) isolation without Chrome sandbox escape warnings, while injecting a transparent `postMessage` storage proxy bridge (`iframe-storage-bridge.js`) to provide namespaced `IndexedDB` and `localStorage` persistence for custom elements, trapping `ServiceWorker`/`caches` `SecurityError` rejections, polyfilling `showOpenFilePicker`/`showSaveFilePicker`, and relaying programmatic/link navigation and declarative `BroadcastChannel` messages via `IframeBroadcastProxy`
283
- - **Iframe embed sanitization** — DOMPurify-based iframe allowlisting protects markdown and HTML previews, with Settings-backed host patterns and a safe default host list
284
- - **SSRF proxy hardening** — `/proxy` blocks non-HTTP/S schemes and private/loopback IP ranges by default; bypassed via `--allow-private-proxy` flag or the authenticated service-worker JSON format
285
- - **Prompt injection defense** — external tool outputs (`fetch_url`, `web_search`, `remote_mcp_call_tool`) are structurally wrapped in `UNTRUSTED` delimiters; system prompt includes explicit anti-injection instructions when untrusted-content tools are active
286
-
287
- **File I/O:**
192
+ **Setup & architecture:** [docs/guides/configuring-messaging-channels.md](docs/guides/configuring-messaging-channels.md) (setup) | [docs/subsystems/channels.md](docs/subsystems/channels.md) (architecture + custom channels)
288
193
 
289
- - **OPFS** — browser-sandboxed storage (`shadowclaw/<groupId>/workspace/`)
290
- - **Per-deployment storage namespacing** — IndexedDB (`shadowclaw_<namespace>`), OPFS (`shadow-claw-opfs-<namespace>`), and localStorage (`shadowclaw:<namespace>:<key>`) are namespaced per deployment subpath with automated legacy database migration (`migrateLegacyDatabase.ts`)
291
- - **Local Folder** — user-selected directory via File System Access API
292
- - **Centralized write paths** — cross-browser fallback for Safari compatibility
293
- - **Zip export/import** — for conversation backup/restore
294
- - **Copy/move safety** — folder copy/move operations prevent pasting a folder into itself or one of its descendants, and support inter-group operations with conflict resolution
194
+ ---
295
195
 
296
- **Full details**: [docs/architecture/storage.md](docs/architecture/storage.md) | [docs/subsystems/crypto.md](docs/subsystems/crypto.md) | [docs/subsystems/custom-element-security.md](docs/subsystems/custom-element-security.md)
196
+ ## Documentation Index
297
197
 
298
- ## Scheduled Tasks & Web Push
198
+ Comprehensive architectural specifications, subsystem deep-dives, step-by-step guides, and ADRs live in [`docs/`](docs/README.md):
299
199
 
300
- ShadowClaw supports **cron-based scheduled tasks** with Web Push notifications. Tasks fire even when the app is closed.
200
+ - **[Architecture](docs/README.md#architecture):** [System Overview](docs/architecture/overview.md) · [Orchestrator & State Machine](docs/architecture/orchestrator.md) · [Worker Protocol](docs/architecture/worker-protocol.md) · [Storage System](docs/architecture/storage.md) · [Context Management](docs/architecture/context-management.md) · [Streaming](docs/architecture/streaming.md)
201
+ - **[Subsystems](docs/README.md#subsystems):** [Shell Emulator](docs/subsystems/shell.md) · [WebVM](docs/subsystems/vm.md) · [Git Integration](docs/subsystems/git.md) · [Channels](docs/subsystems/channels.md) · [Tools & Profiles](docs/subsystems/tools.md) · [Providers & Model Registry](docs/subsystems/providers.md) · [Notifications & Scheduling](docs/subsystems/notifications.md) · [Electron Desktop](docs/subsystems/electron.md) · [Reactive UI & Web Components](docs/subsystems/reactive-ui.md) · [Remote MCP](docs/subsystems/remote-mcp.md) · [Stateless MCP Server](docs/subsystems/mcp-server.md) · [WebMCP](docs/subsystems/webmcp.md) · [Crypto & Secrets](docs/subsystems/crypto.md) · [Control Plane](docs/subsystems/control-plane.md) · [Pages System](docs/subsystems/pages.md) · [Agent Skills](docs/subsystems/skills.md) · [Security Hardening](docs/subsystems/custom-element-security.md) · [File Backup](docs/subsystems/backup.md) · [Web Share Target](docs/subsystems/share-target.md) · [OpenAPI](docs/subsystems/openapi.md)
202
+ - **[Guides](docs/README.md#guides):** [Adding a Provider](docs/guides/adding-a-provider.md) · [Adding a Tool](docs/guides/adding-a-tool.md) · [Adding a Shell Command](docs/guides/adding-a-shell-command.md) · [Adding a UI Page](docs/guides/adding-a-page.md) · [Adding a Channel](docs/guides/adding-a-channel.md) · [Protocol-Agnostic Integrations](docs/guides/protocol-agnostic-integrations.md) · [Service Accounts & Credentials](docs/guides/adding-service-accounts.md) · [Configuring Messaging Channels](docs/guides/configuring-messaging-channels.md) · [Server Development Configuration](docs/guides/server-development-configuration.md) · [Publishing to GitHub Pages](docs/guides/publishing-to-github-pages.md)
203
+ - **[Decisions](docs/README.md#decisions):** ADRs on [Bundled TypeScript Architecture](docs/decisions/bundled-typescript-architecture.md), [Native Web Components and Signals](docs/decisions/native-web-components-and-signals.md), [Worker-Isolated Agent Runtime](docs/decisions/worker-isolated-agent-runtime.md), [IndexedDB and OPFS Storage](docs/decisions/indexeddb-and-opfs-storage.md), and [Peer-to-Peer Protocol (A2A via AGUI)](docs/decisions/peer-protocol-a2a-agui.md)
204
+ - **[Agent Conventions](AGENTS.md):** Architectural guardrails and conventions for AI coding agents
205
+ - **[E2E Testing Architecture](e2e/README.md):** Playwright fixtures, page objects, and feature-gated testing
301
206
 
302
- - Task expressions use standard **5-field cron syntax**
303
- - **Task sequences** — Execute a single text prompt, or sequentially run a list of agent tools
304
- - **Server-side persistence** — SQLite database ensures reliable firing (can be toggled via Settings)
305
- - **Web Push integration** — OS-level notifications when tasks trigger
306
- - **Recursion guard** — prevents infinite task → notification → task loops
307
- - **Client/Server parity** — Express dev server and Electron both support full scheduling
308
- - **Fresh Context & Subagent isolation** — Toggle task execution to bypass conversation history (fresh context) or run isolated in the background (subagent)
309
-
310
- **Setup & architecture**: [docs/subsystems/notifications.md](docs/subsystems/notifications.md)
311
-
312
- ## Advanced Features
313
-
314
- ### Remote MCP Integration
315
-
316
- Connect external **Model Context Protocol (MCP) servers** to extend agent capabilities dynamically. Tools from remote servers are discovered and executed transparently.
317
-
318
- - Bearer, Basic, and custom header authentication
319
- - OAuth token refresh support
320
- - Automatic reconnection on failure
321
-
322
- **Full guide**: [docs/subsystems/remote-mcp.md](docs/subsystems/remote-mcp.md)
323
-
324
- ### Protocol-Agnostic Integrations
325
-
326
- Email (IMAP/SMTP), RSS, webhooks, and other integrations via a **plugin architecture**.
327
-
328
- - Encrypted credential storage
329
- - Typed action dispatch
330
- - Configurable plugin catalog
331
-
332
- **Full guide**: [docs/guides/protocol-agnostic-integrations.md](docs/guides/protocol-agnostic-integrations.md)
333
-
334
- ### Web Share Target
335
-
336
- Receive files, URLs, and text directly from your OS share sheet into ShadowClaw.
337
-
338
- - Supported on all PWA-capable browsers and Android
339
- - Files are persisted to workspace
340
- - Auto-opens dated conversation with imported files
341
-
342
- **Full details**: [manifest.json](manifest.json) | [src/service-worker/share-target.ts](src/service-worker/share-target.ts)
343
-
344
- ### Tool Profiles & Customization
345
-
346
- Create model-specific or task-specific tool profiles to optimize the context window.
347
-
348
- - Enable/disable individual tools
349
- - Override system prompt per profile
350
- - Auto-activate profiles by model
351
- - Save custom selections
352
- - **Built-in Profile** — Default Prompt API profile is restricted to core file and script tools (`javascript`, `list_files`, `open_file`, `read_file`, `write_file`)
353
- - **Declarative tool defaults** — Pre-seed default tool profiles (`defaultToolsProfile`) and built-in tools (`enabledTools`) via `shadow-claw.config.json` (or `site-config.json`)
354
- - **Declarative tool management & gating** — Declarative tool toggles persist in storage, update in-place in `<shadow-claw-tools>`, gate execution during LLM invocation, and synchronize automatically with WebMCP
355
- - **Execution-time allowlist enforcement** — Tool calls are re-validated at runtime against the active enabled tool list (profile/manual), not only generation-time schema hints
356
- - **Shared internet access control** — Toggles public internet access (`fetch` and shell networking) globally for the `bash` and `javascript` tools
357
-
358
- **Full guide**: [docs/subsystems/tools.md](docs/subsystems/tools.md#tool-profiles)
359
-
360
- ### Attachment Capabilities
361
-
362
- Native multimodal delivery with automatic text fallback.
363
-
364
- - Model registry fetches capability metadata dynamically
365
- - Attachments sent as native content blocks when supported
366
- - Automatic fallback to OCR/markdown for unsupported formats
367
-
368
- **Full details**: [docs/subsystems/attachment-capabilities.md](docs/subsystems/attachment-capabilities.md)
369
-
370
- ### Dynamic Context & Auto-Compaction
371
-
372
- Instead of fixed-size message windows, context is **token-aware and adaptive**.
373
-
374
- - System prompt + max output tokens budgeted first
375
- - Messages walked newest-to-oldest within budget
376
- - Large outputs truncated at line boundaries
377
- - UI progress bar tracks context usage
378
- - **Token estimation & cache tracking** — Tracks token usage and cache hits/misses across context window
379
- - Auto-compaction triggers at 80% usage
380
-
381
- **Full details**: [docs/architecture/context-management.md](docs/architecture/context-management.md)
382
-
383
- ## Documentation
384
-
385
- Architecture docs, subsystem guides, and decision records live in [`docs/`](docs/README.md):
386
-
387
- - **[Architecture](docs/README.md#architecture)** — Orchestrator, worker protocol, storage, context, streaming
388
- - **[Subsystems](docs/README.md#subsystems)** — Shell, VM, git, channels, tools, providers, notifications, Electron, reactive UI, crypto
389
- - **[Guides](docs/README.md#guides)** — Adding providers, tools, shell commands, pages, channels
390
- - **[Decisions](docs/README.md#decisions)** — ADRs for bundled architecture, TypeScript, Signals, worker-owned VM, IndexedDB
391
-
392
- Agent-specific conventions and guardrails: [`AGENTS.md`](AGENTS.md)
393
-
394
- E2E test architecture: [`e2e/README.md`](e2e/README.md)
207
+ ---
395
208
 
396
209
  ## Development
397
210
 
398
211
  ```bash
399
- npm run dev # Dev server (watch mode)
212
+ npm run dev # Dev server (watch mode on http://localhost:8888)
400
213
  npm run dev -- --https # Dev server with opt-in HTTPS (auto-generates self-signed cert)
401
214
  npm start # Express server
402
215
  npm test # Jest (*.test.ts files live next to source)
@@ -405,7 +218,7 @@ npm run build:storybook # Build static Storybook documentation to dist/stor
405
218
  npm run build:lib # Build reusable ESM library and TypeScript declarations to dist/lib
406
219
  npm run e2e # Playwright E2E tests (e2e/*.test.ts)
407
220
  npm run e2e:install # Install Playwright browser binaries
408
- npm run tsc # TypeScript type-check
221
+ npm run tsc # Full TypeScript type-check across all workspaces
409
222
  npm run build # Bundle application via Rolldown + generate service worker
410
223
  npm run build:service-worker # Generate the Workbox service worker
411
224
  npm run build:prod # Production bundle build
@@ -427,6 +240,7 @@ npx shadow-claw tasks --client <id> # List scheduled tasks on a
427
240
  npx shadow-claw backup # Trigger OPFS workspace backup
428
241
  npx shadow-claw backup list # List available backup snapshots
429
242
  npx shadow-claw backup delete --backup-id <id> # Delete a backup snapshot
243
+ npx shadow-claw mcp # Run official Stateless MCP server (STDIO)
430
244
  npx shadow-claw server --tmp # Run services with temporary directory cache (/tmp/shadow-claw)
431
245
  npx shadow-claw server --cache-dir <dir> # Run services with custom cache directory
432
246
  npx shadow-claw webrtc listen # Start headless WebRTC DataChannel daemon
@@ -434,9 +248,13 @@ npx shadow-claw peer-id # Get or generate persisten
434
248
  npx shadow-claw skills:index # Generate or update .well-known/agent-skills/index.json
435
249
  ```
436
250
 
437
- When launching `dev`, `run`, `serve`, or `server` without an existing cache, ShadowClaw prompts interactively to select between the local directory (`.cache`), system temporary storage (`tmpdir()`), or a custom path (skip prompting via `--tmp`, `-y`, `--cache-dir <dir>`, or `SHADOWCLAW_CACHE_DIR`).
251
+ When launching `dev`, `run`, `serve`, or `server` without an existing cache, ShadowClaw prompts interactively to select between `.cache`, `tmpdir()`, or a custom path (skip prompting via `--tmp`, `-y`, `--cache-dir <dir>`, or `SHADOWCLAW_CACHE_DIR`).
252
+
253
+ Commands support `--transport webrtc` for direct peer-to-peer DataChannel execution with connected browser clients. Control plane authentication automatically resolves tokens across flags, environment variables (`SHADOWCLAW_CONTROL_TOKEN`), system temporary directory (`tmpdir()`), parent directories, and SQLite with automatic fallback retry on 401 Unauthorized errors, and supports HTTPS endpoints via `--https` (and `--insecure` for self-signed certs).
254
+
255
+ **Full CLI reference:** [docs/subsystems/cli.md](docs/subsystems/cli.md)
438
256
 
439
- Commands support `--transport webrtc` for direct peer-to-peer DataChannel execution with connected browser clients. Control plane authentication uses `SHADOWCLAW_CONTROL_TOKEN` (env) or `--token` flag, and supports HTTPS endpoints via `--https` (and `--insecure` for self-signed certs). The control plane endpoint and token are printed to the console on server start.
257
+ ---
440
258
 
441
259
  ## License
442
260
 
package/bin/cli.mjs CHANGED
@@ -733,6 +733,10 @@ program
733
733
  "http",
734
734
  )
735
735
  .option("--peer-id <id>", "Custom WebRTC CLI peer ID")
736
+ .option(
737
+ "--cache-dir <dir>",
738
+ "Custom cache directory for control token and databases",
739
+ )
736
740
  .action(async (options) => {
737
741
  await runMcpCommand(options);
738
742
  });