@deeplake/hivemind 0.6.47 → 0.7.4

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.
Files changed (41) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +158 -51
  4. package/bundle/cli.js +4103 -282
  5. package/codex/bundle/capture.js +510 -90
  6. package/codex/bundle/commands/auth-login.js +219 -72
  7. package/codex/bundle/embeddings/embed-daemon.js +243 -0
  8. package/codex/bundle/pre-tool-use.js +713 -108
  9. package/codex/bundle/session-start-setup.js +209 -58
  10. package/codex/bundle/session-start.js +40 -11
  11. package/codex/bundle/shell/deeplake-shell.js +679 -112
  12. package/codex/bundle/stop.js +477 -59
  13. package/codex/bundle/wiki-worker.js +312 -11
  14. package/cursor/bundle/capture.js +768 -57
  15. package/cursor/bundle/commands/auth-login.js +219 -72
  16. package/cursor/bundle/embeddings/embed-daemon.js +243 -0
  17. package/cursor/bundle/pre-tool-use.js +1684 -0
  18. package/cursor/bundle/session-end.js +223 -2
  19. package/cursor/bundle/session-start.js +209 -57
  20. package/cursor/bundle/shell/deeplake-shell.js +679 -112
  21. package/cursor/bundle/wiki-worker.js +571 -0
  22. package/hermes/bundle/capture.js +1194 -0
  23. package/hermes/bundle/commands/auth-login.js +1009 -0
  24. package/hermes/bundle/embeddings/embed-daemon.js +243 -0
  25. package/hermes/bundle/package.json +1 -0
  26. package/hermes/bundle/pre-tool-use.js +1681 -0
  27. package/hermes/bundle/session-end.js +265 -0
  28. package/hermes/bundle/session-start.js +655 -0
  29. package/hermes/bundle/shell/deeplake-shell.js +69905 -0
  30. package/hermes/bundle/wiki-worker.js +572 -0
  31. package/mcp/bundle/server.js +289 -69
  32. package/openclaw/dist/chunks/auth-creds-AEKS6D3P.js +14 -0
  33. package/openclaw/dist/chunks/chunk-SRCBBT4H.js +37 -0
  34. package/openclaw/dist/chunks/config-G23NI5TV.js +33 -0
  35. package/openclaw/dist/chunks/index-marker-store-PGT5CW6T.js +33 -0
  36. package/openclaw/dist/chunks/setup-config-C35UK4LP.js +114 -0
  37. package/openclaw/dist/index.js +752 -702
  38. package/openclaw/openclaw.plugin.json +1 -1
  39. package/openclaw/package.json +1 -1
  40. package/package.json +7 -3
  41. package/pi/extension-source/hivemind.ts +807 -0
@@ -6,13 +6,13 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Cloud-backed persistent shared memory for AI agents powered by Deeplake",
9
- "version": "0.6.47"
9
+ "version": "0.7.4"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "hivemind",
14
14
  "description": "Persistent shared memory powered by Deeplake — captures all session activity and provides cross-session, cross-agent memory search",
15
- "version": "0.6.47",
15
+ "version": "0.7.4",
16
16
  "source": "./claude-code",
17
17
  "homepage": "https://github.com/activeloopai/hivemind"
18
18
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hivemind",
3
3
  "description": "Cloud-backed persistent memory powered by Deeplake — read, write, and share memory across Claude Code sessions and agents",
4
- "version": "0.6.47",
4
+ "version": "0.7.4",
5
5
  "author": {
6
6
  "name": "Activeloop",
7
7
  "url": "https://deeplake.ai"
package/README.md CHANGED
@@ -17,7 +17,7 @@
17
17
  </p>
18
18
 
19
19
  <p align="center">
20
- Persistent, cloud-backed shared memory for <b>Claude Code • OpenClaw • Codex • Cursor • Hermes • pi • Cline • Roo • Kilo</b> agents.<br>
20
+ Persistent, cloud-backed shared memory for <b>Claude Code • OpenClaw • Codex • Cursor • Hermes • pi</b> agents.<br>
21
21
  </p>
22
22
 
23
23
  > One session ends, everything important disappears.
@@ -37,45 +37,39 @@ Hivemind automatically captures every prompt, tool call, decision, and file oper
37
37
  One command, all your agents:
38
38
 
39
39
  ```bash
40
- npx @deeplake/hivemind@latest install
40
+ npm install -g @deeplake/hivemind && hivemind install
41
41
  ```
42
42
 
43
- That's it. The installer detects every supported assistant on your machine (Claude Code, Codex, OpenClaw, Cursor, Hermes Agent, pi, Cline, Roo Code, Kilo Code), wires up the hooks or MCP server, and opens a browser once for login. Restart your assistants and they all share the same brain.
43
+ That's it. The installer detects every supported assistant on your machine (Claude Code, Codex, OpenClaw, Cursor, Hermes Agent, pi), wires up the hooks, and opens a browser once for login. Restart your assistants and they all share the same brain.
44
44
 
45
45
  **Install for a specific assistant only:**
46
46
 
47
47
  ```bash
48
- npx @deeplake/hivemind@latest install --only claude
49
- npx @deeplake/hivemind@latest claude install # equivalent
50
- npx @deeplake/hivemind@latest codex install
51
- npx @deeplake/hivemind@latest claw install
52
- npx @deeplake/hivemind@latest cursor install
53
- npx @deeplake/hivemind@latest hermes install
54
- npx @deeplake/hivemind@latest pi install
55
- npx @deeplake/hivemind@latest cline install
56
- npx @deeplake/hivemind@latest roo install
57
- npx @deeplake/hivemind@latest kilo install
48
+ hivemind install --only claude
49
+ hivemind claude install # equivalent
50
+ hivemind codex install
51
+ hivemind claw install
52
+ hivemind cursor install
53
+ hivemind hermes install
54
+ hivemind pi install
58
55
  ```
59
56
 
60
57
  **Check what's wired up:**
61
58
 
62
59
  ```bash
63
- npx @deeplake/hivemind@latest status
60
+ hivemind status
64
61
  ```
65
62
 
66
63
  **Supported assistants:**
67
64
 
68
- | Platform | Integration | Auto-capture | Auto-recall |
69
- |------------------|---------------------------|--------------|-------------|
70
- | **Claude Code** | Marketplace plugin | ✅ | ✅ |
71
- | **OpenClaw** | Native extension | ✅ | ✅ |
72
- | **Codex** | Hooks (`hooks.json`) | ✅ | ✅ |
73
- | **Cursor** | Hooks (`hooks.json` 1.7+) | ✅ | ✅ |
74
- | **Hermes Agent** | Skill (`agentskills.io`) | | via grep |
75
- | **pi** | Skill + AGENTS.md | | via grep |
76
- | **Cline** | MCP server | — | ✅ |
77
- | **Roo Code** | MCP server | — | ✅ |
78
- | **Kilo Code** | MCP server | — | ✅ |
65
+ | Platform | Integration | Auto-capture | Auto-recall |
66
+ |------------------|--------------------------------------------------|--------------|-------------|
67
+ | **Claude Code** | Marketplace plugin | ✅ | ✅ |
68
+ | **OpenClaw** | Native extension | ✅ | ✅ |
69
+ | **Codex** | Hooks (`hooks.json`) | ✅ | ✅ |
70
+ | **Cursor** | Hooks (`hooks.json` 1.7+) | ✅ | ✅ |
71
+ | **Hermes Agent** | Shell hooks (`config.yaml`) + skill + MCP server | | |
72
+ | **pi** | Extension API (`pi.on(...)`) + skill + AGENTS.md | | |
79
73
 
80
74
  ### Alternative install paths
81
75
 
@@ -156,7 +150,7 @@ Restart Codex to activate.
156
150
  The unified installer wires six lifecycle events in `~/.cursor/hooks.json` — sessionStart, beforeSubmitPrompt, postToolUse, afterAgentResponse, stop, sessionEnd. Hooks fork a Node bundle at `~/.cursor/hivemind/bundle/` per event. Restart Cursor after install to load.
157
151
 
158
152
  ```bash
159
- npx @deeplake/hivemind@latest cursor install
153
+ hivemind cursor install
160
154
  ```
161
155
 
162
156
  Auto-capture is enabled the same way as Claude Code / Codex / OpenClaw.
@@ -165,42 +159,31 @@ Auto-capture is enabled the same way as Claude Code / Codex / OpenClaw.
165
159
  <details>
166
160
  <summary><b>Hermes Agent</b></summary>
167
161
 
168
- Drops an `agentskills.io`-compatible skill at `~/.hermes/skills/hivemind-memory/`. Recall is via direct grep on `~/.deeplake/memory/`. Auto-capture is not yet supported (Hermes' lifecycle-hook surface isn't documented at the time of writing).
162
+ Wires shell hooks into `~/.hermes/config.yaml` (`pre_llm_call` / `post_tool_call` / `post_llm_call` / `on_session_end`) for auto-capture, drops the bundle at `~/.hermes/hivemind/bundle/`, registers the shared MCP server (`~/.hivemind/mcp/server.js`) under `mcp_servers.hivemind`, and installs an `agentskills.io`-compatible skill at `~/.hermes/skills/hivemind-memory/` for recall.
169
163
 
170
164
  ```bash
171
- npx @deeplake/hivemind@latest hermes install
165
+ hivemind hermes install
172
166
  ```
173
167
  </details>
174
168
 
175
169
  <details>
176
170
  <summary><b>pi (badlogic/pi-mono coding-agent)</b></summary>
177
171
 
178
- Drops `~/.pi/agent/AGENTS.md` (idempotent BEGIN/END marker block) plus a skill at `~/.pi/agent/skills/hivemind-memory/`. Recall is via direct grep on `~/.deeplake/memory/`.
172
+ Upserts an idempotent BEGIN/END marker block into `~/.pi/agent/AGENTS.md` (auto-loaded every turn) and drops a TypeScript extension at `~/.pi/agent/extensions/hivemind.ts`. The extension subscribes to pi's lifecycle events (`session_start` / `input` / `tool_result` / `message_end`) for auto-capture and registers `hivemind_search`, `hivemind_read`, `hivemind_index` as first-class pi tools.
179
173
 
180
174
  ```bash
181
- npx @deeplake/hivemind@latest pi install
182
- ```
183
- </details>
184
-
185
- <details>
186
- <summary><b>Cline / Roo Code / Kilo Code (MCP-based)</b></summary>
187
-
188
- Each MCP-aware editor extension gets a registered server entry pointing at the shared Hivemind MCP server at `~/.hivemind/mcp/server.js`. The server exposes three tools — `hivemind_search`, `hivemind_read`, `hivemind_index` — that the agent can call when it needs to recall org memory.
189
-
190
- ```bash
191
- npx @deeplake/hivemind@latest cline install # ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
192
- npx @deeplake/hivemind@latest roo install # ~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json
193
- npx @deeplake/hivemind@latest kilo install # ~/.kilocode/mcp.json
175
+ hivemind pi install
194
176
  ```
195
177
 
196
- The MCP server is shared across all three one binary, three configs. Auto-capture is not exposed via MCP; recall is on-demand only.
178
+ Note: no per-agent SKILL.md is dropped under `~/.pi/agent/skills/` — pi reads skills from both that directory AND the shared `~/.agents/skills/` location. If the codex installer has run on the same machine, pi picks up the hivemind skill from the shared `~/.agents/skills/hivemind-memory` symlink automatically. The AGENTS.md block plus the registered tools cover the action surface in either case.
197
179
  </details>
198
180
 
181
+
199
182
  ### Uninstall
200
183
 
201
184
  ```bash
202
- npx @deeplake/hivemind@latest uninstall # remove from every detected assistant
203
- npx @deeplake/hivemind@latest codex uninstall # remove from one
185
+ hivemind uninstall # remove from every detected assistant
186
+ hivemind codex uninstall # remove from one
204
187
  ```
205
188
 
206
189
  ## How it works
@@ -290,8 +273,126 @@ This plugin captures session activity and stores it in your Deeplake workspace:
290
273
  | `HIVEMIND_SESSIONS_TABLE` | `sessions` | SQL table for per-event session capture |
291
274
  | `HIVEMIND_MEMORY_PATH` | `~/.deeplake/memory` | Path that triggers interception |
292
275
  | `HIVEMIND_CAPTURE` | `true` | Set to `false` to disable capture |
276
+ | `HIVEMIND_EMBEDDINGS` | `true` | Set to `false` to force lexical-only mode |
293
277
  | `HIVEMIND_DEBUG` | — | Set to `1` for verbose hook debug logs |
294
278
 
279
+ ## Optional: enable semantic search (embeddings)
280
+
281
+ Hivemind can run a local embedding daemon (nomic-embed-text-v1.5, ~130 MB)
282
+ so that `Grep` over `~/.deeplake/memory/` uses hybrid semantic + lexical
283
+ ranking instead of pure BM25. This is **off by default** — the daemon
284
+ depends on `@huggingface/transformers`, which pulls onnxruntime-node and
285
+ sharp (~600 MB total with native binaries). Shipping that with every agent
286
+ install would 60× the install size for a feature most users don't need.
287
+
288
+ To enable, run the bundled command:
289
+
290
+ ```bash
291
+ hivemind embeddings install
292
+ ```
293
+
294
+ This installs `@huggingface/transformers` **once** into a shared directory
295
+ (`~/.hivemind/embed-deps/`) and symlinks every detected agent's plugin to
296
+ it, so the 600 MB cost is paid one time regardless of how many agents you
297
+ have wired up. Re-run the same command after installing a new agent and
298
+ the new symlink is added (the npm install is skipped because it's cached).
299
+
300
+ Or do it in one shot at install time:
301
+
302
+ ```bash
303
+ hivemind install --with-embeddings # all detected agents
304
+ hivemind <agent> install --with-embeddings # a single agent
305
+ ```
306
+
307
+ Other commands:
308
+
309
+ ```bash
310
+ hivemind embeddings status # show shared deps + per-agent state
311
+ hivemind embeddings uninstall # remove the per-agent symlinks
312
+ hivemind embeddings uninstall --prune # also delete the shared dir (~600 MB)
313
+ ```
314
+
315
+ Restart your agents after enabling. From the next session, captured
316
+ messages and AI-generated summaries will include a 768-dim embedding,
317
+ and semantic recall queries will route through the local daemon (the
318
+ nomic model is downloaded on first use and cached in `~/.cache/huggingface/`).
319
+
320
+ If `@huggingface/transformers` is **not** present, Hivemind silently
321
+ degrades to lexical-only mode:
322
+
323
+ - ✅ Capture continues; rows still land in Deeplake.
324
+ - ✅ `Grep` still works via BM25 / `ILIKE` matching on text columns.
325
+ - ⚪ The `message_embedding` / `summary_embedding` columns stay `NULL`.
326
+ - ⚪ The hook log notes `embeddings: no-transformers` once at session start.
327
+
328
+ You can also force lexical-only mode explicitly with
329
+ `HIVEMIND_EMBEDDINGS=false` (useful for CI or air-gapped environments).
330
+
331
+ ## Summaries
332
+
333
+ Hivemind doesn't just capture raw events — it also generates an
334
+ **AI-written wiki summary** for each session and stores it in the
335
+ `memory` table (alongside its 768-dim `summary_embedding`). The summary
336
+ is what shows up when you `Grep` for past sessions or follow links from
337
+ `~/.deeplake/memory/index.md`.
338
+
339
+ ### When summaries are written
340
+
341
+ Each agent (Claude Code / Codex / Cursor / Hermes / pi) fires a wiki
342
+ worker on two triggers:
343
+
344
+ | Trigger | When it fires |
345
+ |-------------------|-------------------------------------------------------------------------------|
346
+ | **Final** | At session end (Stop / SessionEnd / session_shutdown), once. |
347
+ | **Periodic** | Mid-session, when **either** of two thresholds is hit since the last summary: |
348
+ | | • messages-since-last-summary ≥ `HIVEMIND_SUMMARY_EVERY_N_MSGS` (default 50) |
349
+ | | • elapsed time ≥ `HIVEMIND_SUMMARY_EVERY_HOURS` (default 2) |
350
+
351
+ The first message after a long pause therefore triggers a fresh
352
+ summary; long sessions naturally checkpoint every ~50 messages.
353
+
354
+ A per-session JSON sidecar at
355
+ `~/.claude/hooks/summary-state/<sessionId>.json` tracks
356
+ `{lastSummaryAt, lastSummaryCount, totalCount}`. The dir is shared
357
+ across all agents (session ids are UUIDs so no collisions). It is
358
+ **never deleted**, so resuming a session via `--resume` / `--continue`
359
+ picks up where it left off.
360
+
361
+ ### How a summary is generated
362
+
363
+ 1. The wiki worker queries the `sessions` table for every event tied to
364
+ that session.
365
+ 2. It builds a structured prompt asking the host agent's CLI to extract
366
+ entities, decisions, files modified, open questions, etc.
367
+ 3. It shells out to that agent's CLI (`claude -p`, `codex exec`,
368
+ `pi --print`, …) with the prompt — never a separate API key, the
369
+ agent's existing credentials are used.
370
+ 4. The generated markdown is uploaded to the `memory` table at
371
+ `/summaries/<user>/<sessionId>.md`. The shared embedding daemon
372
+ produces the 768-dim `summary_embedding` so the summary is recallable
373
+ via semantic search.
374
+
375
+ A lock file at `~/.claude/hooks/summary-state/<sessionId>.lock`
376
+ prevents two workers from running concurrently for the same session.
377
+
378
+ ### Configuration
379
+
380
+ | Env var | Default | Effect |
381
+ |------------------------------------|----------------|-----------------------------------------------------|
382
+ | `HIVEMIND_SUMMARY_EVERY_N_MSGS` | `50` | Trigger periodic when messages-since-last ≥ this |
383
+ | `HIVEMIND_SUMMARY_EVERY_HOURS` | `2` | Trigger periodic after this many hours, with ≥1 msg |
384
+ | `HIVEMIND_CURSOR_MODEL` | `auto` | (cursor only) model passed to `cursor-agent --print --model` |
385
+ | `HIVEMIND_HERMES_PROVIDER` | `openrouter` | (hermes only) provider passed to `hermes -z --provider` |
386
+ | `HIVEMIND_HERMES_MODEL` | `anthropic/claude-haiku-4-5` | (hermes only) model passed to `hermes -z -m` |
387
+ | `HIVEMIND_PI_PROVIDER` | `google` | (pi only) provider passed to `pi --print --provider`|
388
+ | `HIVEMIND_PI_MODEL` | `gemini-2.5-flash` | (pi only) model passed to `pi --print --model` |
389
+ | `HIVEMIND_CAPTURE=false` | unset | Disable both capture and summary generation |
390
+
391
+ For pi specifically, the wiki worker is bundled separately at
392
+ `~/.pi/agent/hivemind/wiki-worker.js` (deposited by `hivemind pi install`).
393
+ The other agents ship the wiki worker inside their per-agent plugin
394
+ bundle.
395
+
295
396
  ## Architecture
296
397
 
297
398
  ### Integration model per agent
@@ -304,7 +405,6 @@ This plugin captures session activity and stores it in your Deeplake workspace:
304
405
  | **Cursor (1.7+)** | `~/.cursor/hooks.json` | `sessionStart` · `beforeSubmitPrompt` · `postToolUse` · `afterAgentResponse` · `stop` · `sessionEnd` |
305
406
  | **Hermes** | Skill at `~/.hermes/skills/hivemind-memory/` | recall via grep on `~/.deeplake/memory/` |
306
407
  | **pi** | `~/.pi/agent/AGENTS.md` + skill | recall via grep on `~/.deeplake/memory/` |
307
- | **Cline · Roo · Kilo** | MCP server at `~/.hivemind/mcp/server.js` | `hivemind_search` · `hivemind_read` · `hivemind_index` |
308
408
 
309
409
  ### Monorepo structure
310
410
 
@@ -314,13 +414,20 @@ hivemind/
314
414
  │ ├── hooks/ ← Claude Code hooks
315
415
  │ ├── hooks/codex/ ← Codex hooks
316
416
  │ ├── hooks/cursor/ ← Cursor hooks
317
- │ ├── mcp/ MCP server (shared by Cline / Roo / Kilo)
417
+ │ ├── hooks/hermes/ Hermes shell hooks
418
+ │ ├── hooks/pi/ ← pi wiki-worker (extension lives in pi/extension-source/)
419
+ │ ├── embeddings/ ← nomic embed-daemon + protocol + SQL helpers
420
+ │ ├── mcp/ ← MCP server (used by Hermes; available to any future MCP-aware client)
421
+ │ ├── commands/ ← auth, auth-creds, auth-login, session-prune
318
422
  │ └── cli/ ← unified `hivemind install` CLI + per-agent installers
319
423
  ├── claude-code/ ← Claude Code plugin source (marketplace-distributed)
320
- ├── openclaw/ OpenClaw plugin source
321
- ├── codex/ Codex plugin source
322
- ├── cursor/ ← Cursor plugin source
323
- └── mcp/ ← MCP server build output
424
+ ├── codex/ Codex plugin build output (npm-distributed)
425
+ ├── cursor/ Cursor plugin build output (npm-distributed)
426
+ ├── hermes/ ← Hermes plugin build output (npm-distributed)
427
+ ├── mcp/ ← MCP server build output (shared by Hermes + future MCP clients)
428
+ ├── openclaw/ ← OpenClaw plugin source + build output (ClawHub-distributed)
429
+ ├── pi/ ← pi extension source (ships raw .ts; pi compiles at load)
430
+ └── bundle/ ← unified `hivemind` CLI build output
324
431
  ```
325
432
 
326
433
  ## Security