Skip to content

Feature: Cross-agent shared memory namespaces with conflict resolution #3

@cdzzy

Description

@cdzzy

Problem

In multi-agent systems, multiple agents often need to share knowledge (e.g., a research agent and a writer agent both need access to the same context). Currently there's no standard pattern for shared vs. private memory in agent frameworks.

Proposed Solution: Memory Namespaces

// Private namespace (default) -- only this agent reads/writes
const privateMemory = new Engram({ agentId: "research-agent", namespace: "private" })

// Shared namespace -- all agents in the same session can read
const sharedMemory = new Engram({ agentId: "research-agent", namespace: "shared:session-001" })

// Team namespace -- agents with the same team ID share memories
const teamMemory = new Engram({ agentId: "research-agent", namespace: "team:writing-crew" })

Conflict Resolution Strategy

const memory = new Engram({
  namespace: "shared:session-001",
  conflictPolicy: "last-writer-wins",  // or "merge", "version", "ask-llm"
  onConflict: async (existing, incoming) => {
    // Custom merge logic
    return await mergeLLM(existing.content, incoming.content)
  }
})

Use Cases

  • Multi-agent pipelines: researcher passes findings to writer via shared memory
  • Parallel agents: coordinate without redundant work
  • Persistent sessions: multiple chat sessions sharing user preference profiles

Prior Art

Redis namespaces, PostgreSQL row-level locking, CRDTs for distributed state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions