cel-memory
Local-first memory subsystem for AI agents. Trait surface, value types, and an in-memory reference provider.
cel-memory is the contract between an agent runtime and an arbitrary persistence layer. The trait is small enough to drop in your own backend (file, SQLite, Redis, Mem0, Hindsight, etc.) without changing agent code. Cellar ships an SQLite + vector implementation in cel-memory-sqlite.
Status: v0.1 — trait surface is locked per the Cellar v1 memory plan.
What's in this crate
MemoryProvidertrait — async interface every backend implements.- Value types:
MemoryChunk,ChunkKind,MemoryTier,MemoryQuery,MemorySession, etc. BasicMemoryProvider— in-memory reference impl. Useful for tests and as the conformance reference for new backends.MemoryWriteHooktrait — governance hook every backend should consult before persisting (lets a rule engine redact or veto writes).MemoryError— self-contained error type.
What's NOT in this crate
- Storage. See
cel-memory-sqlitefor SQLite + vector retrieval. - Embedding models. The trait makes no assumption about whether/how content is embedded — that's a backend concern.
- LLM-call retrieval logic. See
cel-brieffor "retrieve memory + assemble into an LLM prompt."
Example
use ;
use json;
let memory = new;
memory.write.await?;
let hits = memory.retrieve.await?;
See examples/basic.rs for a complete runnable example.
Comparable libraries
| cel-memory | Hindsight | Mem0 | Letta | |
|---|---|---|---|---|
| Language | Rust | Python | Python | Python |
| Local-first | ✓ | ✓ | partial | ✓ |
| Pluggable backend | ✓ (trait) | partial | ✗ | ✗ |
| Governance hooks | ✓ | ✗ | ✗ | partial |
| Per-caller scoping | ✓ | ✗ | partial | partial |
| Sessions | ✓ | ✓ | ✓ | ✓ |
License
Apache-2.0