Skip to content

feat: Unified 3-Tier Memory System#11

Open
nagual2 wants to merge 17 commits intomraza007:mainfrom
nagual2:unified-memory-model
Open

feat: Unified 3-Tier Memory System#11
nagual2 wants to merge 17 commits intomraza007:mainfrom
nagual2:unified-memory-model

Conversation

@nagual2
Copy link
Copy Markdown

@nagual2 nagual2 commented Apr 5, 2026

Summary

This PR introduces a unified 3-tier memory system for EchoVault with automatic migration and rollback support.

Features

  • Fast Tier: In-memory SQLite with 24h TTL (<1ms access)
  • Medium Tier: SSD storage with 7-day retention and LRU eviction (<100ms)
  • Slow Tier: HDD archive with async semantic search via Ollama

Migration Path

disabled → shadow → canary → enabled → emergency_rollback

Shadow mode writes to both existing and unified systems for safe testing.

New MCP Tools

  • memory_rollback_status - Check system health
  • memory_rollback_enable - Enable stages (shadow/canary/enabled)
  • memory_rollback_emergency - Emergency revert

Documentation

All markdown files are now bilingual (EN/RU).

Ready for review and gradual rollout.

Ri-Lin-Tal-Si added 17 commits March 30, 2026 22:26
- Memory Governor: manages Core vs Main memory layers based on usage (3 hits/session to promote, 10 sessions idle to demote)
- Collective Wisdom: cross-project search and strategic suggestions for complex tasks
- Usage tracking: SQLite migrations for access_count and session-based tracking
- MCP server: added memory_record_usage, memory_governor, and memory_collective_solve tools
- Fast tier: in-memory SQLite with 24h TTL
- Medium tier: SSD with 7d retention and LRU eviction
- Slow tier: HDD with async semantic search via Ollama
- Migration pipeline: Fast→Medium→Slow every 5 min
- Async scheduler: non-blocking callback-based search
- Adapter for gradual migration from existing system

Maps to user model: Fast=Core, Medium=Short-term, Slow=Long-term
- Rollback manager with feature flags (shadow/canary/enabled/emergency)
- Auto-rollback on error rate threshold
- MCP tools: memory_unified_search, save, context
- Rollback tools: status, enable, emergency
- Extended tests: concurrent access, eviction, error recovery

Migration path: shadow → canary → enabled → emergency_rollback
- test_shadow_mode.py: standalone test script for shadow mode
- mcp_server.py: integrated unified memory with rollback tools
- New MCP tools: memory_rollback_status, enable, emergency
- Shadow mode writes to both existing and unified systems
- UNIFIED_MEMORY.md: English version first, Russian second
- ACTIVATE_COLLECTIVE.md: English version first, Russian second
- WEB_SEARCH.md: English version first, Russian second
- AGENTS.md: Added Russian translation section
- skills/echovault/SKILL.md: Added Russian translation section

All files now have language switcher at top:
> **Русский** | [Перейти к русской версии](#russian-version)
- Add Unified 3-Tier Memory to Features section
- Add Safe Rollout feature description
- Add new rollback commands to Commands table
- Reference UNIFIED_MEMORY.md for details
Add TCP transport layer for MCP server:
- mcp_bridge.py: stdio-to-TCP bridge
- mcp_tcp_server.py: TCP server implementation
- run_mcp_tcp.bat: TCP launcher with background server
- run_mcp.bat, run_mcp_safe.bat: various launch scripts
- mcp_minimal.py, mcp_fixed.py, mcp_standalone.py: debug variants
- run-mcp-clean.cmd: clean environment launcher
Add stdio_patch.py for Windows MCP server compatibility:
- Handles Windows-specific stdio stream issues
- Provides patched stdio_server for async transport
- Fixes newline/encoding problems on Windows terminals
- Used by mcp_server.py via conditional import
Update mcp_server.py with unified memory support:
- Add UnifiedMemoryAdapter integration
- Add shadow mode support for dual-system writes
- Add rollback tools integration (status, enable, emergency)
- Add memory_collective_solve with web search fallback
- Implement proper error handling for unified adapter
- Add 3 unified tools: memory_unified_search, memory_unified_context, memory_unified_save
- Remove TCP server files (mcp_tcp_server.py, mcp_bridge.py, run_mcp_tcp.bat)
- Remove stdio_patch to fix stdio transport
- Total tools: 12 (9 base + 3 unified)
…elines

Changes:

- Split AGENTS.md, .codex/AGENTS.md, skills/echovault/SKILL.md into EN/RU versions

- Add detailed memory system operations section to AGENT_ROLE.md

- Add Session Finalization section to README.md

- Make CHANGELOG.md and ECHO_VAULT_GUIDE.md bilingual

- Add memory_unified_* commands to README
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant