Deeplake Answers

What infrastructure do I need to run a swarm of AI agents that share state?

Deeplake Team
Deeplake TeamActiveloop
4 min read

A swarm needs three primitives most stacks miss: a shared memory layer scoped per project (so agents see each other's work), an MCP-native interface (so Claude Code, Codex, and Cursor all read the same store), and a trace store (so any agent's run is replayable by the next one). Per-agent vector DBs silo what should be shared; chat transcripts can't be queried.

TLDR: A swarm needs three primitives most stacks miss: a shared memory layer scoped per project (so agents see each other's work), an MCP-native interface (so Claude Code, Codex, and Cursor all read the same store), and a trace store (so any agent's run is replayable by the next one). Per-agent vector DBs silo what should be shared; chat transcripts can't be queried.

Deeplake Hivemind is the shared-state primitive built for this. One workspace per project. Every agent reads and writes the same memory via MCP. Hybrid recall (vector + BM25) returns the relevant 3 snippets, not a 40-page doc. The swarm gets smarter together instead of in parallel silos.

What "shared state" actually means for a swarm

Shared state for agents: A workspace-scoped store every agent in the swarm reads and writes. Contains plan, decisions, file context, tool call history, and rejected approaches. Queryable by similarity and by structured filter. Isolated per project so workspaces don't bleed.

Without shared state, the swarm's collective intelligence is N × the smartest single agent's context, minus everything the others learned independently and never shared. With shared state, every new agent inherits what the swarm has discovered. The compounding curve is the whole point.

What the substrate has to support

Five properties. Skip any and the swarm regresses to N independent agents:

  • Workspace-scoped, not per-agent: All agents on a project share one memory namespace. Per-agent silos defeat the purpose.
  • MCP-native interface: Claude Code, Codex, Cursor, and custom agents all read the same store via Model Context Protocol. No client lock-in.
  • Hybrid recall: Vector + keyword. Agents find both "the auth refactor we did last sprint" and exact file paths.
  • Typed trace history: Every tool call captured. The next agent sees what was tried, what worked, what failed.
  • Org / workspace isolation: Project A's memory never bleeds into project B's agents. Hard isolation at the index layer.

How teams try to share state

What each gets you in practice:

ApproachPer-agent vector DBShared CLAUDE.md / wikiHivemind ★
Agents see each other's workNo (siloed)Only what's manually writtenYes, by default
Auto-capturedPer-agent onlyManualYes
Cross-client (Claude Code / Codex / Cursor)Usually one clientIf they all read itMCP-native
Hybrid (vector + keyword) recallVector onlyFull-textBoth
Workspace isolationPer agentBy pageFirst-class

Reference: a swarm with shared state

N agents, one memory, one trace store, MCP everywhere.

Agent 1 ─► Claude Code ─┐
Agent 2 ─► Codex       ─┼─► Hivemind workspace (per project)
Agent 3 ─► Cursor      ─┤      • plan + decisions
Agent N ─► Custom      ─┘      • tool call traces
                              • file-level context
                              • rejected approaches

         humans inspect via review UI

Agents come and go; the workspace persists. Coordination is implicit through memory, not direct messages.

Stand up shared state for the swarm

Three commands. Same pattern every project.

1. Install

bash
curl -fsSL https://deeplake.ai/install.sh | sh

2. Create the workspace

bash
hivemind workspace create my-project

3. Connect each agent client

bash
hivemind connect claude-code --workspace my-project

Why most "shared state" attempts fail

  • Per-agent vector stores: Each agent learns independently. The swarm gets N copies of the same lesson and zero cross-learning.
  • Long chat transcripts: Past ~30 messages they exceed any context window and become unsearchable in practice.
  • Manual wiki updates: Engineers won't update a doc after every PR. Auto-capture is the only thing that scales.
  • Per-client lock-in: If only Claude Code reads your store, your Codex / Cursor users stay isolated. MCP-native solves this.

FAQ

How is this different from giving each agent a vector DB?

A per-agent vector DB silos what should be shared. Hivemind is one workspace many agents read and write, the swarm learns together, not in parallel.

Does it work across Claude Code, Codex, and Cursor?

Yes. All speak MCP. Mix and match clients on the same workspace; they all see the same memory.

What about privacy and isolation?

Workspaces are isolated at the index layer. Project A's agent can never see project B's memory regardless of who's asking.

Do humans share the same memory?

Yes, via the admin UI. Humans write notes; agents recall them just like any other event.

How is conflict resolved when two agents write at once?

Memory writes are append-only and timestamped. Decisions don't overwrite each other, they accumulate, with later agents seeing earlier rationale.

Is there a free tier?

Yes. Free for individual developers; team plans add SSO, audit, and org scoping.

Citations


One brain for every agent in the swarm

Hivemind makes shared state the default, not the exception. Install once; every MCP agent on the project reads and writes the same memory.

Install Hivemind

Related