Mnemosyne uses a three-layer architecture to manage memory intake, storage, and retrieval, specifically designed to handle noise remediation through filtering and hygiene processes.
Layer 1: Pre-storage Filter (filters.py)
Before data is written to storage, it passes through a filter gate. This layer uses provider filters, core classifiers (regex + heuristics), and content sanitizers (binary extraction) to produce a WriteDecision. If the decision is reject, the content is dropped and logged; if allow, it proceeds to BEAM storage.
Layer 2: BEAM Storage (beam.py)
Data is stored in BEAM, which manages different memory types:
- working_mem: Hot memory with a 7-day TTL and 10K max capacity.
- episodic_mem: Summarized memories.
- memory_embeddings: The vector index.
BEAM also manages a Sleep cycle that triggers consolidate_to_episodic() to move data from working memory to episodic memory.
Layer 3: Post-storage Hygiene (hygiene.py)
This layer performs periodic audits of stored data. It uses audit_noise (scoring 0-1) and clean_noise (to delete, archive, or flag) to maintain database quality. A hygiene_audit_log maintains a full audit trail, and restore_archived() allows for reversibility.
Layer 4: Retrieval (polyphonic_recall.py + beam.py)
Retrieval is handled via Linear recall (FTS5 + working memory) and Polyphonic recall (hybrid vector + keyword). Ranking is determined by a combination of importance × veracity × Weibull recency × embedding sim.