Expand description
ScrapMem optical forgetting — progressive content-fidelity decay (issue #3713).
Transitions old messages through resolution levels by compressing their content via LLM:
- Full — original message content, unchanged.
- Compressed — LLM-generated summary preserving key facts (stored in
compressed_content). SummaryOnly— one-line distilled fact (replaces original content, most compact).
The sweep is orthogonal to SleepGate (which decays importance scores):
SleepGateprunes by importance score below a floor.- Optical forgetting compresses by age (turns since creation).
Both can run concurrently; optical forgetting skips messages below the SleepGate prune
threshold to avoid compressing content that will be pruned shortly anyway.
§Invariants
- Messages below the
SleepGateforgetting_floorare skipped. - The
episodic_eventstable (EM-Graph) references messages by FK; events survive optical forgetting because messages are never deleted — only their content is replaced. focus_pinnedis a runtime-onlyMessageMetadatafield and is not stored in themessagestable, so it cannot be filtered at the SQL level. The agent loop is responsible for not triggering optical forgetting on pinned sessions.
Structs§
- Optical
Forgetting Config ScrapMemoptical forgetting configuration.- Optical
Forgetting Result - Outcome of a single optical forgetting sweep.
Enums§
- Content
Fidelity - Content-fidelity level for optical forgetting.
Functions§
- run_
optical_ forgetting_ sweep - Execute one full optical forgetting sweep.
- start_
optical_ forgetting_ loop - Start the background optical forgetting loop.