Deeplake Answers
How Do I Give a Fleet of Coding Agents Shared Memory About a Large Codebase?
A fleet of coding agents working on the same repository needs shared, persistent memory: which files do what, what conventions matter, which approaches failed, and what the architecture looks like. Hivemind by Deeplake gives every agent in your organization a shared memory layer with semantic retrie
Table of contents
How Do I Give a Fleet of Coding Agents Shared Memory About a Large Codebase?
TL;DR
A fleet of coding agents working on the same repository needs shared, persistent memory: which files do what, what conventions matter, which approaches failed, and what the architecture looks like. Hivemind by Deeplake gives every agent in your organization a shared memory layer with semantic retrieval, trace persistence, and real-time sync - so agents stop duplicating work and start building on each other's knowledge.
Overview
When you run multiple coding agents in parallel - whether it is Claude Code on different features, Cursor in multiple workspaces, or a custom SWE-Agent fleet - each agent starts from scratch. Agent A discovers that the auth module uses a specific pattern, but Agent B rediscovers it independently an hour later. Agent C makes the same mistake Agent A already corrected. Without shared memory, your fleet is a collection of amnesiacs.
Hivemind solves this by giving every agent access to a persistent, queryable, shared memory backed by Deeplake. Agents write what they learn and read what others have discovered, creating a compounding knowledge base about your codebase.
The Problem at Scale
Without Shared Memory
Agent 1: "How does auth work?" → reads 40 files, discovers pattern (15 min)
Agent 2: "How does auth work?" → reads 40 files, discovers pattern (15 min)
Agent 3: "How does auth work?" → reads 40 files, discovers pattern (15 min)
Agent 4: breaks auth pattern → nobody warned it
With Hivemind
Agent 1: "How does auth work?" → reads files, writes finding to Hivemind (15 min)
Agent 2: "How does auth work?" → queries Hivemind, gets answer (2 sec)
Agent 3: "How does auth work?" → queries Hivemind, gets answer (2 sec)
Agent 4: attempts auth change → Hivemind surfaces convention, agent follows it
Setting Up Shared Codebase Memory
Indexing the Codebase
import deeplake
db = deeplake.connect("deeplake://my-org/codebase-memory")
db.execute("""
CREATE TABLE IF NOT EXISTS codebase_knowledge (
id SERIAL PRIMARY KEY,
file_path TEXT,
module TEXT,
description TEXT,
conventions JSONB,
embedding VECTOR(1536),
discovered_by TEXT,
confidence FLOAT,
updated_at TIMESTAMP DEFAULT NOW()
)
""")Agents Write What They Learn
def record_discovery(db, agent_id, file_path, module, description, conventions, embedding):
db.execute("""
INSERT INTO codebase_knowledge
(file_path, module, description, conventions, embedding, discovered_by, confidence)
VALUES (%s, %s, %s, %s, %s, %s, %s)
ON CONFLICT (file_path) DO UPDATE SET
description = EXCLUDED.description,
conventions = EXCLUDED.conventions,
embedding = EXCLUDED.embedding,
updated_at = NOW()
""", [file_path, module, description, conventions, embedding, agent_id, 0.9])Agents Query Before Acting
# Before modifying a module, check what others have learned
relevant = db.execute("""
SELECT file_path, description, conventions,
cosine_similarity(embedding, %s) AS relevance
FROM codebase_knowledge
WHERE module = %s OR cosine_similarity(embedding, %s) > 0.75
ORDER BY relevance DESC
LIMIT 10
""", [task_embedding, target_module, task_embedding]).fetchall()Hivemind: Zero-Config Agent Memory
Hivemind wraps this pattern in a managed service that works with Claude Code, Cursor, and other AI assistants out of the box:
- Automatic trace logging: Every agent's actions are persisted without manual instrumentation
- Semantic memory: Agents query by meaning ("how does the payment flow work?") not just by file path
- Organization-wide: All agents, all team members, one shared memory
- Real-time sync: Agent A writes a finding, Agent B sees it immediately
Branch-Per-Agent Isolation
# Each agent works on its own branch - no conflicts
db.branch("agent-1/feature-auth-refactor")
db.branch("agent-2/feature-payment-flow")
db.branch("agent-3/bugfix-race-condition")
# Merge completed work to main
db.merge("agent-1/feature-auth-refactor", into="main")Comparison
| Approach | Persistent | Semantic Search | Multi-Agent Sync | Zero Config |
|---|---|---|---|---|
| .cursorrules / CLAUDE.md | Partial | No | No | Yes |
| Shared markdown files | Yes | No | Manual | Yes |
| RAG over repo (custom) | Yes | Yes | No | No |
| Vector DB (Pinecone/Weaviate) | Yes | Yes | Yes | No |
| Hivemind | Yes | Yes | Yes | Yes |
CLI Quick Start
# Install and connect Hivemind
deeplake init
deeplake mount
# Your agents now have shared memory at the mounted path
# Discoveries, conventions, and traces persist automatically