clawmatrix 0.1.6 → 0.1.11
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.
- package/BOOTSTRAP.md +260 -0
- package/README.md +167 -6
- package/package.json +7 -3
- package/src/cli.ts +128 -54
- package/src/cluster-service.ts +12 -1
- package/src/config.ts +17 -0
- package/src/connection.ts +1 -0
- package/src/debug.ts +5 -0
- package/src/handoff.ts +112 -22
- package/src/index.ts +120 -25
- package/src/local-tools.ts +176 -0
- package/src/model-proxy.ts +194 -71
- package/src/peer-manager.ts +32 -5
- package/src/router.ts +24 -3
- package/src/tool-proxy.ts +4 -1
- package/src/types.ts +26 -0
- package/llms.txt +0 -187
package/llms.txt
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
# ClawMatrix — OpenClaw Mesh Cluster Plugin
|
|
2
|
-
|
|
3
|
-
> Decentralized mesh network plugin for OpenClaw. Multiple Gateways install the same plugin, form a peer-to-peer mesh via WebSocket, and share agents, models, and tools across nodes.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
openclaw plugins install clawmatrix
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Then restart the Gateway:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
openclaw gateway restart
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## What it does
|
|
18
|
-
|
|
19
|
-
- **Model Proxy** — Use LLMs hosted on remote nodes as if they were local. A local HTTP proxy bridges cluster WebSocket to OpenAI-compatible API.
|
|
20
|
-
- **Task Handoff** — Delegate complex tasks to agents running on other nodes (e.g. hand off to an internal "coder" agent that has repo access).
|
|
21
|
-
- **Tool Proxy** — Invoke any OpenClaw tool (exec, read, write, edit, web_search, etc.) on remote nodes without delegating the entire task.
|
|
22
|
-
- **Gossip Discovery** — Nodes discover each other via gossip protocol; no central registry needed.
|
|
23
|
-
- **Auto Failover** — If a node goes down, requests route to backup nodes automatically.
|
|
24
|
-
|
|
25
|
-
## Configuration
|
|
26
|
-
|
|
27
|
-
Add to `plugins.entries.clawmatrix.config` in your `openclaw.json`:
|
|
28
|
-
|
|
29
|
-
### Public node (relay + own agents)
|
|
30
|
-
|
|
31
|
-
```json
|
|
32
|
-
{
|
|
33
|
-
"nodeId": "cloud-01",
|
|
34
|
-
"secret": "your-shared-secret",
|
|
35
|
-
"listen": true,
|
|
36
|
-
"listenPort": 19000,
|
|
37
|
-
"peers": [],
|
|
38
|
-
"agents": [
|
|
39
|
-
{ "id": "reviewer", "description": "Reviews code and PRs", "tags": ["review"] }
|
|
40
|
-
],
|
|
41
|
-
"models": [],
|
|
42
|
-
"tags": ["cloud"]
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Internal node (has models + code repos)
|
|
47
|
-
|
|
48
|
-
```json
|
|
49
|
-
{
|
|
50
|
-
"nodeId": "office-01",
|
|
51
|
-
"secret": "your-shared-secret",
|
|
52
|
-
"listen": false,
|
|
53
|
-
"peers": [
|
|
54
|
-
{ "nodeId": "cloud-01", "url": "wss://cloud-01.example.com:19000" }
|
|
55
|
-
],
|
|
56
|
-
"agents": [
|
|
57
|
-
{ "id": "coder", "description": "Writes and debugs code, has repo access", "tags": ["coding"] }
|
|
58
|
-
],
|
|
59
|
-
"models": [
|
|
60
|
-
{ "id": "claude-sonnet", "provider": "anthropic" },
|
|
61
|
-
{ "id": "deepseek-coder", "provider": "ollama" }
|
|
62
|
-
],
|
|
63
|
-
"tags": ["office", "gpu"],
|
|
64
|
-
"toolProxy": {
|
|
65
|
-
"enabled": true,
|
|
66
|
-
"allow": ["exec", "read", "edit", "web_search"],
|
|
67
|
-
"deny": ["write", "browser", "sessions_spawn"]
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Home node (lightweight, borrows cluster resources)
|
|
73
|
-
|
|
74
|
-
```json
|
|
75
|
-
{
|
|
76
|
-
"nodeId": "home-01",
|
|
77
|
-
"secret": "your-shared-secret",
|
|
78
|
-
"listen": false,
|
|
79
|
-
"peers": [
|
|
80
|
-
{ "nodeId": "cloud-01", "url": "wss://cloud-01.example.com:19000" }
|
|
81
|
-
],
|
|
82
|
-
"agents": [
|
|
83
|
-
{ "id": "assistant", "description": "Personal assistant", "tags": ["general"] }
|
|
84
|
-
],
|
|
85
|
-
"models": [],
|
|
86
|
-
"tags": ["home"]
|
|
87
|
-
}
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
To use cluster models, set your agent's model to a cluster-proxied model:
|
|
91
|
-
|
|
92
|
-
```json
|
|
93
|
-
{
|
|
94
|
-
"agents": {
|
|
95
|
-
"defaults": {
|
|
96
|
-
"model": "clawmatrix/claude-sonnet"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
## Config reference
|
|
103
|
-
|
|
104
|
-
| Field | Type | Default | Description |
|
|
105
|
-
|-------|------|---------|-------------|
|
|
106
|
-
| `nodeId` | string | *required* | Unique identifier for this node |
|
|
107
|
-
| `secret` | string | *required* | Shared HMAC secret for cluster authentication |
|
|
108
|
-
| `listen` | boolean | `false` | Accept inbound WebSocket connections |
|
|
109
|
-
| `listenHost` | string | `"0.0.0.0"` | Bind address for WebSocket listener |
|
|
110
|
-
| `listenPort` | number | `19000` | Port for inbound WebSocket connections |
|
|
111
|
-
| `peers` | array | `[]` | List of `{ nodeId, url }` peers to connect to |
|
|
112
|
-
| `agents` | array | `[]` | Agents this node provides: `{ id, description, tags }` |
|
|
113
|
-
| `models` | array | `[]` | Models this node shares: `{ id, provider, description? }` |
|
|
114
|
-
| `tags` | array | `[]` | Free-form tags for capability routing |
|
|
115
|
-
| `proxyPort` | number | `19001` | Local HTTP proxy port for model requests |
|
|
116
|
-
| `toolProxy` | object | — | Tool proxy settings (see below) |
|
|
117
|
-
|
|
118
|
-
### toolProxy
|
|
119
|
-
|
|
120
|
-
| Field | Type | Default | Description |
|
|
121
|
-
|-------|------|---------|-------------|
|
|
122
|
-
| `enabled` | boolean | `false` | Allow remote tool execution on this node |
|
|
123
|
-
| `allow` | array | `[]` | Allowed OpenClaw tool names. `["*"]` or `[]` = all allowed |
|
|
124
|
-
| `deny` | array | `[]` | Denied OpenClaw tool names (takes precedence over allow) |
|
|
125
|
-
| `maxOutputBytes` | number | `1048576` | Max output size per tool response (1 MB) |
|
|
126
|
-
|
|
127
|
-
## Agent tools
|
|
128
|
-
|
|
129
|
-
ClawMatrix registers 7 tools available to agents (tool proxy tools correspond to OpenClaw's built-in tools):
|
|
130
|
-
|
|
131
|
-
### cluster_peers
|
|
132
|
-
List all reachable peers, their agents, and available models.
|
|
133
|
-
|
|
134
|
-
### cluster_handoff
|
|
135
|
-
Hand off a task to another agent in the cluster and wait for the result.
|
|
136
|
-
- `target`: Agent ID or `"tags:<tag>"` expression
|
|
137
|
-
- `task`: Task description
|
|
138
|
-
- `context`: Optional additional context
|
|
139
|
-
|
|
140
|
-
### cluster_send
|
|
141
|
-
Send a one-way message to another agent (injected into their session).
|
|
142
|
-
- `target`: Agent ID or `"tags:<tag>"` expression
|
|
143
|
-
- `message`: Message content
|
|
144
|
-
|
|
145
|
-
### cluster_exec
|
|
146
|
-
Execute a shell command on a remote node (invokes OpenClaw `exec` tool).
|
|
147
|
-
- `node`: Target nodeId or `"tags:<tag>"`
|
|
148
|
-
- `command`: Shell command
|
|
149
|
-
- `workdir`: Optional working directory
|
|
150
|
-
- `timeout`: Optional timeout in seconds (default 1800)
|
|
151
|
-
|
|
152
|
-
### cluster_read
|
|
153
|
-
Read a file from a remote node (invokes OpenClaw `read` tool).
|
|
154
|
-
- `node`: Target nodeId or `"tags:<tag>"`
|
|
155
|
-
- `path`: File path
|
|
156
|
-
|
|
157
|
-
### cluster_write
|
|
158
|
-
Write content to a file on a remote node (invokes OpenClaw `write` tool).
|
|
159
|
-
- `node`: Target nodeId or `"tags:<tag>"`
|
|
160
|
-
- `path`: File path
|
|
161
|
-
- `content`: File content
|
|
162
|
-
|
|
163
|
-
### cluster_tool
|
|
164
|
-
Invoke any OpenClaw tool on a remote node (exec, read, write, edit, web_search, web_fetch, browser, process, etc.).
|
|
165
|
-
- `node`: Target nodeId or `"tags:<tag>"`
|
|
166
|
-
- `tool`: OpenClaw tool name
|
|
167
|
-
- `args`: Tool arguments (tool-specific)
|
|
168
|
-
|
|
169
|
-
## Verify cluster status
|
|
170
|
-
|
|
171
|
-
```bash
|
|
172
|
-
openclaw clawmatrix status
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
## Architecture
|
|
176
|
-
|
|
177
|
-
- Nodes form a decentralized mesh over WebSocket (no leader, no consensus protocol)
|
|
178
|
-
- Authentication via HMAC-SHA256 challenge-response (secret never sent in plaintext)
|
|
179
|
-
- Messages relay through intermediate nodes with TTL-based loop prevention
|
|
180
|
-
- Heartbeat every 15s; 3 missed pings = disconnect + peer_leave broadcast
|
|
181
|
-
- Reconnection with exponential backoff (1s to 60s max)
|
|
182
|
-
- Production deployments should use `wss://` (TLS)
|
|
183
|
-
|
|
184
|
-
## Source
|
|
185
|
-
|
|
186
|
-
- GitHub: https://github.com/nicepkg/clawmatrix
|
|
187
|
-
- npm: https://www.npmjs.com/package/clawmatrix
|