CRDT Memory

Shared Memory for Any Number of Agents

CRDT (Conflict-free Replicated Data Types) let multiple agents write to the same namespace concurrently without coordination. No locks. No conflicts. No data loss.

Three CRDT Primitives

LWW-Map
Last-Write-Wins Map

Key-value store. On concurrent writes to the same key, the write with the higher timestamp wins. Best for agent status, configuration, scalar state.

Use: agent_status, config, scalar values
OR-Set
Observed-Remove Set

Collaborative list. Multiple agents can add and remove items concurrently. Removals are based on the specific add operation observed — no phantom removes.

Use: task lists, agent registries, capability sets
VectorClock
Vector Clock

Causal ordering tracker. Assigns a logical timestamp to every write. Lets agents determine happens-before relationships across the mesh without a central clock.

Use: ordering events, detecting causality, debugging

Live CRDT Merge Animation

Two agents write to the same key concurrently. Watch the CRDT resolve the conflict automatically.

Agent A
status =
"processing"
CRDT Mesh
merging...
Agent B
status =
Agent A writes key='status', value='processing'

Memory API

memory-api.pyPython
from aisp import AISPClient

client = AISPClient(session_id="session_ffc4a366...")

# LWW-Map: write a key
client.memory.set("default", "task_status", "running")

# LWW-Map: read a key
status = client.memory.get("default", "task_status")

# OR-Set: add to a list
client.memory.set_add("default", "completed_tasks", "task_001")

# Watch for changes (any agent's writes)
for update in client.memory.watch("task.abc123"):
    print(f"Key {update.key} changed to {update.value}")

Multiple Agents, One Worldview

CRDT memory means your agent fleet always converges to a consistent state — automatically.