Expand description
Where memories live, how they are found, and who decides what to keep.
Memory was one concrete struct with a fixed directory layout, one search that was a substring scan, and one retriever that was an LLM call written inline. Every part of that is a reasonable default and none of it was a choice: a host with memories in a database, a deployment that wants a vector index, a project whose recall should be deterministic in tests — none had anywhere to plug in.
The seams, matching the things that are actually separable:
MemoryStorage— where the memories are.DurableStore— the session’s memory as the turn uses it: recall bookkeeping, what extraction may add, the prompt and the index.MemoryRetriever— which ones this turn should see.RetrievalHook— a look at the question before, and the answer after.
§The defaults
A session given no store has NoMemory. The memory crate’s
MemoryStore implements both store traits over the session’s memory
directories, and its retriever is an LLM selection call; the assembly
injects it when the memory unit is built.
Structs§
- InMemory
Storage - Memories held in memory. The second implementation, and what a test that is about recall rather than about files should use.
- NoMemory
- No durable memory: nothing recalled, nothing kept, nothing in the prompt.
- Retrieval
Request - What a turn is asking for.
- Substring
Retriever - Matches on substrings and spends nothing.
Traits§
- Durable
Store - A session’s durable memory as the turn recalls from it and adds to it.
- Memory
Retriever - Which memories this turn should see.
- Memory
Storage - Where durable memories are kept.
- Retrieval
Hook - A look at the question before it is asked, and the answer before it is used.
Functions§
- retrieve_
with_ hooks - Run a retrieval with its hooks around it.