seclaw-agent 0.1.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 (219) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +668 -0
  3. package/SECURITY.md +253 -0
  4. package/assets/logo.png +0 -0
  5. package/dist/agent/context.d.ts +37 -0
  6. package/dist/agent/context.d.ts.map +1 -0
  7. package/dist/agent/context.js +211 -0
  8. package/dist/agent/context.js.map +1 -0
  9. package/dist/agent/docker_sandbox.d.ts +41 -0
  10. package/dist/agent/docker_sandbox.d.ts.map +1 -0
  11. package/dist/agent/docker_sandbox.js +239 -0
  12. package/dist/agent/docker_sandbox.js.map +1 -0
  13. package/dist/agent/loop.d.ts +86 -0
  14. package/dist/agent/loop.d.ts.map +1 -0
  15. package/dist/agent/loop.js +858 -0
  16. package/dist/agent/loop.js.map +1 -0
  17. package/dist/agent/memory.d.ts +21 -0
  18. package/dist/agent/memory.d.ts.map +1 -0
  19. package/dist/agent/memory.js +128 -0
  20. package/dist/agent/memory.js.map +1 -0
  21. package/dist/agent/security/execution_audit.d.ts +17 -0
  22. package/dist/agent/security/execution_audit.d.ts.map +1 -0
  23. package/dist/agent/security/execution_audit.js +126 -0
  24. package/dist/agent/security/execution_audit.js.map +1 -0
  25. package/dist/agent/security/input_validation/entity.d.ts +57 -0
  26. package/dist/agent/security/input_validation/entity.d.ts.map +1 -0
  27. package/dist/agent/security/input_validation/entity.js +121 -0
  28. package/dist/agent/security/input_validation/entity.js.map +1 -0
  29. package/dist/agent/security/input_validation/index.d.ts +114 -0
  30. package/dist/agent/security/input_validation/index.d.ts.map +1 -0
  31. package/dist/agent/security/input_validation/index.js +971 -0
  32. package/dist/agent/security/input_validation/index.js.map +1 -0
  33. package/dist/agent/security/input_validation/lattice.d.ts +33 -0
  34. package/dist/agent/security/input_validation/lattice.d.ts.map +1 -0
  35. package/dist/agent/security/input_validation/lattice.js +61 -0
  36. package/dist/agent/security/input_validation/lattice.js.map +1 -0
  37. package/dist/agent/security/input_validation/program_graph.d.ts +51 -0
  38. package/dist/agent/security/input_validation/program_graph.d.ts.map +1 -0
  39. package/dist/agent/security/input_validation/program_graph.js +285 -0
  40. package/dist/agent/security/input_validation/program_graph.js.map +1 -0
  41. package/dist/agent/security/input_validation/security_policy.d.ts +29 -0
  42. package/dist/agent/security/input_validation/security_policy.d.ts.map +1 -0
  43. package/dist/agent/security/input_validation/security_policy.js +256 -0
  44. package/dist/agent/security/input_validation/security_policy.js.map +1 -0
  45. package/dist/agent/security/memory_audit.d.ts +14 -0
  46. package/dist/agent/security/memory_audit.d.ts.map +1 -0
  47. package/dist/agent/security/memory_audit.js +126 -0
  48. package/dist/agent/security/memory_audit.js.map +1 -0
  49. package/dist/agent/security/skill_audit.d.ts +15 -0
  50. package/dist/agent/security/skill_audit.d.ts.map +1 -0
  51. package/dist/agent/security/skill_audit.js +112 -0
  52. package/dist/agent/security/skill_audit.js.map +1 -0
  53. package/dist/agent/security/snapshot_and_rollback/base.d.ts +10 -0
  54. package/dist/agent/security/snapshot_and_rollback/base.d.ts.map +1 -0
  55. package/dist/agent/security/snapshot_and_rollback/base.js +10 -0
  56. package/dist/agent/security/snapshot_and_rollback/base.js.map +1 -0
  57. package/dist/agent/security/snapshot_and_rollback/docker_snapshot.d.ts +52 -0
  58. package/dist/agent/security/snapshot_and_rollback/docker_snapshot.d.ts.map +1 -0
  59. package/dist/agent/security/snapshot_and_rollback/docker_snapshot.js +358 -0
  60. package/dist/agent/security/snapshot_and_rollback/docker_snapshot.js.map +1 -0
  61. package/dist/agent/security/snapshot_and_rollback/index.d.ts +7 -0
  62. package/dist/agent/security/snapshot_and_rollback/index.d.ts.map +1 -0
  63. package/dist/agent/security/snapshot_and_rollback/index.js +450 -0
  64. package/dist/agent/security/snapshot_and_rollback/index.js.map +1 -0
  65. package/dist/agent/skills.d.ts +35 -0
  66. package/dist/agent/skills.d.ts.map +1 -0
  67. package/dist/agent/skills.js +235 -0
  68. package/dist/agent/skills.js.map +1 -0
  69. package/dist/agent/subagent.d.ts +39 -0
  70. package/dist/agent/subagent.d.ts.map +1 -0
  71. package/dist/agent/subagent.js +151 -0
  72. package/dist/agent/subagent.js.map +1 -0
  73. package/dist/agent/tools/base.d.ts +32 -0
  74. package/dist/agent/tools/base.d.ts.map +1 -0
  75. package/dist/agent/tools/base.js +91 -0
  76. package/dist/agent/tools/base.js.map +1 -0
  77. package/dist/agent/tools/cron.d.ts +46 -0
  78. package/dist/agent/tools/cron.d.ts.map +1 -0
  79. package/dist/agent/tools/cron.js +95 -0
  80. package/dist/agent/tools/cron.js.map +1 -0
  81. package/dist/agent/tools/filesystem.d.ts +102 -0
  82. package/dist/agent/tools/filesystem.d.ts.map +1 -0
  83. package/dist/agent/tools/filesystem.js +257 -0
  84. package/dist/agent/tools/filesystem.js.map +1 -0
  85. package/dist/agent/tools/message.d.ts +40 -0
  86. package/dist/agent/tools/message.d.ts.map +1 -0
  87. package/dist/agent/tools/message.js +55 -0
  88. package/dist/agent/tools/message.js.map +1 -0
  89. package/dist/agent/tools/registry.d.ts +16 -0
  90. package/dist/agent/tools/registry.d.ts.map +1 -0
  91. package/dist/agent/tools/registry.js +47 -0
  92. package/dist/agent/tools/registry.js.map +1 -0
  93. package/dist/agent/tools/shell.d.ts +40 -0
  94. package/dist/agent/tools/shell.d.ts.map +1 -0
  95. package/dist/agent/tools/shell.js +166 -0
  96. package/dist/agent/tools/shell.js.map +1 -0
  97. package/dist/agent/tools/spawn.d.ts +30 -0
  98. package/dist/agent/tools/spawn.d.ts.map +1 -0
  99. package/dist/agent/tools/spawn.js +50 -0
  100. package/dist/agent/tools/spawn.js.map +1 -0
  101. package/dist/agent/tools/web.d.ts +59 -0
  102. package/dist/agent/tools/web.d.ts.map +1 -0
  103. package/dist/agent/tools/web.js +167 -0
  104. package/dist/agent/tools/web.js.map +1 -0
  105. package/dist/bus/events.d.ts +31 -0
  106. package/dist/bus/events.d.ts.map +1 -0
  107. package/dist/bus/events.js +28 -0
  108. package/dist/bus/events.js.map +1 -0
  109. package/dist/bus/queue.d.ts +32 -0
  110. package/dist/bus/queue.d.ts.map +1 -0
  111. package/dist/bus/queue.js +104 -0
  112. package/dist/bus/queue.js.map +1 -0
  113. package/dist/channels/base.d.ts +25 -0
  114. package/dist/channels/base.d.ts.map +1 -0
  115. package/dist/channels/base.js +54 -0
  116. package/dist/channels/base.js.map +1 -0
  117. package/dist/channels/dingtalk.d.ts +31 -0
  118. package/dist/channels/dingtalk.d.ts.map +1 -0
  119. package/dist/channels/dingtalk.js +177 -0
  120. package/dist/channels/dingtalk.js.map +1 -0
  121. package/dist/channels/discord.d.ts +30 -0
  122. package/dist/channels/discord.d.ts.map +1 -0
  123. package/dist/channels/discord.js +197 -0
  124. package/dist/channels/discord.js.map +1 -0
  125. package/dist/channels/email.d.ts +41 -0
  126. package/dist/channels/email.d.ts.map +1 -0
  127. package/dist/channels/email.js +210 -0
  128. package/dist/channels/email.js.map +1 -0
  129. package/dist/channels/feishu.d.ts +32 -0
  130. package/dist/channels/feishu.d.ts.map +1 -0
  131. package/dist/channels/feishu.js +109 -0
  132. package/dist/channels/feishu.js.map +1 -0
  133. package/dist/channels/manager.d.ts +24 -0
  134. package/dist/channels/manager.d.ts.map +1 -0
  135. package/dist/channels/manager.js +205 -0
  136. package/dist/channels/manager.js.map +1 -0
  137. package/dist/channels/mochat.d.ts +38 -0
  138. package/dist/channels/mochat.d.ts.map +1 -0
  139. package/dist/channels/mochat.js +201 -0
  140. package/dist/channels/mochat.js.map +1 -0
  141. package/dist/channels/qq.d.ts +40 -0
  142. package/dist/channels/qq.d.ts.map +1 -0
  143. package/dist/channels/qq.js +280 -0
  144. package/dist/channels/qq.js.map +1 -0
  145. package/dist/channels/slack.d.ts +27 -0
  146. package/dist/channels/slack.d.ts.map +1 -0
  147. package/dist/channels/slack.js +118 -0
  148. package/dist/channels/slack.js.map +1 -0
  149. package/dist/channels/telegram.d.ts +31 -0
  150. package/dist/channels/telegram.d.ts.map +1 -0
  151. package/dist/channels/telegram.js +218 -0
  152. package/dist/channels/telegram.js.map +1 -0
  153. package/dist/channels/whatsapp.d.ts +29 -0
  154. package/dist/channels/whatsapp.d.ts.map +1 -0
  155. package/dist/channels/whatsapp.js +117 -0
  156. package/dist/channels/whatsapp.js.map +1 -0
  157. package/dist/cli/commands.d.ts +8 -0
  158. package/dist/cli/commands.d.ts.map +1 -0
  159. package/dist/cli/commands.js +537 -0
  160. package/dist/cli/commands.js.map +1 -0
  161. package/dist/config/loader.d.ts +24 -0
  162. package/dist/config/loader.d.ts.map +1 -0
  163. package/dist/config/loader.js +182 -0
  164. package/dist/config/loader.js.map +1 -0
  165. package/dist/config/schema.d.ts +2921 -0
  166. package/dist/config/schema.d.ts.map +1 -0
  167. package/dist/config/schema.js +257 -0
  168. package/dist/config/schema.js.map +1 -0
  169. package/dist/cron/service.d.ts +38 -0
  170. package/dist/cron/service.d.ts.map +1 -0
  171. package/dist/cron/service.js +336 -0
  172. package/dist/cron/service.js.map +1 -0
  173. package/dist/cron/types.d.ts +46 -0
  174. package/dist/cron/types.d.ts.map +1 -0
  175. package/dist/cron/types.js +6 -0
  176. package/dist/cron/types.js.map +1 -0
  177. package/dist/heartbeat/service.d.ts +26 -0
  178. package/dist/heartbeat/service.d.ts.map +1 -0
  179. package/dist/heartbeat/service.js +142 -0
  180. package/dist/heartbeat/service.js.map +1 -0
  181. package/dist/index.d.ts +7 -0
  182. package/dist/index.d.ts.map +1 -0
  183. package/dist/index.js +14 -0
  184. package/dist/index.js.map +1 -0
  185. package/dist/providers/base.d.ts +38 -0
  186. package/dist/providers/base.d.ts.map +1 -0
  187. package/dist/providers/base.js +21 -0
  188. package/dist/providers/base.js.map +1 -0
  189. package/dist/providers/litellm_provider.d.ts +35 -0
  190. package/dist/providers/litellm_provider.d.ts.map +1 -0
  191. package/dist/providers/litellm_provider.js +205 -0
  192. package/dist/providers/litellm_provider.js.map +1 -0
  193. package/dist/providers/registry.d.ts +44 -0
  194. package/dist/providers/registry.d.ts.map +1 -0
  195. package/dist/providers/registry.js +252 -0
  196. package/dist/providers/registry.js.map +1 -0
  197. package/dist/providers/transcription.d.ts +10 -0
  198. package/dist/providers/transcription.d.ts.map +1 -0
  199. package/dist/providers/transcription.js +83 -0
  200. package/dist/providers/transcription.js.map +1 -0
  201. package/dist/session/manager.d.ts +35 -0
  202. package/dist/session/manager.d.ts.map +1 -0
  203. package/dist/session/manager.js +193 -0
  204. package/dist/session/manager.js.map +1 -0
  205. package/dist/utils/helpers.d.ts +15 -0
  206. package/dist/utils/helpers.d.ts.map +1 -0
  207. package/dist/utils/helpers.js +100 -0
  208. package/dist/utils/helpers.js.map +1 -0
  209. package/dist/utils/logger.d.ts +7 -0
  210. package/dist/utils/logger.d.ts.map +1 -0
  211. package/dist/utils/logger.js +25 -0
  212. package/dist/utils/logger.js.map +1 -0
  213. package/package.json +58 -0
  214. package/templates/AGENTS.md +51 -0
  215. package/templates/HEARTBEAT.md +16 -0
  216. package/templates/SOUL.md +36 -0
  217. package/templates/TOOLS.md +150 -0
  218. package/templates/USER.md +17 -0
  219. package/templates/memory/MEMORY.md +23 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SeClaw Group
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,668 @@
1
+ # 🦾 SeClaw - Armored Personal AI Assistant
2
+
3
+ <p align="center">
4
+ <img src="assets/logo.png" alt="SeClaw" width="500">
5
+ </p>
6
+
7
+ **SeClaw** is a security-first, lightweight TypeScript personal agent framework inspired by OpenClaw.
8
+
9
+ ---
10
+
11
+ ## 🔒 Why SeClaw
12
+
13
+ SeClaw is a security-first, lightweight personal agent assistant.
14
+
15
+ ### Core security capabilities
16
+
17
+ - 🧱 **Agent Execution Isolation**: SeClaw supports Docker containers. Unlike common deployments that run the entire project inside a container, SeClaw keeps the project on the host and only runs agent operations through mapped execution in Docker. This further reduces blast radius and lowers the risk of damaging project code or workspace files.
18
+ - ♻️ **Snapshot & Rollback**: SeClaw supports an efficient CoW rollback mechanism that can quickly snapshot and restore mounted host/container files. You can quickly restore to a known-good state after any risky operations. Let your agent run free!
19
+ - 🛡️ **Prompt Injection Defense (System + Model Levels)**: SeClaw enforces Control-Flow Integrity (CFI) and Information-Flow Integrity (IFI) at the system level to constrain the agent’s valid action space and block unsafe decision paths. At the model level, SeClaw uses a guard model to sanitize suspicious tool outputs before they are fed back into the reasoning loop.
20
+ - 🔍 **Skill Audit**: Scans skills for dangerous patterns (prompt injection, exfiltration, and destructive commands).
21
+ - 🧠 **Memory Audit**: Scans memory files for stored prompt-injection payloads, credentials, and PII leakage risks.
22
+ - 📜 **Execution Audit**: Records full task traces and reports potentially risky actions after each task completion.
23
+ - 🔐 **Privacy Protection**: SeClaw monitors potential privacy leaks during agent execution, including identity information, API keys, SSH keys, and other sensitive credentials. Suspicious exposures are detected and flagged before they can be unintentionally disclosed through tool outputs or external communications.
24
+ - ⚠️ **Risky Operation Protection**: SeClaw detects potentially dangerous commands (e.g., `rm -rf`, `sudo`, or destructive system modifications). When such operations are triggered, SeClaw requires explicit user confirmation before execution, reducing the risk of unintended damage caused by agent tool misuse.
25
+ - 📡 **Secure Communication Isolation**: SeClaw isolates communication channels by maintaining separate context windows for each interaction source. This prevents cross-channel prompt injection and ensures that messages from one channel cannot manipulate the agent’s behavior in another.
26
+ - 🌐 **Network Security Controls**: SeClaw provides secure network communication through HTTPS enforcement, request timeout protection, and configurable network modes for agent execution environments, reducing the risk of network-based attacks and uncontrolled external access.
27
+
28
+
29
+ For deeper architecture and threat-model notes, see [SECURITY.md](SECURITY.md).
30
+
31
+ ---
32
+
33
+ ### ✨ Other Features
34
+
35
+ - **Lightweight and fast**: Less RAM (< 100 MB) and faster startup speed (~150 ms on ~4.4GHz).
36
+ - **Easy to develop**: Just ~2,800 lines of security code and ~3,000 lines of core agent code, which are easy to read for extending and develop further.
37
+ - **Multi-channel gateway**: A rich selection of channels (Telegram, Discord, WhatsApp, Feishu, Mochat, DingTalk, Slack, Email, QQ).
38
+
39
+
40
+ ---
41
+
42
+ ## 🎬 Demos
43
+
44
+
45
+ <details open>
46
+ <summary>📸 Snapshot Rollback</summary>
47
+
48
+ https://github.com/user-attachments/assets/456e4488-96e6-4aa2-a2d2-30a91808fe6f
49
+
50
+ </details>
51
+
52
+ <details>
53
+ <summary>🛡 Prompt Injection Defense</summary>
54
+
55
+ https://github.com/user-attachments/assets/c90dc8d7-0300-45ff-83ec-89c949239192
56
+
57
+ </details>
58
+
59
+ <details>
60
+ <summary>🔍 Skill Audit</summary>
61
+
62
+ https://github.com/user-attachments/assets/b64d33bc-8a23-4511-87ed-a501c216239c
63
+
64
+ </details>
65
+
66
+ <details>
67
+ <summary>🧠 Memory Audit</summary>
68
+
69
+ https://github.com/user-attachments/assets/910b0748-7149-4557-b392-391a076f2c26
70
+ </details>
71
+
72
+
73
+ ---
74
+
75
+ ## 🚀 Quick Start
76
+
77
+ ### 1) Requirements
78
+
79
+ - Node.js >= 20
80
+ - npm
81
+ - (Optional but recommended) [Docker Desktop](https://www.docker.com/products/docker-desktop/) if you enable `security.dockerSandbox.enabled`
82
+
83
+ ### 2) Build and install
84
+
85
+ ```bash
86
+ npm ci
87
+ npm run build
88
+ npm install -g .
89
+ ```
90
+
91
+ ### 3) Initialize config and workspace
92
+
93
+ ```bash
94
+ seclaw onboard
95
+ ```
96
+
97
+ This creates:
98
+
99
+ - `~/.seclaw/config.json`
100
+ - `~/.seclaw/workspace/`
101
+
102
+ ### 4) Configure at least one provider
103
+
104
+ Go to the **Provider Deployment Guides** section below and configure your target provider in `~/.seclaw/config.json`.
105
+
106
+ ### 5) Run
107
+
108
+ Direct CLI chat:
109
+
110
+ ```bash
111
+ seclaw agent -m "Summarize this repository"
112
+ ```
113
+
114
+ Gateway mode (channels + cron + heartbeat + agent loop):
115
+
116
+ ```bash
117
+ seclaw gateway
118
+ ```
119
+
120
+ ---
121
+
122
+
123
+ ## 🛡️ Security Hardening Checklist (Recommended)
124
+
125
+ Apply these before production use:
126
+
127
+ - Set `security.dockerSandbox.enabled` to `true`.
128
+ - Set `tools.restrictToWorkspace` to `true`.
129
+ - Configure `security.prohibitedCommands` with your deny-list.
130
+ - Keep `security.inputValidationEnabled` enabled.
131
+ - Keep `security.outputValidationEnabled` enabled.
132
+ - Keep `security.executionLogEnabled` and `security.postExecutionAuditEnabled` enabled.
133
+ - Restrict channel callers using `allowFrom` for every enabled channel.
134
+
135
+ ---
136
+
137
+ ## 💬 Chat App Deployment Guides
138
+
139
+ Built on top of NanoBot, SeClaw also supports Telegram, Discord, WhatsApp, Feishu, Mochat, DingTalk, Slack, Email, and QQ.
140
+
141
+ Use this command anytime to verify channel setup state:
142
+
143
+ ```bash
144
+ seclaw channels status
145
+ ```
146
+
147
+ ### Channel quick matrix
148
+
149
+ | Channel | Required fields |
150
+ |---|---|
151
+ | Telegram | `token`, `allowFrom` |
152
+ | Discord | `token`, `allowFrom` |
153
+ | WhatsApp | `bridgeUrl`, `allowFrom` |
154
+ | Feishu | `appId`, `appSecret` |
155
+ | Mochat | `baseUrl`, `clawToken`, `agentUserId` |
156
+ | DingTalk | `clientId`, `clientSecret` |
157
+ | Slack | `botToken`, `appToken` |
158
+ | Email | IMAP/SMTP credentials + `consentGranted` |
159
+ | QQ | `appId`, `secret` |
160
+
161
+ <details>
162
+ <summary><b>Telegram</b> (Recommended)</summary>
163
+
164
+ **1. Create a bot**
165
+ - Open Telegram and search `@BotFather`.
166
+ - Send `/newbot` and finish setup.
167
+ - Copy your bot token.
168
+
169
+ **2. Configure**
170
+
171
+ ```json
172
+ {
173
+ "channels": {
174
+ "telegram": {
175
+ "enabled": true,
176
+ "token": "YOUR_BOT_TOKEN",
177
+ "allowFrom": ["YOUR_USER_ID"],
178
+ "proxy": null,
179
+ "startReply": "👋 Hi, I'm SeClaw, your secure AI agent assistant.\n I help you complete tasks safely and efficiently.\nSend /help to see the available commands."
180
+ }
181
+ }
182
+ }
183
+ ```
184
+
185
+ **3. Run**
186
+
187
+ ```bash
188
+ seclaw gateway
189
+ ```
190
+
191
+ </details>
192
+
193
+ <details>
194
+ <summary><b>Discord</b></summary>
195
+
196
+ **1. Create bot app**
197
+ - Go to https://discord.com/developers/applications.
198
+ - Create app → Bot → Add Bot.
199
+ - Copy bot token.
200
+
201
+ **2. Enable intents**
202
+ - Enable **MESSAGE CONTENT INTENT**.
203
+
204
+ **3. Configure**
205
+
206
+ ```json
207
+ {
208
+ "channels": {
209
+ "discord": {
210
+ "enabled": true,
211
+ "token": "YOUR_BOT_TOKEN",
212
+ "allowFrom": ["YOUR_USER_ID"],
213
+ "gatewayUrl": "wss://gateway.discord.gg/?v=10&encoding=json",
214
+ "intents": 37377
215
+ }
216
+ }
217
+ }
218
+ ```
219
+
220
+ **4. Invite and run**
221
+ - Invite bot with message permissions.
222
+
223
+ ```bash
224
+ seclaw gateway
225
+ ```
226
+
227
+ </details>
228
+
229
+ <details>
230
+ <summary><b>WhatsApp</b></summary>
231
+
232
+ **1. Link device via QR**
233
+
234
+ ```bash
235
+ seclaw channels login
236
+ ```
237
+
238
+ Scan the QR from WhatsApp → Settings → Linked Devices.
239
+
240
+ **2. Configure**
241
+
242
+ ```json
243
+ {
244
+ "channels": {
245
+ "whatsapp": {
246
+ "enabled": true,
247
+ "bridgeUrl": "ws://localhost:3001",
248
+ "allowFrom": ["+1234567890"]
249
+ }
250
+ }
251
+ }
252
+ ```
253
+
254
+ **3. Run gateway**
255
+
256
+ ```bash
257
+ seclaw gateway
258
+ ```
259
+
260
+ </details>
261
+
262
+ <details>
263
+ <summary><b>Feishu (飞书)</b></summary>
264
+
265
+ **1. Create Feishu app**
266
+ - Go to https://open.feishu.cn/app.
267
+ - Enable Bot capability.
268
+ - Grant message permissions/events.
269
+
270
+ **2. Configure**
271
+
272
+ ```json
273
+ {
274
+ "channels": {
275
+ "feishu": {
276
+ "enabled": true,
277
+ "appId": "cli_xxx",
278
+ "appSecret": "xxx",
279
+ "encryptKey": "",
280
+ "verificationToken": "",
281
+ "allowFrom": []
282
+ }
283
+ }
284
+ }
285
+ ```
286
+
287
+ **3. Run**
288
+
289
+ ```bash
290
+ seclaw gateway
291
+ ```
292
+
293
+ </details>
294
+
295
+ <details>
296
+ <summary><b>Mochat (Claw IM)</b></summary>
297
+
298
+ **1. Obtain Mochat credentials**
299
+ - Prepare `clawToken` and `agentUserId` from your Mochat setup.
300
+
301
+ **2. Configure**
302
+
303
+ ```json
304
+ {
305
+ "channels": {
306
+ "mochat": {
307
+ "enabled": true,
308
+ "baseUrl": "https://mochat.io",
309
+ "socketUrl": "https://mochat.io",
310
+ "socketPath": "/socket.io",
311
+ "clawToken": "claw_xxx",
312
+ "agentUserId": "6982abcdef",
313
+ "sessions": ["*"],
314
+ "panels": ["*"],
315
+ "allowFrom": [],
316
+ "replyDelayMode": "non-mention",
317
+ "replyDelayMs": 120000
318
+ }
319
+ }
320
+ }
321
+ ```
322
+
323
+ **3. Run**
324
+
325
+ ```bash
326
+ seclaw gateway
327
+ ```
328
+
329
+ </details>
330
+
331
+ <details>
332
+ <summary><b>DingTalk (钉钉)</b></summary>
333
+
334
+ **1. Create DingTalk app**
335
+ - Go to https://open-dev.dingtalk.com/.
336
+ - Add Robot capability and enable Stream Mode.
337
+ - Copy Client ID / Client Secret.
338
+
339
+ **2. Configure**
340
+
341
+ ```json
342
+ {
343
+ "channels": {
344
+ "dingtalk": {
345
+ "enabled": true,
346
+ "clientId": "YOUR_APP_KEY",
347
+ "clientSecret": "YOUR_APP_SECRET",
348
+ "allowFrom": []
349
+ }
350
+ }
351
+ }
352
+ ```
353
+
354
+ **3. Run**
355
+
356
+ ```bash
357
+ seclaw gateway
358
+ ```
359
+
360
+ </details>
361
+
362
+ <details>
363
+ <summary><b>Slack</b></summary>
364
+
365
+ **1. Create Slack app**
366
+ - Create app at https://api.slack.com/apps.
367
+ - Enable Socket Mode and generate `xapp-...` token.
368
+ - Install bot and copy `xoxb-...` token.
369
+
370
+ **2. Configure**
371
+
372
+ ```json
373
+ {
374
+ "channels": {
375
+ "slack": {
376
+ "enabled": true,
377
+ "mode": "socket",
378
+ "botToken": "xoxb-...",
379
+ "appToken": "xapp-...",
380
+ "groupPolicy": "mention"
381
+ }
382
+ }
383
+ }
384
+ ```
385
+
386
+ **3. Run**
387
+
388
+ ```bash
389
+ seclaw gateway
390
+ ```
391
+
392
+ </details>
393
+
394
+ <details>
395
+ <summary><b>Email</b></summary>
396
+
397
+ **1. Prepare mailbox**
398
+ - Create a dedicated mailbox for the bot.
399
+ - Use app passwords for IMAP/SMTP when required.
400
+
401
+ **2. Configure**
402
+
403
+ ```json
404
+ {
405
+ "channels": {
406
+ "email": {
407
+ "enabled": true,
408
+ "consentGranted": true,
409
+ "imapHost": "imap.gmail.com",
410
+ "imapPort": 993,
411
+ "imapUsername": "my-seclaw@gmail.com",
412
+ "imapPassword": "your-app-password",
413
+ "smtpHost": "smtp.gmail.com",
414
+ "smtpPort": 587,
415
+ "smtpUsername": "my-seclaw@gmail.com",
416
+ "smtpPassword": "your-app-password",
417
+ "fromAddress": "my-seclaw@gmail.com",
418
+ "allowFrom": ["your-real-email@gmail.com"]
419
+ }
420
+ }
421
+ }
422
+ ```
423
+
424
+ **3. Run**
425
+
426
+ ```bash
427
+ seclaw gateway
428
+ ```
429
+
430
+ </details>
431
+
432
+ <details>
433
+ <summary><b>QQ (QQ 单聊)</b></summary>
434
+
435
+ **1. Create QQ bot app**
436
+ - Register at https://q.qq.com and create bot app.
437
+ - Copy AppID and AppSecret.
438
+
439
+ **2. Configure sandbox members**
440
+ - Add your QQ account in sandbox config to test private messages.
441
+
442
+ **3. Configure**
443
+
444
+ ```json
445
+ {
446
+ "channels": {
447
+ "qq": {
448
+ "enabled": true,
449
+ "appId": "YOUR_APP_ID",
450
+ "secret": "YOUR_APP_SECRET",
451
+ "allowFrom": []
452
+ }
453
+ }
454
+ }
455
+ ```
456
+
457
+ **4. Run**
458
+
459
+ ```bash
460
+ seclaw gateway
461
+ ```
462
+
463
+ </details>
464
+
465
+ ---
466
+
467
+ ## 🔌 Provider Deployment Guides
468
+
469
+ SeClaw provider config is in:
470
+
471
+ - `~/.seclaw/config.json` → `providers.*`
472
+ - default model in `agents.defaults.model`
473
+
474
+ Each provider entry supports:
475
+
476
+ - `apiKey: string`
477
+ - `apiBase: string | null`
478
+ - `extraHeaders: Record<string, string> | null`
479
+
480
+ ### Provider routing logic
481
+
482
+ When selecting provider credentials:
483
+
484
+ 1. SeClaw first tries model-keyword matching with non-empty API keys.
485
+ 2. If no keyword match is found, it falls back to the first provider with a non-empty API key.
486
+
487
+ ### Supported providers (current schema)
488
+
489
+ `openrouter`, `aihubmix`, `anthropic`, `openai`, `deepseek`, `gemini`, `zhipu`, `dashscope`, `moonshot`, `minimax`, `vllm`, `groq`
490
+
491
+ ### Deployment matrix
492
+
493
+ | Provider | Console/API key | Typical model naming | Notes |
494
+ |---|---|---|---|
495
+ | OpenRouter | https://openrouter.ai | `openrouter/...` | Gateway, broad model coverage |
496
+ | AiHubMix | https://aihubmix.com | raw model id | Gateway mode |
497
+ | Anthropic | https://console.anthropic.com | `anthropic/...` / `claude...` | Direct Anthropic key |
498
+ | OpenAI | https://platform.openai.com | `gpt-...` | Direct OpenAI key |
499
+ | DeepSeek | https://platform.deepseek.com | `deepseek/...` | DeepSeek direct |
500
+ | Gemini | https://aistudio.google.com | `gemini/...` | Gemini direct |
501
+ | Zhipu | https://open.bigmodel.cn | `glm...` / `zai/...` | Zhipu GLM |
502
+ | DashScope | https://dashscope.console.aliyun.com | `qwen...` / `dashscope/...` | Qwen via DashScope |
503
+ | Moonshot | https://platform.moonshot.cn | `kimi...` / `moonshot/...` | Kimi models |
504
+ | MiniMax | https://platform.minimaxi.com | `minimax/...` | Region-specific base URL may vary |
505
+ | vLLM | self-hosted | your local model id | Set `apiBase` to local endpoint |
506
+ | Groq | https://console.groq.com | `groq/...` | Fast inference + whisper-related workflows |
507
+
508
+ <details>
509
+ <summary><b>vLLM (local/self-hosted) deployment</b></summary>
510
+
511
+ 1. Start local OpenAI-compatible server (example):
512
+
513
+ ```bash
514
+ vllm serve meta-llama/Llama-3.1-8B-Instruct --port 8000
515
+ ```
516
+
517
+ 2. Configure provider to local endpoint:
518
+
519
+ ```json
520
+ {
521
+ "providers": {
522
+ "vllm": {
523
+ "apiKey": "dummy",
524
+ "apiBase": "http://localhost:8000/v1",
525
+ "extraHeaders": null
526
+ }
527
+ },
528
+ "agents": {
529
+ "defaults": {
530
+ "model": "meta-llama/Llama-3.1-8B-Instruct"
531
+ }
532
+ }
533
+ }
534
+ ```
535
+
536
+ </details>
537
+
538
+
539
+ ---
540
+
541
+ ## 🧭 CLI Reference
542
+
543
+ | Command | Description |
544
+ |---|---|
545
+ | `seclaw onboard` | Initialize `~/.seclaw/config.json` and workspace |
546
+ | `seclaw gateway` | Start gateway (channels + cron + heartbeat + agent) |
547
+ | `seclaw agent [-m <msg>]` | Talk to the agent directly |
548
+ | `seclaw channels status` | Show channel configuration status |
549
+ | `seclaw channels login` | Start WhatsApp bridge login flow (QR) |
550
+ | `seclaw cron list` | List scheduled jobs |
551
+ | `seclaw cron remove <id>` | Remove scheduled job |
552
+ | `seclaw snapshot list` | List available snapshots |
553
+ | `seclaw snapshot take [label]` | Create workspace snapshot |
554
+ | `seclaw snapshot restore <tag>` | Restore snapshot by tag |
555
+
556
+ ---
557
+
558
+ ## 💬 Chat Slash Commands
559
+
560
+ In chat channels, SeClaw supports:
561
+
562
+ | Command | Description |
563
+ |---|---|
564
+ | `/start` | Send fixed welcome message (Telegram: direct reply, no agent interaction) |
565
+ | `/new` | Start a new conversation session |
566
+ | `/help` | Show command help |
567
+ | `/skill_audit` | Audit loaded skills for security risks |
568
+ | `/memory_audit` | Audit memory files for security risks |
569
+ | `/take_snapshot [label]` | Create a snapshot manually |
570
+ | `/snapshot_list` | List available snapshots |
571
+ | `/snapshot_restore <TAG>` | Restore snapshot by tag |
572
+
573
+ ---
574
+
575
+ ## ⚙️ Configuration Reference
576
+
577
+ Config file location:
578
+
579
+ - `~/.seclaw/config.json`
580
+
581
+ ### `agents.defaults`
582
+
583
+ | Field | Type | Description |
584
+ |---|---|---|
585
+ | `workspace` | string | Workspace path |
586
+ | `model` | string | Default model |
587
+ | `maxTokens` | number | Token budget per call |
588
+ | `temperature` | number | Sampling temperature |
589
+ | `maxToolIterations` | number | Max tool-call loop iterations |
590
+
591
+ ### `gateway`
592
+
593
+ | Field | Type | Description |
594
+ |---|---|---|
595
+ | `host` | string | Gateway bind host |
596
+ | `port` | number | Gateway port |
597
+
598
+ ### `tools`
599
+
600
+ | Field | Type | Description |
601
+ |---|---|---|
602
+ | `web.search.apiKey` | string | Brave web search API key |
603
+ | `web.search.maxResults` | number | Max search results |
604
+ | `exec.timeout` | number | Shell tool timeout (seconds) |
605
+ | `restrictToWorkspace` | boolean | Restrict tool actions to workspace |
606
+
607
+ ### `security`
608
+
609
+ | Field | Type | Description |
610
+ |---|---|---|
611
+ | `prohibitedCommands` | string[] | Explicitly blocked shell commands |
612
+ | `inputValidationEnabled` | boolean | Enable multi-layer validation |
613
+ | `outputValidationEnabled` | boolean | Enable output validation for tool-output sanitization |
614
+ | `executionLogEnabled` | boolean | Persist execution traces |
615
+ | `executionLogStep` | number | Save trace every N steps |
616
+ | `postExecutionAuditEnabled` | boolean | Run post-task audit |
617
+ | `skillAuditEnabled` | boolean | Enable skill audit |
618
+
619
+ #### `security.dockerSandbox`
620
+
621
+ | Field | Type | Description |
622
+ |---|---|---|
623
+ | `enabled` | boolean | Enable Docker sandbox |
624
+ | `image` | string | Container image |
625
+ | `containerName` | string | Container name |
626
+ | `workspaceContainer` | string | Mounted workspace path in container |
627
+ | `workspaceReadOnly` | boolean | Mount workspace read-only (`true`) or read-write (`false`) |
628
+ | `extraMounts` | string[] | Extra bind mounts |
629
+ | `extraEnv` | object | Extra env vars |
630
+ | `memoryLimit` | string \| null | Memory cap (e.g. `512m`) |
631
+ | `network` | string | Docker network mode |
632
+ | `snapshotEnabled` | boolean | Enable snapshot feature |
633
+ | `snapshotMax` | number | Max retained snapshots |
634
+ | `snapshotMinIntervalSeconds` | number | Min snapshot interval |
635
+
636
+ ---
637
+
638
+ ## 🗂️ Workspace Structure
639
+
640
+ By default (`~/.seclaw/workspace`):
641
+
642
+ ```text
643
+ ~/.seclaw/
644
+ ├── config.json
645
+ ├── sessions/
646
+ ├── snapshots/
647
+ │ └── docker_snapshots.json
648
+ ├── cron/
649
+ │ └── jobs.json
650
+ ├── security/
651
+ │ ├── execution_logs/
652
+ │ └── audit_reports/
653
+ └── workspace/
654
+ ├── AGENTS.md
655
+ ├── HEARTBEAT.md
656
+ ├── SOUL.md
657
+ ├── TOOLS.md
658
+ ├── USER.md
659
+ ├── memory/
660
+ │ └── MEMORY.md
661
+ └── skills/
662
+ ```
663
+
664
+ ---
665
+
666
+ ## 🙏 Acknowledgement
667
+
668
+ This project builds on ideas from [OpenClaw](https://github.com/openclaw/openclaw) and [Nanobot](https://github.com/HKUDS/nanobot). Thanks to both communities.