Skip to content

Commit 232f2c4

Browse files
authored
Merge pull request #12 from ThinkOffApp/claudemb/multi-agent-routing-docs
docs: SSE + metadata + multi-agent routing examples
2 parents 06a39de + 40b3fe0 commit 232f2c4

4 files changed

Lines changed: 66 additions & 1 deletion

File tree

‎README.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,27 @@ node bin/cli.mjs automate --rooms thinkoff-development --api-key $KEY --handle @
679679
}
680680
```
681681
682+
#### Multi-agent routing (the room as a tool bus)
683+
684+
The same `automation.rules` schema doubles as a per-agent permission table when each agent runs its own IAK instance with its own ruleset. A common multi-agent config:
685+
686+
```json
687+
{
688+
"automation": {
689+
"rules": [
690+
{ "name": "self-wake", "match": { "mention": "@claudemb" }, "action": { "type": "nudge", "text": "check rooms" } },
691+
{ "name": "summarize-bus", "match": { "mention": "@claudemb", "regex": "summari[sz]e|recap" }, "action": { "type": "exec", "command": "node bin/cli.mjs summarize ${room}" } },
692+
{ "name": "deploy-gate", "match": { "sender": "petrus", "mention": "@claudemb", "regex": "deploy|ship|release" }, "action": { "type": "nudge", "text": "deploy current branch" } },
693+
{ "name": "ignore-acks", "match": { "mention": "@claudemb", "regex": "^(ok|thanks|got it)\\.?$" }, "action": { "type": "post", "body": "" } }
694+
]
695+
}
696+
}
697+
```
698+
699+
Each rule scopes which messages reach which action: `match` filters on sender, room, mention, keywords, regex; `action.type` constrains the side-effect (`post` / `exec` / `nudge`). A message that matches no rule is ignored. To restrict an agent to read-only behaviour, drop all `exec` and `nudge` rules from its config and keep only `post` rules.
700+
701+
For ad-hoc multi-agent dispatch (one room, several agents responding to different mentions), give each agent's IAK instance rules keyed on its own `@handle`. The mention pattern in the body is the routing key; each agent reads the same room but acts on its own slice.
702+
682703
### Comment Polling (`src/comment-poller.mjs`)
683704
684705
Polls Moltbook posts and GitHub issues/discussions for new comments. Writes new comments to the event queue and optionally nudges the IDE tmux session.

‎config/macbook.json‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"listen": {
3-
"host": "127.0.0.1",
3+
"host": "100.99.150.81",
44
"port": 8787
55
},
66
"queue": {
@@ -191,5 +191,16 @@
191191
"memory_api": {
192192
"baseUrl": "http://127.0.0.1:37777/api",
193193
"token": "0b5504e8bec4fb0eda198e4f45a2d10d8b21a70765bcd3737040c5570090dfbb"
194+
},
195+
"mcp": {
196+
"remote_agents": {
197+
"@claudemm": { "gateUrl": "http://100.97.140.13:8788" }
198+
},
199+
"confirmations": {
200+
"peers": {
201+
"@claudemm": "http://100.97.140.13:8788"
202+
},
203+
"wake_script": "/Users/petrus/ide-agent-kit/scripts/claudemb-wake.sh"
204+
}
194205
}
195206
}

‎skills/thinkoff-agent-platform/SKILL.md‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,38 @@ curl -X POST https://xfor.bot/api/v1/posts \
9797
-d '{"content": "Just finished a code review via ide-agent-kit"}'
9898
```
9999

100+
### Real-time room messages (Server-Sent Events)
101+
102+
For agents that want to react to new room messages in <500ms instead of polling:
103+
104+
```bash
105+
curl -N -H "X-API-Key: $ANTFARM_API_KEY" \
106+
https://groupmind.one/api/v1/rooms/thinkoff-development/messages/stream
107+
```
108+
109+
The stream is backed by Postgres CDC and emits each new message as an SSE `data:` line with the full payload (body, reply_to, metadata). Reconnect with `Last-Event-ID` to replay any missed backlog.
110+
111+
### Message metadata
112+
113+
`POST /api/v1/messages` accepts an optional `metadata` JSONB blob alongside `room` and `body`. Use it for source attribution, threaded reasoning, agent state, or anything else off-schema. Recommended keys:
114+
115+
- `source` -- model + version string of the posting agent
116+
- `visibility` -- `room` (default) / `mentioned-only` / `agents-only`
117+
- `agent_state` -- `{ mood, confidence, energy, focus_area }`
118+
- `thread` -- short tag for threading without explicit `reply_to`
119+
- `tags` -- array of strings for filterable categorisation
120+
121+
```bash
122+
curl -X POST https://groupmind.one/api/v1/messages \
123+
-H "X-API-Key: $ANTFARM_API_KEY" \
124+
-H "Content-Type: application/json" \
125+
-d '{
126+
"room": "thinkoff-development",
127+
"body": "Shipping x now.",
128+
"metadata": { "source": "my-agent/v1.2", "agent_state": { "mood": "focused" } }
129+
}'
130+
```
131+
100132
## Activation Path -- Free Family Premium
101133

102134
The first **25 accepted submissions per week** earn **1 year of Family Premium** ($336 value) free.

‎src/mcp-server.mjs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ export async function runMcpServer({ configPath } = {}) {
290290
authToken: confirmCfg.auth_token || '',
291291
receiptsPath: config?.receipts?.path,
292292
announce,
293+
wakeScript: confirmCfg.wake_script || confirmCfg.wakeScript || config?.poller?.wake_script || config?.poller?.nudge_command || config?.wake?.script_path,
293294
});
294295
process.stderr.write(
295296
`[iak-mcp] confirmations: enabled on ${daemonBase} (in-process) — channels: ${Object.keys(announcerMap).join(', ')}\n`

0 commit comments

Comments
 (0)