feat: prevent repeated memories via archival and activated-only retrieval#880
Merged
CaralHsi merged 6 commits intodev-20260112-v2.0.2from Jan 16, 2026
Merged
feat: prevent repeated memories via archival and activated-only retrieval#880CaralHsi merged 6 commits intodev-20260112-v2.0.2from
CaralHsi merged 6 commits intodev-20260112-v2.0.2from
Conversation
* feat: add in mem-reader * feat: add merge from in mem-reader * feat: set merge ids archived * feat: update en mem-reader prompt * fix: abstract * fix: set graph db bug
* feat: add in mem-reader * feat: add merge from in mem-reader * feat: set merge ids archived * feat: update en mem-reader prompt * fix: abstract * fix: set graph db bug * fix: prompt build bug: replace None
* feat: add in mem-reader * feat: add merge from in mem-reader * feat: set merge ids archived * feat: update en mem-reader prompt * fix: abstract * fix: set graph db bug * fix: prompt build bug: replace None * fix: did not pass through username into mem-reader transfer function * feat: fix user_name not pass bug * feat: tackle with merged nodes when async mode in scheduler * feat: modify repeat problem * feat: modify multi modal struct * feat: update en-version MEMORY_MERGE_PROMPT_EN
* feat: add in mem-reader * feat: add merge from in mem-reader * feat: set merge ids archived * feat: update en mem-reader prompt * fix: abstract * fix: set graph db bug * fix: prompt build bug: replace None * fix: did not pass through username into mem-reader transfer function * feat: fix user_name not pass bug * feat: tackle with merged nodes when async mode in scheduler * feat: modify repeat problem * feat: modify multi modal struct * feat: update en-version MEMORY_MERGE_PROMPT_EN * feat: add status to some graph db func; modify prompt
…val (#874) * feat: add in mem-reader * feat: add merge from in mem-reader * feat: set merge ids archived * feat: update en mem-reader prompt * fix: abstract * fix: set graph db bug * fix: prompt build bug: replace None * fix: did not pass through username into mem-reader transfer function * feat: fix user_name not pass bug * feat: tackle with merged nodes when async mode in scheduler * feat: modify repeat problem * feat: modify multi modal struct * feat: update en-version MEMORY_MERGE_PROMPT_EN * feat: add status to some graph db func; modify prompt * fix: status filter not specified bug; feat: log merge * feat: remove log_merge_check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR closes the loop on the “repeated memory” problem at the add stage.
Previously, when adding new memories, the system could:
merged_frommemories to keep influencing downstream reasoning.Now, when a new memory is added, we:
merged_fromnodes so they no longer participate in recall.Combined with stricter filtering on
status="activated", this ensures that:What’s changed
1. Mem-reader: detect & merge repeated memories on add
graph_dbintoMemReaderviaMemReaderFactory.from_config(..., graph_db=...), so readers can:MEMORY_MERGE_PROMPT_EN/MEMORY_MERGE_PROMPT_ZH) to:{ value, merged_from, should_merge: true }, or{ should_merge: false }.value,merged_fromfor later archival.2. Graph DB & recall: only
activatedmemories, plus archivalupdate_node(id, fields, user_name=None)with tenant context,get_node(..., **kwargs)andget_nodes(ids, ..., **kwargs)for user-scoped queries,get_by_metadata(filters, status=None)andget_all_memory_items(scope, ..., status=None)with optionalstatusfiltering.status="activated",user_nameto respect multi-tenant isolation.merged_frominmetadata.info, the referenced IDs are updated to:{"status": "archived"}user_name/mem_cube_id,3. Prompt & behavior: make “repeat vs. new” explicit
Fix: #881
Docs Issue/PR: (docs-issue-or-pr-link)
Reviewer: @(reviewer)
Checklist: