## 1. Implement ContextTier - [ ] 1.1 Create ContextTier class with token-budget summarization (max_tokens_before_summary: 16000) - [ ] 1.2 Implement RunningSummary tracking - [ ] 1.3 Add summary injection into system prompt on budget exceeded - [ ] 1.4 Add configurable thresholds and token counter ## 2. Implement DailyTier - [ ] 2.1 Create DailyTier class with Markdown file management - [ ] 2.2 Implement lazy daily file creation (memory/YYYY-MM-DD.md) - [ ] 2.3 Implement append() with timestamped entries - [ ] 2.4 Add user-scoped variants (memory/users/{uid}/) - [ ] 2.5 Implement get_main_memory_file() for MEMORY.md ## 3. Implement CoreTier - [ ] 3.1 Set up better-sqlite3 with FTS5 extension - [ ] 3.2 Create chunks table with vector BLOB column - [ ] 3.3 Create chunks_fts virtual table for full-text search - [ ] 3.4 Implement chunk storage with text chunker - [ ] 3.5 Implement hybrid search (vector 0.7 + keyword 0.3 with temporal decay) - [ ] 3.6 Implement fact storage with confidence scores ## 4. Implement Deep Dream consolidation - [ ] 4.1 Create DeepDream class for overnight consolidation - [ ] 4.2 Read daily + core → LLM summarizes → overwrite MEMORY.md - [ ] 4.3 Implement dedup via content hashing - [ ] 4.4 Write dream diary to memory/dreams/YYYY-MM-DD.md - [ ] 4.5 Add cron scheduling ## 5. Add memory management tools - [ ] 5.1 Implement manage-memory tool (create/update/delete) - [ ] 5.2 Implement search-memory tool (hybrid search) - [ ] 5.3 Register tools for agent use ## 6. Add context compression (DCP) - [ ] 6.1 Implement range/message dedup - [ ] 6.2 Implement purge errors - [ ] 6.3 Implement turn protection - [ ] 6.4 Wire into compaction pipeline ## 7. Add boulder state - [ ] 7.1 Implement cross-session plan persistence in Postgres - [ ] 7.2 Add automatic resumption on session start ## 8. Add System Context model - [ ] 8.1 Implement typed context sources - [ ] 8.2 Implement immutable epoch baselines - [ ] 8.3 Add reconciliation on context change ## 9. Add SWR caching - [ ] 9.1 Implement stale-while-revalidate for MCP tool results - [ ] 9.2 Add TTU-based revalidation - [ ] 9.3 Add cache invalidation on project switch ## 10. UI: Memory & context - [ ] 10.1 Add memory browser UI - [ ] 10.2 Add context composition breakdown - [ ] 10.3 Add consolidation timeline - [ ] 10.4 Add cross-session continuity indicator