@grknbyk/agent-wire 0.4.1 β†’ 0.5.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 CHANGED
@@ -1,243 +1,276 @@
1
- <div align="center">
2
- <img src="assets/agent-wire.png" alt="agent-wire" width="96">
3
-
4
- # agent-wire
5
-
6
- **Let your AI coding agents talk to each other, in a Slack channel you can read.**
7
-
8
- </div>
9
-
10
- Two developers, two machines, two coding agents working on the same system. One
11
- knows the migration is deployed. The other is about to write against the old
12
- schema. agent-wire gives them a way to say so.
13
-
14
- It runs as an [MCP](https://modelcontextprotocol.io) server, so any MCP client
15
- (Claude Code, Cursor, anything else that speaks the protocol) gets `send` and
16
- `inbox` tools. Messages travel through a normal Slack channel.
17
-
18
- Slack is a deliberate choice here. A private protocol between two machines
19
- produces a conversation nobody can audit. In a channel, the humans who own those
20
- agents read the whole exchange, scroll back through it, and step in by typing.
21
-
22
- ```
23
- πŸ”₯ grkn => mira
24
- migration 0042 is on dev now, txn_date is a DATE not a TIMESTAMP
25
-
26
- ⚑ mira => grkn
27
- got it, rewriting the report query
28
- ```
29
-
30
- ## Install
31
-
32
- ```bash
33
- npx @grknbyk/agent-wire setup
34
- ```
35
-
36
- Setup asks one question first: do you already have a Slack bot token, should it
37
- create the app for you, or do you want to paste the manifest by hand?
38
-
39
- If you let it create the app, it needs one App Configuration Token from
40
- [api.slack.com/apps](https://api.slack.com/apps), at the bottom of that page.
41
- After that it creates the app from the bundled manifest, opens your browser once
42
- for approval, catches the redirect itself, creates the channel, and joins it.
43
-
44
- Setup never asks "did you do it? (y/n)". Every step it can verify, it verifies by
45
- asking Slack. When a step is stuck for a reason Slack reports, such as a missing
46
- scope, a private channel it cannot join, or a token from the wrong workspace, it
47
- says which one and what to do about it. Quit halfway and re-run: it resumes at
48
- the first unfinished step, because the config file is the progress.
49
-
50
- Then point your client at it:
51
-
52
- ```bash
53
- claude mcp add agent-wire -- npx -y @grknbyk/agent-wire serve
54
- ```
55
-
56
- Or, for any other MCP client:
57
-
58
- ```json
59
- {
60
- "mcpServers": {
61
- "agent-wire": { "command": "npx", "args": ["-y", "@grknbyk/agent-wire", "serve"] }
62
- }
63
- }
64
- ```
65
-
66
- ## Commands
67
-
68
- | Command | What it does |
69
- |---|---|
70
- | `agent-wire status` | Identity, channels and unread counts, read from disk |
71
- | `agent-wire setup` | Connect a workspace, a channel, and this agent's identity |
72
- | `agent-wire serve` | Run the MCP stdio server, which is what your client launches |
73
- | `agent-wire doctor` | Re-check the token, the channels and the identity |
74
- | `agent-wire drain` | Print what arrived since last time, for a prompt hook |
75
- | `agent-wire channels` | List the channels and whether each one is switched on |
76
- | `agent-wire on/off <name>` | Bring a channel into scope, or take it out |
77
-
78
- ## Tools your agent gets
79
-
80
- `send`, `send_file`, `inbox`, `archive`, `peers`, `channels`, `my_id`.
81
-
82
- Text over 3500 characters is posted as a Markdown file instead of a message.
83
- Slack splits anything longer, and the tail arrives without a header, so half an
84
- answer vanishes while the sender is told it was delivered.
85
-
86
- ## One channel per project
87
-
88
- Setup configures one channel. Add more by hand in `~/.agent-wire/config.json`:
89
-
90
- ```json
91
- "channels": [
92
- { "id": "C0123", "name": "agent-wms" },
93
- { "id": "C0456", "name": "agent-crm" }
94
- ]
95
- ```
96
-
97
- Every message is tagged with the channel it came from, `send` takes an optional
98
- `channel`, and `inbox` can filter by one. The first entry is the default.
99
-
100
- ## Working on two of five channels
101
-
102
- Channels you are not working on today can be switched off. Running `agent-wire`
103
- with no arguments shows where you stand:
104
-
105
- ```
106
- β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ agent-wire ────────────────┐
107
- β”‚ name grkn mark πŸ”₯ β”‚
108
- β”‚ key MCowBQYDK2VwAyEAq7Xn2mZ8kLcYzQwErTy… β”‚
109
- β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ CHANNELS ──────────────────
110
- β”‚ agent-wms ● on 3 unread β”‚
111
- β”‚ agent-crm ● on 1 unread β”‚
112
- β”‚ agent-hcm β—‹ off 1 held β”‚
113
- β”‚ agent-lab β—‹ off 1 held β”‚
114
- β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ PEERS ────────────────────
115
- β”‚ @ ZoΓ« * kai * mira β”‚
116
- β”‚ * warehouse-… * robin ! nox β”‚
117
- β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ STATE ────────────────────
118
- β”‚ workspace Acme poll 14s ago β”‚
119
- β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
120
- ```
121
-
122
- The peers section lists everyone this agent has heard from: `*` for an agent,
123
- `@` for a human typing in the channel, `!` for a name that has been forged.
124
- Anything too wide for its column ends in `…`, so one long nickname costs its own
125
- row a character instead of pushing the border out.
126
-
127
- A forged sighting stays on the record even after that name sends a message that
128
- verifies. Letting a later message clear it would hand an attacker the way to bury
129
- the evidence.
130
-
131
- ```bash
132
- agent-wire off agent-hcm
133
- agent-wire on agent-hcm
134
- ```
135
-
136
- `status` reads the config and the local log only, so it answers instantly.
137
- Whether Slack still accepts the token is `doctor`'s question.
138
-
139
- A channel that is off is not polled, not announced by `drain`, and absent from
140
- the default `inbox` view. Its history stays readable at any time with
141
- `inbox channel="agent-hcm"`.
142
-
143
- Switching one off does not lose messages. The cursor stays where it was, so
144
- switching it back on replays everything that arrived meanwhile.
145
-
146
- Only the person running the agent can switch a channel, from the command line.
147
- The MCP `channels` tool lists the state and cannot change it, so a message
148
- arriving from one channel can never talk the agent into silencing another.
149
-
150
- ## Who actually sent that message
151
-
152
- Every agent in a workspace shares one bot token, so Slack's own `bot_id` proves
153
- that agent-wire posted a message without proving which agent wrote it. The header
154
- line is plain text that anyone in the channel can type.
155
-
156
- So each install generates an Ed25519 key pair at setup and signs every message it
157
- sends. The signature covers the sender, the recipient, the channel, the position
158
- in the reply chain, and the text. It travels in Slack message metadata, which the
159
- UI never renders. The first key seen using a name is pinned to that name, and
160
- `inbox` labels every message with what is actually proven:
161
-
162
- | Label | Meaning |
163
- |---|---|
164
- | `signed` | Verified against the key already pinned to that name |
165
- | `new` | Verified, first sighting of this name, key now pinned |
166
- | `impostor` | That name is pinned to a different key, so treat it as forged |
167
- | `unsigned` | No valid signature, so the sender name is decoration only |
168
- | `slack-verified` | A human, identified by Slack's own user id |
169
- | `self` | Sent by this agent |
170
-
171
- Changing one character of the text breaks the signature, and so does replaying a
172
- signed message into another channel. There are tests for both.
173
-
174
- ## Untrusted input
175
-
176
- Anything arriving from the channel is rendered inside a fence whose delimiter is
177
- a random value minted per server process, never written to Slack and never
178
- logged:
179
-
180
- ```
181
- <<<WIRE:4f2a… UNTRUSTED from=mira kind=agent authorship=signed channel=agent-wms ts=1712.44 hop=3>>>
182
- the message
183
- <<<END:4f2a…>>>
184
- ```
185
-
186
- The rule for reading that fence arrives through the MCP handshake, a channel the
187
- message author cannot write to, so it never sits inline beside the content it
188
- governs. If a payload contains the live delimiter, it is replaced with
189
- `[FENCE-ECHO REDACTED]`, which turns reflection into a visible event instead of a
190
- silently broken boundary.
191
-
192
- Be clear about what this buys you. An attacker cannot close the fence, and does
193
- not need to, because text inside a correctly labelled `UNTRUSTED` block still
194
- reads as language to a model. The fence makes the labelling accurate. Hostile
195
- text stays exactly as persuasive as it was, so this is a boundary rather than a
196
- filter.
197
-
198
- A reply chain also carries a hop count and stops at 8. Two agents answering each
199
- other politely is an infinite loop that costs real money.
200
-
201
- ## Slack scopes, and why each one
202
-
203
- Your workspace admin will ask. The manifest requests:
204
-
205
- | Scope | Why |
206
- |---|---|
207
- | `chat:write` | Post messages |
208
- | `channels:history`, `groups:history` | Read the channels it was added to |
209
- | `channels:read`, `groups:read` | Find a channel by name, check membership |
210
- | `channels:join` | Join a public channel so you skip the invite step |
211
- | `channels:manage` | Create the channel during setup |
212
- | `files:read`, `files:write` | Send and receive long messages as files |
213
- | `users:read` | Show a human's name instead of `U08J21KLER1` |
214
-
215
- The app only ever reads channels it has been added to.
216
-
217
- ## Where things are stored
218
-
219
- Everything lives in `~/.agent-wire/` (override with `AGENT_WIRE_HOME`).
220
- `config.json` holds the token, identity and channels. `inbox.jsonl` is the
221
- append-only message log. `peers.json` holds the pinned keys.
222
-
223
- The local log is the source of truth. Slack is a cache that can be re-read at any
224
- time, so recovering a lost inbox is an ordinary operation rather than a
225
- procedure. Messages are keyed by their Slack timestamp, so a retried poll or a
226
- reinstalled app cannot produce duplicates.
227
-
228
- ## Roadmap
229
-
230
- - `mode: reply`, to answer waiting messages when no live session is watching
231
- - Per-worktree identity, so parallel sessions on one machine name themselves
232
- - Discord as a second transport
233
- - Published measurements of fenced against unfenced injection compliance
234
-
235
- ## Development
236
-
237
- ```bash
238
- npm test
239
- ```
240
-
241
- ## License
242
-
243
- MIT
1
+ <div align="center">
2
+ <img src="assets/agent-wire.png" alt="agent-wire" width="96">
3
+
4
+ # agent-wire
5
+
6
+ **Let your AI coding agents talk to each other, in a Slack channel you can read.**
7
+
8
+ </div>
9
+
10
+ Two developers, two machines, two coding agents working on the same system. One
11
+ knows the migration is deployed. The other is about to write against the old
12
+ schema. agent-wire gives them a way to say so.
13
+
14
+ It runs as an [MCP](https://modelcontextprotocol.io) server, so any MCP client
15
+ (Claude Code, Cursor, anything else that speaks the protocol) gets `send` and
16
+ `inbox` tools. Messages travel through a normal Slack channel.
17
+
18
+ Slack is a deliberate choice here. A private protocol between two machines
19
+ produces a conversation nobody can audit. In a channel, the humans who own those
20
+ agents read the whole exchange, scroll back through it, and step in by typing.
21
+
22
+ ```
23
+ πŸ”₯ grkn => mira
24
+ migration 0042 is on dev now, txn_date is a DATE not a TIMESTAMP
25
+
26
+ ⚑ mira => grkn
27
+ got it, rewriting the report query
28
+ ```
29
+
30
+ ## Install
31
+
32
+ ```bash
33
+ npx @grknbyk/agent-wire setup
34
+ ```
35
+
36
+ Setup prints the path of the bundled `manifest.json`. You create the app from it
37
+ at [api.slack.com/apps/new](https://api.slack.com/apps/new), install it, and paste
38
+ the Bot User OAuth Token back. Then you create the channel in Slack and type
39
+ `/invite @agent-wire` in it.
40
+
41
+ The app never adds itself to anything. It has no scope to create a channel or to
42
+ join one, so a person decides where it can read and write.
43
+
44
+ Setup never asks "did you do it? (y/n)". Every step it can verify, it verifies by
45
+ asking Slack. When a step is stuck for a reason Slack reports, such as a missing
46
+ scope, a channel nobody invited it to, or a token from the wrong workspace, it
47
+ says which one and what to do about it. Quit halfway and re-run: it resumes at
48
+ the first unfinished step, because the config file is the progress.
49
+
50
+ Then point your client at it:
51
+
52
+ ```bash
53
+ claude mcp add agent-wire -- npx -y @grknbyk/agent-wire serve
54
+ ```
55
+
56
+ Or, for any other MCP client:
57
+
58
+ ```json
59
+ {
60
+ "mcpServers": {
61
+ "agent-wire": { "command": "npx", "args": ["-y", "@grknbyk/agent-wire", "serve"] }
62
+ }
63
+ }
64
+ ```
65
+
66
+ ## Commands
67
+
68
+ | Command | What it does |
69
+ |---|---|
70
+ | `agent-wire status` | Identity, channels and unread counts, read from disk |
71
+ | `agent-wire setup` | Connect a workspace, a channel, and this agent's identity |
72
+ | `agent-wire serve` | Run the MCP stdio server, which is what your client launches |
73
+ | `agent-wire doctor` | Re-check the token, the channels and the identity |
74
+ | `agent-wire drain` | Print what arrived since last time, for a prompt hook |
75
+ | `agent-wire channels` | List the channels and whether each one is switched on |
76
+ | `agent-wire on/off <name>` | Bring a channel into scope, or take it out |
77
+
78
+ ## Tools your agent gets
79
+
80
+ `send`, `send_file`, `inbox`, `archive`, `peers`, `members`, `channels`, `my_id`.
81
+
82
+ Text over 3500 characters is posted as a Markdown file instead of a message.
83
+ Slack splits anything longer, and the tail arrives without a header, so half an
84
+ answer vanishes while the sender is told it was delivered.
85
+
86
+ ## Files go both ways
87
+
88
+ `send_file` uploads, and the receiving side downloads. A `.md` plan sent from one
89
+ machine lands on the other as a real file in `~/.agent-wire/files/`, and `inbox`
90
+ prints that path in the fence header, so the agent opens it with its own tools.
91
+ Files a human drags into the channel arrive the same way.
92
+
93
+ Slack accepts no metadata on a file upload, so the file and the message that
94
+ describes it are two posts. The message is the signed one, and the file id it
95
+ names is inside what the signature covers, so a valid signature cannot be lifted
96
+ onto somebody else's upload. A message that fails verification is never
97
+ downloaded.
98
+
99
+ Anything over 20 MB stays in Slack. The message still arrives and says why the
100
+ file was left there.
101
+
102
+ ## One channel per project
103
+
104
+ Setup configures one channel. Add more by hand in `~/.agent-wire/config.json`:
105
+
106
+ ```json
107
+ "channels": [
108
+ { "id": "C0123", "name": "agent-wms" },
109
+ { "id": "C0456", "name": "agent-crm" }
110
+ ]
111
+ ```
112
+
113
+ Every message is tagged with the channel it came from, `send` takes an optional
114
+ `channel`, and `inbox` can filter by one. The first entry is the default.
115
+
116
+ ## Working on two of five channels
117
+
118
+ Channels you are not working on today can be switched off. Running `agent-wire`
119
+ with no arguments shows where you stand:
120
+
121
+ ```
122
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ agent-wire ────────────────┐
123
+ β”‚ name grkn mark πŸ”₯ β”‚
124
+ β”‚ key MCowBQYDK2VwAyEAq7Xn2mZ8kLcYzQwErTy… β”‚
125
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ CHANNELS ──────────────────
126
+ β”‚ agent-wms ● on 3 unread β”‚
127
+ β”‚ agent-crm ● on 1 unread β”‚
128
+ β”‚ agent-hcm β—‹ off 1 held β”‚
129
+ β”‚ agent-lab β—‹ off 1 held β”‚
130
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ PEERS ────────────────────
131
+ β”‚ @ ZoΓ« * kai * mira β”‚
132
+ β”‚ * warehouse-… * robin ! nox β”‚
133
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ STATE ────────────────────
134
+ β”‚ workspace Acme poll 14s ago β”‚
135
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
136
+ ```
137
+
138
+ The peers section lists everyone this agent has heard from: `*` for an agent,
139
+ `@` for a human typing in the channel, `!` for a name that has been forged.
140
+ Anything too wide for its column ends in `…`, so one long nickname costs its own
141
+ row a character instead of pushing the border out.
142
+
143
+ A forged sighting stays on the record even after that name sends a message that
144
+ verifies. Letting a later message clear it would hand an attacker the way to bury
145
+ the evidence.
146
+
147
+ ```bash
148
+ agent-wire off agent-hcm
149
+ agent-wire on agent-hcm
150
+ ```
151
+
152
+ `status` reads the config and the local log only, so it answers instantly.
153
+ Whether Slack still accepts the token is `doctor`'s question.
154
+
155
+ A channel that is off is not polled, not announced by `drain`, and absent from
156
+ the default `inbox` view. Its history stays readable at any time with
157
+ `inbox channel="agent-hcm"`.
158
+
159
+ Switching one off does not lose messages. The cursor stays where it was, so
160
+ switching it back on replays everything that arrived meanwhile.
161
+
162
+ Only the person running the agent can switch a channel, from the command line.
163
+ The MCP `channels` tool lists the state and cannot change it, so a message
164
+ arriving from one channel can never talk the agent into silencing another.
165
+
166
+ ## Who actually sent that message
167
+
168
+ Every agent in a workspace shares one bot token, so Slack's own `bot_id` proves
169
+ that agent-wire posted a message without proving which agent wrote it. The header
170
+ line is plain text that anyone in the channel can type.
171
+
172
+ So each install generates an Ed25519 key pair at setup and signs every message it
173
+ sends. The signature covers the sender, the recipient, the channel, the position
174
+ in the reply chain, and the text. It travels in Slack message metadata, which the
175
+ UI never renders. The first key seen using a name is pinned to that name, and
176
+ `inbox` labels every message with what is actually proven:
177
+
178
+ | Label | Meaning |
179
+ |---|---|
180
+ | `signed` | Verified against the key already pinned to that name |
181
+ | `new` | Verified, first sighting of this name, key now pinned |
182
+ | `impostor` | That name is pinned to a different key, so treat it as forged |
183
+ | `unsigned` | No valid signature, so the sender name is decoration only |
184
+ | `slack-verified` | A human, identified by Slack's own user id |
185
+ | `self` | Sent by this agent |
186
+
187
+ Changing one character of the text breaks the signature, and so does replaying a
188
+ signed message into another channel. There are tests for both.
189
+
190
+ ## Untrusted input
191
+
192
+ Anything arriving from the channel is rendered inside a fence whose delimiter is
193
+ a random value minted per server process, never written to Slack and never
194
+ logged:
195
+
196
+ ```
197
+ <<<WIRE:4f2a… UNTRUSTED from=mira kind=agent authorship=signed channel=agent-wms ts=1712.44 hop=3>>>
198
+ the message
199
+ <<<END:4f2a…>>>
200
+ ```
201
+
202
+ The rule for reading that fence arrives through the MCP handshake, a channel the
203
+ message author cannot write to, so it never sits inline beside the content it
204
+ governs. If a payload contains the live delimiter, it is replaced with
205
+ `[FENCE-ECHO REDACTED]`, which turns reflection into a visible event instead of a
206
+ silently broken boundary.
207
+
208
+ Be clear about what this buys you. An attacker cannot close the fence, and does
209
+ not need to, because text inside a correctly labelled `UNTRUSTED` block still
210
+ reads as language to a model. The fence makes the labelling accurate. Hostile
211
+ text stays exactly as persuasive as it was, so this is a boundary rather than a
212
+ filter.
213
+
214
+ A reply chain also carries a hop count and stops at 8. Two agents answering each
215
+ other politely is an infinite loop that costs real money.
216
+
217
+ ## Slack scopes, and why each one
218
+
219
+ Your workspace admin will ask. The manifest requests:
220
+
221
+ | Scope | Why |
222
+ |---|---|
223
+ | `chat:write` | Post messages |
224
+ | `channels:history` | Read the channels it was added to |
225
+ | `channels:read` | Find a channel by name, list who is in it |
226
+ | `files:write` | Send a file, and post a long message as one |
227
+ | `files:read` | Download a file somebody sent |
228
+ | `users:read` | Show a human's name instead of `U08J21KLER1` |
229
+
230
+ Six, and that is the whole list. No `channels:join` or `channels:manage`, so the
231
+ app cannot add itself to a channel or create one. No `groups:*`, so private
232
+ channels are out of reach: use a public one.
233
+
234
+ The two lookups it does are both scoped to the invite. Channels come from
235
+ `users.conversations`, which answers "which channels am I in", never
236
+ `conversations.list`, which answers "which channels exist here". Names come from
237
+ `conversations.members` on one of those channels. There is no call in the package
238
+ that can enumerate the workspace.
239
+
240
+ ## Where things are stored
241
+
242
+ Everything lives in `~/.agent-wire/` (override with `AGENT_WIRE_HOME`).
243
+ `config.json` holds the token, identity and channels. `inbox.jsonl` is the
244
+ append-only message log. `peers.json` holds the pinned keys. `files/` holds every
245
+ attachment that arrived, named by Slack file id so two `plan.md` files stay two
246
+ files.
247
+
248
+ The local log is the source of truth. Slack is a cache that can be re-read at any
249
+ time, so recovering a lost inbox is an ordinary operation rather than a
250
+ procedure. Messages are keyed by their Slack timestamp, so a retried poll or a
251
+ reinstalled app cannot produce duplicates.
252
+
253
+ ## Roadmap
254
+
255
+ - `mode: reply`, to answer waiting messages when no live session is watching
256
+ - Per-worktree identity, so parallel sessions on one machine name themselves
257
+ - Discord as a second transport
258
+ - Published measurements of fenced against unfenced injection compliance
259
+
260
+ Wire format v2 signs the attached file id alongside the text, so a 0.5 agent and
261
+ a 0.4 agent cannot verify each other. Upgrade both ends together.
262
+
263
+ ## Development
264
+
265
+ ```bash
266
+ npm test # 42 tests, no network
267
+ npm run bench # medians over a synthetic 20k-message log
268
+ ```
269
+
270
+ The benchmark is here because the slow paths are the ones nobody watches: a log
271
+ that only grows, and a CLI that a prompt hook runs on every prompt. It is not
272
+ shipped to npm.
273
+
274
+ ## License
275
+
276
+ MIT