fix(hindsight): replace destructive aretain_batch with safe file-based retain - #55819
Closed
kumaxs wants to merge 1 commit into
Closed
fix(hindsight): replace destructive aretain_batch with safe file-based retain#55819kumaxs wants to merge 1 commit into
kumaxs wants to merge 1 commit into
Conversation
…d retain
Background Review fork was calling hindsight_retain with the parent
session_id, causing destructive overwrites of auto-retained session
documents in Hindsight. The tool description was misleading — it
advertised 'Store information' without disclosing the full-overwrite
semantics and that auto_retain already handles routine memory retention.
Changes:
- Replace hindsight_retain's direct aretain_batch with file-based retain
that generates a unique filename per call:
{agent}_{channel}_{user}_{session}_{uuid}.md — guaranteed no collision
with auto-retained session documents.
- Rewrite RETAIN_SCHEMA description to accurately describe the tool as
'one dedicated extra memory record' and prohibit storing core info
that belongs in memory.md.
- Update Background Review MEMORY_REVIEW_PROMPT to guide correct tool
selection: essential core info → memory.md, on-demand info → memory
provider tools, skip if nothing worth saving.
Closes NousResearch#55816
kumaxs
force-pushed
the
fix/hindsight-retain-safe-file-retain
branch
from
June 30, 2026 18:38
277d36d to
9b7c3f2
Compare
Contributor
|
Thanks for investigating the Hindsight overwrite risk. Automated hermes-sweeper review found that the reported Background Review route is already isolated on current
Closing as implemented on main. |
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
Background Review fork was calling
hindsight_retainwith the parent session_id, causing destructive overwrites of auto-retained session documents in Hindsight. The tool description was misleading — it advertised "Store information" without disclosing that every retain is a full document overwrite (not an incremental append) and thatauto_retainalready continuously maintains memories in the background.Changes
1.
plugins/memory/hindsight/__init__.py— Safe file-based retainhindsight_retaintool now uses Hindsight's file retain API instead of directaretain_batch. Each call generates a unique filename:{agent}_{channel}_{user}_{session}_{uuid}.mdThe UUID guarantees no collision with auto-retained session documents. File retain also enables richer content (markdown formatting, structured text).
2.
plugins/memory/hindsight/__init__.py— Accurate tool descriptionOld: "Store information to long-term memory. Hindsight automatically extracts structured facts, resolves entities, and indexes for retrieval."
New: "This tool grants one dedicated extra memory record. Hindsight's auto_retain continuously maintains memories in the background — do not use this tool for routine memory retention. All long-term essential core information must be stored in memory.md; saving such content through this tool is prohibited under all circumstances."
3.
agent/background_review.py— Guided promptThe
_MEMORY_REVIEW_PROMPTnow tells the model to:memory.mdVerification
py_compilesync_turn) is completely unaffected — it uses the internalaretain_batchAPI, not the toolCloses #55816