MULTI-AGENT SYSTEMS

ChainMemory was designed from the ground up for a world where multiple AI agents collaborate on the same project. Every agent reads the same Project State, every contribution is attributed, and every handoff is traceable.

The Multi-Agent Problem

Modern development workflows already involve multiple AI agents:

  • Claude designs the architecture and writes documentation
  • Cursor implements the code with inline AI assistance
  • GPT-4 reviews PRs and analyzes security implications
  • Gemini processes large codebases for refactoring suggestions

Without shared memory, each agent starts from zero. Decisions made in Claude are invisible to Cursor. Architecture agreed in GPT is unknown to Gemini. You become the bottleneck — constantly re-explaining context.

How ChainMemory Solves This

Shared Project State

All agents connected to the same project see the same consolidated state: decisions, milestones, risks, stack, and context. When Claude marks a decision as "active", Cursor sees it immediately.

Shared State Flow
┌──────────┐    ┌──────────────────────────┐    ┌──────────┐
│  Claude  │───▶│                          │◀───│  Cursor  │
│  (MCP)   │    │   ChainMemory Project    │    │  (MCP)   │
└──────────┘    │                          │    └──────────┘
                │  decisions: [d001, d002]  │
┌──────────┐    │  milestones: [m001]      │    ┌──────────┐
│  GPT-4   │───▶│  risks: [r001, r002]     │◀───│  Gemini  │
│  (API)   │    │  stack: [Node, Redis]    │    │  (API)   │
└──────────┘    └──────────────────────────┘    └──────────┘

Agent Handoff Pattern

When work moves from one agent to another, ChainMemory provides seamless context transfer:

1

Claude designs the architecture

Claude saves key decisions via MCP: database choice, API structure, authentication strategy. Each memory is attributed to Claude's ai_id.

Claude saves
chainmemory_remember({
  content: "Use PostgreSQL with row-level security for multi-tenant isolation",
  tags: ["architecture", "database", "security"],
  importance: 0.9
})
2

Cursor picks up implementation

When you open Cursor, it injects the project context automatically. Cursor knows the database choice, the API structure, and why those decisions were made — without you repeating anything.

Cursor receives (via inject)
Project State v3:
- Decision d001: "Use PostgreSQL with RLS" (active, evidence: #12, #15)
- Decision d002: "REST API with versioned endpoints" (active, evidence: #18)
- Milestone m001: "Database schema complete" (pending)
- Risk r001: "RLS performance on large tenants" (medium, evidence: #15)
3

Cursor implements and saves progress

As Cursor implements, it saves implementation memories. These are attributed to Cursor's ai_id and feed back into the shared state.

Cursor saves
chainmemory_remember({
  content: "Implemented RLS policies for tenants table. Performance tested at 50K rows: 2ms avg query time.",
  tags: ["implementation", "database", "performance"],
  importance: 0.8
})
4

GPT-4 reviews with full context

A GPT-4 agent reviewing the PR can query ChainMemory to understand why each decision was made, who made it, and what evidence supports it.

Handoff Patterns

Pattern Flow Use Case
Sequential Claude → Cursor → GPT-4 Design → Implement → Review
Parallel Claude + Cursor + Gemini simultaneously Multiple developers, same project
Specialist Any agent → Security agent → Back Specific expertise on demand
Supervisory Human + Claude oversee, Cursor executes Human-in-the-loop with delegation

Conflict Resolution Across Agents

When two agents make contradictory decisions, ChainMemory's Conflict Resolution applies the same rules:

  • Temporal precedence — The most recent decision wins, regardless of which agent made it
  • Evidence weight — A decision supported by 5 memories from 3 agents is stronger than one with a single memory
  • Explicit supersession — Any agent can explicitly supersede a previous decision by referencing it
  • Full audit trail — Both the original and superseding decisions are preserved with their respective ai_id attribution
No single point of truth — except the chain In a multi-agent system, no single agent owns the "truth". The Project State is a materialized view derived from all agents' contributions. The on-chain anchor is the only authoritative timestamp. This means even if one agent hallucinates or makes an error, the evidence chain allows other agents (or humans) to trace and correct it.

Setting Up Multi-Agent

No special configuration needed. Any agent connected to the same project automatically participates in multi-agent collaboration:

  1. Create a project via Extension, MCP, or API
  2. Use the same API key across agents (or create agent-specific keys under the same account)
  3. Each agent uses inject_memories at session start to load shared context
  4. Each agent uses chainmemory_remember to save contributions
  5. The Consolidation Engine merges all contributions into the unified Project State
Best practice Use descriptive tags that identify the agent's role: ["architecture", "claude-design"], ["implementation", "cursor-code"], ["review", "gpt4-security"]. This makes filtering by agent role easy without needing to parse ai_id directly.