hivecode-mcp 0.12.0 → 0.12.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/README.md +94 -280
- package/docs/MCP.md +18 -10
- package/docs/SELF_HOSTING.md +10 -7
- package/hive-mcp.js +108 -12
- package/hive-mux-proto.js +58 -0
- package/hive-mux.js +350 -0
- package/hive-privacy.js +25 -0
- package/hive-relay-health.js +24 -4
- package/hive-setup.js +445 -0
- package/hive-stdio.js +168 -0
- package/hive-update.js +58 -0
- package/limits.js +49 -1
- package/package.json +17 -7
- package/sync.js +113 -26
package/README.md
CHANGED
|
@@ -1,278 +1,140 @@
|
|
|
1
1
|
<h1>Hivecode</h1>
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**A live shared workspace for people and their AI agents.**
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
· [**Website**](https://hivecode.vercel.app)
|
|
11
|
-
· [Latest .vsix](https://github.com/Ganesh-Kute/HiveCode/releases)
|
|
5
|
+
A few people, each with their own AI agent — Claude Code, Cursor, Windsurf, Antigravity, or
|
|
6
|
+
your own bot — work on one project at the same time. Every edit reaches everyone in about a
|
|
7
|
+
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 undo anything.
|
|
12
10
|
|
|
13
11
|
---
|
|
14
12
|
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
You can't trust an AI agent blindly. The faster it edits, the more you have to
|
|
18
|
-
check — and the moment you run more than one, it gets worse: they touch files they
|
|
19
|
-
shouldn't, overwrite each other, and you lose track of who changed what. Today's
|
|
20
|
-
answer is to isolate each agent in a git worktree and pray at merge time — which
|
|
21
|
-
doesn't help you *trust* the output, it just defers the mess.
|
|
22
|
-
|
|
23
|
-
Hivecode adds the missing layer: **oversight and control.**
|
|
13
|
+
## How it works
|
|
24
14
|
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
1. Someone creates a **room** and gets a **join link**, like
|
|
16
|
+
`wss://hivecode-relay.onrender.com|room-a1b2c3d4e5`
|
|
17
|
+
2. Everyone — people and agents — joins with that link.
|
|
18
|
+
3. Each agent works in **its own folder**. Hivecode keeps every folder identical, live.
|
|
19
|
+
4. An agent **claims** a file before editing it and **releases** it after. While someone
|
|
20
|
+
holds a file, anyone else's write to it is refused — never silently overwritten.
|
|
21
|
+
5. You watch and steer from the **Control Room** in your browser.
|
|
29
22
|
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
Nothing to host. Rooms run on the Hivecode relay, and anyone who has a link can join that
|
|
24
|
+
room — **treat the link like a password** and share it only with your team.
|
|
32
25
|
|
|
33
26
|
---
|
|
34
27
|
|
|
35
|
-
##
|
|
36
|
-
|
|
37
|
-
The hard part is what happens when two agents edit the same file. Git compares lines, so
|
|
38
|
-
a rename on one side and a new call site on the other merge with no conflict — and ship a
|
|
39
|
-
crash. **ICR**, our merge engine, compares structure and intent instead.
|
|
40
|
-
|
|
41
|
-
Measured on [CooperBench](https://arxiv.org/abs/2601.13295) (Stanford, 2026), which gives
|
|
42
|
-
two agents independent features on one repo and scores the result by running **both**
|
|
43
|
-
features' own test suites. Of its 652 gold pairs — professional human patches, the
|
|
44
|
-
cleanest possible input — **505 conflict under git**:
|
|
45
|
-
|
|
46
|
-
| Merge layer | Of those 505, integrated cleanly | Passes both test suites |
|
|
47
|
-
|---|---|---|
|
|
48
|
-
| `git merge` | 0 (0%) | — |
|
|
49
|
-
| mergiraf 0.18 | 56 (11.1%) | — |
|
|
50
|
-
| **ICR** — safe default | **112 (22.2%)** | **100%** (27/27) |
|
|
51
|
-
| **ICR** — union mode | **206 (40.8%)** | **96.2%** (50/52) |
|
|
52
|
-
|
|
53
|
-
Three more independent checks:
|
|
54
|
-
|
|
55
|
-
- **279 real conflicts humans already resolved** — compared against what the maintainer
|
|
56
|
-
actually committed: ICR matched 87, mergiraf 64, zero broken outputs, ICR ahead on all
|
|
57
|
-
five repositories.
|
|
58
|
-
- **[ConGra](https://arxiv.org/abs/2409.14121), 6,430 real Python conflicts** verified with
|
|
59
|
-
CPython's own `ast.parse`: 32.1% resolved vs mergiraf's 31.8%, with **zero crashes and
|
|
60
|
-
zero parse-guarantee violations**.
|
|
61
|
-
- **Properties, not examples** — symmetry (`M(b,x,y) = M(b,y,x)`), fixed-point, no-loss and
|
|
62
|
-
the parse guarantee, under seeded fuzz across 20+ languages: 13,000+ assertions, green.
|
|
28
|
+
## Set up an AI agent (about 2 minutes)
|
|
63
29
|
|
|
64
|
-
|
|
65
|
-
[`data/`](data/).
|
|
30
|
+
You need [Node.js](https://nodejs.org) 18 or newer. Then run this once, in any terminal:
|
|
66
31
|
|
|
67
32
|
```bash
|
|
68
|
-
npx
|
|
69
|
-
npx git-clash --scan --base=main --head=my-branch # check one of YOUR merges before you make it
|
|
70
|
-
npm i icr-merge # the engine: library, CLI, and git merge driver (MIT)
|
|
71
|
-
npx hivecode-mcp # the live medium, as MCP tools for any agent
|
|
33
|
+
npx -y hivecode-mcp@latest setup
|
|
72
34
|
```
|
|
73
35
|
|
|
74
|
-
|
|
36
|
+
No link goes in this command. The join link is for your agent, in step 2 below.
|
|
75
37
|
|
|
76
|
-
|
|
38
|
+
It finds the agent apps on your computer (Claude Code, Antigravity, Cursor, Windsurf, Claude
|
|
39
|
+
Desktop, Gemini CLI), adds Hivecode to each one, and **starts each one to check it works**. An
|
|
40
|
+
app it could not set up is printed as `FAILED` with the reason, never as ready. The first run
|
|
41
|
+
downloads the package, which takes about 10 seconds.
|
|
77
42
|
|
|
78
|
-
|
|
79
|
-
They are setup failures that report success. Each item below was measured, not guessed.
|
|
43
|
+
Then:
|
|
80
44
|
|
|
81
|
-
|
|
45
|
+
1. **Reload your agent.** Setup prints how for each app. In Antigravity it is Settings → Skills &
|
|
46
|
+
Customizations → MCP Servers → refresh. For Claude Code, start a new session.
|
|
47
|
+
2. **Paste this to your agent**, with the link you were sent and a name:
|
|
82
48
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
missing join link, an unset `HIVE_RELAY`, a VS Code setting nobody changed. Nothing fails
|
|
86
|
-
when it happens. The agent joins, `hive_status` says connected, and the source is on a
|
|
87
|
-
server the team does not run.
|
|
49
|
+
> Use your hive_join tool to join the Hivecode room `wss://hivecode-relay.onrender.com|room-a1b2c3d4e5`
|
|
50
|
+
> as **Alice-AI**. Then follow the rules it gives you.
|
|
88
51
|
|
|
89
|
-
|
|
52
|
+
The agent's files go in `~/hivecode/<room>/<name>`, a folder of its own. To use a particular
|
|
53
|
+
folder instead, add *"using the folder ./hive-alice"*.
|
|
90
54
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
```
|
|
55
|
+
**Starting a brand-new room?** Paste: *"Use your hive_join tool to host a new Hivecode room as
|
|
56
|
+
Alice-AI, then give me the join link."* It creates the room and prints the link for you to share.
|
|
94
57
|
|
|
95
|
-
|
|
96
|
-
|
|
58
|
+
**Another MCP client?** Run the same command. If it doesn't know your app, it prints the exact
|
|
59
|
+
entry to paste into that app's MCP settings, with the right paths for your machine.
|
|
97
60
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
| `HIVE_RELAY` / `hivecode.relayUrl` | agent env / VS Code | the relay to use — a **default** |
|
|
101
|
-
| `HIVE_RELAY_PIN` / `hivecode.relayPin` | agent env / VS Code | the only relays allowed — a **rule** |
|
|
61
|
+
The join link goes to your **agent**, not to a terminal: the `|` in it means "pipe" to every
|
|
62
|
+
shell. If you ever pass a link to `setup`, put it in quotes.
|
|
102
63
|
|
|
103
|
-
|
|
104
|
-
a client on the public relay with every indicator green. With it, that client refuses to
|
|
105
|
-
connect at all (**Q550**), before a socket opens and before a file is published.
|
|
64
|
+
### Check that it worked
|
|
106
65
|
|
|
107
|
-
`hive_status
|
|
66
|
+
Ask the agent to run `hive_status`. You want to see:
|
|
108
67
|
|
|
109
68
|
```
|
|
110
|
-
|
|
111
|
-
privacy: "PUBLIC RELAY — not yours" <- ours
|
|
69
|
+
connected: true
|
|
112
70
|
```
|
|
113
71
|
|
|
114
|
-
|
|
115
|
-
`npm run test:selfhost`, which starts a real relay, syncs a real file between two real
|
|
116
|
-
clients through it, and asserts a pinned client refuses the public one.
|
|
72
|
+
If it says **NOT JOINED** instead, see [Troubleshooting](#troubleshooting).
|
|
117
73
|
|
|
118
|
-
|
|
74
|
+
---
|
|
119
75
|
|
|
120
|
-
|
|
121
|
-
`hive_*` call still returns success. It looks like multiplayer and it is not — nothing is
|
|
122
|
-
being tested, and the collision handling you came to evaluate never runs.
|
|
76
|
+
## Join as a person
|
|
123
77
|
|
|
124
|
-
|
|
125
|
-
alice/ <- her agent syncs here
|
|
126
|
-
bob/ <- his agent syncs here
|
|
127
|
-
```
|
|
78
|
+
You don't need to install anything to watch and steer.
|
|
128
79
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
### One WebSocket is opened per file
|
|
133
|
-
|
|
134
|
-
This is the most important operational fact about Hivecode and the one that surprises
|
|
135
|
-
people. A relay admits a bounded number of connections (`maxConnsTotal`, default 512;
|
|
136
|
-
per-room default 8 on the free tier). A repository with more files than that cannot open a
|
|
137
|
-
socket for each one, so the client keeps a **bounded working set** — the most recently used
|
|
138
|
-
`HIVE_MAX_OPEN_FILES` (default 128) stay connected and the rest are closed and reopened on
|
|
139
|
-
demand.
|
|
140
|
-
|
|
141
|
-
**The consequence, stated plainly: a file outside the working set is not on your disk yet.**
|
|
142
|
-
It exists in the room, and `hive_claim` on the path — or `fetch(path)` if you want to wait for
|
|
143
|
-
the bytes — brings it down. An agent that instead lists its directory, does not see the file,
|
|
144
|
-
and concludes it does not exist will write a new one, and that is how you get two definitions
|
|
145
|
-
of the same thing.
|
|
146
|
-
|
|
147
|
-
That sentence was false until 21 Sep 2026, and it is worth saying so rather than quietly
|
|
148
|
-
fixing it. Measured against a client holding 8 of a room's 41 files, on a path that *was* in
|
|
149
|
-
the manifest: `claim()` returned `true`, the file's doc was never opened (`headOf` → `null`,
|
|
150
|
-
0 provenance receipts), no bytes arrived after 9 seconds, and there was no `fetch`, `read` or
|
|
151
|
-
`open` in the API at all. One line in `reconcile` was the cause — the file doc was only opened
|
|
152
|
-
when something already existed on local disk — so the *only* way to obtain a file you could
|
|
153
|
-
not see was to write to the path, which is exactly the blind recreate described below. The
|
|
154
|
-
documented safe route did nothing and the dangerous route worked.
|
|
155
|
-
|
|
156
|
-
`fetch(path)` resolves when the bytes are on disk, not when a flag flips, and it tells the two
|
|
157
|
-
lookalike cases apart:
|
|
158
|
-
|
|
159
|
-
| what you get back | what it means | what to do |
|
|
160
|
-
|---|---|---|
|
|
161
|
-
| `{ ok: true, bytes: N }` | it was in the room, it is on your disk now | read it |
|
|
162
|
-
| `{ ok: true, alreadyLocal: true }` | you already had it | nothing |
|
|
163
|
-
| `{ ok: false, notInRoom: true }` | **no client has ever published this path** | nothing will ever fetch it; check the room's ignore rules, then have whoever holds the file write it into their synced folder |
|
|
164
|
-
| `{ ok: false, timedOut: true }` | in the room, did not arrive | the file's own socket is likely refused — check `filesHeld` against `roomFiles` |
|
|
80
|
+
1. Open the Control Room: **https://hivecode-relay.onrender.com/control**
|
|
81
|
+
2. Paste the join link, type your name, and press **Enter room**.
|
|
165
82
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
83
|
+
To skip the pasting, put the link after a `#` in the address — the room is filled in and you
|
|
84
|
+
only type your name:
|
|
85
|
+
`https://hivecode-relay.onrender.com/control#wss://hivecode-relay.onrender.com|room-a1b2c3d4e5`
|
|
169
86
|
|
|
170
|
-
|
|
87
|
+
From there you can:
|
|
171
88
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
89
|
+
- **See** who is in the room and what each agent is doing, live
|
|
90
|
+
- **Chat** — start a message with `@Alice-AI` to address an agent directly
|
|
91
|
+
- **Approve or deny** work that is waiting on you
|
|
92
|
+
- **Pause or resume** any agent
|
|
93
|
+
- **Restore or revert** — undo one file, or everything one agent did
|
|
177
94
|
|
|
178
|
-
|
|
179
|
-
If those two numbers differ, that is expected — not a fault.
|
|
95
|
+
To write code yourself, run your own AI agent (above) and join the same room.
|
|
180
96
|
|
|
181
|
-
|
|
97
|
+
---
|
|
182
98
|
|
|
183
|
-
|
|
184
|
-
`participants × (1 + HIVE_MAX_OPEN_FILES)` against the relay's `maxConnsTotal`, and remember
|
|
185
|
-
the relay is shared with every other room on it. At defaults, five participants want
|
|
186
|
-
5 × (1 + 128) = **645 connections against 512**.
|
|
99
|
+
## The rules agents follow
|
|
187
100
|
|
|
188
|
-
|
|
189
|
-
fewer open files per client. **`HIVE_SEATS` will not help here**, and an earlier version of
|
|
190
|
-
this section wrongly suggested it would. Verified in `limits.js`: `limitsFor()` returns no
|
|
191
|
-
`maxConnsTotal` at all, and the refusal at `limits.js:166` reads the module-level
|
|
192
|
-
`LIMITS.maxConnsTotal`, so seats never touch the total. Seats raise the **per-room** cap,
|
|
193
|
-
which is a different ceiling that bites in a different place — see the table below.
|
|
101
|
+
Every agent is handed these when it joins. They are worth knowing as a person too:
|
|
194
102
|
|
|
195
|
-
|
|
103
|
+
| Rule | Why |
|
|
104
|
+
|---|---|
|
|
105
|
+
| **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. |
|
|
106
|
+
| **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. |
|
|
107
|
+
| **Address people by name** with `@Name` (`hive_say`). | A message that names nobody is treated as background chatter. |
|
|
108
|
+
| **Answer every question aimed at you.** | Silence looks exactly like "still thinking". |
|
|
109
|
+
| **Wait with `hive_wait`** instead of ending your turn. | An agent that stops is unreachable; `hive_wait` wakes it the moment someone needs it. |
|
|
196
110
|
|
|
197
|
-
|
|
198
|
-
curl -s https://your-relay/health
|
|
199
|
-
```
|
|
111
|
+
---
|
|
200
112
|
|
|
201
|
-
|
|
202
|
-
the wrong one:
|
|
113
|
+
## Troubleshooting
|
|
203
114
|
|
|
204
|
-
|
|
|
115
|
+
| You see | What it means | What to do |
|
|
205
116
|
|---|---|---|
|
|
206
|
-
| `
|
|
207
|
-
| `
|
|
208
|
-
|
|
209
|
-
`
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
### When an agent goes quiet
|
|
220
|
-
|
|
221
|
-
An agent whose turn has ended is still connected, so "is it online" is the wrong question.
|
|
222
|
-
The room answers the one that is decidable — is it inside a blocking `hive_wait` right now:
|
|
223
|
-
|
|
224
|
-
```
|
|
225
|
-
Alice (ai) — WORKING: last action 2 min ago (hive_claim). Reachable.
|
|
226
|
-
Bob (ai) — WAITING: blocked in hive_wait, wakes the moment anything arrives. Reachable.
|
|
227
|
-
Carol (ai) — PARKED: connected, but NOT inside hive_wait and silent for 22 min.
|
|
228
|
-
It will not wake on its own — anything you send it now will sit
|
|
229
|
-
unread until a human prompts it.
|
|
230
|
-
Dave (ai) — GONE: not connected. Last action 41 min ago (hive_say).
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
`hive_say` warns you at send time if you address a PARKED or GONE agent, and `hive_owed`
|
|
234
|
-
marks a debt owed by one as `[UNREACHABLE]` rather than pending.
|
|
235
|
-
|
|
236
|
-
### Known limits
|
|
237
|
-
|
|
238
|
-
- **Marketplace extension**: loses offline edits on rejoin. Not fixed — it needs a real
|
|
239
|
-
VS Code host to verify, and we will not claim it without one. The `sync.js` engine is
|
|
240
|
-
covered; the extension is not.
|
|
241
|
-
- **Bounded working set**: described above. A real behaviour change, deliberately taken.
|
|
242
|
-
- **`git`-vs-room drift**: a room checkout and a git branch can diverge.
|
|
243
|
-
`scripts/check-drift.mjs` reports it.
|
|
244
|
-
- **Relay deploy**: pushing this repo does not redeploy a hosted relay unless auto-deploy
|
|
245
|
-
is on. Check `/health` uptime against your last deploy.
|
|
246
|
-
- **Dead-heat file creation** (HIV-P17, fixed in `929323b`). If two participants create the
|
|
247
|
-
*same* path in the same instant, the creation-race path now runs `fusionReason()` — the same
|
|
248
|
-
check the normal merge path uses. When both inputs parse but the merged output does not (or
|
|
249
|
-
has structural duplication), the merge is REFUSED: nothing is written, both copies stay
|
|
250
|
-
intact, and the room is told via `say()`. Disjoint functions that parse cleanly when merged
|
|
251
|
-
are still unioned as before. Non-code files (no language support) are unaffected.
|
|
252
|
-
`tests/genesis-collision-test.mjs` pins the fix (6/6).
|
|
117
|
+
| 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 |
|
|
118
|
+
| `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 |
|
|
119
|
+
| `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 |
|
|
120
|
+
| `'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 |
|
|
121
|
+
| `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 |
|
|
122
|
+
| `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` |
|
|
123
|
+
| `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` |
|
|
124
|
+
| `Q431` | this room is full | fewer participants in one room, or ask whoever runs the relay to raise `HIVE_SEATS` |
|
|
125
|
+
| 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. |
|
|
126
|
+
| `hive_members` doesn't list someone | they are not in the room | check they used the same link, in their own folder |
|
|
127
|
+
|
|
128
|
+
**Secured room?** Give the agent its token: pass `token` to `hive_join`, or set `HIVE_TOKEN`.
|
|
253
129
|
|
|
254
130
|
---
|
|
255
131
|
|
|
256
132
|
## Documentation
|
|
257
133
|
|
|
258
|
-
- **[
|
|
259
|
-
- **[
|
|
260
|
-
- **[
|
|
261
|
-
- **[
|
|
262
|
-
- **[🔐 DCO (Deterministic Context Override)](docs/DCO_EXPLAINED.md)** — tools locked by CRDT state, structurally preventing drift.
|
|
263
|
-
- **[🔗 The Substrate](docs/SUBSTRATE.md)** — a governed *medium*: every change a signed `(intent, patch, provenance)` triple, enforced by the relay, with no controller.
|
|
264
|
-
- **[🏗️ Architecture](docs/ARCHITECTURE.md)** · **[🚀 Self-hosting](docs/SELF_HOSTING.md)** · **[⚙️ Setup](docs/SETUP.md)**
|
|
265
|
-
|
|
266
|
-
### `learnings/` — read this one if you read nothing else
|
|
267
|
-
|
|
268
|
-
Eight defect classes, every one found on this repo, every one having already recurred at
|
|
269
|
-
least once. They are written as classes rather than bug reports, and
|
|
270
|
-
[`tests/learnings-test.mjs`](tests/learnings-test.mjs) fails if a document cites a file that
|
|
271
|
-
has moved — a stale learning is worse than none, because it is read with the authority of
|
|
272
|
-
something that was once checked.
|
|
273
|
-
|
|
274
|
-
The recurring shape is **false success**: nothing crashes, every signal is green, the result
|
|
275
|
-
is wrong. [`learnings/false-success.md`](learnings/false-success.md) is the index into it.
|
|
134
|
+
- **[AI Agent Manual](docs/AI_AGENT_MANUAL.md)** — written for agents: joining, claiming, working in the room.
|
|
135
|
+
- **[Operating Hivecode with a team](docs/OPERATIONS.md)** — what surprises a real team, and how to check each thing.
|
|
136
|
+
- **[Hivecode explained, end to end](docs/HIVECODE_EXPLAINED.md)** — how it works underneath.
|
|
137
|
+
- **[Architecture](docs/ARCHITECTURE.md)** · **[Run your own relay](docs/SELF_HOSTING.md)** · **[MCP server](docs/MCP.md)**
|
|
276
138
|
|
|
277
139
|
---
|
|
278
140
|
|
|
@@ -281,63 +143,17 @@ is wrong. [`learnings/false-success.md`](learnings/false-success.md) is the inde
|
|
|
281
143
|
```bash
|
|
282
144
|
npm install
|
|
283
145
|
npm test # unit + property suites; pretest runs the packaging and deploy guards
|
|
284
|
-
npm run test:hardening #
|
|
146
|
+
npm run test:hardening # the live suites, against real relays and real clients
|
|
285
147
|
```
|
|
286
148
|
|
|
287
|
-
`test:hardening` is the one to run if you are evaluating this. It spawns real relays
|
|
288
|
-
real clients, and
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
`pretest` is not optional and is worth understanding: it runs
|
|
293
|
-
[`scripts/check-files.mjs`](scripts/check-files.mjs), which refuses the package if any
|
|
294
|
-
relative import is missing from `package.json` `files[]`. That guard has caught a published
|
|
295
|
-
tarball that would have thrown `ERR_MODULE_NOT_FOUND` on its first call.
|
|
296
|
-
|
|
297
|
-
### Never pack or publish from a synced room folder
|
|
149
|
+
`test:hardening` is the one to run if you are evaluating this. It spawns real relays and drives
|
|
150
|
+
real clients, and it asserts on what the product actually writes — bytes on disk and the room's
|
|
151
|
+
own chat — rather than on a status flag. What each live suite covers, and why you should never
|
|
152
|
+
pack a release from a synced room folder, is in [docs/OPERATIONS.md](docs/OPERATIONS.md).
|
|
298
153
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
`night/deepmind` 26, while the repo itself had none.
|
|
303
|
-
|
|
304
|
-
`npm publish` is safe — `prepublishOnly` runs the guard, which fails with
|
|
305
|
-
`files[] lists "hive-mailbox.js" but it does not exist on disk`, one line per entry.
|
|
306
|
-
|
|
307
|
-
**`npm pack` is not.** On npm 9.6.1 a real `npm pack` runs *no* lifecycle script — not
|
|
308
|
-
`prepack`, not `prepare` — so it cannot be guarded that way. It omits a `files[]` entry it
|
|
309
|
-
cannot find and says nothing at all: no warning, no non-zero exit, just a smaller tarball
|
|
310
|
-
that installs cleanly and throws on the user's first import. Verified with a two-file probe
|
|
311
|
-
where one listed file did not exist.
|
|
312
|
-
|
|
313
|
-
So: pack from the repository, never from a participant folder, and check the tarball
|
|
314
|
-
against `files[]` rather than trusting the count.
|
|
315
|
-
|
|
316
|
-
Live suites spawn a real relay on a pid-derived port, so they can run concurrently:
|
|
317
|
-
|
|
318
|
-
```bash
|
|
319
|
-
node tests/agent-liveness-test.mjs # WORKING / WAITING / PARKED / GONE, real dispatch
|
|
320
|
-
node tests/relay-diagnosis-test.mjs # a real relay made genuinely full, and the advice it gets
|
|
321
|
-
node tests/unreachable-recipient-test.mjs # send-time warnings for unreachable recipients
|
|
322
|
-
node tests/open-file-cap-test.mjs # the bounded working set, and the trade it makes
|
|
323
|
-
node tests/ceiling-no-data-loss-test.mjs # a full relay must not cost you your files
|
|
324
|
-
node tests/first-contact-refusal-test.mjs # clone-then-join must not clobber local work
|
|
325
|
-
node tests/genesis-claim-test.mjs # a claim whose bytes could never leave is refused
|
|
326
|
-
node tests/blind-recreate-test.mjs # writing a file you cannot see, that the room already has
|
|
327
|
-
node tests/genesis-collision-test.mjs # HIV-P17: two whole-module rewrites in a creation race are refused
|
|
328
|
-
node tests/join-honesty-test.mjs # what a join says when the relay refused it
|
|
329
|
-
node tests/mention-boundary-test.mjs # who owes an answer, and who cannot be asked
|
|
330
|
-
node tests/coordination-test.mjs # claims, leases, flow-around under contention
|
|
331
|
-
|
|
332
|
-
npm run test:ceiling · test:gate · test:learnings · test:features · test:coordination
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
Everything under [`tests/`](tests/) is runnable directly with `node`. Suites assert on
|
|
336
|
-
observable behaviour — bytes on disk, tool output, relay refusals — rather than on source
|
|
337
|
-
text, for the reason set out in
|
|
338
|
-
[`learnings/testing-the-consumer-instead-of-the-derivation.md`](learnings/testing-the-consumer-instead-of-the-derivation.md).
|
|
339
|
-
|
|
340
|
-
The extension source is in [`extension/`](extension/).
|
|
154
|
+
[`learnings/`](learnings/) holds the defect classes found in this repo, each one written as a
|
|
155
|
+
class rather than a bug report; [`learnings/false-success.md`](learnings/false-success.md) is
|
|
156
|
+
the way in.
|
|
341
157
|
|
|
342
158
|
---
|
|
343
159
|
|
|
@@ -346,8 +162,6 @@ The extension source is in [`extension/`](extension/).
|
|
|
346
162
|
- **Issues** — https://github.com/Ganesh-Kute/HiveCode/issues
|
|
347
163
|
- **Email** — support@getgrm.tech
|
|
348
164
|
|
|
349
|
-
---
|
|
350
|
-
|
|
351
165
|
## License
|
|
352
166
|
|
|
353
167
|
MIT.
|
package/docs/MCP.md
CHANGED
|
@@ -23,19 +23,27 @@ Add Hivecode to your MCP client config. The command runs this repo's server.
|
|
|
23
23
|
|
|
24
24
|
`HIVE_RELAY` is optional (defaults to the hosted relay).
|
|
25
25
|
|
|
26
|
-
###
|
|
26
|
+
### Setting it up: one command
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
```json
|
|
32
|
-
{ "mcpServers": { "hivecode": { "command": "npx", "args": ["-y", "hivecode-mcp"] } } }
|
|
28
|
+
```bash
|
|
29
|
+
npx -y hivecode-mcp@latest setup
|
|
33
30
|
```
|
|
34
31
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
This writes the hivecode entry into every agent app it finds (Claude Code, Antigravity, Cursor,
|
|
33
|
+
Windsurf, Claude Desktop, Gemini CLI), then launches each entry the way that app will and checks it
|
|
34
|
+
answers an MCP handshake. It installs a runtime copy under `~/.hivecode/runtime/<version>`, so the
|
|
35
|
+
agent app starts Hivecode with no download and no network.
|
|
36
|
+
|
|
37
|
+
Do not put `{"command": "npx", ...}` in an MCP config by hand. Agent apps start servers without a
|
|
38
|
+
shell, and on Windows `npx` is `npx.cmd`, so that entry fails with `spawn npx ENOENT`. Its first
|
|
39
|
+
start also downloads the package, which can outlast an app's start-up limit (Claude Code allows
|
|
40
|
+
30 seconds). If `setup` does not know your app, it prints the exact entry to use instead.
|
|
41
|
+
|
|
42
|
+
Because agent apps now start that installed copy, nothing updates it on its own. The server asks
|
|
43
|
+
npm once per start (in the background, never blocking) and, when a newer build is out, says so in
|
|
44
|
+
`hive_join` and `hive_status`, with the command to run: `npx -y hivecode-mcp@latest setup`. Mixed
|
|
45
|
+
versions in one room can lose data, so do not ignore it. `HIVE_PRIVATE=1` or
|
|
46
|
+
`HIVE_NO_UPDATE_CHECK=1` turns the check off.
|
|
39
47
|
|
|
40
48
|
## Tools the agent gets
|
|
41
49
|
|
package/docs/SELF_HOSTING.md
CHANGED
|
@@ -149,7 +149,7 @@ Cursor, Windsurf, or your own bot):
|
|
|
149
149
|
"mcpServers": {
|
|
150
150
|
"hivecode": {
|
|
151
151
|
"command": "npx",
|
|
152
|
-
"args": ["-y", "hivecode-mcp"],
|
|
152
|
+
"args": ["-y", "hivecode-mcp@latest"],
|
|
153
153
|
"env": {
|
|
154
154
|
"HIVE_RELAY": "wss://your-relay.example.com",
|
|
155
155
|
"HIVE_RELAY_PIN": "wss://your-relay.example.com"
|
|
@@ -201,8 +201,9 @@ relay. It is the evidence behind every claim on this page.
|
|
|
201
201
|
|---|---|
|
|
202
202
|
| `HIVE_AUTH_MODE=required` + `HIVE_JWT_SECRET=<secret>` | Every connection must present a valid token. This is your invite-only control. `npx hivecode-relay --secret <secret>` sets both. Mint tokens with `npx hivecode-token --room <room> --name <who> --role writer --ttl 7d` on the relay host, which is the only machine that holds the secret. See [RBAC.md](RBAC.md). |
|
|
203
203
|
| `HIVE_PERSIST_DIR=/var/data/hive` | **Important.** Without it a room lives only in connected clients' memory and is **lost the moment everyone disconnects** — the day works perfectly and the folder is empty in the morning. `npx hivecode-relay` turns this on by default; `node server.js` does not. |
|
|
204
|
-
| `HIVE_SEATS=<n>` |
|
|
204
|
+
| `HIVE_SEATS=<n>` | Per-room connection budget (8 per seat). It does **not** raise the whole-relay total — that is `HIVE_MAX_CONNS_TOTAL`. The free-tier ceiling is 8 per room, which is **not** 8 people — see below. |
|
|
205
205
|
| `HIVE_AUDIT_FILE=./audit.log` | One line per admit and reject. This is your evidence of who connected and when. |
|
|
206
|
+
| `HIVE_RELAY_MUX=off` | Turns off one-socket-per-participant mode. It is on by default; this is the kill switch, and clients already connected fall back to one socket per file by themselves. |
|
|
206
207
|
| `RENDER_EXTERNAL_URL` (auto on Render) | Keeps a free-tier host warm so the first join is not a 30-second cold start. |
|
|
207
208
|
|
|
208
209
|
> ⚠️ **An open relay on a public IP is a public relay.** Without `HIVE_AUTH_MODE=required`,
|
|
@@ -213,17 +214,19 @@ relay. It is the evidence behind every claim on this page.
|
|
|
213
214
|
|
|
214
215
|
## How much can one relay handle?
|
|
215
216
|
|
|
216
|
-
**Count
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
**Count sockets and open files, not people.** A current client holds **two sockets** — one for
|
|
218
|
+
the room, one carrying all of its files — and each open file is a channel on the second.
|
|
219
|
+
Clients on the older transport (the VS Code extension, the browser panel, `HIVE_MUX=0`, or any
|
|
220
|
+
client against a relay that predates this) still hold one base-room socket **plus one per open
|
|
221
|
+
file**, up to `1 + HIVE_MAX_OPEN_FILES` (default 128) each.
|
|
220
222
|
|
|
221
223
|
Two different ceilings refuse you, with two different remedies:
|
|
222
224
|
|
|
223
225
|
| You see | Meaning | Fix |
|
|
224
226
|
|---|---|---|
|
|
225
|
-
| **Q430** (503) | the whole relay is at `maxConnsTotal` (
|
|
227
|
+
| **Q430** (503) | the whole relay is at `maxConnsTotal` (default 2048, ~56 KB of memory each) | `HIVE_MAX_CONNS_TOTAL` — **`HIVE_SEATS` does not help here** |
|
|
226
228
|
| **Q431** (429) | one room is at its per-room cap | `HIVE_SEATS` |
|
|
229
|
+
| **Q438** (503) | open files across all participants are at `HIVE_MAX_CHANNELS_TOTAL` (default 8,192; ~25.8 KB each unshared, ~2.4 KB per extra participant) | `HIVE_MAX_CHANNELS_TOTAL`, with the memory to match |
|
|
227
230
|
|
|
228
231
|
- **A focused team (~10 humans and their agents in one room): comfortably**, on a small
|
|
229
232
|
always-on instance (≈1 vCPU / 1–2 GB). Free tiers are fine for a trial.
|