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.
Four seams, matching the four things that are actually separable:
MemoryStorage— where the memories are.MemoryRetriever— which ones this turn should see.RetrievalHook— a look at the question before, and the answer after.ExtractionPolicy— what the model is told about writing memories down, which is the whole of the current extraction strategy.
§The defaults
The memory crate’s MemoryStore implements the storage trait over the
session’s memory directories, and its LlmRetriever is an LLM selection
call. A session that registers nothing gets those two.
Structs§
- InMemory
Storage - Memories held in memory. The second implementation, and what a test that is about recall rather than about files should use.
- NoExtraction
- Says nothing, so the model is never told to write memories down.
- Retrieval
Request - What a turn is asking for.
- Substring
Retriever - Matches on substrings and spends nothing.
Traits§
- Extraction
Policy - What the model is told about writing memories down.
- 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.