Repository navigation
Correcting or restoring one fact in a multi-fact memory rewrites the entire memory text #2527
Description
Pre-submission checklist | 提交前检查
- I have searched existing issues and this hasn't been mentioned before
- I have read the project documentation and confirmed this issue doesn't already exist
- This issue is specific to MemOS and not a general software issue
Bug Description | 问题描述
A memory item keeps one current string, and each history entry keeps one previous string (ArchivedTextualMemory.memory). When that string contains several facts, correcting one fact or restoring an older snapshot replaces every fact in the item.
The feedback prompt tells the model to change only the wrong span and leave the other sentences unchanged. The version layer does not check that those sentences are still present. should_keep_update compares character sets. filter_fault_update runs only when at least five updates are proposed, and then it asks the model again.
Expected: correcting or rolling back one fact leaves the other facts in that memory at their latest values.
How to Reproduce | 如何重现
-
Build one working-memory string with four facts, plus a longer daily-work passage that does not restate the visit. The facts are: the user is a primary-school Chinese teacher in Haidian, Beijing; the user prefers paper books, especially long-form nonfiction, on weekends; the user plans to visit their sister in Hangzhou in May 2026 and stay one weekend; the user's sister lives in Xihu District, Hangzhou, and they talk once a month.
estimate_tokenson this string is 447. Store that whole string as the single history snapshot. -
Correct only the job, to a middle-school math teacher in the same district. Call
MemFeedback._single_update_operationwithmemory_version_switchoff andoperation["text"]set to the full replacement string. The nodememoryfield becomes that entire string. The other three facts are present only because they were copied into the replacement. -
Later change only the plan, to a Chengdu teaching conference in August 2026, again by writing the whole string.
-
Restore the snapshot by writing
history[0].memorythrough the same update. The stored text is the original string. The Chengdu plan is gone together with the job correction. The preference and the sister fact are the snapshot sentences, not values merged from the current text. -
From the original string, delete only the Hangzhou-visit sentence and leave the job, the preference, and the sister fact.
should_keep_updatereturns true. The character-set change ratio is 0.0949, below the 0.2 gate used when the estimate is at least 200 tokens.standard_operationskeeps the operation as UPDATE. The following write stores the text without the visit. -
Repeat the job correction with
memory_version_switchon and no provider formemory_version.apply_feedback_update. The fallback assigns the whole new string. The fields written to the node do not includehistory, and the existing snapshot list stays at length 1.
Environment | 环境信息
- Python version: 3.12.15
- Operating System: Darwin 27.0.0 arm64
- MemOS version: MemoryOS 2.0.33
Additional Context | 其他信息
This shape is already in the shipped prompts. The chat extraction example puts a meeting, a timeline, and a deadline concern into one value. The feedback example updates the employer inside a memory that also says the user has a good relationship with his wife, and it relies on the model to copy that second sentence into the new text.
Open and closed issues were checked for rollback, memory version, and feedback text updates. None report this. The feedback module doc describes archiving the old memory and writing the new one. It does not describe a per-fact snapshot.
Willingness to Implement | 实现意愿
- I'm willing to implement this myself
Activity