-
Notifications
You must be signed in to change notification settings - Fork 2
research(memory): AOI three-layer hierarchical memory architecture #1839
Description
Research Finding
Paper: AOI — Three-Layer Hierarchical Memory Compression (arXiv:2512.13956)
Related: arXiv:2501.11739 (Jan 2025), arXiv:2512.13564
Three-layer architecture: Working memory (active context) → Episodic memory (recent interaction traces) → Semantic memory (consolidated long-term facts). LLM-based compression at layer boundaries achieves 72.4% context reduction while preserving critical information through selective consolidation.
Applicability to Zeph
Zeph's memory is currently flat (SQLite rows + Qdrant vectors). A three-tier promotion pipeline maps directly onto existing infrastructure:
- Working memory → active
messages[]context window (already exists) - Episodic memory → SQLite
messagestable + recent Qdrant entries (already exists, but promotion logic is missing) - Semantic memory → Qdrant
zeph_key_facts/zeph_session_summaries(already exists)
Missing piece: explicit promotion thresholds at each boundary — rules for when episodic entries graduate to semantic, and when working memory entries age into episodic. Currently all compaction flows directly from working memory to semantic (via summarize_messages), skipping a proper episodic staging tier.
Memory Tier Design
| Tier | Table | Retention | Retrieval weight |
|---|---|---|---|
| Episodic | messages |
decays (Ebbinghaus) | temporal boost |
| Working | summaries |
session-scoped | context priority |
| Semantic | semantic_facts (new) |
permanent | high weight |
Implementation Sketch
- Add
MemoryTierenum:Working | Episodic | Semantic - Tag
messagestable rows withtier+promotion_timestamp - Background sweep (similar to existing autosave/snapshot loop):
- Compact working → episodic at current
summarization_threshold - Promote episodic → semantic on Ebbinghaus expiry or after appearance in N+ sessions:
a. Cluster recent embeddings using cosine similarity threshold (e.g. 0.92)
b. Merge near-duplicate entries via LLM, strip episodic metadata (timestamp, session_id)
c. Soft-delete episodic originals after promotion (preserving searchability with decay boost) - Promotion signal: a fact appears in N+ sessions without contradiction → stable semantic knowledge
- Compact working → episodic at current
memory_searchqueries all three tiers with tier-weighted scoring- CLI:
/memory promoteto trigger manual promotion - TUI: semantic fact count in memory panel
Config:
[memory.tiers]
enabled = true
promotion_min_sessions = 3 # appearances before episodic→semantic promotion
similarity_threshold = 0.92 # cosine threshold for clusteringIntegration Points
crates/zeph-memory:MemoryTierenum,promote_to_semantic()background job, updated eviction policy[memory]config:[memory.tiers]section with thresholds- CLI:
/memory promotecommand - TUI: semantic fact count in memory panel
- Complementary to: research(memory): event segmentation-based episodic boundary detection for compaction (ES-Mem) #1855 (ES-Mem event segmentation for better episodic boundaries), research(memory): MAGMA multi-graph memory with causal/temporal/semantic/entity edge types #1821 (MAGMA multi-graph memory)
References
- arXiv:2512.13956 (AOI)
- arXiv:2501.11739, arXiv:2512.13564 (memory survey)
- Zeph crates:
zeph-memory(semantic/mod.rs,sqlite/),zeph-core(agent/persistence.rs)