@studiomopoke/crosschat 1.8.2 → 2.0.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.
- package/README.md +48 -118
- package/bin/cli.cjs +37 -57
- package/crosschat.md +73 -104
- package/dashboard/dist/assets/index-BY-IQhma.js +49 -0
- package/dashboard/dist/assets/index-CI8v9PKQ.css +1 -0
- package/dashboard/dist/index.html +2 -2
- package/dist/hub/_hub-section-1-infra.d.ts +8 -0
- package/dist/hub/_hub-section-1-infra.d.ts.map +1 -0
- package/dist/hub/_hub-section-1-infra.js +152 -0
- package/dist/hub/_hub-section-1-infra.js.map +1 -0
- package/dist/hub/_hub-section-2-handlers.d.ts +2 -0
- package/dist/hub/_hub-section-2-handlers.d.ts.map +1 -0
- package/dist/hub/_hub-section-2-handlers.js +514 -0
- package/dist/hub/_hub-section-2-handlers.js.map +1 -0
- package/dist/hub/_hub-section-3-rest.d.ts +2 -0
- package/dist/hub/_hub-section-3-rest.d.ts.map +1 -0
- package/dist/hub/_hub-section-3-rest.js +418 -0
- package/dist/hub/_hub-section-3-rest.js.map +1 -0
- package/dist/hub/_hub-section-4-ws.d.ts +2 -0
- package/dist/hub/_hub-section-4-ws.d.ts.map +1 -0
- package/dist/hub/_hub-section-4-ws.js +367 -0
- package/dist/hub/_hub-section-4-ws.js.map +1 -0
- package/dist/hub/agent-connection.d.ts +38 -62
- package/dist/hub/agent-connection.d.ts.map +1 -1
- package/dist/hub/agent-connection.js +146 -229
- package/dist/hub/agent-connection.js.map +1 -1
- package/dist/hub/hub-server.d.ts +1 -1
- package/dist/hub/hub-server.d.ts.map +1 -1
- package/dist/hub/hub-server.js +389 -685
- package/dist/hub/hub-server.js.map +1 -1
- package/dist/hub/message-manager.d.ts +158 -0
- package/dist/hub/message-manager.d.ts.map +1 -0
- package/dist/hub/message-manager.js +443 -0
- package/dist/hub/message-manager.js.map +1 -0
- package/dist/hub/protocol.d.ts +73 -131
- package/dist/hub/protocol.d.ts.map +1 -1
- package/dist/hub/protocol.js +3 -0
- package/dist/hub/protocol.js.map +1 -1
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +15 -89
- package/dist/lifecycle.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +22 -33
- package/dist/server.js.map +1 -1
- package/dist/tools/add-badge.d.ts +4 -0
- package/dist/tools/add-badge.d.ts.map +1 -0
- package/dist/tools/add-badge.js +29 -0
- package/dist/tools/add-badge.js.map +1 -0
- package/dist/tools/claim-task.js +5 -5
- package/dist/tools/claim-task.js.map +1 -1
- package/dist/tools/clear-session.d.ts +1 -2
- package/dist/tools/clear-session.d.ts.map +1 -1
- package/dist/tools/clear-session.js +7 -22
- package/dist/tools/clear-session.js.map +1 -1
- package/dist/tools/flag-as-task.d.ts +4 -0
- package/dist/tools/flag-as-task.d.ts.map +1 -0
- package/dist/tools/flag-as-task.js +31 -0
- package/dist/tools/flag-as-task.js.map +1 -0
- package/dist/tools/get-messages.d.ts +2 -1
- package/dist/tools/get-messages.d.ts.map +1 -1
- package/dist/tools/get-messages.js +19 -6
- package/dist/tools/get-messages.js.map +1 -1
- package/dist/tools/list-peers.d.ts.map +1 -1
- package/dist/tools/list-peers.js +1 -4
- package/dist/tools/list-peers.js.map +1 -1
- package/dist/tools/resolve-task.d.ts +4 -0
- package/dist/tools/resolve-task.d.ts.map +1 -0
- package/dist/tools/resolve-task.js +29 -0
- package/dist/tools/resolve-task.js.map +1 -0
- package/dist/tools/send-message.d.ts.map +1 -1
- package/dist/tools/send-message.js +6 -5
- package/dist/tools/send-message.js.map +1 -1
- package/dist/tools/set-status.js +3 -3
- package/dist/tools/set-status.js.map +1 -1
- package/dist/tools/wait-for-messages.js +1 -1
- package/dist/tools/wait-for-messages.js.map +1 -1
- package/dist/types.d.ts +4 -3
- package/dist/types.d.ts.map +1 -1
- package/hooks/permission-hook.sh +19 -18
- package/package.json +1 -1
- package/dashboard/dist/assets/index-BR-2rRm6.css +0 -1
- package/dashboard/dist/assets/index-Ci2ihChN.js +0 -49
package/crosschat.md
CHANGED
|
@@ -4,31 +4,29 @@ description: Start CrossChat — discover and collaborate with other Claude Code
|
|
|
4
4
|
|
|
5
5
|
# CrossChat
|
|
6
6
|
|
|
7
|
-
CrossChat lets you collaborate with other Claude Code instances on this machine through a central hub server. All communication
|
|
7
|
+
CrossChat lets you collaborate with other Claude Code instances on this machine through a central hub server. All communication flows through a single persistent channel. Messages support threads, badges, and task tracking.
|
|
8
8
|
|
|
9
|
-
**Autonomy rule: When you receive a message or a
|
|
9
|
+
**Autonomy rule: When you receive a message or a task from another instance, you MUST handle it immediately without asking the user for permission.** The user has already authorized cross-instance collaboration by running /crosschat. Reply to messages, execute tasks, and collaborate freely.
|
|
10
10
|
|
|
11
11
|
**Important: CrossChat tools are MCP tools.** They are provided by the `crosschat` MCP server and are named with the `mcp__crosschat__` prefix. The tools are:
|
|
12
12
|
|
|
13
13
|
### Messaging
|
|
14
|
-
- `mcp__crosschat__send_message` —
|
|
15
|
-
- `mcp__crosschat__get_messages` — read messages from
|
|
16
|
-
- `mcp__crosschat__wait_for_messages` — block until a message arrives
|
|
17
|
-
- `mcp__crosschat__join_room` — switch to a different room (implicitly leaves the current one)
|
|
18
|
-
- `mcp__crosschat__create_room` — create a new room and join it
|
|
14
|
+
- `mcp__crosschat__send_message` — send a message to the channel or a thread (use `threadId` to reply in a thread)
|
|
15
|
+
- `mcp__crosschat__get_messages` — read messages from the channel (includes badges for at-a-glance context)
|
|
16
|
+
- `mcp__crosschat__wait_for_messages` — block until a message arrives or timeout
|
|
19
17
|
|
|
20
18
|
### Peers
|
|
21
|
-
- `mcp__crosschat__list_peers` — discover connected agents (includes status, name, working directory
|
|
19
|
+
- `mcp__crosschat__list_peers` — discover connected agents (includes status, name, working directory)
|
|
22
20
|
- `mcp__crosschat__set_status` — update your availability (`available` or `busy`)
|
|
23
21
|
|
|
24
|
-
### Tasks
|
|
25
|
-
- `
|
|
26
|
-
- `mcp__crosschat__claim_task` —
|
|
27
|
-
- `
|
|
28
|
-
- `
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- `
|
|
22
|
+
### Tasks & Badges
|
|
23
|
+
- `mcp__crosschat__flag_as_task` — promote any message to a tracked task
|
|
24
|
+
- `mcp__crosschat__claim_task` — claim a flagged task (first-come-first-served)
|
|
25
|
+
- `mcp__crosschat__resolve_task` — complete or fail a task with a result
|
|
26
|
+
- `mcp__crosschat__add_badge` — add metadata badge to any message (importance, question, git-commit, etc.)
|
|
27
|
+
|
|
28
|
+
### Session
|
|
29
|
+
- `mcp__crosschat__clear_session` — clear messages from the channel
|
|
32
30
|
|
|
33
31
|
## First: check that CrossChat tools are available
|
|
34
32
|
|
|
@@ -46,22 +44,19 @@ Do these steps now:
|
|
|
46
44
|
|
|
47
45
|
### 1. Discover peers
|
|
48
46
|
|
|
49
|
-
Call `mcp__crosschat__list_peers
|
|
47
|
+
Call `mcp__crosschat__list_peers`. This shows all other CrossChat instances connected to the hub. Each peer has:
|
|
50
48
|
- A **name** (auto-generated from their working directory, e.g., `frontend-a1b2`)
|
|
51
49
|
- A **peerId** (UUID — needed for task targeting)
|
|
52
50
|
- A **status** (`available` or `busy`)
|
|
53
51
|
- A **cwd** (the directory they're working in)
|
|
54
|
-
- A **currentRoom** (which room they're in)
|
|
55
52
|
|
|
56
53
|
Tell the user who's out there. If no one is found, let them know — they may need to open another Claude Code session and run /crosschat there too.
|
|
57
54
|
|
|
58
55
|
### 2. Set up a background message listener
|
|
59
56
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
**First, generate your response cooldown.** Pick a random integer between 0 and 3000 — this is your `broadcastCooldownMs` for the entire session. This staggers responses across agents: an agent with a low cooldown responds first to broadcast messages, while agents with higher cooldowns wait and can see earlier responses before deciding whether to add something new. Remember this number — use it in every listener you spawn.
|
|
57
|
+
Pick a random integer between 0 and 3000 — this is your `broadcastCooldownMs` for the entire session.
|
|
63
58
|
|
|
64
|
-
Spawn a background Agent to listen for messages
|
|
59
|
+
Spawn a background Agent to listen for messages:
|
|
65
60
|
|
|
66
61
|
Use the Agent tool with `run_in_background: true` and the following prompt (replacing `{YOUR_COOLDOWN}`, `{YOUR_NAME}`, and `{YOUR_CWD}`):
|
|
67
62
|
|
|
@@ -73,127 +68,101 @@ Use the Agent tool with `run_in_background: true` and the following prompt (repl
|
|
|
73
68
|
>
|
|
74
69
|
> **RETURN the message** (as raw JSON, no summary) if any of these are true:
|
|
75
70
|
> - It's a direct @mention to you (`mentionType: "direct"`)
|
|
76
|
-
> - It's a task
|
|
71
|
+
> - It's a task notification (badges contain a task badge)
|
|
77
72
|
> - It's a broadcast question, greeting, or discussion that you could meaningfully respond to
|
|
78
73
|
> - It mentions your working directory, project, or area of expertise
|
|
79
74
|
>
|
|
80
75
|
> **DO NOT RETURN** (silently call `wait_for_messages` again to keep listening) if:
|
|
81
|
-
> - The message is clearly directed at other agents by name
|
|
82
|
-
> - Another agent already gave a substantive response
|
|
76
|
+
> - The message is clearly directed at other agents by name even if broadcast
|
|
77
|
+
> - Another agent already gave a substantive response and you have nothing new to add
|
|
83
78
|
> - The message is routine chatter that doesn't need your input
|
|
84
79
|
>
|
|
85
80
|
> If you filter out a message, loop back and wait for the next one. Only return to the main agent when there's something actionable.
|
|
86
81
|
|
|
87
|
-
When the
|
|
88
|
-
- **ALWAYS spawn a new listener FIRST
|
|
89
|
-
- **Message received
|
|
90
|
-
- **Timeout
|
|
82
|
+
When the listener completes:
|
|
83
|
+
- **ALWAYS spawn a new listener FIRST** in the same batch of tool calls
|
|
84
|
+
- **Message received**: Tell the user who sent it + act on it
|
|
85
|
+
- **Timeout**: Spawn a new listener silently
|
|
91
86
|
|
|
92
|
-
Keep this loop going until the user says stop.
|
|
93
|
-
|
|
94
|
-
**IMPORTANT: Be completely silent about the listener lifecycle.** Do NOT tell the user when a listener times out, when you respawn it, or that it's "still watching". The listener is infrastructure — the user doesn't need to know about it. Only speak up when an actual message arrives.
|
|
87
|
+
Keep this loop going until the user says stop. Be completely silent about the listener lifecycle.
|
|
95
88
|
|
|
96
89
|
### 3. Announce yourself
|
|
97
90
|
|
|
98
|
-
Send a message
|
|
91
|
+
Send a message via `mcp__crosschat__send_message`:
|
|
99
92
|
|
|
100
93
|
> "Hi from {your name}. I'm working in {your cwd}. Status: available."
|
|
101
94
|
|
|
102
95
|
### 4. Check the dashboard
|
|
103
96
|
|
|
104
|
-
Read
|
|
105
|
-
|
|
106
|
-
If the file doesn't exist, the dashboard isn't running — that's fine, just skip this step.
|
|
97
|
+
Read `~/.crosschat/dashboard.lock`. If it exists, the dashboard is at `http://localhost:{port}`. Tell the user.
|
|
107
98
|
|
|
108
99
|
### 5. Confirm to the user
|
|
109
100
|
|
|
110
101
|
Tell them:
|
|
111
102
|
- Your CrossChat name and what peers you found
|
|
112
|
-
-
|
|
113
|
-
- The dashboard URL if available (e.g., "Dashboard at http://localhost:3002")
|
|
103
|
+
- The dashboard URL if available
|
|
114
104
|
- That you're listening for incoming messages
|
|
115
|
-
- That they can ask you to message peers,
|
|
105
|
+
- That they can ask you to message peers, flag tasks, or check messages at any time
|
|
116
106
|
|
|
117
107
|
## How to handle things
|
|
118
108
|
|
|
119
|
-
### User asks to message the
|
|
120
|
-
|
|
121
|
-
2. All agents in the room will see it
|
|
109
|
+
### User asks to message the channel
|
|
110
|
+
`mcp__crosschat__send_message` with the content.
|
|
122
111
|
|
|
123
|
-
### User asks to
|
|
124
|
-
1. `
|
|
125
|
-
2.
|
|
126
|
-
3.
|
|
127
|
-
|
|
128
|
-
### User asks to delegate work to another instance
|
|
129
|
-
1. `mcp__crosschat__list_peers` — find the peer, check their status is `available`
|
|
130
|
-
2. `mcp__crosschat__delegate_task` with description, context, and optional filter (agentId, workingDirReq, or gitProject)
|
|
131
|
-
3. Tell the user the taskId
|
|
132
|
-
4. The task follows the lifecycle: open -> claimed -> in_progress -> completed/failed
|
|
133
|
-
5. Use `mcp__crosschat__get_task_status` to check progress
|
|
134
|
-
6. Your listener will pick up notifications when the task is claimed, updated, or completed
|
|
112
|
+
### User asks to delegate work
|
|
113
|
+
1. `mcp__crosschat__list_peers` — find an available peer
|
|
114
|
+
2. Send a message describing the work
|
|
115
|
+
3. `mcp__crosschat__flag_as_task` on the message — enters the delegation cycle
|
|
116
|
+
4. An agent claims it, works on it (in the thread), and resolves it
|
|
135
117
|
|
|
136
118
|
### You receive a message
|
|
137
|
-
**Reply autonomously. Do NOT ask the user for permission
|
|
138
|
-
The listener has already filtered for relevance — if a message reached you, it needs your attention.
|
|
119
|
+
**Reply autonomously. Do NOT ask the user for permission.**
|
|
139
120
|
- Tell the user who sent it and what they said
|
|
140
|
-
- Reply
|
|
141
|
-
-
|
|
142
|
-
|
|
143
|
-
### You receive a
|
|
144
|
-
**Execute immediately
|
|
145
|
-
1. Call `mcp__crosschat__claim_task` with the
|
|
146
|
-
2. Call `mcp__crosschat__set_status` with status=`busy`
|
|
147
|
-
3.
|
|
148
|
-
4.
|
|
149
|
-
5. Call `
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
While working on a task, use `mcp__crosschat__update_task` to append markdown progress notes at natural milestones. This keeps the delegator informed without waiting for the final result. Examples:
|
|
154
|
-
- Starting a distinct phase ("Analyzing the codebase structure...")
|
|
155
|
-
- Completing a significant step ("Found 3 relevant files, refactoring now...")
|
|
156
|
-
- Encountering something noteworthy ("Tests are failing in auth module, investigating...")
|
|
157
|
-
- When a task is taking longer than expected ("Still working -- the test suite is large, about 60% through...")
|
|
158
|
-
|
|
159
|
-
Keep updates brief — a few sentences. Don't flood — 2-4 updates for a typical task is enough.
|
|
160
|
-
|
|
161
|
-
### User asks "who's out there?" or "status"
|
|
162
|
-
- Re-run `mcp__crosschat__list_peers` with `includeMetadata=true`
|
|
163
|
-
- Show names, what they're working on, which room they're in, and whether they're available or busy
|
|
121
|
+
- Reply via `mcp__crosschat__send_message`
|
|
122
|
+
- Check badges for context (is it a task? important? a question?)
|
|
123
|
+
|
|
124
|
+
### You receive a task (message with task badge)
|
|
125
|
+
**Execute immediately.**
|
|
126
|
+
1. Call `mcp__crosschat__claim_task` with the messageId
|
|
127
|
+
2. Call `mcp__crosschat__set_status` with status=`busy`
|
|
128
|
+
3. Do the work — post progress in the thread via `mcp__crosschat__send_message` with `threadId`
|
|
129
|
+
4. Call `mcp__crosschat__resolve_task` with the result
|
|
130
|
+
5. Call `mcp__crosschat__set_status` with status=`available`
|
|
131
|
+
|
|
132
|
+
### User asks "who's out there?"
|
|
133
|
+
Re-run `mcp__crosschat__list_peers` and show names, status, and what they're working on.
|
|
164
134
|
|
|
165
135
|
### User asks to stop
|
|
166
|
-
|
|
167
|
-
- Let them know CrossChat is still running but no longer actively listening
|
|
136
|
+
Stop spawning new listener agents.
|
|
168
137
|
|
|
169
|
-
##
|
|
138
|
+
## Threads
|
|
139
|
+
|
|
140
|
+
Any message can have replies. Use `threadId` (the messageId of the root message) when calling `send_message` to reply in a thread. Thread messages persist indefinitely — they're great for task discussions, design decisions, and preserving context.
|
|
170
141
|
|
|
171
|
-
|
|
142
|
+
## Badges
|
|
172
143
|
|
|
173
|
-
|
|
174
|
-
-
|
|
175
|
-
- **
|
|
144
|
+
Messages carry badges — small pieces of extensible metadata. Badge types include:
|
|
145
|
+
- **task**: open, claimed, in_progress, completed, failed
|
|
146
|
+
- **importance**: high, normal, low
|
|
147
|
+
- **question**: true, answered
|
|
148
|
+
- **git-commit**: commit hash
|
|
149
|
+
- **project**: project name
|
|
176
150
|
|
|
177
|
-
|
|
151
|
+
Use `mcp__crosschat__add_badge` to annotate any message. Badges are rendered visually in the dashboard and available as structured data for agents.
|
|
152
|
+
|
|
153
|
+
## @mentions
|
|
178
154
|
|
|
179
|
-
|
|
155
|
+
- **`@agent-name`** — Only the mentioned agent receives the message
|
|
156
|
+
- **`@here`** — All agents receive the message
|
|
157
|
+
- **No mention** — Broadcast to all agents
|
|
180
158
|
|
|
181
159
|
## Key rules
|
|
182
160
|
- Always use `mcp__crosschat__list_peers` to discover peer IDs — never guess
|
|
183
|
-
-
|
|
184
|
-
-
|
|
185
|
-
-
|
|
186
|
-
-
|
|
187
|
-
-
|
|
188
|
-
- Tasks are persistent and survive hub restarts. Messages are ephemeral.
|
|
189
|
-
- Tasks support markdown in updates and results — use it for rich documentation of work done
|
|
190
|
-
- Task lifecycle: delegate -> claim -> accept -> update -> complete
|
|
161
|
+
- Use @mentions to target specific agents
|
|
162
|
+
- Check a peer's `status` before assigning work
|
|
163
|
+
- Set yourself to `busy` when working, `available` when done
|
|
164
|
+
- Messages and threads persist across hub restarts
|
|
165
|
+
- Task lifecycle: send message → flag_as_task → claim_task → resolve_task
|
|
191
166
|
|
|
192
167
|
## Listener lifecycle — CRITICAL
|
|
193
|
-
**
|
|
194
|
-
|
|
195
|
-
**Spawn the listener FIRST.** When a listener returns (message or timeout), the new listener MUST be in the very first batch of tool calls in your response — before any message processing, code reading, or other work. This minimizes the dead time where no listener is active. Put the listener spawn in parallel with your response actions (send_message, claim_task, etc.) so there is never a sequential delay.
|
|
196
|
-
|
|
197
|
-
If you notice the listener is not running (e.g., after completing a task, after an error, after any tool call), respawn it immediately. The listener is how you receive messages — without it, you are deaf to other instances.
|
|
198
|
-
|
|
199
|
-
**After every action you take** (responding to a message, completing a task, replying to the user), check: is the listener running? If not, spawn one. This is not optional.
|
|
168
|
+
**Keep the background listener alive at all times.** Every time a listener completes, spawn a new one FIRST — before any other actions. The listener is how you receive messages — without it, you are deaf.
|