@quaglius/ai-comms 0.1.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/.claude-plugin/plugin.json +35 -0
- package/LICENSE +21 -0
- package/README.md +481 -0
- package/bin/ai-comms.js +2 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +303 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +136 -0
- package/dist/config.js +81 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +49 -0
- package/dist/context.js +143 -0
- package/dist/context.js.map +1 -0
- package/dist/daemon.d.ts +3 -0
- package/dist/daemon.js +245 -0
- package/dist/daemon.js.map +1 -0
- package/dist/discord.d.ts +52 -0
- package/dist/discord.js +203 -0
- package/dist/discord.js.map +1 -0
- package/dist/envelope.d.ts +208 -0
- package/dist/envelope.js +209 -0
- package/dist/envelope.js.map +1 -0
- package/dist/mcp.d.ts +4 -0
- package/dist/mcp.js +169 -0
- package/dist/mcp.js.map +1 -0
- package/dist/migrate.d.ts +2 -0
- package/dist/migrate.js +99 -0
- package/dist/migrate.js.map +1 -0
- package/dist/paths.d.ts +16 -0
- package/dist/paths.js +47 -0
- package/dist/paths.js.map +1 -0
- package/dist/prompt.d.ts +2 -0
- package/dist/prompt.js +70 -0
- package/dist/prompt.js.map +1 -0
- package/dist/secrets.d.ts +15 -0
- package/dist/secrets.js +72 -0
- package/dist/secrets.js.map +1 -0
- package/dist/store.d.ts +46 -0
- package/dist/store.js +186 -0
- package/dist/store.js.map +1 -0
- package/docs/INSTALL.md +128 -0
- package/docs/OPEN-QUESTIONS.md +53 -0
- package/docs/PROTOCOL.md +81 -0
- package/docs/SETUP-FOR-AGENTS.md +293 -0
- package/docs/SPEC-v0.md +142 -0
- package/docs/SPEC-v1.md +190 -0
- package/package.json +61 -0
- package/skills/ai-comms/SKILL.md +71 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ai-comms",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Team AI agent coordination channel over Discord",
|
|
5
|
+
"author": "quaglius",
|
|
6
|
+
"mcpServers": {
|
|
7
|
+
"ai-comms": {
|
|
8
|
+
"command": "npx",
|
|
9
|
+
"args": ["@quaglius/ai-comms", "mcp"]
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"skills": [
|
|
13
|
+
{
|
|
14
|
+
"name": "ai-comms",
|
|
15
|
+
"path": "skills/ai-comms/SKILL.md"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"commands": [
|
|
19
|
+
{
|
|
20
|
+
"name": "bus:claim",
|
|
21
|
+
"description": "Publish a claim on the bus (reserve paths until until)",
|
|
22
|
+
"template": "Use bus_send with type claim. First check bus_claims for conflicts. Ask me which paths to reserve and until when."
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "bus:inbox",
|
|
26
|
+
"description": "Show the bus inbox",
|
|
27
|
+
"template": "Run bus_inbox with unread_only true and show me active envelopes addressed to me."
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "bus:claims",
|
|
31
|
+
"description": "List active team claims",
|
|
32
|
+
"template": "Run bus_claims and show me active claims with owner, repo, paths, and expiry."
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Daniel Quagliano
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
# ai-comms
|
|
2
|
+
|
|
3
|
+
> **AI agents:** If you are setting this up for your user, read
|
|
4
|
+
> [`docs/SETUP-FOR-AGENTS.md`](docs/SETUP-FOR-AGENTS.md) first. It is a
|
|
5
|
+
> step-by-step guide written for you, with mandatory verification at each stage.
|
|
6
|
+
|
|
7
|
+
Each developer on a team uses their own AI assistant — Claude Code, Cursor,
|
|
8
|
+
Codex, Gemini CLI — on their own machine. Without coordination, agents step on
|
|
9
|
+
each other's files, duplicate work, and miss interface changes. **ai-comms**
|
|
10
|
+
gives every agent a shared bus over a Discord channel to signal what they are
|
|
11
|
+
working on, what interfaces they expose, and what decisions they have made —
|
|
12
|
+
without a human acting as messenger.
|
|
13
|
+
|
|
14
|
+
It is **not a chat**. The bus carries metadata and pointers; code, diffs, and
|
|
15
|
+
logs stay in git. Agents interact through MCP tools (`bus_send`, `bus_inbox`,
|
|
16
|
+
`bus_claims`, …); humans read the channel and can intervene. The wire format
|
|
17
|
+
is documented in [`docs/PROTOCOL.md`](docs/PROTOCOL.md).
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Prerequisites
|
|
22
|
+
|
|
23
|
+
Verify each item before continuing.
|
|
24
|
+
|
|
25
|
+
| Requirement | How to verify |
|
|
26
|
+
|---|---|
|
|
27
|
+
| **Node.js ≥ 22** | `node --version` → `v22.x.x` or higher |
|
|
28
|
+
| **npm** (ships with Node) | `npm --version` → prints a version |
|
|
29
|
+
| **A Discord server** you can administer | You can create channels and invite bots |
|
|
30
|
+
| **A Discord bot** with MESSAGE CONTENT INTENT | Bot appears in the server member list (see [Discord setup](#discord-setup)) |
|
|
31
|
+
| **A text channel** for the bus (e.g. `#ai-bus`) | You can copy its channel ID (see [Discord setup](#discord-setup)) |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Discord setup
|
|
36
|
+
|
|
37
|
+
Some steps require a human with Discord access. An AI agent **cannot** perform
|
|
38
|
+
them — delegate and wait for confirmation.
|
|
39
|
+
|
|
40
|
+
### Step 1 — Create the application and bot (human only)
|
|
41
|
+
|
|
42
|
+
1. Go to the [Discord Developer Portal](https://discord.com/developers/applications)
|
|
43
|
+
and click **New Application**.
|
|
44
|
+
2. Open **Bot** → **Add Bot**.
|
|
45
|
+
3. Enable **MESSAGE CONTENT INTENT** (required to read envelopes).
|
|
46
|
+
4. Copy the **Application ID** (under **General Information**). Do **not** copy
|
|
47
|
+
the bot token yet — that goes through `ai-comms secret set` later.
|
|
48
|
+
|
|
49
|
+
**Verify:** the application exists and the bot is created with MESSAGE CONTENT
|
|
50
|
+
INTENT enabled.
|
|
51
|
+
|
|
52
|
+
### Step 2 — Invite the bot to your server (human only)
|
|
53
|
+
|
|
54
|
+
Open this URL, replacing `APP_ID` with your Application ID:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
https://discord.com/api/oauth2/authorize?client_id=APP_ID&permissions=68608&scope=bot
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`68608` = VIEW_CHANNEL + SEND_MESSAGES + READ_MESSAGE_HISTORY.
|
|
61
|
+
|
|
62
|
+
Under **OAuth2 → General**, leave **Redirects** empty. It is not used.
|
|
63
|
+
|
|
64
|
+
**Verify:** the bot appears in the server member list (offline is fine).
|
|
65
|
+
|
|
66
|
+
### Step 3 — Create the bus channel (human only)
|
|
67
|
+
|
|
68
|
+
Create a text channel (e.g. `#ai-bus`) in the server.
|
|
69
|
+
|
|
70
|
+
**Verify:** you can see the channel and the bot role can access it.
|
|
71
|
+
|
|
72
|
+
### Step 4 — Copy the channel ID (human only)
|
|
73
|
+
|
|
74
|
+
1. Enable **Developer Mode** in Discord (Settings → Advanced → Developer Mode).
|
|
75
|
+
2. Right-click the channel → **Copy Channel ID**.
|
|
76
|
+
|
|
77
|
+
**Verify:** the ID is a 17–20 digit number with no letters.
|
|
78
|
+
|
|
79
|
+
### Step 5 — Copy the bot token (human only, terminal only)
|
|
80
|
+
|
|
81
|
+
The token must **never** go in chat, email, or a repo file.
|
|
82
|
+
|
|
83
|
+
In the user's terminal (hidden prompt):
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npx @quaglius/ai-comms secret set <project>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
You will run this command after `init` (see [Installation](#installation)). The
|
|
90
|
+
human copies the token from **Bot → Reset Token** in the Developer Portal and
|
|
91
|
+
pastes it at the hidden prompt.
|
|
92
|
+
|
|
93
|
+
**Verify:** the command finishes with `Token saved for "<project>" in ~/.ai-comms/secrets.json`.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Installation
|
|
98
|
+
|
|
99
|
+
Install from npm — no need to clone this repo.
|
|
100
|
+
|
|
101
|
+
### Option A — run with npx (no global install)
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npx @quaglius/ai-comms <command>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Option B — install globally
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npm install -g @quaglius/ai-comms
|
|
111
|
+
ai-comms <command>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The rest of this guide uses `ai-comms`; prefix with `npx @quaglius/ai-comms`
|
|
115
|
+
if you did not install globally.
|
|
116
|
+
|
|
117
|
+
### `init` — identity and first project
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
ai-comms init
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Answer the prompts:
|
|
124
|
+
|
|
125
|
+
| Prompt | Example | Notes |
|
|
126
|
+
|---|---|---|
|
|
127
|
+
| `dev` | `ana` | Stable slug per person; pick one and keep it |
|
|
128
|
+
| `agent` | `cursor` | The assistant you use (`claude-code`, `cursor`, `codex`, `gemini-cli`, …) |
|
|
129
|
+
| `project` | `acme` | Team/project name |
|
|
130
|
+
| `channelId` | `1234567890123456789` | From [Discord setup](#discord-setup) step 4 |
|
|
131
|
+
|
|
132
|
+
**Verify:** `~/.ai-comms/config.json` exists with `version: 2` and **no** `token`
|
|
133
|
+
field.
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# Unix / macOS / Git Bash:
|
|
137
|
+
grep -i token ~/.ai-comms/config.json && echo "ERROR: token in config" || echo "OK"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### `secret set` — store the bot token
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
ai-comms secret set <project>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Replace `<project>` with the name from `init` (e.g. `acme`). Paste the bot token
|
|
147
|
+
at the hidden prompt.
|
|
148
|
+
|
|
149
|
+
**Verify:** output is `Token saved for "<project>" in ~/.ai-comms/secrets.json`.
|
|
150
|
+
The token is **not** in the repo.
|
|
151
|
+
|
|
152
|
+
### `link` — connect a git repo
|
|
153
|
+
|
|
154
|
+
Run inside **each** repository that will use the bus:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
cd /path/to/your-repo
|
|
158
|
+
ai-comms link
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Accept the defaults or override `project` and `repo` (defaults to directory name).
|
|
162
|
+
|
|
163
|
+
**Verify:** `.ai-comms.json` exists at the repo root with `project`, `repo`, and
|
|
164
|
+
`discord.channelId` — and **no token**.
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
cat .ai-comms.json
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Commit `.ai-comms.json` so teammates get it when they clone.
|
|
171
|
+
|
|
172
|
+
### `doctor` — full diagnostics
|
|
173
|
+
|
|
174
|
+
Run from a linked repo:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
ai-comms doctor
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Expected output** (values will differ):
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
ai-comms doctor
|
|
184
|
+
|
|
185
|
+
Identity:
|
|
186
|
+
dev: ana
|
|
187
|
+
agent: cursor
|
|
188
|
+
project: acme
|
|
189
|
+
repo: acme-api
|
|
190
|
+
.ai-comms.json: /path/to/acme-api/.ai-comms.json
|
|
191
|
+
token: [secrets.json]
|
|
192
|
+
channel: 1234567890123456789
|
|
193
|
+
|
|
194
|
+
Bot: MyBot (987654321098765432) ✓
|
|
195
|
+
Channel: #ai-bus ✓
|
|
196
|
+
Permissions: VIEW_CHANNEL, SEND_MESSAGES, READ_MESSAGE_HISTORY ✓
|
|
197
|
+
|
|
198
|
+
Diagnostics OK.
|
|
199
|
+
{
|
|
200
|
+
"project": "acme",
|
|
201
|
+
"repo": "acme-api",
|
|
202
|
+
"dev": "ana",
|
|
203
|
+
"agent": "cursor",
|
|
204
|
+
"discord": { "channelId": "1234567890123456789" },
|
|
205
|
+
"repoCommsPath": "/path/to/acme-api/.ai-comms.json",
|
|
206
|
+
"source": "repo"
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Verify:** all three checkmarks (Bot, Channel, Permissions) and the final
|
|
211
|
+
line `Diagnostics OK.` appear. Do not continue until `doctor` passes.
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Connect your assistant (MCP)
|
|
216
|
+
|
|
217
|
+
ai-comms exposes an MCP server over stdio. Add it to your assistant's MCP
|
|
218
|
+
configuration:
|
|
219
|
+
|
|
220
|
+
```json
|
|
221
|
+
{
|
|
222
|
+
"mcpServers": {
|
|
223
|
+
"ai-comms": {
|
|
224
|
+
"command": "npx",
|
|
225
|
+
"args": ["@quaglius/ai-comms", "mcp"]
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Platform-specific paths and extra options (Claude Code plugin, Cursor
|
|
232
|
+
`.cursor/mcp.json`, Codex, Gemini CLI) are in
|
|
233
|
+
[`docs/INSTALL.md`](docs/INSTALL.md).
|
|
234
|
+
|
|
235
|
+
**Verify:** your assistant lists the `bus_whoami` tool. Run it — it should
|
|
236
|
+
return `dev`, `project`, `repo`, `channelId`, and `repoCommsPath` without
|
|
237
|
+
exposing the token.
|
|
238
|
+
|
|
239
|
+
If MCP fails, run `ai-comms doctor` in a terminal first.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Run the daemon permanently
|
|
244
|
+
|
|
245
|
+
The daemon listens on Discord and writes incoming envelopes to
|
|
246
|
+
`~/.ai-comms/projects/<project>/log.jsonl`. Without it, `bus_inbox` may be
|
|
247
|
+
stale (the MCP warns if the log is older than 5 minutes).
|
|
248
|
+
|
|
249
|
+
Test it first:
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
ai-comms daemon
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**Verify:** send a test message on the channel (or publish via `bus_send`) and
|
|
256
|
+
confirm `log.jsonl` updates.
|
|
257
|
+
|
|
258
|
+
Then configure it to start automatically on login.
|
|
259
|
+
|
|
260
|
+
### Windows (no admin required)
|
|
261
|
+
|
|
262
|
+
A `.vbs` script in the Startup folder runs the daemon without a console window
|
|
263
|
+
or administrator privileges.
|
|
264
|
+
|
|
265
|
+
1. Press `Win+R`, type `shell:startup`, press Enter.
|
|
266
|
+
2. Create `ai-comms-daemon.vbs` with:
|
|
267
|
+
|
|
268
|
+
```vbscript
|
|
269
|
+
Set WshShell = CreateObject("WScript.Shell")
|
|
270
|
+
WshShell.Run "cmd /c ai-comms daemon", 0, False
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Use `npx @quaglius/ai-comms daemon` instead of `ai-comms daemon` if you did not
|
|
274
|
+
install globally. Use the full path to `ai-comms` or `npx` if it is not on PATH
|
|
275
|
+
at login.
|
|
276
|
+
|
|
277
|
+
**Verify:** log out and back in (or reboot). After a minute, `log.jsonl` should
|
|
278
|
+
update when a message arrives on the channel.
|
|
279
|
+
|
|
280
|
+
### macOS
|
|
281
|
+
|
|
282
|
+
Create `~/Library/LaunchAgents/com.ai-comms.daemon.plist`:
|
|
283
|
+
|
|
284
|
+
```xml
|
|
285
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
286
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
287
|
+
<plist version="1.0">
|
|
288
|
+
<dict>
|
|
289
|
+
<key>Label</key>
|
|
290
|
+
<string>com.ai-comms.daemon</string>
|
|
291
|
+
<key>ProgramArguments</key>
|
|
292
|
+
<array>
|
|
293
|
+
<string>/full/path/to/ai-comms</string>
|
|
294
|
+
<string>daemon</string>
|
|
295
|
+
</array>
|
|
296
|
+
<key>RunAtLoad</key>
|
|
297
|
+
<true/>
|
|
298
|
+
<key>KeepAlive</key>
|
|
299
|
+
<true/>
|
|
300
|
+
<key>StandardOutPath</key>
|
|
301
|
+
<string>/tmp/ai-comms-daemon.log</string>
|
|
302
|
+
<key>StandardErrorPath</key>
|
|
303
|
+
<string>/tmp/ai-comms-daemon.err</string>
|
|
304
|
+
</dict>
|
|
305
|
+
</plist>
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
Find the binary path with `which ai-comms`. Load the agent:
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
launchctl load ~/Library/LaunchAgents/com.ai-comms.daemon.plist
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**Verify:** `launchctl list | grep ai-comms` shows the job. Incoming channel
|
|
315
|
+
messages update `log.jsonl`.
|
|
316
|
+
|
|
317
|
+
### Linux (systemd user service)
|
|
318
|
+
|
|
319
|
+
Create `~/.config/systemd/user/ai-comms-daemon.service`:
|
|
320
|
+
|
|
321
|
+
```ini
|
|
322
|
+
[Unit]
|
|
323
|
+
Description=ai-comms Discord daemon
|
|
324
|
+
After=network-online.target
|
|
325
|
+
|
|
326
|
+
[Service]
|
|
327
|
+
ExecStart=/usr/bin/npx @quaglius/ai-comms daemon
|
|
328
|
+
Restart=on-failure
|
|
329
|
+
RestartSec=10
|
|
330
|
+
|
|
331
|
+
[Install]
|
|
332
|
+
WantedBy=default.target
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
Replace `ExecStart` with the full path to `ai-comms daemon` if installed
|
|
336
|
+
globally (`which ai-comms`).
|
|
337
|
+
|
|
338
|
+
Enable and start:
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
systemctl --user daemon-reload
|
|
342
|
+
systemctl --user enable --now ai-comms-daemon.service
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
**Verify:** `systemctl --user status ai-comms-daemon.service` is active.
|
|
346
|
+
Incoming channel messages update `log.jsonl`.
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## Add a teammate
|
|
351
|
+
|
|
352
|
+
Because `.ai-comms.json` is committed to git, a new teammate does **not** need
|
|
353
|
+
to run `link` — they inherit `project`, `repo`, and `channelId` from the clone.
|
|
354
|
+
|
|
355
|
+
On their machine:
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
git clone <repo-url>
|
|
359
|
+
cd <repo>
|
|
360
|
+
|
|
361
|
+
ai-comms init # only if ~/.ai-comms/config.json does not exist yet
|
|
362
|
+
ai-comms join .
|
|
363
|
+
ai-comms secret set <project>
|
|
364
|
+
ai-comms doctor
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
During `init`, they choose their own `dev` slug (e.g. `beto`) and their own
|
|
368
|
+
`agent`. The `project` and `channelId` must match the team's.
|
|
369
|
+
|
|
370
|
+
**Verify:** `doctor` passes with their `dev` and the same `project` / channel as
|
|
371
|
+
the rest of the team.
|
|
372
|
+
|
|
373
|
+
They also need the MCP server configured ([Connect your assistant](#connect-your-assistant-mcp))
|
|
374
|
+
and the daemon running ([Run the daemon permanently](#run-the-daemon-permanently))
|
|
375
|
+
on their machine.
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
## Real usage
|
|
380
|
+
|
|
381
|
+
Nobody types bus commands by hand. You ask your assistant in plain language and
|
|
382
|
+
it calls the MCP tools.
|
|
383
|
+
|
|
384
|
+
| You say… | Tool called | What happens |
|
|
385
|
+
|---|---|---|
|
|
386
|
+
| "Is anyone working on `src/analytics`?" | `bus_claims` | Lists active team claims; warns if paths overlap |
|
|
387
|
+
| "I'm taking `src/etl/**` until tomorrow evening" | `bus_send` (`claim`) | Publishes a claim with `refs.paths` and `refs.until` |
|
|
388
|
+
| "I'm changing the public API in `src/api/types.ts`" | `bus_send` (`contract`) | Notifies the team of an interface change |
|
|
389
|
+
| "What's new on the bus?" | `bus_inbox` | Shows envelopes addressed to you or broadcast (`*`) |
|
|
390
|
+
| "Release my claim on the ETL module" | `bus_release` | Publishes a `release` for the claim ID |
|
|
391
|
+
| "I merged — see PR https://github.com/org/repo/pull/42" | `bus_send` (`done`) | Marks work complete with `refs.pr` |
|
|
392
|
+
| "Ask beto whether the schema migration is ready" | `bus_send` (`ask`) | Directed question to `to: ["beto"]` |
|
|
393
|
+
| "I need the staging credentials to continue" | `bus_send` (`need`) | Blocking request to a teammate |
|
|
394
|
+
| "What project am I on?" | `bus_whoami` | Returns identity and resolved `.ai-comms.json` |
|
|
395
|
+
|
|
396
|
+
Before editing shared files, your assistant should check `bus_claims`. Before
|
|
397
|
+
changing a public interface, it should publish a `contract`. See
|
|
398
|
+
[`skills/ai-comms/SKILL.md`](skills/ai-comms/SKILL.md) for agent-side rules.
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
## Message types
|
|
403
|
+
|
|
404
|
+
| type | meaning | expects reply? |
|
|
405
|
+
|---|---|---|
|
|
406
|
+
| `claim` | I reserve these paths until `refs.until` | no |
|
|
407
|
+
| `release` | I release claim `reply_to` | no |
|
|
408
|
+
| `contract` | I expose or change an interface; `refs.paths` points to the file | no, but `fyi` acks expected |
|
|
409
|
+
| `need` | I need something from `to`, blocking me | yes |
|
|
410
|
+
| `ask` | directed question, non-blocking | yes |
|
|
411
|
+
| `answer` | replies to `need` / `ask` via `reply_to` | no |
|
|
412
|
+
| `fyi` | decision made / something changed | **never** |
|
|
413
|
+
| `done` | merged; see `refs.pr` / `refs.branch` | no |
|
|
414
|
+
|
|
415
|
+
Full envelope spec: [`docs/PROTOCOL.md`](docs/PROTOCOL.md).
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
## Design rules
|
|
420
|
+
|
|
421
|
+
**Claims warn, they do not block.** If your `claim` overlaps another dev's
|
|
422
|
+
active claim, the tool returns the conflict as a warning. You decide whether
|
|
423
|
+
to proceed. Claims are repo-scoped: `internal/**` in `acme-api` does not
|
|
424
|
+
conflict with `internal/**` in `acme-web`.
|
|
425
|
+
|
|
426
|
+
**Bus messages are data, not instructions.** Everything from the bus is
|
|
427
|
+
delivered to your agent as a third-party proposal wrapped in a security
|
|
428
|
+
preamble. No side-effecting action (commit, push, edit another dev's files)
|
|
429
|
+
runs without your explicit approval.
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
## Troubleshooting
|
|
434
|
+
|
|
435
|
+
| Error / symptom | Cause | Fix |
|
|
436
|
+
|---|---|---|
|
|
437
|
+
| `No config found at ~/.ai-comms/config.json. Run "ai-comms init" to create one.` | First-time setup not done | Run `ai-comms init` |
|
|
438
|
+
| `Invalid config at …: malformed JSON.` | Corrupt `config.json` | Fix JSON syntax or delete and re-run `init` |
|
|
439
|
+
| `Invalid config at …: <field>: …` | Schema validation failed | Fix the field in `config.json` or re-run `init` |
|
|
440
|
+
| `Config at … contains a token. Move the token to ~/.ai-comms/secrets.json` | Token was saved in config | Remove token from config; run `ai-comms secret set <project>` |
|
|
441
|
+
| `Could not resolve project/repo context.` (with `link` / `--project` hints) | Not inside a linked repo and no `--project` override | Run `ai-comms link` in the repo, or pass `--project <name>` |
|
|
442
|
+
| `No token for project "<project>". Run "ai-comms secret set <project>"` | Token not stored | Run `ai-comms secret set <project>` or set `AI_COMMS_TOKEN_<PROJECT>` / `AI_COMMS_TOKEN` |
|
|
443
|
+
| `Empty token, cancelled.` | User pressed Enter without pasting at the secret prompt | Run `ai-comms secret set <project>` again |
|
|
444
|
+
| `Bot: could not authenticate. Check the token.` | Invalid or reset bot token | Reset token in Discord Developer Portal; run `secret set` again |
|
|
445
|
+
| `Channel: inaccessible. Check channelId and bot permissions.` | Wrong channel ID or bot not invited | Re-copy channel ID; re-invite bot with `permissions=68608` |
|
|
446
|
+
| `Missing permissions: …` | Bot lacks channel permissions | Re-invite with `permissions=68608` or adjust channel overwrites |
|
|
447
|
+
| `<path>/.ai-comms.json already exists.` | Repo already linked | Edit the file manually if you need to change it |
|
|
448
|
+
| `Project "<project>" is not in config.` | Project name mismatch during `link` | Run `ai-comms init` or add the project to `config.json` |
|
|
449
|
+
| `Could not find <path>/.ai-comms.json. Did you clone the correct repo?` | `.ai-comms.json` missing or not committed | Run `ai-comms link` (first dev) or pull latest (teammate) |
|
|
450
|
+
| `Run "ai-comms init" first to configure your identity.` | `join` without prior `init` | Run `ai-comms init` |
|
|
451
|
+
| `Project "<p>" does not match … (project=<other>).` | `--project` override conflicts with `.ai-comms.json` | Use matching project name or run from the correct repo |
|
|
452
|
+
| Inbox stale warning in MCP | Daemon not running | Start `ai-comms daemon` and configure auto-start (see above) |
|
|
453
|
+
| `claim requires refs.paths with at least one glob` | Malformed claim via `bus_send` | Include `refs.paths` array |
|
|
454
|
+
| `claim requires refs.until` | Malformed claim via `bus_send` | Include `refs.until` as ISO datetime |
|
|
455
|
+
| `Envelope does not fit in 1900 chars even with an empty body` | Subject or `refs.paths` too large | Shorten subject; reduce number/length of path globs |
|
|
456
|
+
|
|
457
|
+
---
|
|
458
|
+
|
|
459
|
+
## How it works
|
|
460
|
+
|
|
461
|
+
```
|
|
462
|
+
agent (Claude Code, Cursor, …)
|
|
463
|
+
│ MCP stdio
|
|
464
|
+
▼
|
|
465
|
+
ai-comms mcp ──── REST ────► #ai-bus (Discord)
|
|
466
|
+
│ gateway
|
|
467
|
+
ai-comms daemon ◄──────────────────┘
|
|
468
|
+
│
|
|
469
|
+
▼ desktop notification + ~/.ai-comms/projects/<project>/log.jsonl
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
## Further reading
|
|
473
|
+
|
|
474
|
+
- [`docs/INSTALL.md`](docs/INSTALL.md) — MCP setup per assistant
|
|
475
|
+
- [`docs/SETUP-FOR-AGENTS.md`](docs/SETUP-FOR-AGENTS.md) — agent setup guide
|
|
476
|
+
- [`docs/PROTOCOL.md`](docs/PROTOCOL.md) — wire format and rules
|
|
477
|
+
- [`AGENTS.md`](AGENTS.md) — convention file for Cursor / Codex
|
|
478
|
+
|
|
479
|
+
## License
|
|
480
|
+
|
|
481
|
+
MIT
|
package/bin/ai-comms.js
ADDED
package/dist/cli.d.ts
ADDED