Skip to main content
Enable multiple AI agents to share and coordinate memory.

Use Case

A team of AI agents working on a project:
  • Research agent finds information
  • Coding agent implements features
  • Review agent checks code quality
  • All share context via MemoClaw

Implementation

Agent Identification

Each agent uses a unique agent_id for scoping:
from memoclaw import MemoClaw

# Different agents use different agent_ids
research_agent = MemoClaw()
research_agent.agent_id = "research-001"

coding_agent = MemoClaw()
coding_agent.agent_id = "coding-001"

review_agent = MemoClaw()
review_agent.agent_id = "review-001"

Share Findings Between Agents

# Research agent stores findings
research_agent.store(
    content="Found that pgvector HNSW index performs better than IVFFlat for small datasets",
    importance=0.85,
    agent_id="research-001",
    namespace="project-backend",
    memory_type="decision"
)

# Coding agent can recall research findings
findings = coding_agent.recall(
    query="vector database performance research",
    namespace="project-backend",
    limit=5
)

Filter by Agent

# Get memories created by a specific agent
agent_memories = client.list(
    agent_id="research-001",
    namespace="project-backend"
)

Create Relations Between Agents’ Memories

# Link research finding to implementation
research_memory = research_agent.store(
    content="HNSW is better for our use case",
    agent_id="research-001",
    namespace="project-backend"
)

implementation_memory = coding_agent.store(
    content="Implemented HNSW index for vector search",
    agent_id="coding-001", 
    namespace="project-backend"
)

# Create relation
client.create_relation(
    memory_id=implementation_memory.id,
    target_id=research_memory.id,
    relation_type="derived_from"
)

Memory Isolation

  • Same wallet = same user identity
  • Different agent_ids = different agent perspectives on same memory store
  • Namespaces = completely separate memory pools

Best Practices

  1. Use consistent agent_id naming: {role}-{number} or {name}
  2. Use namespace to separate projects
  3. Use relations to link cross-agent dependencies
  4. Use memory_type to distinguish findings vs implementations vs reviews