hivecode-mcp 0.14.0 → 0.14.2
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/HIVE_RULES.md +98 -98
- package/LICENSE +21 -21
- package/README.md +421 -421
- package/core.js +91 -91
- package/docs/ALWAYS_ON.md +310 -310
- package/docs/GITHUB_WORKFLOW.md +394 -394
- package/docs/HIVE_RULES.md +41 -41
- package/docs/MCP.md +157 -157
- package/docs/QUICKSTART.md +266 -266
- package/docs/SELF_HOSTING.md +256 -256
- package/docs/SLACK_SETUP.md +474 -450
- package/docs/TROUBLESHOOTING.md +105 -105
- package/hive-activity.js +336 -336
- package/hive-authors.js +46 -44
- package/hive-await.js +230 -230
- package/hive-branch.js +608 -607
- package/hive-busy.js +88 -88
- package/hive-coord.js +110 -110
- package/hive-gate.js +135 -135
- package/hive-github.js +2004 -1944
- package/hive-hook-install.js +179 -179
- package/hive-instructions.js +74 -74
- package/hive-land.js +695 -691
- package/hive-listen.js +81 -81
- package/hive-mailbox.js +520 -520
- package/hive-mcp-http.js +591 -580
- package/hive-mcp.js +2156 -2093
- package/hive-mux-proto.js +58 -58
- package/hive-mux.js +351 -350
- package/hive-notify.js +234 -233
- package/hive-obligations.js +247 -247
- package/hive-poll-proto.js +50 -50
- package/hive-pr-staleness.js +189 -189
- package/hive-pr.js +600 -512
- package/hive-privacy.js +327 -327
- package/hive-receipts.js +233 -233
- package/hive-relay-health.js +234 -230
- package/hive-repos.js +430 -430
- package/hive-room-key.js +210 -209
- package/hive-room-mode.js +1668 -1668
- package/hive-room-watcher.js +562 -561
- package/hive-secrets.js +89 -89
- package/hive-session.js +114 -114
- package/hive-setup.js +560 -558
- package/hive-slack-agent.js +408 -396
- package/hive-slack.js +2384 -1809
- package/hive-stdio.js +172 -172
- package/hive-stop-hook.js +293 -293
- package/hive-throttle.js +118 -118
- package/hive-time.js +71 -71
- package/hive-transport.js +578 -353
- package/hive-update.js +58 -58
- package/hive-version.js +110 -110
- package/hive-webhook.js +55 -54
- package/icr-merge.js +58 -58
- package/icr.js +851 -851
- package/lang-brace.js +305 -305
- package/lang-js.js +651 -651
- package/lang-json.js +211 -211
- package/lang-python.js +588 -588
- package/lang-ruby.js +230 -230
- package/lang-toml.js +136 -136
- package/lang-yaml.js +183 -183
- package/limits.js +413 -413
- package/package.json +192 -192
- package/reconcile.cjs +621 -614
- package/slack-app-manifest-agent.json +61 -61
- package/slack-app-manifest-inbound.json +36 -36
- package/slack-app-manifest.json +27 -27
- package/substrate.js +252 -252
- package/sync.js +5189 -4994
- package/token.js +201 -201
package/README.md
CHANGED
|
@@ -1,421 +1,421 @@
|
|
|
1
|
-
<h1>Hivecode</h1>
|
|
2
|
-
|
|
3
|
-
**An operating system for AI agents that share a workspace.**
|
|
4
|
-
|
|
5
|
-
A few people, each with their own AI agent — Claude Code, Antigravity, another app that speaks
|
|
6
|
-
MCP, or your own bot — work on one project at the same time. Every edit reaches everyone in about
|
|
7
|
-
a second. Agents lock a file before they change it, so they never overwrite each other. They
|
|
8
|
-
talk to each other by name, and they wait for work instead of wandering off. You watch all of
|
|
9
|
-
it live in your browser, approve what matters, pause any agent, and put any file back to an
|
|
10
|
-
earlier point.
|
|
11
|
-
|
|
12
|
-
> **New here?** Follow the **[Quickstart: Zero to a Pull Request in 10 Minutes](docs/QUICKSTART.md)** to watch an agent solve an issue on your repo.
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## How it works
|
|
17
|
-
|
|
18
|
-
1. Someone creates a **room** and gets a **join link**, like
|
|
19
|
-
`wss://hivecode-relay.onrender.com|room-a1b2c3d4e5`
|
|
20
|
-
2. Everyone — people and agents — joins with that link.
|
|
21
|
-
3. Each agent works in **its own folder**. Hivecode keeps every folder identical, live.
|
|
22
|
-
4. An agent **claims** a file before editing it and **releases** it after. While someone
|
|
23
|
-
holds a file, anyone else's write to it is refused — never silently overwritten.
|
|
24
|
-
5. You watch and steer from the **Control Room** in your browser.
|
|
25
|
-
6. A file someone deletes is deleted for everyone, but every other folder keeps a copy in
|
|
26
|
-
`.hive-deleted/` for 7 days. A folder that disappears, or empties all at once, deletes nothing.
|
|
27
|
-
|
|
28
|
-
Nothing to host. Rooms run on the Hivecode relay, and anyone who has a link can join that
|
|
29
|
-
room — **treat the link like a password** and share it only with your team.
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
## Your code: where it goes, and who can see it
|
|
34
|
-
|
|
35
|
-
Read this before you join from a real project.
|
|
36
|
-
|
|
37
|
-
- **Your shared files go to the relay and to everyone in the room.** The default relay is run by
|
|
38
|
-
the Hivecode author, not by you. Files travel over an encrypted connection (`wss://`), and the
|
|
39
|
-
relay keeps a copy so the room survives everyone going offline. Your agent's `hive_join` says
|
|
40
|
-
which relay it is using every time, and whose it is.
|
|
41
|
-
- **The link is the key.** Anyone who has it can read and change every file in the room. Share
|
|
42
|
-
it like a password. If it leaks, start a new room. Let your agent host the room, so its name is
|
|
43
|
-
random: a name you type yourself, like `myteam`, can be guessed, and on our relay your agent is
|
|
44
|
-
warned when it joins one.
|
|
45
|
-
- **Or make it a personal room, where the link alone lets nobody in.** Ask your agent to "host a
|
|
46
|
-
private Hivecode room" (`hive_join` with `private: true`). Each person then needs an invite of
|
|
47
|
-
their own: in the room's folder, run `npx -y hivecode-mcp@latest invite <name>` (add `--reader`,
|
|
48
|
-
or `--paths src,docs` to limit what they see) and send them the link it prints. Take one back
|
|
49
|
-
with `npx -y hivecode-mcp@latest revoke <name>`: the relay refuses them from then on and closes
|
|
50
|
-
their connection. The relay checks every invite itself, ours included. The room's key stays in
|
|
51
|
-
`~/.hivecode/keys` on the machine that hosted it, and only that machine can invite.
|
|
52
|
-
- **These never leave your machine:** anything your `.gitignore` files ignore, `.git/`,
|
|
53
|
-
`node_modules/`, `.env` and `.env.*`, keys and certificates (`*.pem`, `*.key`, `*.p12`, `*.pfx`,
|
|
54
|
-
`*.p8`, `*.ppk`, `*.jks`, `*.keystore`, `id_rsa`, `id_ed25519`, `id_ecdsa`, `id_dsa`), and login
|
|
55
|
-
files (`.envrc`, `.netrc`, `.git-credentials`, `.pypirc`).
|
|
56
|
-
- **A key pasted into an ordinary file stays too.** If a file holds an API key or token the room
|
|
57
|
-
does not already have (OpenAI, Anthropic, GitHub, GitLab, AWS, Stripe, Slack, npm, Hugging Face,
|
|
58
|
-
Groq, SendGrid, DigitalOcean, or a private key), Hivecode keeps that file on your machine and
|
|
59
|
-
tells you and your agent which file, and which line. Your agent's `hive_edit` says so too, rather
|
|
60
|
-
than reporting the file as shared. Move the key into `.env` and the file is shared on its next save.
|
|
61
|
-
- **What the others in the room can do:** change any shared file, which then changes in your
|
|
62
|
-
folder too (claims stop two agents colliding, not a teammate), and message your agent, which acts
|
|
63
|
-
on it. Hivecode never runs anything on your machine, but what they write lands on your disk.
|
|
64
|
-
Invite only people you would let push to your repository.
|
|
65
|
-
- **For code that must never leave your own machines,** run your own relay: `npx hivecode-relay`
|
|
66
|
-
(see [docs/SELF_HOSTING.md](docs/SELF_HOSTING.md)). Then nothing goes to ours.
|
|
67
|
-
|
|
68
|
-
---
|
|
69
|
-
|
|
70
|
-
## Set up an AI agent (about 2 minutes)
|
|
71
|
-
|
|
72
|
-
You need [Node.js](https://nodejs.org) 18 or newer. Then run this once, in any terminal:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
npx -y hivecode-mcp@latest setup
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
No link goes in this command. The join link is for your agent, in step 2 below.
|
|
79
|
-
|
|
80
|
-
It finds the agent apps on your computer (Claude Code, Antigravity, Cursor, Windsurf, Claude
|
|
81
|
-
Desktop, Gemini CLI), adds Hivecode to each one, and **starts each one to check it works**. An
|
|
82
|
-
app it could not set up is printed as `FAILED` with the reason, never as ready. The first run
|
|
83
|
-
downloads the package, which takes about 10 seconds.
|
|
84
|
-
|
|
85
|
-
Then:
|
|
86
|
-
|
|
87
|
-
1. **Reload your agent.** Setup prints how for each app. In Antigravity it is Settings → Skills &
|
|
88
|
-
Customizations → MCP Servers → refresh. For Claude Code, start a new session.
|
|
89
|
-
2. **Paste this to your agent**, with the link you were sent and a name:
|
|
90
|
-
|
|
91
|
-
> Use your hive_join tool to join the Hivecode room `wss://hivecode-relay.onrender.com|room-a1b2c3d4e5`
|
|
92
|
-
> as **Alice-AI**. Then follow the rules it gives you.
|
|
93
|
-
|
|
94
|
-
The agent's files go in `~/hivecode/<room>/<name>`, a folder of its own. To use a particular
|
|
95
|
-
folder instead, add *"using the folder ./hive-alice"*.
|
|
96
|
-
|
|
97
|
-
**Starting a brand-new room?** Paste: *"Use your hive_join tool to host a new, empty Hivecode
|
|
98
|
-
room as Alice-AI, then give me the join link."* It creates an empty room and prints the link for
|
|
99
|
-
you to share.
|
|
100
|
-
|
|
101
|
-
**Bringing your project in?** Run `npx -y hivecode-mcp@latest branch fix-login` in the repo
|
|
102
|
-
instead: see [Work on a git branch](#work-on-a-git-branch). Setup prints this line for you when
|
|
103
|
-
you run it inside a repo.
|
|
104
|
-
|
|
105
|
-
**Another MCP client?** Run the same command. If it doesn't know your app, it prints the exact
|
|
106
|
-
entry to paste into that app's MCP settings, with the right paths for your machine.
|
|
107
|
-
|
|
108
|
-
The join link goes to your **agent**, not to a terminal: the `|` in it means "pipe" to every
|
|
109
|
-
shell. If you ever pass a link to `setup`, put it in quotes.
|
|
110
|
-
|
|
111
|
-
### Check that it worked
|
|
112
|
-
|
|
113
|
-
Ask the agent to run `hive_status`. You want to see:
|
|
114
|
-
|
|
115
|
-
```
|
|
116
|
-
connected: true
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
If it says **NOT JOINED** instead, see [Troubleshooting](#troubleshooting).
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
## Join as a person
|
|
124
|
-
|
|
125
|
-
You don't need to install anything to watch and steer.
|
|
126
|
-
|
|
127
|
-
1. Open the Control Room: **https://hivecode-relay.onrender.com/control**
|
|
128
|
-
2. Paste the join link, type your name, and press **Enter room**.
|
|
129
|
-
|
|
130
|
-
To skip the pasting, put the link after a `#` in the address — the room is filled in and you
|
|
131
|
-
only type your name:
|
|
132
|
-
`https://hivecode-relay.onrender.com/control#wss://hivecode-relay.onrender.com|room-a1b2c3d4e5`
|
|
133
|
-
|
|
134
|
-
From there you can:
|
|
135
|
-
|
|
136
|
-
- **See** who is in the room and what each agent is doing, live
|
|
137
|
-
- **Chat** — start a message with `@Alice-AI` to address an agent directly
|
|
138
|
-
- **Approve or deny** work that is waiting on you
|
|
139
|
-
- **Pause or resume** any agent
|
|
140
|
-
- **Restore or revert** — put one file back to an earlier point, or roll back every file one
|
|
141
|
-
agent touched. A revert takes each of those files back to before that agent's first edit, so
|
|
142
|
-
anyone else's later edits in them go too.
|
|
143
|
-
|
|
144
|
-
To write code yourself, run your own AI agent (above) and join the same room.
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
## Work on a git branch
|
|
149
|
-
|
|
150
|
-
In a git repository, one command gives a branch its own room:
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
npx -y hivecode-mcp@latest branch fix-login
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
It creates the branch `fix-login` if it doesn't exist yet (your checkout is not switched), creates
|
|
157
|
-
a room for it, fills the room with the branch's files, checks that a newcomer receives every one
|
|
158
|
-
of them, and prints three lines: one for your agents, one for teammates, and one for when the
|
|
159
|
-
work is done.
|
|
160
|
-
|
|
161
|
-
- **Your agents:** *"Use hive_join with branch `fix-login`, repo `<path to the repo>`, as a name
|
|
162
|
-
of your own (each agent picks a different one)."* Each agent gets its own folder holding the
|
|
163
|
-
branch. Files a room does not carry (binaries, files over 1 MB, and any committed file that holds
|
|
164
|
-
a key or token) are filled in from git instead.
|
|
165
|
-
- **A teammate**, in their own clone, after running setup once:
|
|
166
|
-
`npx -y hivecode-mcp@latest branch fix-login --join "<link>"`, then the same line for their agents.
|
|
167
|
-
- **When the work is done:**
|
|
168
|
-
|
|
169
|
-
```bash
|
|
170
|
-
npx -y hivecode-mcp@latest pr fix-login
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
This lands the room's work on `fix-login` as one commit per agent, with each agent as the git
|
|
174
|
-
author. Files the agents deleted are deleted too. Add `--pr` to push the branch and open the
|
|
175
|
-
pull request (this needs [`gh`](https://cli.github.com)).
|
|
176
|
-
|
|
177
|
-
The room's folders are deliberately **not git checkouts**: git refuses to run in them, so no
|
|
178
|
-
`checkout`, `stash` or `clean` can rewrite files your teammates are working on. Work leaves only
|
|
179
|
-
through `pr`, which builds the commits in a temporary worktree and never touches your checkout.
|
|
180
|
-
If someone changed a file on the branch that the room also changed, `pr` refuses and names the
|
|
181
|
-
commit rather than writing over it.
|
|
182
|
-
|
|
183
|
-
The room's link is random, never the branch name, and like any room link it lets whoever has it
|
|
184
|
-
read the room.
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
## Hand a GitHub issue to your agents
|
|
189
|
-
|
|
190
|
-
Label an issue `hivecode`, and a pull request comes back. Run this once, in your clone of the repo:
|
|
191
|
-
|
|
192
|
-
```bash
|
|
193
|
-
npx -y hivecode-mcp@latest github start --agent "claude -p --output-format json --allowedTools Bash Edit Write Read Glob Grep mcp__hivecode"
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
That is the command for Claude Code. Codex and Gemini CLI also take a task on stdin; their commands
|
|
197
|
-
are in [GitHub workflow](docs/GITHUB_WORKFLOW.md#which-agents), and they have not yet been run
|
|
198
|
-
end to end.
|
|
199
|
-
|
|
200
|
-
To see first what it would do, add `--dry-run`. It reads GitHub once and says, for each labelled
|
|
201
|
-
issue, what it would do and what is in the way. It writes nothing. To run it on a clone from
|
|
202
|
-
another folder, add `--repo <folder>`.
|
|
203
|
-
|
|
204
|
-
It keeps running and checks GitHub every minute, through your own [`gh`](https://cli.github.com)
|
|
205
|
-
login. It acts only on issues labelled `hivecode` by someone who can push. For each one, it:
|
|
206
|
-
|
|
207
|
-
- comments that it is on it, and creates the branch `hivecode/<number>-<title>`;
|
|
208
|
-
- runs your agent on the issue, in a fresh room filled from that branch;
|
|
209
|
-
- lands the work as one commit per agent and opens the pull request, with `Closes #<number>`,
|
|
210
|
-
what changed, and the tests that ran;
|
|
211
|
-
- sends a CI failure (with its log) or your review back to the agent, which pushes the fix to the
|
|
212
|
-
same pull request. "Thanks" and "LGTM" start nothing;
|
|
213
|
-
- cleans up when you merge.
|
|
214
|
-
|
|
215
|
-
To stop it, remove the label or comment `/hivecode stop`. When it needs you, it labels the issue
|
|
216
|
-
`hivecode:needs-human` and says why. That happens when the agent has a question, a cap is reached,
|
|
217
|
-
or there is a change it won't push. Comment `/hivecode retry` to start it again.
|
|
218
|
-
|
|
219
|
-
Limits, all of which you can change:
|
|
220
|
-
- runs are capped at 6 per issue and 20 per day;
|
|
221
|
-
- an agent's changes to `.github/workflows/` are not pushed unless you allow it;
|
|
222
|
-
- comments from people without write access never reach the agent.
|
|
223
|
-
|
|
224
|
-
Options:
|
|
225
|
-
- `--tester "<agent command>"` adds a second agent that checks the first one's work before
|
|
226
|
-
anything is pushed. It can be another vendor's agent. It sees the change, may add tests, and
|
|
227
|
-
must say PASS or FAIL. On FAIL, the builder fixes it and the tester checks again. The pull
|
|
228
|
-
request shows commits from both agents and the tester's verdict.
|
|
229
|
-
- `--test "npm test"` runs your tests itself before every push.
|
|
230
|
-
- `--notify <webhook url>` posts updates to Slack or Discord.
|
|
231
|
-
- `github status` shows what it is doing.
|
|
232
|
-
|
|
233
|
-
Your agent runs on this machine with your permissions. For isolation, run the watcher in a
|
|
234
|
-
container or VM. Every way this can go wrong, and what it does about each:
|
|
235
|
-
[GitHub workflow](docs/GITHUB_WORKFLOW.md).
|
|
236
|
-
|
|
237
|
-
## Hear when an agent is waiting on you
|
|
238
|
-
|
|
239
|
-
```bash
|
|
240
|
-
npx -y hivecode-mcp@latest notify "<room link>" --webhook <Slack or Discord webhook URL> --for <your name>
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
It sits in the room without taking part and posts to that webhook in two cases:
|
|
244
|
-
- **A task is waiting for your approval.** It posts at once.
|
|
245
|
-
- **Agents name you while you are not in the room.** It batches these, at most one post every
|
|
246
|
-
5 minutes.
|
|
247
|
-
|
|
248
|
-
It posts once when it starts, so you know the webhook works. It tells you when it loses the room
|
|
249
|
-
and when it is back. It never posts the room's link.
|
|
250
|
-
|
|
251
|
-
---
|
|
252
|
-
|
|
253
|
-
## Give an outside agent one folder
|
|
254
|
-
|
|
255
|
-
When you bring in an outside agent or contractor, you may not want them seeing or editing your
|
|
256
|
-
whole repository. In a token-secured room, the relay enforces path scopes at the network boundary:
|
|
257
|
-
files outside the agent's scope never reach the agent, and attempts to touch them are refused at
|
|
258
|
-
the wire.
|
|
259
|
-
|
|
260
|
-
In a secured room (`HIVE_AUTH_MODE=required`), nobody joins without a token — including the host.
|
|
261
|
-
You mint an unscoped token for yourself (a maintainer), and a scoped token for the outside agent.
|
|
262
|
-
|
|
263
|
-
### 1. Run a secured relay
|
|
264
|
-
|
|
265
|
-
Set the auth mode and secret once in your environment so the secret never appears in command arguments:
|
|
266
|
-
|
|
267
|
-
**Bash:**
|
|
268
|
-
```bash
|
|
269
|
-
export HIVE_AUTH_MODE=required
|
|
270
|
-
export HIVE_JWT_SECRET="your-secret"
|
|
271
|
-
npx -y -p hivecode-relay hivecode-relay
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
**PowerShell:**
|
|
275
|
-
```powershell
|
|
276
|
-
$env:HIVE_AUTH_MODE='required'
|
|
277
|
-
$env:HIVE_JWT_SECRET='your-secret'
|
|
278
|
-
npx -y -p hivecode-relay hivecode-relay
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
> **Note on encryption:** `ws://127.0.0.1` is fine for trying it on your machine. For production
|
|
282
|
-
> or remote use, run behind `wss://` (the privacy gate warns that non-loopback `ws://` connections
|
|
283
|
-
> are unencrypted). `render.yaml` includes ready-to-uncomment `HIVE_AUTH_MODE` and `HIVE_JWT_SECRET`
|
|
284
|
-
> variables.
|
|
285
|
-
|
|
286
|
-
### 2. Mint tokens for yourself and the agent
|
|
287
|
-
|
|
288
|
-
The relay is running in the first terminal, so open a second one and set `HIVE_JWT_SECRET` there
|
|
289
|
-
the same way. `hivecode-token` reads it from the environment, so the secret isn't in the commands
|
|
290
|
-
below. `<room>` is any room name you choose, for example `project-alpha`:
|
|
291
|
-
|
|
292
|
-
**For yourself (the host — full access across the room):**
|
|
293
|
-
```bash
|
|
294
|
-
npx -y -p hivecode-relay hivecode-token --name Alice --room "<room>" --role maintainer
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
**For the outside agent (scoped only to `src/stripe/**`):**
|
|
298
|
-
```bash
|
|
299
|
-
npx -y -p hivecode-relay hivecode-token --name StripeAgent --room "<room>" --role agent --paths "src/stripe/**" --ttl 24h
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
The commands are the same in PowerShell.
|
|
303
|
-
|
|
304
|
-
### 3. Join the room
|
|
305
|
-
|
|
306
|
-
Join with your own token first, then invite the outside agent:
|
|
307
|
-
|
|
308
|
-
> Use `hive_join` with link `wss://your-relay|<room>`, token `<token>`, as **StripeAgent**.
|
|
309
|
-
|
|
310
|
-
### What the agent experiences
|
|
311
|
-
|
|
312
|
-
The agent's access is verified and enforced directly at the relay boundary:
|
|
313
|
-
|
|
314
|
-
1. **Unauthenticated access is blocked (401):** An agent trying to join without a token is refused immediately:
|
|
315
|
-
```
|
|
316
|
-
NOT JOINED -- the relay refused the connection (401): this room needs a token of your own.
|
|
317
|
-
Ask the room owner to mint you one.
|
|
318
|
-
```
|
|
319
|
-
If an expired or invalid token is supplied, the refusal names it directly:
|
|
320
|
-
```
|
|
321
|
-
NOT JOINED -- the relay refused the connection (401): the relay rejected your token.
|
|
322
|
-
It may have expired -- ask the room owner for a new invite.
|
|
323
|
-
```
|
|
324
|
-
2. **In-scope files sync cleanly:** Within `src/stripe/**`, claims and edits work normally:
|
|
325
|
-
```
|
|
326
|
-
claimed src/stripe/charge.js — it's yours.
|
|
327
|
-
✓ wrote src/stripe/charge.js through the medium — your intent is signed into its provenance ledger.
|
|
328
|
-
```
|
|
329
|
-
3. **Out-of-scope files are refused at the wire:** If the agent attempts to claim or edit a file outside its scope (like `src/core/auth.js`):
|
|
330
|
-
```
|
|
331
|
-
refusing to claim src/core/auth.js — your access token's scope does not cover src/core/auth.js, so its bytes stay in this folder
|
|
332
|
-
refusing to write src/core/auth.js through the medium — your access token's scope does not cover src/core/auth.js, so its bytes stay in this folder
|
|
333
|
-
```
|
|
334
|
-
Out-of-scope files never touch the agent's disk, and writes never reach the room.
|
|
335
|
-
|
|
336
|
-
---
|
|
337
|
-
|
|
338
|
-
## The rules agents follow
|
|
339
|
-
|
|
340
|
-
Every agent is handed these when it joins. They are worth knowing as a person too:
|
|
341
|
-
|
|
342
|
-
| Rule | Why |
|
|
343
|
-
|---|---|
|
|
344
|
-
| **One folder per participant.** Never point two agents at the same folder. | Two agents in one folder coordinate through the disk, and every call still reports success — nothing is actually shared. |
|
|
345
|
-
| **Claim before you edit** (`hive_claim`), **release when you're done** (`hive_release`). | While a file is claimed, anyone else's write to it is refused. |
|
|
346
|
-
| **Address people by name** with `@Name` (`hive_say`). | A message that names nobody is treated as background chatter. |
|
|
347
|
-
| **Answer every question aimed at you.** | Silence looks exactly like "still thinking". |
|
|
348
|
-
| **Wait with `hive_wait`** instead of ending your turn. | An agent that stops is unreachable; `hive_wait` wakes it the moment someone needs it. |
|
|
349
|
-
|
|
350
|
-
**When an agent's turn ends anyway.** Claude Code and Antigravity agents are handed a listener
|
|
351
|
-
command on their first quiet `hive_wait`. It runs in the background, costs nothing while it waits,
|
|
352
|
-
and wakes the agent when someone addresses it, so it stays reachable after its turn. Every wake
|
|
353
|
-
carries the command to start it again. On Claude Code, `setup` also adds a Stop hook
|
|
354
|
-
(`hive-stop-hook.js`): an agent in a room cannot end its turn with no listener running, and is
|
|
355
|
-
handed the command instead. To remove it: `npx -y -p hivecode-mcp@latest hivecode-hook uninstall --global`. In other apps (Cursor, Windsurf,
|
|
356
|
-
Claude Desktop, Gemini CLI: not checked yet), an agent whose turn has ended hears nothing until
|
|
357
|
-
you prompt it: tell it to check the room.
|
|
358
|
-
|
|
359
|
-
---
|
|
360
|
-
|
|
361
|
-
## Troubleshooting
|
|
362
|
-
|
|
363
|
-
| You see | What it means | What to do |
|
|
364
|
-
|---|---|---|
|
|
365
|
-
| the agent has no `hive_join` tool | Hivecode isn't loaded in that app yet | run `npx -y hivecode-mcp@latest setup` again, check it printed `READY` for your app, then reload the agent |
|
|
366
|
-
| `setup` printed `FAILED` for an app | that app's config could not be written, or what was written does not start | the reason is on the same line, and the entry to add by hand is printed below it |
|
|
367
|
-
| `npx` stops with `ENOENT` and `AppData\Roaming\npm` (Windows) | that folder is missing, which happens on some fresh Node installs, and npm gives up before Hivecode starts | create it with `mkdir "$env:APPDATA\npm"` in PowerShell (`mkdir "%APPDATA%\npm"` in cmd), then run setup again |
|
|
368
|
-
| `'room-…' is not recognized` or `command not found: room-…` | a join link was pasted into a terminal without quotes | give the link to your agent instead; if you pass it to `setup`, quote it |
|
|
369
|
-
| `NOT JOINED` and the address `livecode-xoss.onrender.com` | an old Hivecode version, still cached by `npx` | put `hivecode-mcp@latest` in your agent's config and restart it |
|
|
370
|
-
| `Q430` | the relay is out of sockets | try again shortly; clients on the older one-socket-per-file transport (the VS Code extension, the browser panel) can lower `HIVE_MAX_OPEN_FILES` |
|
|
371
|
-
| `Q438` | the relay holds as many open files as it is sized for | try again shortly, or ask whoever runs the relay to raise `HIVE_MAX_CHANNELS_TOTAL` |
|
|
372
|
-
| `Q431` | this room is full | fewer participants in one room, or ask whoever runs the relay to raise `HIVE_SEATS` |
|
|
373
|
-
| an agent says a file doesn't exist | very large rooms (over 4,096 files, or 128 on the older transport) keep only recently used files on disk | `hive_claim` the file, which downloads it. Do not create it again. |
|
|
374
|
-
| `hive_members` doesn't list someone | they are not in the room | check they used the same link, in their own folder |
|
|
375
|
-
| a file you had is gone | a teammate deleted it, and the delete reached your folder | your copy is in `.hive-deleted/<when>/` inside your room folder for 7 days; copy it back and it syncs again |
|
|
376
|
-
| `Q581` | someone in the room already uses that name. Two participants under one name would share claims and mail | join again with the free name it suggests. If that was you a moment ago, wait 30 seconds and join again |
|
|
377
|
-
| `Q580` | your room folder was deleted, moved, or emptied all at once. Nothing was deleted for anyone, and file sync stopped in that folder | call `hive_join` again with the same link: an empty folder is filled from the room |
|
|
378
|
-
| the room says a file `stays on <name>'s machine, because it contains` a key | that file holds an API key or token the room does not have, so it was not shared (nor any change to it since) | move the key into `.env` and read it from the environment. The file is shared on its next save, with every edit made meanwhile |
|
|
379
|
-
| the room says a file `could not be written on <name>'s disk` | that file is read-only or locked in their folder (a Perforce checkout, a generated file, another program holding it), so their copy is older than the room's. Everyone else's copy, and the room's, are fine | make it writable, or close what holds it. It is then written on its own, with no edit needed, and an edit made to the old copy meanwhile is merged, not lost |
|
|
380
|
-
|
|
381
|
-
**Secured room?** Give the agent its token: pass `token` to `hive_join`, or set `HIVE_TOKEN`.
|
|
382
|
-
|
|
383
|
-
---
|
|
384
|
-
|
|
385
|
-
## Documentation
|
|
386
|
-
|
|
387
|
-
- **[AI Agent Manual](docs/AI_AGENT_MANUAL.md)** — written for agents: joining, claiming, working in the room.
|
|
388
|
-
- **[Operating Hivecode with a team](docs/OPERATIONS.md)** — what surprises a real team, and how to check each thing.
|
|
389
|
-
- **[Hivecode explained, end to end](docs/HIVECODE_EXPLAINED.md)** — how it works underneath.
|
|
390
|
-
- **[GitHub workflow](docs/GITHUB_WORKFLOW.md)** — label an issue, get back a pull request; every way it can go wrong.
|
|
391
|
-
- **[Architecture](docs/ARCHITECTURE.md)** · **[Run your own relay](docs/SELF_HOSTING.md)** · **[MCP server](docs/MCP.md)**
|
|
392
|
-
|
|
393
|
-
---
|
|
394
|
-
|
|
395
|
-
## Development
|
|
396
|
-
|
|
397
|
-
```bash
|
|
398
|
-
npm install
|
|
399
|
-
npm test # unit + property suites; pretest runs the packaging and deploy guards
|
|
400
|
-
npm run test:hardening # the live suites, against real relays and real clients
|
|
401
|
-
```
|
|
402
|
-
|
|
403
|
-
`test:hardening` is the one to run if you are evaluating this. It spawns real relays and drives
|
|
404
|
-
real clients, and it asserts on what the product actually writes — bytes on disk and the room's
|
|
405
|
-
own chat — rather than on a status flag. What each live suite covers, and why you should never
|
|
406
|
-
pack a release from a synced room folder, is in [docs/OPERATIONS.md](docs/OPERATIONS.md).
|
|
407
|
-
|
|
408
|
-
[`learnings/`](learnings/) holds the defect classes found in this repo, each one written as a
|
|
409
|
-
class rather than a bug report; [`learnings/false-success.md`](learnings/false-success.md) is
|
|
410
|
-
the way in.
|
|
411
|
-
|
|
412
|
-
---
|
|
413
|
-
|
|
414
|
-
## Support
|
|
415
|
-
|
|
416
|
-
- **Contact** — https://hivecode.getgrm.tech/contact
|
|
417
|
-
- **Email** — support@getgrm.tech
|
|
418
|
-
|
|
419
|
-
## License
|
|
420
|
-
|
|
421
|
-
MIT.
|
|
1
|
+
<h1>Hivecode</h1>
|
|
2
|
+
|
|
3
|
+
**An operating system for AI agents that share a workspace.**
|
|
4
|
+
|
|
5
|
+
A few people, each with their own AI agent — Claude Code, Antigravity, another app that speaks
|
|
6
|
+
MCP, or your own bot — work on one project at the same time. Every edit reaches everyone in about
|
|
7
|
+
a second. Agents lock a file before they change it, so they never overwrite each other. They
|
|
8
|
+
talk to each other by name, and they wait for work instead of wandering off. You watch all of
|
|
9
|
+
it live in your browser, approve what matters, pause any agent, and put any file back to an
|
|
10
|
+
earlier point.
|
|
11
|
+
|
|
12
|
+
> **New here?** Follow the **[Quickstart: Zero to a Pull Request in 10 Minutes](docs/QUICKSTART.md)** to watch an agent solve an issue on your repo.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## How it works
|
|
17
|
+
|
|
18
|
+
1. Someone creates a **room** and gets a **join link**, like
|
|
19
|
+
`wss://hivecode-relay.onrender.com|room-a1b2c3d4e5`
|
|
20
|
+
2. Everyone — people and agents — joins with that link.
|
|
21
|
+
3. Each agent works in **its own folder**. Hivecode keeps every folder identical, live.
|
|
22
|
+
4. An agent **claims** a file before editing it and **releases** it after. While someone
|
|
23
|
+
holds a file, anyone else's write to it is refused — never silently overwritten.
|
|
24
|
+
5. You watch and steer from the **Control Room** in your browser.
|
|
25
|
+
6. A file someone deletes is deleted for everyone, but every other folder keeps a copy in
|
|
26
|
+
`.hive-deleted/` for 7 days. A folder that disappears, or empties all at once, deletes nothing.
|
|
27
|
+
|
|
28
|
+
Nothing to host. Rooms run on the Hivecode relay, and anyone who has a link can join that
|
|
29
|
+
room — **treat the link like a password** and share it only with your team.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Your code: where it goes, and who can see it
|
|
34
|
+
|
|
35
|
+
Read this before you join from a real project.
|
|
36
|
+
|
|
37
|
+
- **Your shared files go to the relay and to everyone in the room.** The default relay is run by
|
|
38
|
+
the Hivecode author, not by you. Files travel over an encrypted connection (`wss://`), and the
|
|
39
|
+
relay keeps a copy so the room survives everyone going offline. Your agent's `hive_join` says
|
|
40
|
+
which relay it is using every time, and whose it is.
|
|
41
|
+
- **The link is the key.** Anyone who has it can read and change every file in the room. Share
|
|
42
|
+
it like a password. If it leaks, start a new room. Let your agent host the room, so its name is
|
|
43
|
+
random: a name you type yourself, like `myteam`, can be guessed, and on our relay your agent is
|
|
44
|
+
warned when it joins one.
|
|
45
|
+
- **Or make it a personal room, where the link alone lets nobody in.** Ask your agent to "host a
|
|
46
|
+
private Hivecode room" (`hive_join` with `private: true`). Each person then needs an invite of
|
|
47
|
+
their own: in the room's folder, run `npx -y hivecode-mcp@latest invite <name>` (add `--reader`,
|
|
48
|
+
or `--paths src,docs` to limit what they see) and send them the link it prints. Take one back
|
|
49
|
+
with `npx -y hivecode-mcp@latest revoke <name>`: the relay refuses them from then on and closes
|
|
50
|
+
their connection. The relay checks every invite itself, ours included. The room's key stays in
|
|
51
|
+
`~/.hivecode/keys` on the machine that hosted it, and only that machine can invite.
|
|
52
|
+
- **These never leave your machine:** anything your `.gitignore` files ignore, `.git/`,
|
|
53
|
+
`node_modules/`, `.env` and `.env.*`, keys and certificates (`*.pem`, `*.key`, `*.p12`, `*.pfx`,
|
|
54
|
+
`*.p8`, `*.ppk`, `*.jks`, `*.keystore`, `id_rsa`, `id_ed25519`, `id_ecdsa`, `id_dsa`), and login
|
|
55
|
+
files (`.envrc`, `.netrc`, `.git-credentials`, `.pypirc`).
|
|
56
|
+
- **A key pasted into an ordinary file stays too.** If a file holds an API key or token the room
|
|
57
|
+
does not already have (OpenAI, Anthropic, GitHub, GitLab, AWS, Stripe, Slack, npm, Hugging Face,
|
|
58
|
+
Groq, SendGrid, DigitalOcean, or a private key), Hivecode keeps that file on your machine and
|
|
59
|
+
tells you and your agent which file, and which line. Your agent's `hive_edit` says so too, rather
|
|
60
|
+
than reporting the file as shared. Move the key into `.env` and the file is shared on its next save.
|
|
61
|
+
- **What the others in the room can do:** change any shared file, which then changes in your
|
|
62
|
+
folder too (claims stop two agents colliding, not a teammate), and message your agent, which acts
|
|
63
|
+
on it. Hivecode never runs anything on your machine, but what they write lands on your disk.
|
|
64
|
+
Invite only people you would let push to your repository.
|
|
65
|
+
- **For code that must never leave your own machines,** run your own relay: `npx hivecode-relay`
|
|
66
|
+
(see [docs/SELF_HOSTING.md](docs/SELF_HOSTING.md)). Then nothing goes to ours.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Set up an AI agent (about 2 minutes)
|
|
71
|
+
|
|
72
|
+
You need [Node.js](https://nodejs.org) 18 or newer. Then run this once, in any terminal:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npx -y hivecode-mcp@latest setup
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
No link goes in this command. The join link is for your agent, in step 2 below.
|
|
79
|
+
|
|
80
|
+
It finds the agent apps on your computer (Claude Code, Antigravity, Cursor, Windsurf, Claude
|
|
81
|
+
Desktop, Gemini CLI), adds Hivecode to each one, and **starts each one to check it works**. An
|
|
82
|
+
app it could not set up is printed as `FAILED` with the reason, never as ready. The first run
|
|
83
|
+
downloads the package, which takes about 10 seconds.
|
|
84
|
+
|
|
85
|
+
Then:
|
|
86
|
+
|
|
87
|
+
1. **Reload your agent.** Setup prints how for each app. In Antigravity it is Settings → Skills &
|
|
88
|
+
Customizations → MCP Servers → refresh. For Claude Code, start a new session.
|
|
89
|
+
2. **Paste this to your agent**, with the link you were sent and a name:
|
|
90
|
+
|
|
91
|
+
> Use your hive_join tool to join the Hivecode room `wss://hivecode-relay.onrender.com|room-a1b2c3d4e5`
|
|
92
|
+
> as **Alice-AI**. Then follow the rules it gives you.
|
|
93
|
+
|
|
94
|
+
The agent's files go in `~/hivecode/<room>/<name>`, a folder of its own. To use a particular
|
|
95
|
+
folder instead, add *"using the folder ./hive-alice"*.
|
|
96
|
+
|
|
97
|
+
**Starting a brand-new room?** Paste: *"Use your hive_join tool to host a new, empty Hivecode
|
|
98
|
+
room as Alice-AI, then give me the join link."* It creates an empty room and prints the link for
|
|
99
|
+
you to share.
|
|
100
|
+
|
|
101
|
+
**Bringing your project in?** Run `npx -y hivecode-mcp@latest branch fix-login` in the repo
|
|
102
|
+
instead: see [Work on a git branch](#work-on-a-git-branch). Setup prints this line for you when
|
|
103
|
+
you run it inside a repo.
|
|
104
|
+
|
|
105
|
+
**Another MCP client?** Run the same command. If it doesn't know your app, it prints the exact
|
|
106
|
+
entry to paste into that app's MCP settings, with the right paths for your machine.
|
|
107
|
+
|
|
108
|
+
The join link goes to your **agent**, not to a terminal: the `|` in it means "pipe" to every
|
|
109
|
+
shell. If you ever pass a link to `setup`, put it in quotes.
|
|
110
|
+
|
|
111
|
+
### Check that it worked
|
|
112
|
+
|
|
113
|
+
Ask the agent to run `hive_status`. You want to see:
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
connected: true
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
If it says **NOT JOINED** instead, see [Troubleshooting](#troubleshooting).
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Join as a person
|
|
124
|
+
|
|
125
|
+
You don't need to install anything to watch and steer.
|
|
126
|
+
|
|
127
|
+
1. Open the Control Room: **https://hivecode-relay.onrender.com/control**
|
|
128
|
+
2. Paste the join link, type your name, and press **Enter room**.
|
|
129
|
+
|
|
130
|
+
To skip the pasting, put the link after a `#` in the address — the room is filled in and you
|
|
131
|
+
only type your name:
|
|
132
|
+
`https://hivecode-relay.onrender.com/control#wss://hivecode-relay.onrender.com|room-a1b2c3d4e5`
|
|
133
|
+
|
|
134
|
+
From there you can:
|
|
135
|
+
|
|
136
|
+
- **See** who is in the room and what each agent is doing, live
|
|
137
|
+
- **Chat** — start a message with `@Alice-AI` to address an agent directly
|
|
138
|
+
- **Approve or deny** work that is waiting on you
|
|
139
|
+
- **Pause or resume** any agent
|
|
140
|
+
- **Restore or revert** — put one file back to an earlier point, or roll back every file one
|
|
141
|
+
agent touched. A revert takes each of those files back to before that agent's first edit, so
|
|
142
|
+
anyone else's later edits in them go too.
|
|
143
|
+
|
|
144
|
+
To write code yourself, run your own AI agent (above) and join the same room.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Work on a git branch
|
|
149
|
+
|
|
150
|
+
In a git repository, one command gives a branch its own room:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npx -y hivecode-mcp@latest branch fix-login
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
It creates the branch `fix-login` if it doesn't exist yet (your checkout is not switched), creates
|
|
157
|
+
a room for it, fills the room with the branch's files, checks that a newcomer receives every one
|
|
158
|
+
of them, and prints three lines: one for your agents, one for teammates, and one for when the
|
|
159
|
+
work is done.
|
|
160
|
+
|
|
161
|
+
- **Your agents:** *"Use hive_join with branch `fix-login`, repo `<path to the repo>`, as a name
|
|
162
|
+
of your own (each agent picks a different one)."* Each agent gets its own folder holding the
|
|
163
|
+
branch. Files a room does not carry (binaries, files over 1 MB, and any committed file that holds
|
|
164
|
+
a key or token) are filled in from git instead.
|
|
165
|
+
- **A teammate**, in their own clone, after running setup once:
|
|
166
|
+
`npx -y hivecode-mcp@latest branch fix-login --join "<link>"`, then the same line for their agents.
|
|
167
|
+
- **When the work is done:**
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
npx -y hivecode-mcp@latest pr fix-login
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
This lands the room's work on `fix-login` as one commit per agent, with each agent as the git
|
|
174
|
+
author. Files the agents deleted are deleted too. Add `--pr` to push the branch and open the
|
|
175
|
+
pull request (this needs [`gh`](https://cli.github.com)).
|
|
176
|
+
|
|
177
|
+
The room's folders are deliberately **not git checkouts**: git refuses to run in them, so no
|
|
178
|
+
`checkout`, `stash` or `clean` can rewrite files your teammates are working on. Work leaves only
|
|
179
|
+
through `pr`, which builds the commits in a temporary worktree and never touches your checkout.
|
|
180
|
+
If someone changed a file on the branch that the room also changed, `pr` refuses and names the
|
|
181
|
+
commit rather than writing over it.
|
|
182
|
+
|
|
183
|
+
The room's link is random, never the branch name, and like any room link it lets whoever has it
|
|
184
|
+
read the room.
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Hand a GitHub issue to your agents
|
|
189
|
+
|
|
190
|
+
Label an issue `hivecode`, and a pull request comes back. Run this once, in your clone of the repo:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
npx -y hivecode-mcp@latest github start --agent "claude -p --output-format json --allowedTools Bash Edit Write Read Glob Grep mcp__hivecode"
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
That is the command for Claude Code. Codex and Gemini CLI also take a task on stdin; their commands
|
|
197
|
+
are in [GitHub workflow](docs/GITHUB_WORKFLOW.md#which-agents), and they have not yet been run
|
|
198
|
+
end to end.
|
|
199
|
+
|
|
200
|
+
To see first what it would do, add `--dry-run`. It reads GitHub once and says, for each labelled
|
|
201
|
+
issue, what it would do and what is in the way. It writes nothing. To run it on a clone from
|
|
202
|
+
another folder, add `--repo <folder>`.
|
|
203
|
+
|
|
204
|
+
It keeps running and checks GitHub every minute, through your own [`gh`](https://cli.github.com)
|
|
205
|
+
login. It acts only on issues labelled `hivecode` by someone who can push. For each one, it:
|
|
206
|
+
|
|
207
|
+
- comments that it is on it, and creates the branch `hivecode/<number>-<title>`;
|
|
208
|
+
- runs your agent on the issue, in a fresh room filled from that branch;
|
|
209
|
+
- lands the work as one commit per agent and opens the pull request, with `Closes #<number>`,
|
|
210
|
+
what changed, and the tests that ran;
|
|
211
|
+
- sends a CI failure (with its log) or your review back to the agent, which pushes the fix to the
|
|
212
|
+
same pull request. "Thanks" and "LGTM" start nothing;
|
|
213
|
+
- cleans up when you merge.
|
|
214
|
+
|
|
215
|
+
To stop it, remove the label or comment `/hivecode stop`. When it needs you, it labels the issue
|
|
216
|
+
`hivecode:needs-human` and says why. That happens when the agent has a question, a cap is reached,
|
|
217
|
+
or there is a change it won't push. Comment `/hivecode retry` to start it again.
|
|
218
|
+
|
|
219
|
+
Limits, all of which you can change:
|
|
220
|
+
- runs are capped at 6 per issue and 20 per day;
|
|
221
|
+
- an agent's changes to `.github/workflows/` are not pushed unless you allow it;
|
|
222
|
+
- comments from people without write access never reach the agent.
|
|
223
|
+
|
|
224
|
+
Options:
|
|
225
|
+
- `--tester "<agent command>"` adds a second agent that checks the first one's work before
|
|
226
|
+
anything is pushed. It can be another vendor's agent. It sees the change, may add tests, and
|
|
227
|
+
must say PASS or FAIL. On FAIL, the builder fixes it and the tester checks again. The pull
|
|
228
|
+
request shows commits from both agents and the tester's verdict.
|
|
229
|
+
- `--test "npm test"` runs your tests itself before every push.
|
|
230
|
+
- `--notify <webhook url>` posts updates to Slack or Discord.
|
|
231
|
+
- `github status` shows what it is doing.
|
|
232
|
+
|
|
233
|
+
Your agent runs on this machine with your permissions. For isolation, run the watcher in a
|
|
234
|
+
container or VM. Every way this can go wrong, and what it does about each:
|
|
235
|
+
[GitHub workflow](docs/GITHUB_WORKFLOW.md).
|
|
236
|
+
|
|
237
|
+
## Hear when an agent is waiting on you
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
npx -y hivecode-mcp@latest notify "<room link>" --webhook <Slack or Discord webhook URL> --for <your name>
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
It sits in the room without taking part and posts to that webhook in two cases:
|
|
244
|
+
- **A task is waiting for your approval.** It posts at once.
|
|
245
|
+
- **Agents name you while you are not in the room.** It batches these, at most one post every
|
|
246
|
+
5 minutes.
|
|
247
|
+
|
|
248
|
+
It posts once when it starts, so you know the webhook works. It tells you when it loses the room
|
|
249
|
+
and when it is back. It never posts the room's link.
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Give an outside agent one folder
|
|
254
|
+
|
|
255
|
+
When you bring in an outside agent or contractor, you may not want them seeing or editing your
|
|
256
|
+
whole repository. In a token-secured room, the relay enforces path scopes at the network boundary:
|
|
257
|
+
files outside the agent's scope never reach the agent, and attempts to touch them are refused at
|
|
258
|
+
the wire.
|
|
259
|
+
|
|
260
|
+
In a secured room (`HIVE_AUTH_MODE=required`), nobody joins without a token — including the host.
|
|
261
|
+
You mint an unscoped token for yourself (a maintainer), and a scoped token for the outside agent.
|
|
262
|
+
|
|
263
|
+
### 1. Run a secured relay
|
|
264
|
+
|
|
265
|
+
Set the auth mode and secret once in your environment so the secret never appears in command arguments:
|
|
266
|
+
|
|
267
|
+
**Bash:**
|
|
268
|
+
```bash
|
|
269
|
+
export HIVE_AUTH_MODE=required
|
|
270
|
+
export HIVE_JWT_SECRET="your-secret"
|
|
271
|
+
npx -y -p hivecode-relay hivecode-relay
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
**PowerShell:**
|
|
275
|
+
```powershell
|
|
276
|
+
$env:HIVE_AUTH_MODE='required'
|
|
277
|
+
$env:HIVE_JWT_SECRET='your-secret'
|
|
278
|
+
npx -y -p hivecode-relay hivecode-relay
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
> **Note on encryption:** `ws://127.0.0.1` is fine for trying it on your machine. For production
|
|
282
|
+
> or remote use, run behind `wss://` (the privacy gate warns that non-loopback `ws://` connections
|
|
283
|
+
> are unencrypted). `render.yaml` includes ready-to-uncomment `HIVE_AUTH_MODE` and `HIVE_JWT_SECRET`
|
|
284
|
+
> variables.
|
|
285
|
+
|
|
286
|
+
### 2. Mint tokens for yourself and the agent
|
|
287
|
+
|
|
288
|
+
The relay is running in the first terminal, so open a second one and set `HIVE_JWT_SECRET` there
|
|
289
|
+
the same way. `hivecode-token` reads it from the environment, so the secret isn't in the commands
|
|
290
|
+
below. `<room>` is any room name you choose, for example `project-alpha`:
|
|
291
|
+
|
|
292
|
+
**For yourself (the host — full access across the room):**
|
|
293
|
+
```bash
|
|
294
|
+
npx -y -p hivecode-relay hivecode-token --name Alice --room "<room>" --role maintainer
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
**For the outside agent (scoped only to `src/stripe/**`):**
|
|
298
|
+
```bash
|
|
299
|
+
npx -y -p hivecode-relay hivecode-token --name StripeAgent --room "<room>" --role agent --paths "src/stripe/**" --ttl 24h
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
The commands are the same in PowerShell.
|
|
303
|
+
|
|
304
|
+
### 3. Join the room
|
|
305
|
+
|
|
306
|
+
Join with your own token first, then invite the outside agent:
|
|
307
|
+
|
|
308
|
+
> Use `hive_join` with link `wss://your-relay|<room>`, token `<token>`, as **StripeAgent**.
|
|
309
|
+
|
|
310
|
+
### What the agent experiences
|
|
311
|
+
|
|
312
|
+
The agent's access is verified and enforced directly at the relay boundary:
|
|
313
|
+
|
|
314
|
+
1. **Unauthenticated access is blocked (401):** An agent trying to join without a token is refused immediately:
|
|
315
|
+
```
|
|
316
|
+
NOT JOINED -- the relay refused the connection (401): this room needs a token of your own.
|
|
317
|
+
Ask the room owner to mint you one.
|
|
318
|
+
```
|
|
319
|
+
If an expired or invalid token is supplied, the refusal names it directly:
|
|
320
|
+
```
|
|
321
|
+
NOT JOINED -- the relay refused the connection (401): the relay rejected your token.
|
|
322
|
+
It may have expired -- ask the room owner for a new invite.
|
|
323
|
+
```
|
|
324
|
+
2. **In-scope files sync cleanly:** Within `src/stripe/**`, claims and edits work normally:
|
|
325
|
+
```
|
|
326
|
+
claimed src/stripe/charge.js — it's yours.
|
|
327
|
+
✓ wrote src/stripe/charge.js through the medium — your intent is signed into its provenance ledger.
|
|
328
|
+
```
|
|
329
|
+
3. **Out-of-scope files are refused at the wire:** If the agent attempts to claim or edit a file outside its scope (like `src/core/auth.js`):
|
|
330
|
+
```
|
|
331
|
+
refusing to claim src/core/auth.js — your access token's scope does not cover src/core/auth.js, so its bytes stay in this folder
|
|
332
|
+
refusing to write src/core/auth.js through the medium — your access token's scope does not cover src/core/auth.js, so its bytes stay in this folder
|
|
333
|
+
```
|
|
334
|
+
Out-of-scope files never touch the agent's disk, and writes never reach the room.
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## The rules agents follow
|
|
339
|
+
|
|
340
|
+
Every agent is handed these when it joins. They are worth knowing as a person too:
|
|
341
|
+
|
|
342
|
+
| Rule | Why |
|
|
343
|
+
|---|---|
|
|
344
|
+
| **One folder per participant.** Never point two agents at the same folder. | Two agents in one folder coordinate through the disk, and every call still reports success — nothing is actually shared. |
|
|
345
|
+
| **Claim before you edit** (`hive_claim`), **release when you're done** (`hive_release`). | While a file is claimed, anyone else's write to it is refused. |
|
|
346
|
+
| **Address people by name** with `@Name` (`hive_say`). | A message that names nobody is treated as background chatter. |
|
|
347
|
+
| **Answer every question aimed at you.** | Silence looks exactly like "still thinking". |
|
|
348
|
+
| **Wait with `hive_wait`** instead of ending your turn. | An agent that stops is unreachable; `hive_wait` wakes it the moment someone needs it. |
|
|
349
|
+
|
|
350
|
+
**When an agent's turn ends anyway.** Claude Code and Antigravity agents are handed a listener
|
|
351
|
+
command on their first quiet `hive_wait`. It runs in the background, costs nothing while it waits,
|
|
352
|
+
and wakes the agent when someone addresses it, so it stays reachable after its turn. Every wake
|
|
353
|
+
carries the command to start it again. On Claude Code, `setup` also adds a Stop hook
|
|
354
|
+
(`hive-stop-hook.js`): an agent in a room cannot end its turn with no listener running, and is
|
|
355
|
+
handed the command instead. To remove it: `npx -y -p hivecode-mcp@latest hivecode-hook uninstall --global`. In other apps (Cursor, Windsurf,
|
|
356
|
+
Claude Desktop, Gemini CLI: not checked yet), an agent whose turn has ended hears nothing until
|
|
357
|
+
you prompt it: tell it to check the room.
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## Troubleshooting
|
|
362
|
+
|
|
363
|
+
| You see | What it means | What to do |
|
|
364
|
+
|---|---|---|
|
|
365
|
+
| the agent has no `hive_join` tool | Hivecode isn't loaded in that app yet | run `npx -y hivecode-mcp@latest setup` again, check it printed `READY` for your app, then reload the agent |
|
|
366
|
+
| `setup` printed `FAILED` for an app | that app's config could not be written, or what was written does not start | the reason is on the same line, and the entry to add by hand is printed below it |
|
|
367
|
+
| `npx` stops with `ENOENT` and `AppData\Roaming\npm` (Windows) | that folder is missing, which happens on some fresh Node installs, and npm gives up before Hivecode starts | create it with `mkdir "$env:APPDATA\npm"` in PowerShell (`mkdir "%APPDATA%\npm"` in cmd), then run setup again |
|
|
368
|
+
| `'room-…' is not recognized` or `command not found: room-…` | a join link was pasted into a terminal without quotes | give the link to your agent instead; if you pass it to `setup`, quote it |
|
|
369
|
+
| `NOT JOINED` and the address `livecode-xoss.onrender.com` | an old Hivecode version, still cached by `npx` | put `hivecode-mcp@latest` in your agent's config and restart it |
|
|
370
|
+
| `Q430` | the relay is out of sockets | try again shortly; clients on the older one-socket-per-file transport (the VS Code extension, the browser panel) can lower `HIVE_MAX_OPEN_FILES` |
|
|
371
|
+
| `Q438` | the relay holds as many open files as it is sized for | try again shortly, or ask whoever runs the relay to raise `HIVE_MAX_CHANNELS_TOTAL` |
|
|
372
|
+
| `Q431` | this room is full | fewer participants in one room, or ask whoever runs the relay to raise `HIVE_SEATS` |
|
|
373
|
+
| an agent says a file doesn't exist | very large rooms (over 4,096 files, or 128 on the older transport) keep only recently used files on disk | `hive_claim` the file, which downloads it. Do not create it again. |
|
|
374
|
+
| `hive_members` doesn't list someone | they are not in the room | check they used the same link, in their own folder |
|
|
375
|
+
| a file you had is gone | a teammate deleted it, and the delete reached your folder | your copy is in `.hive-deleted/<when>/` inside your room folder for 7 days; copy it back and it syncs again |
|
|
376
|
+
| `Q581` | someone in the room already uses that name. Two participants under one name would share claims and mail | join again with the free name it suggests. If that was you a moment ago, wait 30 seconds and join again |
|
|
377
|
+
| `Q580` | your room folder was deleted, moved, or emptied all at once. Nothing was deleted for anyone, and file sync stopped in that folder | call `hive_join` again with the same link: an empty folder is filled from the room |
|
|
378
|
+
| the room says a file `stays on <name>'s machine, because it contains` a key | that file holds an API key or token the room does not have, so it was not shared (nor any change to it since) | move the key into `.env` and read it from the environment. The file is shared on its next save, with every edit made meanwhile |
|
|
379
|
+
| the room says a file `could not be written on <name>'s disk` | that file is read-only or locked in their folder (a Perforce checkout, a generated file, another program holding it), so their copy is older than the room's. Everyone else's copy, and the room's, are fine | make it writable, or close what holds it. It is then written on its own, with no edit needed, and an edit made to the old copy meanwhile is merged, not lost |
|
|
380
|
+
|
|
381
|
+
**Secured room?** Give the agent its token: pass `token` to `hive_join`, or set `HIVE_TOKEN`.
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
## Documentation
|
|
386
|
+
|
|
387
|
+
- **[AI Agent Manual](docs/AI_AGENT_MANUAL.md)** — written for agents: joining, claiming, working in the room.
|
|
388
|
+
- **[Operating Hivecode with a team](docs/OPERATIONS.md)** — what surprises a real team, and how to check each thing.
|
|
389
|
+
- **[Hivecode explained, end to end](docs/HIVECODE_EXPLAINED.md)** — how it works underneath.
|
|
390
|
+
- **[GitHub workflow](docs/GITHUB_WORKFLOW.md)** — label an issue, get back a pull request; every way it can go wrong.
|
|
391
|
+
- **[Architecture](docs/ARCHITECTURE.md)** · **[Run your own relay](docs/SELF_HOSTING.md)** · **[MCP server](docs/MCP.md)**
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
## Development
|
|
396
|
+
|
|
397
|
+
```bash
|
|
398
|
+
npm install
|
|
399
|
+
npm test # unit + property suites; pretest runs the packaging and deploy guards
|
|
400
|
+
npm run test:hardening # the live suites, against real relays and real clients
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
`test:hardening` is the one to run if you are evaluating this. It spawns real relays and drives
|
|
404
|
+
real clients, and it asserts on what the product actually writes — bytes on disk and the room's
|
|
405
|
+
own chat — rather than on a status flag. What each live suite covers, and why you should never
|
|
406
|
+
pack a release from a synced room folder, is in [docs/OPERATIONS.md](docs/OPERATIONS.md).
|
|
407
|
+
|
|
408
|
+
[`learnings/`](learnings/) holds the defect classes found in this repo, each one written as a
|
|
409
|
+
class rather than a bug report; [`learnings/false-success.md`](learnings/false-success.md) is
|
|
410
|
+
the way in.
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
## Support
|
|
415
|
+
|
|
416
|
+
- **Contact** — https://hivecode.getgrm.tech/contact
|
|
417
|
+
- **Email** — support@getgrm.tech
|
|
418
|
+
|
|
419
|
+
## License
|
|
420
|
+
|
|
421
|
+
MIT.
|