Expand description
cel-memory — the durable cross-turn memory contract for AI agents.
This crate answers one question: what should persist across turns? It
owns the memory contract — the MemoryProvider trait plus the value
types every backend and caller share (chunks, sessions, queries, retrieval
profiles, caller scopes, write hooks, summaries, rollups, aging, export).
Storage backends implement the trait; callers depend only on it.
The crate is deliberately narrow. It does not observe live device/world
state — that is cel-cortex’s job (“what is true now?”) — and it does
not assemble per-turn LLM prompts — that is cel-brief’s job (“what
should the model see this turn?”). cel-memory owns persistence only.
Cellar is the motivating consumer: its embedded agent runtime, NL rule
compiler, cel_act gateway, rule-matcher post-fire hook, and Activity /
Memory tabs all compile against this trait. But nothing here depends on
Cellar — the crate is reusable memory infrastructure for any agent runtime.
BasicMemoryProvider is the in-crate reference implementation — real
bodies for MemoryProvider::retrieve, MemoryProvider::write, session
lifecycle, simple deletes, export, and stats; Err(NotImplemented) for
summarization, rollups, and re-embed; no-ops for update_importance and
supersede. A full storage backend (e.g. the cel-memory-sqlite crate)
drops in behind the same trait without caller churn.
Re-exports§
pub use basic::BasicMemoryProvider;pub use chunk::ChunkKind;pub use chunk::ChunkSource;pub use chunk::MemoryChunk;pub use chunk::MemoryTier;pub use chunk::NewMemoryChunk;pub use error::MemoryError;pub use error::Result;pub use importance::score as score_importance;pub use offdevice_hook::ClosureOffdeviceHook;pub use offdevice_hook::OffdeviceCallDescriptor;pub use offdevice_hook::OffdeviceCallHook;pub use offdevice_hook::OffdeviceDecision;pub use ops::AccessEntry;pub use ops::AgingReport;pub use ops::EvictionEntry;pub use ops::EvictionReason;pub use ops::ExportBundle;pub use ops::ExportFilter;pub use ops::MemoryStats;pub use ops::PurgeReport;pub use ops::ReEmbedReport;pub use provider::MemoryProvider;pub use query::CallerScope;pub use query::MemoryPredicate;pub use query::MemoryQuery;pub use query::RetrievalProfile;pub use session::MemorySession;pub use session::NewMemorySession;pub use session::SessionFilter;pub use session::SessionOutcome;pub use summarizer::MockSummarizer;pub use summarizer::MockSummaryCall;pub use summarizer::Summarizer;pub use summarizer::SummarizerError;pub use summarizer::SummarizerResult;pub use summarizer::SummaryContext;pub use write_hook::ClosureHook;pub use write_hook::MemoryWriteHook;pub use write_hook::WriteDecision;
Modules§
- basic
BasicMemoryProvider— the v1 backing implementation.- chunk
- Memory chunk — the primary persisted unit.
- error
- Memory subsystem error type.
- importance
- Importance scoring for memory chunks.
- offdevice_
hook - The
OffdeviceCallHooktrait — the off-device call governance seam. - ops
- Operational types — eviction, access logging, export bundles, reports.
- provider
- The
MemoryProvidertrait — the durable cross-turn memory contract. - query
- Query, profile, scope, and predicate types.
- session
- Memory session — a coherent unit of work.
- summarizer
- Summarizer trait and supporting types.
- write_
hook - The
MemoryWriteHooktrait — the per-write governance seam.