🔄 Hybrid Backend Drift Detection
This release adds automatic metadata synchronization to the hybrid backend, preventing silent data loss when memories are updated on one backend but not synced to the other.
✨ Key Features
- Bidirectional drift detection: Detects metadata changes on either backend (SQLite-vec ↔ Cloudflare)
- Periodic drift checks: Configurable interval via
MCP_HYBRID_DRIFT_CHECK_INTERVAL(default: 1 hour) - "Newer timestamp wins" conflict resolution: Prevents data loss during metadata updates
- Dry-run support: Preview changes via
python scripts/sync/check_drift.py - New configuration variables:
MCP_HYBRID_SYNC_UPDATES- Enable metadata sync (default: true)MCP_HYBRID_DRIFT_CHECK_INTERVAL- Seconds between drift checks (default: 3600)MCP_HYBRID_DRIFT_BATCH_SIZE- Memories to check per scan (default: 100)
🐛 Fixes
- Issue #202 - Hybrid backend now syncs metadata updates (tags, types, custom fields)
- Previous behavior only detected missing memories, ignoring metadata changes
- Prevented silent data loss when memories updated on one backend but not synced
- Tag fixes in Cloudflare now properly propagate to local SQLite
- Metadata updates no longer diverge between backends
🔧 Technical Details
New Methods:
BackgroundSyncService._detect_and_sync_drift()- Core drift detection logic with dry-run modeCloudflareStorage.get_memories_updated_since()- Query memories by update timestamp
Files Modified:
src/mcp_memory_service/config.py- Added 3 configuration variablessrc/mcp_memory_service/storage/hybrid.py- Drift detection implementation (~150 lines)src/mcp_memory_service/storage/cloudflare.py- Added timestamp-based query methodscripts/sync/check_drift.py- New dry-run validation script
Architecture: Timestamp-based drift detection with 1-second clock skew tolerance, non-blocking async operations, configurable batch sizes.
📚 Documentation
- Updated README.md with drift detection features
- Updated CLAUDE.md with new configuration variables and Essential Commands
- Added drift detection to Hybrid Backend benefits
- Comprehensive CHANGELOG entry with technical details
🙏 Credits
Fixes issue #202 reported by the community. Thank you for helping improve MCP Memory Service!
Full Changelog: v8.24.4...v8.25.0
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com