MCPcopy Index your code
hub / github.com/activeloopai/hivemind

github.com/activeloopai/hivemind @v0.7.118

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.7.118 ↗ · + Follow
2,497 symbols 7,976 edges 495 files 229 documented · 9% updated 5d agov0.7.118 · 2026-07-02★ 1,45028 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Hivemind Hivemind

One brain for all your agents

npm GitHub stars License Node Deeplake Y Combinator backed Join us on Slack

Auto-learning, cloud-backed shared brain for Claude Code • OpenClaw • Codex • Cursor • Hermes • pi • Claude Cowork (Alpha) agents.

activeloopai/hivemind | Trendshift

One engineer's agent figures out a tricky migration on Monday.

Tuesday, every agent on the team can execute the pattern.

On LoCoMo, the public long-context memory benchmark, Hivemind is 25% cheaper, 1.7× fewer tokens, and 31% fewer turns than running without shared memory. (See the numbers below.)

Cut Cursor spend by 34% with Hivemind

Beyond memory. Hivemind doesn't just remember. It mines your team's traces for repeated patterns and codifies them into reusable skills that propagate back into every agent on the team. The agent your junior engineer used this morning is sharper because of what your senior engineer's agent figured out last week.

  • 📥 Captures every session's prompts, tool calls, and responses as structured traces in Deeplake
  • 🧠 Codifies patterns into reusable SKILL.md files, available to every agent on your team
  • 🔍 Searches traces and skills with hybrid lexical + semantic retrieval (BM25 fallback when embeddings off)
  • 🔗 Propagates capability across sessions, agents, teammates, and machines in real time
  • 📁 Intercepts file operations on ~/.deeplake/memory/ through a virtual filesystem backed by SQL
  • 📝 Summarizes sessions into AI-generated wiki pages via a background worker at session end
  • ☁️ BYOC: keep data in your own GCS, Azure, S3, or on-prem bucket. See Security & storage

Benchmarks

On the LoCoMo long-context memory benchmark (100 QA pairs, Claude Haiku via claude -p, hybrid lexical + semantic retrieval), Hivemind cuts cost, tokens, and turns versus a no-memory baseline:

Metric Baseline Hivemind Improvement
Cost / 100 QA $8.94 $6.65 25% cheaper
Tokens / question 1,700 1,008 1.7× fewer
Turns / question 8.9 6.2 31% fewer

The agent reaches the answer in fewer turns with less context, because the prior work is already in scope at recall time, not re-derived per session.

Quick start

One command, all your agents:

npm i -g @deeplake/hivemind && hivemind install

The installer detects every supported assistant on your machine (table below), wires up the hooks, and shows a one-line consent prompt before opening a browser for sign-in. Restart your assistants after install.

Headless / CI installs: pass an API token instead of using the browser flow:

HIVEMIND_TOKEN=<your-token> hivemind install
# or
hivemind install --token <your-token>

Get a token from your account settings on https://deeplake.ai. With no token in a non-interactive shell, the install completes with hooks but skips sign-in; run hivemind login later to enable shared memory.

Install for a specific assistant only:

hivemind install --only claude
hivemind claude install    # equivalent
hivemind codex install
hivemind claw install
hivemind cursor install
hivemind hermes install
hivemind pi install
hivemind claude_cowork install   # Alpha

Check what's wired up:

hivemind status

Supported assistants:

Platform Integration Auto-capture Auto-recall
Claude Code Marketplace plugin
OpenClaw Native extension
Codex Hooks (hooks.json)
Cursor Hooks (hooks.json 1.7+)
Hermes Agent Shell hooks (config.yaml) + skill + MCP server
pi Extension API (pi.on(...)) + skill + AGENTS.md
Claude Cowork 🅰️ MCP server (Claude Desktop) 🅰️ Alpha¹

🅰️ Claude Cowork is Alpha. Auto-recall (the hivemind_search / read / index tools) is solid. ¹Auto-capture covers Local Agent Mode sessions only — those write a transcript we can tail; plain desktop-chat turns leave no readable local trace and aren't captured (why).

Alternative install paths

Claude Code plugin marketplace

If you prefer Claude Code's native plugin marketplace:

/plugin marketplace add activeloopai/hivemind
/plugin install hivemind
/reload-plugins
/hivemind:login

Auto-updates on each session start. Manual update: /hivemind:update.

OpenClaw ClawHub

openclaw plugins install clawhub:hivemind

Then type /hivemind_login in chat, click the auth link, and sign in.

Commands

Command Description
/hivemind_login Sign in via device flow
/hivemind_capture Toggle capture on/off
/hivemind_whoami Show current org and workspace
/hivemind_orgs List organizations
/hivemind_switch_org <name> Switch organization
/hivemind_workspaces List workspaces
/hivemind_switch_workspace <id> Switch workspace
/hivemind_update Check for plugin updates

Auto-recall and auto-capture are enabled by default. Data is stored in the same sessions table as Claude Code and Codex.

Coexistence with memory-core

Hivemind runs alongside OpenClaw's built-in memory-core plugin. It does not claim the memory slot, so memory-core's dreaming cron ("0 3 * * *") and other memory-slot-dependent jobs keep working. Hivemind captures session activity and exposes its own commands; memory-core keeps owning recall/promotion/dreaming.

Troubleshooting

  • Hivemind seems slow or unresponsive. Check the agent model in ~/.openclaw/openclaw.json under agents.defaults.model. Hivemind makes many small tool calls per turn; a large reasoning model like Opus will feel sluggish. Recommended default: anthropic/claude-haiku-4-5-20251001.
  • openclaw model <id> says "plugins.allow excludes model". The model plugin CLI is disabled by default. Edit ~/.openclaw/openclaw.json directly (key agents.defaults.model) and restart the gateway: systemctl --user restart openclaw-gateway.service.
  • Model switch rejected as "not allowed". Use the exact dated provider-prefixed ID (anthropic/claude-haiku-4-5-20251001, anthropic/claude-sonnet-4-6). Legacy IDs like claude-3-5-haiku-latest and unprefixed bare IDs are not on OpenClaw's allowlist.
  • Self-update via Telegram fails with "elevated is not available". tools.elevated.allowFrom must include telegram before elevated commands work from that channel. Safer alternative: run the upgrade in a local shell with openclaw plugins update hivemind.
  • npm error EACCES during self-update. OpenClaw was installed under a root-owned npm prefix (e.g. /usr/lib/node_modules/openclaw). Reinstall under a user-writable prefix, or run the update with appropriate privileges locally, not via a channel.

Codex (manual)

Tell Codex to fetch and follow the install instructions:

Fetch and follow instructions from https://raw.githubusercontent.com/activeloopai/hivemind/main/harnesses/codex/INSTALL.md

Or run the installer script directly:

git clone https://github.com/activeloopai/hivemind.git ~/.codex/hivemind
~/.codex/hivemind/harnesses/codex/install.sh

Restart Codex to activate.

First launch — trust the hooks. Codex shows a "Hooks need review" prompt before it will run hivemind's hooks:

Hooks need review
2 hooks are new or changed.
Hooks can run outside the sandbox after you trust them.

   1. Review hooks
 › 2. Trust all and continue
   3. Continue without trusting (hooks won't run)

Choose 2. Trust all and continue — otherwise the hooks won't run and hivemind stays inactive.

Cursor (1.7+)

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.

hivemind cursor install

Auto-capture is enabled the same way as Claude Code / Codex / OpenClaw.

Hermes Agent

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.

hivemind hermes install

pi (badlogic/pi-mono coding-agent)

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.

hivemind pi install

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.

Claude Cowork (Alpha)

Claude Cowork is Anthropic's agentic assistant inside the Claude Desktop app. It has no hook lifecycle like the other agents — it only talks to Hivemind through MCP — so the integration works differently and ships as Alpha.

hivemind claude_cowork install

This registers the shared MCP server (~/.hivemind/mcp/server.js) under mcpServers.hivemind in Claude Desktop's claude_desktop_config.json. Fully quit and reopen Claude Desktop to load it.

Recall (stable). Cowork gains hivemind_search, hivemind_read, and hivemind_index — the same shared memory every other agent reads. On the first tool use per host, a one-time data-collection notice is prepended to the result.

Auto-capture (Alpha) — how it works. With no SessionStart/Stop hooks to capture from, the MCP server runs a background ingester that tails Cowork's Local Agent Mode transcripts (~/Library/Application Support/Claude/local-agent-mode-sessions/**/.claude/projects/<enc>/<sessionId>.jsonl). For each new line it writes a row to the sessions table with agent="claude_cowork" (user prompts, assistant messages, tool calls + results), de-duplicated by a per-transcript line watermark. When a transcript has been idle for 5 minutes it is treated as finished, and the same wiki-worker / skillify workers every other agent uses run for it (summary tagged claude_cowork → it shows up in hivemind_index).

Known limitation. Only Local Agent Mode sessions (where Cowork opens its sandbox/agent and works) write a transcript we can read. Plain desktop-chat turns are not captured: by MCP design a server never sees the conversation (only the tool calls the model makes), and the chat itself lives in Anthropic's cloud + a compresse

Extension points exported contracts — how you extend this code

TSNode (Interface)
* Minimal subset of the tree-sitter Node interface we rely on. The npm package * doesn't ship robust TypeScript types,
src/graph/extract/typescript.ts
QueryRule (Interface)
* Unit-level mirror of the 7 schema/upgrade scenarios the plugin must * survive. Where scenario-matrix.sh measures the
tests/shared/schema-scenarios.test.ts
SummaryEmbedder (Interface)
(no doc) [1 implementers]
src/embeddings/embed-summary.ts
SessionQueueApi (Interface)
(no doc) [1 implementers]
src/hooks/session-queue.ts
WriteRow (Interface)
(no doc)
src/deeplake-api.ts
Config (Interface)
(no doc)
src/config.ts
UserConfig (Interface)
(no doc)
src/user-config.ts
ColumnDef (Interface)
(no doc)
src/deeplake-schema.ts

Core symbols most depended-on inside this repo

log
called by 425
embeddings/embed-daemon.js
get
called by 185
harnesses/openclaw/src/index.ts
sqlStr
called by 158
src/utils/sql.ts
error
called by 102
harnesses/openclaw/src/index.ts
on
called by 95
harnesses/openclaw/src/index.ts
query
called by 93
src/hooks/session-queue.ts
extractTypeScript
called by 87
src/graph/extract/typescript.ts
parseBashGrep
called by 79
src/hooks/grep-direct.ts

Shape

Function 1,871
Interface 310
Method 224
Class 92

Languages

TypeScript100%

Modules by API surface

src/shell/deeplake-fs.ts54 symbols
harnesses/pi/extension-source/hivemind.ts48 symbols
harnesses/openclaw/src/index.ts44 symbols
src/deeplake-api.ts43 symbols
src/hooks/session-queue.ts39 symbols
src/graph/extract/typescript.ts30 symbols
src/hooks/summary-state.ts28 symbols
src/graph/extract/python.ts27 symbols
src/commands/graph.ts27 symbols
src/shell/grep-core.ts24 symbols
embeddings/embed-daemon.js24 symbols
src/embeddings/client.ts22 symbols

For agents

$ claude mcp add hivemind \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page