Concepts
The ideas behind Prime's agent memory architecture.
Everything is an Event
Every mutation — creating a node, adding an edge, storing a vector, deleting a memory — is an immutable event in a Write-Ahead Log (WAL). Events are never modified or deleted. This gives you full audit trails, time-travel queries, and crash recovery for free.
prime.node.created → { id, type, properties, domain }
prime.edge.created → { source, target, relation }
prime.vector.stored → { embedding, text, metadata }
prime.node.deleted → { } (soft-delete, preserved in history)Projections
Projections are materialized views built incrementally from the event stream. Each projection maintains a different index over the same data:
| Projection | What it indexes | Query cost |
|---|---|---|
| NodeState | Node properties by entity_id | O(1) |
| AdjacencyList | Outgoing edges per node | O(1) |
| VectorIndex | HNSW over embeddings | O(log n) |
| DomainIndex | Nodes grouped by domain | O(1) |
| CrossDomain | Edges spanning domain boundaries | O(1) |
| CompressedIndex | Auto-generated markdown TOC | Cached |
Domains
Every node can be tagged with a domain— a knowledge area like "engineering", "revenue", or "product". Domains power the compressed index and cross-domain reasoning:
- The compressed index organizes knowledge by domain
- Cross-domain edges (e.g., revenue → engineering) generate cross-references
- Questions spanning domains trigger both the index and vector search
Compressed Index
A token-efficient markdown summary (~500-1000 tokens) of everything the agent knows. Organized by domain with cross-references. Auto-generated from projections — no manual maintenance.
This is the key insight from zer0dex: vector similarity finds X orY when you ask "how does X relate to Y?" — rarely both. The compressed index bridges this gap by providing explicit cross-domain pointers, doubling cross-reference accuracy from 37.5% to 80%.
Temporal Queries
Since everything is an event, time-travel is a first-class operation:
get_node_as_of(id, timestamp)— reconstruct state at any past pointhistory(id)— full audit trail with timestampsdiff(from, to)— what changed between two timestampsneighbors_as_of(id, timestamp)— graph state at a past point
Hybrid Recall
prime_recall combines three retrieval strategies:
- Vector similarity — find semantically related facts via HNSW
- Graph expansion — follow edges from vector matches to discover connected context
- Temporal recency — boost recently stored facts
For cross-domain questions, use prime_context instead — it adds the compressed index excerpt for navigational scaffolding.
