Memory system
Full description: Read the full narrative
Two coexisting systems: the v1 PlanetaryMemorySystem (5 tiers, decay loop) and the v2 six-tier hierarchy with dedicated SQLite tables and a MemoryManagerV2 facade (store/buildContext/consolidate). The chat semantic cache (similarity threshold 0.7) is wrapped by an EnhancedCache.
| Tier | Capacity | Retention | Hot path |
|---|---|---|---|
| sensory | 10,000 | 60 s | Redis (TTL 60 s) with SQLite fallback |
| working | 1,000 | 1 h | Redis (TTL 3600 s) |
| episodic | 10,000 | 7 days | SQLite |
| semantic | ∞ | — | SQLite |
| procedural | 1,000 | ∞ | SQLite |
| decay sweep | every 60 s (all tiers) | — | See server/memory/memorySystem.ts:22,35-80 |
| Tier | Module | SQLite tables | Source |
|---|---|---|---|
| Sensory | sensoryBuffer.ts (importance-ranked) | sensory_buffer | server/memoryV2/sensoryBuffer.ts:32 server/db/schema.sql:332 |
| Working | workingMemory.ts | working_memory | server/memoryV2/workingMemory.ts:30 server/db/schema.sql:348 |
| Episodic | episodicMemoryV2.ts (outcome + consolidation flags) | episodic_v2 | server/memoryV2/episodicMemoryV2.ts:92 server/db/schema.sql:363 |
| Semantic | semanticMemory.ts | semantic_entities / semantic_relations | server/memoryV2/semanticMemory.ts:54 server/db/schema.sql:391-403 |
| Procedural | proceduralMemoryV2.ts | procedural_v2 | server/memoryV2/proceduralMemoryV2.ts:25 server/db/schema.sql:418 |
| Predictive | predictiveMemory.ts (ensemble models) | predictive_models / prediction_log_v2 | server/memoryV2/predictiveMemory.ts:31 server/db/schema.sql:434-451 |
| Aspect | Detail | Source |
|---|---|---|
| Embeddings | 768-dim cosine (embedding.ts; Xenova MiniLM via Omninet) | server/embedding.ts:4,78 |
| Facade | MemoryManagerV2: store() / buildContext() / consolidate() | server/memoryV2/memoryManagerV2.ts:27,57,172,239 |
| HTTP surface | /api/memory/working|episodes|facts|procedural|predictive|sensory|consolidate|status|stats | server/index.ts:12653-12836 |