Skip to main content

Crate scema_memory

Crate scema_memory 

Source
Expand description

§scema-memory — four memories, one of which is unusual

A vector store is not a memory; it is a search index over things that were said. This crate keeps four kinds, separated because they answer different questions and decay at different rates:

KindQuestionExample
MemoryBody::Episodewhat happened?“deployed X, it failed, cause was an RPC timeout”
MemoryBody::Beliefwhat do I hold to be true?“this RPC provider degrades under load”
MemoryBody::Procedurehow is this done?“seed pools → verify graph → run arb”
MemoryBody::Counterfactualwhat would the branch I rejected have done?“H₂ was projected at 0.31 and not taken”

§The fourth one is the point, and it is mostly unanswerable

A counterfactual records a branch the agent declined. Its projected utility is known — it was computed — and its realised utility almost never is, because nobody ran it. That asymmetry is the design, not a gap to fill in later.

It is the same asymmetry the bot’s own calibration.rs lives with: a bullish call resolves against realised PnL, a bearish one almost never resolves because the bot avoided that pool. The rule that falls out of it is the one that matters:

Unresolved counterfactuals are counted, never scored.

Calibration therefore reports resolved and unresolved as separate integers and computes error only over the first. An implementation that imputed outcomes for untaken branches — from a model, from a neighbour, from a prior — would be generating its own training signal, and every subsequent decision would be tuned to a fiction.

§Storage

Append-only JSONL, one file per kind, under <root>/memory/. The same convention as scematica-trades.jsonl in the bot workspace, for the same reason: an append-only log cannot lose an earlier belief when a later one contradicts it, and contradiction is information. Nothing here rewrites or deletes a line.

Structs§

Calibration
How well past projections matched reality — over the branches that were resolvable.
MemoryRecord
One line in one of the four logs.
MemoryStore
The four logs on disk.
Recall
What to recall.

Enums§

MemoryBody
The content of a memory.
MemoryKind
Which memory a record belongs to. Determines the file it lands in.
Outcome
How something went.

Functions§

self_ignore
Make a state root ignore itself, the moment it first exists.