Skip to content

[GH-974] Prevent consolidation on small tag groups - #985

Merged
o-love merged 2 commits into
mainfrom
fix/semantic-consolidation-spam
Jan 27, 2026
Merged

o-love merged 2 commits into
mainfrom
fix/semantic-consolidation-spam

Conversation

@o-love

@o-love o-love commented Jan 27, 2026 •

Copy link
Copy Markdown
Contributor

Purpose of the change

Fixes consolidation of tags, ensuring that features are properly consolidated based on tags.

Also filters out tags who don't meet the threshold requirement. The storage layer is responsible for ensuring the returned tags meet the consolidation threshold. But there isn't any harm in ensuring this at the application layer as well.

Future changes

While not directly the issue opened in #974 there seems to be a lot of low quality/empty features. Will write a PR to ensure that features generated by the LLM have a minimum quality before writing them to the database.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes tag-based feature consolidation by changing the grouping strategy from (tag, feature_name) to just tag, and adds filtering to skip consolidation on groups below the threshold.

Changes:

  • Modified group_features_by_tag to group by tag only instead of (tag, feature_name) tuple
  • Added threshold filtering in _consolidate_type to skip small groups
  • Updated tests to reflect the new single-tag grouping behavior

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/memmachine/semantic_memory/semantic_model.py Changed grouping key from tuple to single tag string
src/memmachine/semantic_memory/semantic_ingestion.py Added filtering logic to skip consolidation for groups below threshold
tests/memmachine/semantic_memory/test_semantic_model.py Updated test assertions to expect tag-only grouping
tests/memmachine/semantic_memory/test_semantic_ingestion.py Added new test case and renamed feature values for clarity

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/memmachine/semantic_memory/test_semantic_ingestion.py
Comment thread tests/memmachine/semantic_memory/test_semantic_ingestion.py
@o-love o-love self-assigned this Jan 27, 2026
@o-love o-love added the priority: high Issue is urgent or highly impactful. Needs to be addressed as soon as possible. label Jan 27, 2026
@o-love
o-love merged commit ae1753a into main Jan 27, 2026
48 checks passed
@o-love
o-love deleted the fix/semantic-consolidation-spam branch January 27, 2026 18:40
SarahScargall pushed a commit to SarahScargall/MemMachine that referenced this pull request Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: high Issue is urgent or highly impactful. Needs to be addressed as soon as possible.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants