@deeplake/hivemind 0.6.48 → 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 (40) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +147 -20
  4. package/bundle/cli.js +552 -95
  5. package/codex/bundle/capture.js +509 -89
  6. package/codex/bundle/commands/auth-login.js +209 -66
  7. package/codex/bundle/embeddings/embed-daemon.js +243 -0
  8. package/codex/bundle/pre-tool-use.js +629 -104
  9. package/codex/bundle/session-start-setup.js +194 -57
  10. package/codex/bundle/session-start.js +25 -10
  11. package/codex/bundle/shell/deeplake-shell.js +679 -112
  12. package/codex/bundle/stop.js +476 -58
  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 +209 -66
  16. package/cursor/bundle/embeddings/embed-daemon.js +243 -0
  17. package/cursor/bundle/pre-tool-use.js +561 -70
  18. package/cursor/bundle/session-end.js +223 -2
  19. package/cursor/bundle/session-start.js +192 -54
  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 +771 -58
  23. package/hermes/bundle/commands/auth-login.js +209 -66
  24. package/hermes/bundle/embeddings/embed-daemon.js +243 -0
  25. package/hermes/bundle/pre-tool-use.js +560 -69
  26. package/hermes/bundle/session-end.js +224 -1
  27. package/hermes/bundle/session-start.js +195 -54
  28. package/hermes/bundle/shell/deeplake-shell.js +679 -112
  29. package/hermes/bundle/wiki-worker.js +572 -0
  30. package/mcp/bundle/server.js +253 -68
  31. package/openclaw/dist/chunks/auth-creds-AEKS6D3P.js +14 -0
  32. package/openclaw/dist/chunks/chunk-SRCBBT4H.js +37 -0
  33. package/openclaw/dist/chunks/config-G23NI5TV.js +33 -0
  34. package/openclaw/dist/chunks/index-marker-store-PGT5CW6T.js +33 -0
  35. package/openclaw/dist/chunks/setup-config-C35UK4LP.js +114 -0
  36. package/openclaw/dist/index.js +752 -702
  37. package/openclaw/openclaw.plugin.json +1 -1
  38. package/openclaw/package.json +1 -1
  39. package/package.json +2 -1
  40. package/pi/extension-source/hivemind.ts +473 -21
@@ -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.48"
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.48",
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.48",
4
+ "version": "0.7.4",
5
5
  "author": {
6
6
  "name": "Activeloop",
7
7
  "url": "https://deeplake.ai"
package/README.md CHANGED
@@ -37,7 +37,7 @@ 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
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.
@@ -45,19 +45,19 @@ That's it. The installer detects every supported assistant on your machine (Clau
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
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
55
55
  ```
56
56
 
57
57
  **Check what's wired up:**
58
58
 
59
59
  ```bash
60
- npx @deeplake/hivemind@latest status
60
+ hivemind status
61
61
  ```
62
62
 
63
63
  **Supported assistants:**
@@ -150,7 +150,7 @@ Restart Codex to activate.
150
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.
151
151
 
152
152
  ```bash
153
- npx @deeplake/hivemind@latest cursor install
153
+ hivemind cursor install
154
154
  ```
155
155
 
156
156
  Auto-capture is enabled the same way as Claude Code / Codex / OpenClaw.
@@ -159,29 +159,31 @@ Auto-capture is enabled the same way as Claude Code / Codex / OpenClaw.
159
159
  <details>
160
160
  <summary><b>Hermes Agent</b></summary>
161
161
 
162
- 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.
163
163
 
164
164
  ```bash
165
- npx @deeplake/hivemind@latest hermes install
165
+ hivemind hermes install
166
166
  ```
167
167
  </details>
168
168
 
169
169
  <details>
170
170
  <summary><b>pi (badlogic/pi-mono coding-agent)</b></summary>
171
171
 
172
- 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.
173
173
 
174
174
  ```bash
175
- npx @deeplake/hivemind@latest pi install
175
+ hivemind pi install
176
176
  ```
177
+
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.
177
179
  </details>
178
180
 
179
181
 
180
182
  ### Uninstall
181
183
 
182
184
  ```bash
183
- npx @deeplake/hivemind@latest uninstall # remove from every detected assistant
184
- npx @deeplake/hivemind@latest codex uninstall # remove from one
185
+ hivemind uninstall # remove from every detected assistant
186
+ hivemind codex uninstall # remove from one
185
187
  ```
186
188
 
187
189
  ## How it works
@@ -271,8 +273,126 @@ This plugin captures session activity and stores it in your Deeplake workspace:
271
273
  | `HIVEMIND_SESSIONS_TABLE` | `sessions` | SQL table for per-event session capture |
272
274
  | `HIVEMIND_MEMORY_PATH` | `~/.deeplake/memory` | Path that triggers interception |
273
275
  | `HIVEMIND_CAPTURE` | `true` | Set to `false` to disable capture |
276
+ | `HIVEMIND_EMBEDDINGS` | `true` | Set to `false` to force lexical-only mode |
274
277
  | `HIVEMIND_DEBUG` | — | Set to `1` for verbose hook debug logs |
275
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
+
276
396
  ## Architecture
277
397
 
278
398
  ### Integration model per agent
@@ -294,13 +414,20 @@ hivemind/
294
414
  │ ├── hooks/ ← Claude Code hooks
295
415
  │ ├── hooks/codex/ ← Codex hooks
296
416
  │ ├── hooks/cursor/ ← Cursor hooks
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
297
420
  │ ├── mcp/ ← MCP server (used by Hermes; available to any future MCP-aware client)
421
+ │ ├── commands/ ← auth, auth-creds, auth-login, session-prune
298
422
  │ └── cli/ ← unified `hivemind install` CLI + per-agent installers
299
423
  ├── claude-code/ ← Claude Code plugin source (marketplace-distributed)
300
- ├── openclaw/ OpenClaw plugin source
301
- ├── codex/ Codex plugin source
302
- ├── cursor/ ← Cursor plugin source
303
- └── 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
304
431
  ```
305
432
 
306
433
  ## Security