Default "untagged" Tag for All Tagless Memories + Database Cleanup Tooling
This release closes a long-standing gap where memories stored without tags were silently orphaned from tag-based search and dashboard faceted views. The enforcement point is Memory.__post_init__ — the single construction path for every entry point in the system.
Added
-
Universal default tag enforcement (
Memory.__post_init__): AllMemoryobjects with empty orNonetags automatically receive["untagged"]at construction time. This is enforced universally across all 5 entry paths:- MCP tools (
memory_store, consolidation outputs) - REST API (
POST /api/memories) - Document ingestion pipeline
- Consolidation/compression outputs
- CLI direct creation
Previously, 306 production memories had empty tag lists, making them unretrievable via tag-based search and invisible in tag-faceted dashboards.
- MCP tools (
-
scripts/maintenance/tag_untagged_memories.py: New one-shot cleanup script for existing databases. Run with--dry-runto preview how many memories will be updated (counts by category), then--applyto write changes. Applies separate tags for document chunks vs. plain memories:- Document chunks: tagged
untagged,document - Plain memories: tagged
untagged - Test artifacts: soft-deleted
- Document chunks: tagged
Fixed
- 3 tests updated to reflect new default-tag behaviour:
test_empty_tags_gets_untagged_default— updated assertiontest_explicit_tags_not_adds_untagged— new test verifying explicit tags are preserved as-istest_none_tags_gets_untagged_default— new test verifyingNonetags input is correctly handled
Migration for Existing Databases
If you have an existing database with untagged memories, run the cleanup script:
# Preview changes (dry run)
python scripts/maintenance/tag_untagged_memories.py --dry-run
# Apply changes
python scripts/maintenance/tag_untagged_memories.py --applyProduction results when applied: 16 test artifacts soft-deleted, 121 document chunks tagged untagged,document, 169 real memories tagged untagged, 0 untagged memories remaining.
Full Changelog: https://github.com/doobidoo/mcp-memory-service/blob/main/CHANGELOG.md