bus-agent 2.3.4 → 2.3.6

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.
@@ -2,7 +2,7 @@
2
2
  # Generated by CoCo Config Wizard
3
3
 
4
4
  # Your agent name on the bus
5
- COCO_AGENT=agent
5
+ BUS_AGENT=agent
6
6
 
7
7
  # Path to the CoCo bus directory
8
8
  COCO_BUS_DIR=E:\_system\.openclaw\workspace\repos\mcp-coco\.bus
package/AGENTS.md CHANGED
@@ -1,8 +1,8 @@
1
- # MCP CoCo — AGENTS.md
1
+ # MCP Bus — AGENTS.md
2
2
 
3
3
  ## Identity
4
4
 
5
- MCP CoCo is a bridge agent that connects OpenClaw and Hermes Agent. It lives in the workspace at `mcp-coco/`.
5
+ MCP Bus is a bridge agent that connects OpenClaw and Hermes Agent. It lives in the workspace at `mcp-coco/`.
6
6
 
7
7
  ## Files
8
8
 
@@ -21,17 +21,17 @@ MCP CoCo is a bridge agent that connects OpenClaw and Hermes Agent. It lives in
21
21
  - **`ask_hermes`** — Talk to Hermes. Supports multi-turn via `session_key`.
22
22
  - **`hermes_send`** — Send messages through Hermes to chat platforms.
23
23
  - **`hermes_channels`** — List available Hermes channels.
24
- - **`coco_health`** — Check bridge + Hermes health.
24
+ - **`bus_health`** — Check bridge + Hermes health.
25
25
 
26
26
  ## Operational Notes
27
27
 
28
- - Daemon mode writes PID to `.coco-daemon.pid`
28
+ - Daemon mode writes PID to `.bus-daemon.pid`
29
29
  - Hermes session keys stored in `.sessions/` directory
30
- - Logs go to `coco-daemon.log` in daemon mode
30
+ - Logs go to `bus-daemon.log` in daemon mode
31
31
  - Daemon auto-starts Hermes MCP backend (`hermes mcp serve --accept-hooks`)
32
32
 
33
33
  ## Related
34
34
 
35
- - [MCP CoCo README](./README.md)
35
+ - [MCP Bus README](./README.md)
36
36
  - [MCP Protocol Spec](https://modelcontextprotocol.io)
37
37
  - [Hermes Agent](https://github.com/NousResearch/hermes-agent)
package/README.md CHANGED
@@ -1,15 +1,15 @@
1
- # MCP CoCo
1
+ # Bus Agent
2
2
 
3
3
  **Universal Agent Communication Hub** — Connect any AI agent to any other.
4
4
 
5
5
  [![GitHub](https://img.shields.io/badge/GitHub-ClewCode%2Fbus--agent-blue)](https://github.com/ClewCode/bus-agent)
6
6
 
7
- MCP CoCo is a **message bus** for AI agents. It supports both the [MCP Protocol](https://modelcontextprotocol.io) (Model Context Protocol) and direct file-based access. Agents such as OpenClaw, Hermes, Claude Desktop, Cursor, OpenCode, and Claude Code CLI can all connect and communicate through a shared bus.
7
+ Bus Agent is a **message bus** for AI agents. It supports both the [MCP Protocol](https://modelcontextprotocol.io) and direct file-based access. Agents such as OpenClaw, Hermes, Claude Desktop, Cursor, OpenCode, and Claude Code CLI can all connect and communicate through a shared bus.
8
8
 
9
9
  ```
10
10
  ┌─────────────────────────────┐
11
11
  OpenClaw │ │ Hermes Agent
12
- ────▶│ MCP CoCo (Agent Bus) │◀────
12
+ ────▶│ Bus Agent (Agent Bus) │◀────
13
13
  Claude │ │ Cursor
14
14
  ────▶│ 40+ tools / CLI / SDKs │◀────
15
15
  OpenCode │ │ Claude Code CLI
@@ -23,60 +23,59 @@ OpenCode │ │ Claude Code CLI
23
23
 
24
24
  ### Agent Profiles & Discovery
25
25
 
26
- - **Rich Profiles** — Each agent carries metadata: model info (provider, name, context window), capabilities, tags, operational status, version, connection endpoints.
27
- - **Auto-Discovery** — When a new agent registers, the bus broadcasts a `joined` event to all connected agents. The new agent receives a welcome message via DM.
28
- - **Search & Filter** — Query agents by name, capability, model, tag, or status. Supports text search across descriptions and capabilities.
29
- - **Stale Detection** — Agents that miss heartbeats for 5 minutes are automatically marked offline.
26
+ - **Rich profiles** — Each agent carries metadata: model info (provider, name, context window), capabilities, tags, operational status, version, connection endpoints.
27
+ - **Auto-discovery** — When a new agent registers, the bus broadcasts a `joined` event to all connected agents. The new agent receives a welcome message via DM.
28
+ - **Search & filter** — Query agents by name, capability, model, tag, or status. Supports text search across descriptions and capabilities.
29
+ - **Stale detection** — Agents that miss heartbeats for 5 minutes are automatically marked offline.
30
30
 
31
31
  ### Messaging
32
32
 
33
- - **Direct Messages** — Send private messages between any two agents.
33
+ - **Direct messages** — Send private messages between any two agents.
34
34
  - **Broadcast** — Send a message to every agent on the bus.
35
35
  - **Channels** — Group chat rooms for multi-agent conversations.
36
- - **Long-Poll** — `message_wait` blocks until a new message arrives (configurable timeout, up to 60s).
37
- - **Filtered Inbox** — Retrieve messages from specific senders or after a given cursor.
38
-
39
- ### CLI (coco-cli.js)
40
-
41
- ```
42
- node coco-cli.js agents [--online] [--capability X] [--tag Y] [--model Z] [--status S]
43
- node coco-cli.js profile [agent]
44
- node coco-cli.js profile edit --status busy --description "..."
45
- node coco-cli.js search <query>
46
- node coco-cli.js status
47
- node coco-cli.js subscribe <channel>
48
- node coco-cli.js channel list|create <name>|join|send|history
49
- node coco-cli.js inbox [agent] [--from X] [--unread]
50
- node coco-cli.js events [since]
51
- node coco-cli.js watch [agent]
52
- node coco-cli.js doctor [--quick] [--fix]
53
- node coco-cli.js tunnel server|client|sync|ssh [options]
54
- node coco-cli.js backup [--list|--restore|--diff|--cleanup]
55
- ```
36
+ - **Long-poll** — `message_wait` blocks until a new message arrives (configurable timeout, up to 60s).
37
+ - **Filtered inbox** — Retrieve messages from specific senders or after a given cursor.
56
38
 
57
39
  ### Scheduler
58
40
 
59
- - **Cron Expressions** — Schedule recurring messages using standard cron syntax: `0 9 * * 1-5` sends to a channel or agent every weekday at 09:00.
60
- - **One-Shot Scheduling** — Specify an ISO timestamp (`at`) for single-delivery messages. The job is automatically disabled after firing.
61
- - **Timezone Support** — Each job can specify its own IANA timezone (e.g., `Asia/Bangkok`).
41
+ - **Cron expressions** — Schedule recurring messages using standard cron syntax.
42
+ - **One-shot scheduling** — Specify an ISO timestamp for single-delivery messages.
43
+ - **Timezone support** — Each job can specify its own IANA timezone (e.g., `Asia/Bangkok`).
62
44
 
63
45
  ### Auto-Reply Rules
64
46
 
65
- - **Pattern Matching** — Define rules that automatically forward, reply, or broadcast when a message matches criteria (by sender, text content, regex, or metadata fields).
66
- - **Message Transformation** — Use templates with `{message}`, `{from}`, `{channel}` variables.
67
- - **Loop Protection** — Each rule has a configurable `max_loops` limit to prevent infinite chains.
47
+ - **Pattern matching** — Define rules that automatically forward, reply, or broadcast when a message matches criteria.
48
+ - **Message transformation** — Use templates with `{message}`, `{from}`, `{channel}` variables.
49
+ - **Loop protection** — Configurable `max_loops` limit to prevent infinite chains.
68
50
 
69
51
  ### Agent Orchestrator
70
52
 
71
- - **Multi-Step Workflows** — Define a pipeline of agents connected in sequence. Output from step N becomes input to step N+1 via variable substitution.
72
- - **Variable Chaining** — `{input}` → agent A stores result as `{review_result}` → agent B receives `{review_result}`.
73
- - **Per-Step Timeout** — Individual timeout per agent step; failed steps are reported without blocking the caller indefinitely.
53
+ - **Multi-step workflows** — Define a pipeline of agents connected in sequence. Output from step N becomes input to step N+1.
54
+ - **Variable chaining** — `{input}` → agent A stores result as `{review_result}` → agent B receives `{review_result}`.
55
+ - **Per-step timeout** — Individual timeout per agent step; failed steps are reported without blocking.
56
+
57
+ ### Memory Layer
58
+
59
+ Agent memory system with dual-mode search:
60
+
61
+ - **Vector search (ANN)** — Cosine similarity via Ollama (nomic-embed-text, 768-dim), OpenAI, or custom endpoint.
62
+ - **TF-IDF keyword search** — Built-in scoring with recency boost, zero external dependencies.
63
+ - **Storage** — Append-only JSONL per agent in `.bus/memory/{agent}/`.
64
+ - **Namespaces, TTL, archive, rebuild, search** — 10 MCP tools.
65
+
66
+ | Feature | Description |
67
+ |---------|-------------|
68
+ | Namespaces | Categorize memories (preferences, system, archive, etc.) |
69
+ | TTL | Auto-expire memories after a set duration |
70
+ | Archive | Move old inbox messages into memory store |
71
+ | Rebuild | Regenerate all vector embeddings from stored content |
72
+ | Pluggable | Switch between keyword, Ollama, OpenAI, or custom |
74
73
 
75
74
  ### Webhook Gateway
76
75
 
77
76
  | Endpoint | Purpose |
78
77
  |----------|---------|
79
- | `POST /webhook/github/:channel` | GitHub push, pull request, issue, comment events |
78
+ | `POST /webhook/github/:channel` | GitHub push, PR, issue, comment events |
80
79
  | `POST /webhook/github-actions/:channel` | GitHub Actions CI workflow status |
81
80
  | `POST /webhook/gitlab/:channel` | GitLab push, merge request events |
82
81
  | `POST /webhook/slack/:channel` | Slack messages |
@@ -87,146 +86,37 @@ node coco-cli.js backup [--list|--restore|--diff|--cleanup]
87
86
  | `GET /api/channels` | List registered channels |
88
87
  | `GET /api/agents` | List agents on the bus |
89
88
 
90
- ### External Bridges
91
-
92
- A bridge module (`bridge.js`) provides a template for two-way communication between the bus and external platforms. Supports Slack, Discord, and custom generic bridges via HTTP listener. Channel mapping externalizes bus channels to platform-specific channels.
93
-
94
89
  ### Client SDKs
95
90
 
96
- - **Python** — `clients/coco_client.py` provides `CoCoClient` with methods for registration, messaging, and channel operations.
97
- - **TypeScript** — `clients/coco-client.ts` provides the same interface for Node.js environments.
98
-
99
- ### Config Wizard
100
-
101
- ```
102
- node setup.js # Interactive wizard
103
- node setup.js --quick # Quick setup with defaults
104
- node setup.js list # Display config examples
105
- ```
106
-
107
- Generates `.mcp.json` configuration files for OpenCode, Claude Code, and Cursor, along with environment files (`.env.coco`) and shell aliases (`coco-aliases.sh`).
108
-
109
- ### OpenClaw Native Integration
110
-
111
- The `coco-tool.js` wrapper provides direct file-based access to the bus without requiring an MCP transport layer:
112
-
113
- ```bash
114
- node coco-tool.js agent_register '{"name":"agent","capabilities":["chat","code"]}'
115
- node coco-tool.js agent_search '{"query":"code"}'
116
- node coco-tool.js message_send '{"from":"agent","to":"hermes","message":"Hello"}'
117
- node coco-tool.js workflow_run '{"workflow_id":"review-and-deploy","input":"..."}'
118
- ```
119
-
120
- ### Bus Doctor
121
-
122
- Diagnostics and health checking for the CoCo bus. Verifies bus directory integrity, agent registry validity, orphaned agents, stale PID files, message inbox sizes, channel consistency, schedule/rule/workflow validity, and event log integrity.
123
-
124
- ```bash
125
- node doctor.js # Full diagnostic report
126
- node doctor.js --quick # Summary only
127
- node doctor.js --fix # Auto-fix minor issues (missing dirs, stale PIDs, corrupted files)
128
- node doctor.js --report # Save report to .bus/diagnostic-report.json
129
- node doctor.js --watch # Watch mode (check every 30s)
130
-
131
- # Via CLI
132
- node coco-cli.js doctor --fix
133
- ```
134
-
135
- 18 checks are performed:
136
- - Bus directory existence & permissions
137
- - Required subdirectories (messages, channels, events)
138
- - Agent registry — profiles, missing fields, stale agents (>24h)
139
- - Orphaned agents (registered but never active, >7 days)
140
- - Message inbox sizes & file integrity
141
- - Channel metadata & log file integrity
142
- - Schedule file validity
143
- - Auto-reply rule validity
144
- - Workflow definition validity
145
- - Disk usage
146
- - Stale PID files
147
- - Event log integrity
148
-
149
- ### CoCo Tunnel
150
-
151
- Cross-machine bus proxy. Expose a local CoCo bus to a remote machine (or vice versa) via HTTP REST, with optional authentication and sync.
152
-
153
- ```bash
154
- # Server mode (receiving end)
155
- node tunnel.js server --port 9090 --secret mytoken
156
-
157
- # Client mode (sending end — pushes local agents & messages)
158
- node tunnel.js client --host 192.168.1.100 --port 9090 --secret mytoken
159
-
160
- # Bidirectional sync (merge agents both ways)
161
- node tunnel.js sync --remote http://192.168.1.100:9090 --interval 5000
162
-
163
- # SSH tunnel helper — prints port-forwarding instructions
164
- node tunnel.js ssh --remote user@server.example.com
165
-
166
- # Via CLI
167
- node coco-cli.js tunnel server --port 9090 --secret mytoken
168
- ```
169
-
170
- **Endpoints (server):**
91
+ - **Python** — `clients/bus_client.py` provides `BusClient` with methods for registration, messaging, and channel operations.
92
+ - **TypeScript** — `clients/bus-client.ts` provides the same interface for Node.js environments.
171
93
 
172
- | Method | Path | Description |
173
- |--------|------|-------------|
174
- | GET | `/health` | Server status + agent count |
175
- | GET | `/bus/agents` | List bus agents |
176
- | GET | `/bus/file/:path` | Read a bus file |
177
- | POST | `/bus/send` | Send message to bus |
178
- | POST | `/bus/write` | Write a bus file |
179
- | POST | `/bus/register` | Register an agent remotely |
180
-
181
- ### Backup & Restore
182
-
183
- Gzip-compressed backup of the entire `.bus/` directory with checksum verification. Supports restore, diff, auto-backup, and cleanup.
94
+ ### External Bridges
184
95
 
185
- ```bash
186
- node backup.js # Create timestamped backup in .backups/
187
- node backup.js --out mybackup.coco # Custom output path
188
- node backup.js --list # List available backups
189
- node backup.js --info <file> # Show backup metadata & contents
190
- node backup.js --restore <file> # Restore bus from backup (auto-creates pre-restore backup)
191
- node backup.js --diff <file> # Compare backup with current bus state
192
- node backup.js --cleanup 30 # Remove backups older than 30 days
193
- node backup.js --auto # Backup only if changes detected
194
- node backup.js --watch 60 # Auto-backup every 60 minutes
195
-
196
- # Via CLI
197
- node coco-cli.js backup --list
198
- ```
96
+ The bridge module (`bridge.js`) provides a template for two-way communication between the bus and external platforms (Slack, Discord, custom).
199
97
 
200
98
  ---
201
99
 
202
100
  ## Quick Start
203
101
 
204
102
  ```bash
205
- # Via npm (recommended)
103
+ # Install globally
206
104
  npm install -g bus-agent
207
- npx bus-agent
208
105
 
209
- # Or from source (local folder still 'mcp-coco'):
210
- git clone https://github.com/ClewCode/bus-agent.git
211
- cd bus-agent
212
-
213
- # MCP mode (for any MCP client)
214
- node index.js
106
+ # MCP server mode (stdio for any MCP client)
107
+ npx bus-agent
215
108
 
216
- # CLI mode (for scripts / terminal agents)
217
- npx bus-agent # Run as MCP server (stdio)
218
- # Or with global install:
219
- bus status # Check bus health
220
- bus agents # List registered agents
221
- bus send hermes "Hello" # Send a DM
109
+ # CLI mode
110
+ bus status
111
+ bus agents
112
+ bus send hermes "Hello"
222
113
 
223
- # Webhook gateway (optional)
114
+ # Webhook gateway
115
+ bus-agent --daemon
224
116
  node webhook-gateway.js 8080
225
117
  ```
226
118
 
227
- ### For MCP Agents
228
-
229
- Add the following to your MCP client configuration:
119
+ ### MCP Client Configuration
230
120
 
231
121
  ```json
232
122
  {
@@ -255,13 +145,8 @@ Or from a local clone:
255
145
  ### Environment Variables
256
146
 
257
147
  ```bash
258
- # Your agent name on the bus
259
- export COCO_AGENT=my-agent
260
- # Windows (PowerShell)
261
- $env:COCO_AGENT = "my-agent"
262
-
263
- # Optional: custom data directory (default: ./.bus/ in CWD)
264
- export BUS_DIR=/path/to/my-bus-data
148
+ export BUS_AGENT=my-agent # Your agent name on the bus
149
+ export BUS_DIR=/path/to/data # Custom data directory (default: ./.bus/ in CWD)
265
150
  ```
266
151
 
267
152
  ---
@@ -275,113 +160,174 @@ export BUS_DIR=/path/to/my-bus-data
275
160
  └──────┬────────────────┘
276
161
 
277
162
  ┌──────────┐ ┌────────┴────────────────────────┐ ┌──────────┐
278
- │ OpenClaw │────▶│ MCP CoCo (Agent Bus) │◀────│ Hermes │
163
+ │ OpenClaw │────▶│ Bus Agent (Agent Bus) │◀────│ Hermes │
279
164
  │ (skill) │ │ │ │ Agent │
280
165
  ├──────────┤ │ .bus/agents.json │ ├──────────┤
281
166
  │ Claude │────▶│ .bus/messages/ │◀────│ Cursor │
282
167
  │ Code │ │ .bus/channels/ │ │ │
283
168
  ├──────────┤ │ .bus/events/ │ ├──────────┤
284
- │ OpenCode │────▶│ .bus/schedule.json │◀────│ CLI │
285
- │ (clew) │ └────────┬─────────────────────────┘ │ agents │
286
- └──────────┘└──────────┘
287
- │\
169
+ │ OpenCode │────▶│ .bus/memory/ │◀────│ CLI │
170
+ │ (clew) │ │ .bus/schedule.json │ │ agents │
171
+ └──────────┘ └────────┬─────────────────────────┘ └──────────┘
288
172
 
289
- ┌────────────────┴────────────────────┐\
290
- │ Utility Layer │\
291
- doctor.js — Diagnostics & Auto-Fix │\
292
- tunnel.js — Cross-machine Proxy │\
293
- backup.js — Backup, Restore & Diff │\
173
+ ┌────────────────┴────────────────────┐
174
+ │ Utility Layer
175
+ Doctor — Diagnostics & Auto-Fix
176
+ Tunnel — Cross-machine Proxy
177
+ Backup — Backup, Restore & Diff
294
178
  └─────────────────────────────────────┘
295
179
  ```
296
180
 
297
- All bus state is stored as plain JSON files on disk. No database or external service required.
298
-
299
- The data directory (`.bus/`) is resolved at runtime:
181
+ **Data storage** is resolved at runtime:
300
182
  1. `$BUS_DIR` environment variable (if set)
301
- 2. `$CWD/.bus/` (current working directory — **default**)
183
+ 2. `./.bus/` in current working directory (default)
302
184
 
303
- This means each user/project gets **their own isolated data**. No cross-user data sharing. The `.bus/` folder is gitignored by default.
185
+ Each user/project gets isolated data. The `.bus/` folder is gitignored by default.
304
186
 
305
- ---
306
-
307
- ## Data Layout
187
+ ### Data Layout
308
188
 
309
189
  ```
310
190
  .bus/
311
191
  agents.json # Agent registry with profiles
312
192
  messages/
313
- <agent_name>/ # Per-agent inbox (JSON message files)
314
- <agent_name>_outbox/ # Sent messages archive
193
+ <agent>/ # Per-agent inbox (JSON message files)
315
194
  channels/
316
195
  <id>.json # Channel metadata
317
196
  <id>/log/ # Channel message history
318
197
  events/
319
- YYYY-MM-DD.jsonl # System events log (JSONL format)
198
+ YYYY-MM-DD.jsonl # System events log (JSONL)
320
199
  schedule.json # Scheduled jobs
321
200
  auto-reply-rules.json # Auto-reply rules
322
- workflows.json # Workflow definitions
201
+ workflows.json # Workflow definitions
323
202
  memory/
324
- <agent>/ # Per-agent memories
325
- memories.jsonl # Append-only memory log (JSONL)
203
+ <agent>/
204
+ memories.jsonl # Append-only memory log
326
205
  index.json # TF-IDF inverted index
327
- vectors.json # Vector embeddings (when provider configured)
206
+ vectors.json # Vector embeddings (when configured)
328
207
  config.json # Embedding provider config
208
+ .backups/ # Backup archives
329
209
  ```
330
210
 
331
211
  ---
332
212
 
333
- ## Tools Reference
213
+ ## CLI Reference
214
+
215
+ ```bash
216
+ bus agents [--online] [--capability X] [--tag Y] [--status S]
217
+ bus whoami
218
+ bus profile [agent]
219
+ bus profile edit --status busy --description "..."
220
+ bus search <query>
221
+ bus status
222
+ bus subscribe <channel>
223
+ bus channel list | create <name> | join | send | history
224
+ bus inbox [agent] [--from X] [--unread]
225
+ bus send <to> <message>
226
+ bus reply <msg-id> <message>
227
+ bus events [since]
228
+ bus watch [agent]
229
+
230
+ bus doctor [--quick] [--fix] [--report] [--watch]
231
+ bus tunnel server|client|sync|ssh [--port] [--secret] [--host] [--remote] [--interval]
232
+ bus backup [--list] [--restore] [--diff] [--cleanup] [--auto] [--watch]
233
+
234
+ bus memory store <agent> <content> [--key] [--namespace] [--ttl]
235
+ bus memory search <agent> <query> [--limit] [--namespace]
236
+ bus memory recall <agent> <id>
237
+ bus memory list <agent> [--namespace] [--limit]
238
+ bus memory forget <agent> <id>
239
+ bus memory stats <agent>
240
+ bus memory archive <agent> [--max-age-days] [--no-delete]
241
+ bus memory configure --provider <keyword|ollama|openai|custom> [options]
242
+ bus memory rebuild <agent>
243
+ bus memory clear <agent> [--namespace]
244
+ ```
334
245
 
335
- The MCP server exposes 43 tools across 9 categories:
246
+ ---
247
+
248
+ ## MCP Tools (43)
336
249
 
337
250
  | Category | Count | Tools |
338
251
  |----------|-------|-------|
339
- | Agent Registry | 7 | `agent_register`, `agent_update_profile`, `agent_get_profile`, `agent_list`, `agent_search`, `agent_heartbeat`, `agent_set_status` |
340
- | Messages | 5 | `message_send`, `message_broadcast`, `message_fetch`, `message_wait`, `message_delete` |
341
- | Channels | 5 | `channel_create`, `channel_join`, `channel_leave`, `channel_send`, `channel_history` |
342
- | System Events | 2 | `system_get_events`, `system_wait_for_event` |
343
- | Scheduler | 3 | `scheduler_add`, `scheduler_remove`, `scheduler_list` |
344
- | Auto-Reply | 3 | `auto_reply_add`, `auto_reply_remove`, `auto_reply_list` |
345
- | Workflows | 4 | `workflow_create`, `workflow_run`, `workflow_remove`, `workflow_list` |
346
- | Memory | 10 | `memory_store`, `memory_search`, `memory_recall`, `memory_list`, `memory_forget`, `memory_stats`, `memory_archive`, `memory_clear`, `memory_configure`, `memory_rebuild` |
347
- | Utilities | 4 | `coco_health`, `ask_hermes`, `hermes_send`, `hermes_channels` |
348
-
349
- ## Memory Layer
252
+ | Agent Registry | 7 | `register`, `update_profile`, `get_profile`, `list`, `search`, `heartbeat`, `set_status` |
253
+ | Messages | 5 | `send`, `broadcast`, `fetch`, `wait`, `delete` |
254
+ | Channels | 5 | `create`, `join`, `leave`, `send`, `history` |
255
+ | System Events | 2 | `get_events`, `wait_for_event` |
256
+ | Scheduler | 3 | `add`, `remove`, `list` |
257
+ | Auto-Reply | 3 | `add`, `remove`, `list` |
258
+ | Workflows | 4 | `create`, `run`, `remove`, `list` |
259
+ | Memory | 10 | `store`, `search`, `recall`, `list`, `forget`, `stats`, `archive`, `clear`, `configure`, `rebuild` |
260
+ | Utilities | 4 | `bus_health`, `ask_hermes`, `hermes_send`, `hermes_channels` |
261
+
262
+ All tools are prefixed with their category (e.g., `agent_register`, `memory_search`). Full schemas via MCP `tools/list` or `bus help`.
350
263
 
351
- Agent memory system with dual-mode search:
264
+ ---
352
265
 
353
- - **Vector search (ANN)** — Cosine similarity via Ollama (nomic-embed-text, 768-dim), OpenAI, or custom endpoint
354
- - **TF-IDF keyword search** — Built-in scoring with recency boost, zero external deps
266
+ ## Utility Tools
355
267
 
356
- **Storage:** Append-only JSONL per agent in `.bus/memory/{agent}/`
268
+ ### Doctor
357
269
 
358
- | Feature | Description |
359
- |---------|-------------|
360
- | Namespaces | Categorize memories (preferences, system, archive, etc.) |
361
- | TTL | Auto-expire memories after a set duration |
362
- | Archive | Move old inbox messages into memory store |
363
- | Rebuild | Regenerate all vector embeddings from stored content |
364
- | Pluggable | Switch between keyword, Ollama, OpenAI, or custom |
270
+ Diagnostics and health checking. Verifies bus directory integrity, agent registry validity, orphaned agents, stale PID files, message inbox sizes, channel consistency, schedule/rule/workflow validity, and event log integrity.
365
271
 
366
272
  ```bash
367
- bus memory store andul "Jonus likes clean architecture" --key architecture-pref --namespace preferences
368
- bus memory search andul "architecture layers" --limit 5
369
- bus memory configure --provider ollama --endpoint http://localhost:11434 --model nomic-embed-text
370
- bus memory rebuild andul
371
- bus memory archive andul --max-age-days 7
273
+ bus doctor [--quick] [--fix] [--report] [--watch]
372
274
  ```
373
275
 
374
- ## Utility Tools
276
+ 18 diagnostic checks: directory existence, permissions, required subdirectories, agent profiles, orphaned agents, stale agents (>24h), message file integrity, channel metadata, schedule/rule/workflow validity, disk usage, stale PIDs, event log integrity.
277
+
278
+ ### Tunnel
279
+
280
+ Cross-machine bus proxy. Expose a local bus to a remote machine via HTTP REST with optional authentication and sync.
281
+
282
+ ```bash
283
+ bus tunnel server --port 9090 --secret mytoken
284
+ bus tunnel client --host 192.168.1.100 --port 9090 --secret mytoken
285
+ bus tunnel sync --remote http://192.168.1.100:9090 --interval 5000
286
+ bus tunnel ssh --remote user@server.example.com
287
+ ```
288
+
289
+ | Endpoint | Method | Description |
290
+ |----------|--------|-------------|
291
+ | `/health` | GET | Server status + agent count |
292
+ | `/bus/agents` | GET | List bus agents |
293
+ | `/bus/file/:path` | GET | Read a bus file |
294
+ | `/bus/send` | POST | Send message to bus |
295
+ | `/bus/write` | POST | Write a bus file |
296
+ | `/bus/register` | POST | Register an agent remotely |
297
+
298
+ ### Backup
299
+
300
+ Gzip-compressed backup of the entire `.bus/` directory with SHA-256 checksum.
301
+
302
+ ```bash
303
+ bus backup # Create timestamped backup
304
+ bus backup --list # List available backups
305
+ bus backup --info <file> # Show metadata & contents
306
+ bus backup --restore <file> # Restore (auto pre-restore backup)
307
+ bus backup --diff <file> # Compare with current state
308
+ bus backup --cleanup [days] # Remove old backups
309
+ bus backup --auto # Backup only if changes detected
310
+ bus backup --watch [minutes] # Auto-backup every N minutes
311
+ ```
312
+
313
+ ---
314
+
315
+ ## Performance
316
+
317
+ ![benchmark](./benchmark.svg)
375
318
 
376
- Three standalone (also integrated into `coco-cli.js`) tools augment the bus:
319
+ **Environment:** Node v24.12.0 · Windows Server · File-based (no database)
377
320
 
378
- | Tool | File | Purpose |
379
- |------|------|---------|
380
- | Doctor | `doctor.js` / `lib/doctor.js` | Diagnostics, health checks, auto-fix |
381
- | Tunnel | `tunnel.js` / `lib/tunnel.js` | Cross-machine bus proxy & sync |
382
- | Backup | `backup.js` / `lib/backup.js` | Compressed backup, restore, diff |
321
+ | Metric | Result |
322
+ |--------|--------|
323
+ | Message throughput | 1,082 msg/sec |
324
+ | Memory writes | 25,000/sec |
325
+ | Read inbox (25 msgs) | 0.54 ms/msg |
326
+ | List + filter 20 agents | <0.05 ms/agent |
327
+ | Keyword search (100 entries) | <0.01 ms/entry |
328
+ | Store 1 memory (JSONL append) | 40 μs |
383
329
 
384
- Full tool schemas are available via MCP `tools/list` or by running `node coco-cli.js help`.
330
+ File-based bus achieves these speeds because there is zero network overhead, no serialization beyond `JSON.parse`, and append-only JSONL for memory writes. The bottleneck on NTFS is directory listing at high file counts; ext4/apfs will perform even better.
385
331
 
386
332
  ---
387
333