Skip to main content

Module memory

Module memory 

Source
Expand description

Long-term, cross-session memory.

Short-term context lives in crate::Context; the crate::Compactor keeps it within budget within a single run. Long-term memory is what survives across runs — the dataset that turns a generic assistant into a personalised one. Per Harrison Chase / Sarah Wooders: memory is the harness. To keep the framework’s “open harness” promise the memory layer must be:

  • owned by the operator (no provider-side stateful APIs),
  • transferable (a swap to a different model must not lose memory),
  • inspectable (plain on-disk format, no opaque tokens).

This module ships the trait + types. Concrete backends live in [harness_context::FileMemory] (JSONL) and downstream crates.

§Wiring

  • A MemoryGuide from harness-rs-loop calls Memory::recall at the start of every session and injects the top-K matches into the system prompt.
  • A MemoryWriter hook captures the final assistant text on Event::TaskCompleted and calls Memory::write.
  • Tools may use the same Arc<dyn Memory> to commit explicit facts mid-run.

Structs§

MemoryEntry
One persisted memory record.

Enums§

MemoryError

Traits§

Memory
The open-memory primitive.