pub struct MemoryStore { /* private fields */ }Expand description
The four logs on disk.
Implementations§
Source§impl MemoryStore
impl MemoryStore
Sourcepub fn new(root: impl Into<PathBuf>) -> Self
pub fn new(root: impl Into<PathBuf>) -> Self
Memory lives under <root>/memory/. Nothing is created until the first write.
Sourcepub fn remember(&self, record: &MemoryRecord) -> Result<()>
pub fn remember(&self, record: &MemoryRecord) -> Result<()>
Append one record.
Appends rather than the tmp-and-rename used for snapshot files: a single write of
one line to a file opened with append is what the bot’s trade log already relies
on, and rewriting the whole log to add a line would lose history on a crash.
Sourcepub fn read_all(&self, kind: MemoryKind) -> Result<(Vec<MemoryRecord>, usize)>
pub fn read_all(&self, kind: MemoryKind) -> Result<(Vec<MemoryRecord>, usize)>
Every record of a kind, oldest first.
A line that will not parse is skipped and counted, not fatal: one corrupt line — a half-written record from a killed process — must not make the agent amnesiac. The count comes back so a caller can surface it rather than swallow it.
Sourcepub fn recall(
&self,
kind: MemoryKind,
query: &Recall,
) -> Result<Vec<MemoryRecord>>
pub fn recall( &self, kind: MemoryKind, query: &Recall, ) -> Result<Vec<MemoryRecord>>
Matching records, most recent first.
Sourcepub fn calibration(&self) -> Result<Calibration>
pub fn calibration(&self) -> Result<Calibration>
Score past projections against outcomes, honestly.
Joins counterfactuals to realisations on (decision, hypothesis). Everything that
does not join is unresolved — which, for branches the agent declined to take, is
the overwhelming majority and always will be.
Sourcepub fn counts(&self) -> Result<Vec<(MemoryKind, usize, usize)>>
pub fn counts(&self) -> Result<Vec<(MemoryKind, usize, usize)>>
Total records per kind, for scema remember --stats.