Summary
Three targeted fixes to the consolidation engine that resolve crashes, data corruption, and accuracy issues encountered during repeated consolidation cycles.
Fixed
memory_consolidate status KeyError on empty statistics dict (closes #542)
The memory_consolidate MCP tool's status action raised KeyError when the consolidation engine returned an empty or partial statistics dict — a common state during the first run or immediately after a reset. All dict lookups in the status handler are now replaced with safe .get() calls with sensible defaults (empty lists, zero counts, None timestamps).
10 new tests in tests/consolidation/test_status_handler_issue542.py
Exponential metadata prefix nesting in compression engine (closes #543)
The consolidation compression engine accumulated metadata prefixes (consolidated_from_, compressed_from_) exponentially across repeated consolidation cycles. Each cycle read existing prefixes and prepended new ones, so a memory consolidated three times would have triple-nested prefix strings.
Two changes prevent re-accumulation:
- New
_strip_compression_prefixes()static method strips all existing compression-related prefixes from source metadata before re-aggregating into the output memory _INTERNAL_METADATA_KEYSblocklist excludes consolidation-internal keys from the aggregated metadata entirely
14 new tests in tests/consolidation/test_compression_prefix_nesting.py
RelationshipInferenceEngine high false positive rate (closes #541)
The RelationshipInferenceEngine produced excessive contradicts relationship labels due to overly broad contradiction detection patterns. Three targeted changes reduce false positives:
- Weak conjunctions (
but,yet,although,however,nevertheless) removed from contradiction pattern vocabulary - Minimum confidence threshold raised to
min_typed_confidence=0.75and minimum semantic similarity raised tomin_typed_similarity=0.65 - New
_shares_domain_keywords()cross-content guard requires shared domain keywords before acontradictslabel is assigned
16 new tests in tests/consolidation/test_relationship_inference_issue541.py
Test Coverage
- 1,373 tests now passing (40 new tests added in this release)
- All new tests tagged
@pytest.mark.unitfor fast feedback
What's Unchanged
No API changes. No breaking changes. No configuration changes required.
Full Changelog
https://github.com/doobidoo/mcp-memory-service/blob/main/CHANGELOG.md#10220---2026-03-05