Overview
The Memory layer (Layer 2) provides persistent storage and retrieval of information with metadata support. It implements multi-dimensional search across keyword, temporal, and semantic dimensions.Memory Trait
TheMemory trait defines the core interface for storing and retrieving memory entries.
Methods
store()
content: The text content to storemeta: Metadata including tags, priority, and source
traits.rs:112
get()
id: The entry identifier
Some(MemoryEntry) if found, None otherwise
Source: traits.rs:115
search()
query: Search query with filters
traits.rs:118
delete()
id: The entry identifier
true if entry was deleted, false if not found
Source: traits.rs:121
count()
traits.rs:124
as_vector()
VectorMemory if the implementation supports vector search. Returns None by default.
Source: traits.rs:128
VectorMemory Trait
ExtendsMemory with vector embedding and semantic search capabilities.
vector.rs:115
See Vector Search API for detailed documentation.
Data Types
Priority
traits.rs:11
MemoryMeta
traits.rs:24
MemoryEntry
traits.rs:45
MemoryQuery
traits.rs:60
NoopMemory Implementation
In-memory stub implementation for testing.Example Usage
- Thread-safe with
Mutex - No persistence (data lost on drop)
- Simple substring matching for text search
- AND logic for tag filtering
traits.rs:134