Memory Hygiene
Memory hygiene refers to the automatic maintenance processes that keep the memory system healthy, relevant, and within size budgets. PRX runs hygiene tasks periodically to compact, deduplicate, and prune memories.
Overview
Without hygiene, memory stores grow unbounded and recall quality degrades as irrelevant entries dilute search results. The hygiene system addresses this through:
- Compaction -- summarize groups of related memories into concise entries
- Deduplication -- merge semantically duplicate entries
- Pruning -- remove stale or low-relevance memories
- Archival -- move old memories to cold storage
Hygiene Pipeline
Trigger (schedule or threshold)
│
▼
┌──────────────┐
│ Deduplication │──── Merge near-duplicates
└──────┬───────┘
▼
┌──────────────┐
│ Compaction │──── Summarize related entries
└──────┬───────┘
▼
┌──────────────┐
│ Pruning │──── Remove stale entries
└──────┬───────┘
▼
┌──────────────┐
│ Archival │──── Move to cold storage
└──────────────┘Configuration
toml
[memory.hygiene]
enabled = true
schedule = "daily" # "hourly" | "daily" | "weekly"
max_entries = 10000
compaction_threshold = 100 # compact when group exceeds this size
prune_after_days = 90
dedup_similarity_threshold = 0.95Manual Triggers
You can manually trigger hygiene from the CLI:
bash
prx memory compact
prx memory prune --older-than 90d
prx memory statsRelated Pages
- Memory System Overview
- Self-Evolution L1 -- Memory compaction in self-evolution