Skip to content

feat(hindsight): add enable_retain_tool config to gate hindsight_retain exposure - #66417

Closed
kumaxs wants to merge 1 commit into
NousResearch:mainfrom
kumaxs:feat/hindsight-enable-retain-tool
Closed

feat(hindsight): add enable_retain_tool config to gate hindsight_retain exposure#66417
kumaxs wants to merge 1 commit into
NousResearch:mainfrom
kumaxs:feat/hindsight-enable-retain-tool

Conversation

@kumaxs

@kumaxs kumaxs commented Jul 17, 2026

Copy link
Copy Markdown

Summary

Add enable_retain_tool config option to the Hindsight memory plugin, giving users control over whether the hindsight_retain tool is exposed to the agent.

Follow-up to #55819 (closed as implemented_on_main), which identified the destructive risk of hindsight_retain but was resolved upstream by isolating background review forks (skip_memory=True). That fix prevents background review from calling memory tools, but the main conversation agent still has access to hindsight_retain — and if the model calls it without understanding the tool's semantics, it will overwrite the entire session document, silently destroying all auto-retained memories.

Problem

hindsight_retain is a full-overwrite operation, not an incremental append. When the agent calls it:

  1. The existing session document in Hindsight is completely replaced with whatever content the model provides.
  2. All previous auto-retained turns are irretrievably lost.
  3. The tool description (RETAIN_SCHEMA) reads "Store important information" — it does NOT disclose the destructive nature.

Most users rely on auto_retain + auto_recall for memory — these work internally without the model ever touching the hindsight_retain tool. Exposing a destructive manual write tool to the agent is an unnecessary risk vector for those users.

Changes

Single file: plugins/memory/hindsight/__init__.py (+7 / −1 lines)

  1. Schema — new config key enable_retain_tool (default: true, backward-compatible)
  2. Config parsing — reads enable_retain_tool from config, falling back to True
  3. get_tool_schemas() — filters out hindsight_retain when enable_retain_tool is false

Config in hindsight/config.json:

{
  "enable_retain_tool": false
}

When disabled:

  • The agent cannot see or call hindsight_retain — it's removed from the tool list
  • auto_retain continues to work internally and is completely unaffected
  • hindsight_recall and hindsight_reflect (read-only tools) remain exposed

Why this matters

Background review isolation (#27190) is a good fix for one call path, but it doesn't address the broader risk: any agent turn can invoke hindsight_retain. This PR gives users a simple config toggle to eliminate that risk entirely, without sacrificing the automatic memory functionality they already rely on.

…in exposure

Add a user-facing config toggle so the destructive hindsight_retain
tool (full-overwrite, not append) can be hidden from the agent while
auto_retain continues to work internally.

Default is true for backward compatibility; set to false to eliminate
the risk of accidental session-document overwrites.

Follow-up to NousResearch#55819 — the upstream fix (skip_memory=True for background
review) isolates one call path, but the main conversation agent can
still invoke hindsight_retain.  This config gives users the final say.
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins tool/memory Memory tool and memory providers sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 17, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused Hindsight safety proposal.

Automated hermes-sweeper review is closing this under the standing tools-disabled policy: Hermes does not add configuration paths that selectively remove tool schemas from the model. Use the existing memory_mode: "context" option when the desired setup is automatic recall/retention with no Hindsight tools exposed.

  • plugins/memory/hindsight/__init__.py:1698-1701 already implements context mode by returning no Hindsight tool schemas; plugins/memory/hindsight/README.md:108-111 documents it as automatic injection only.
  • The claimed destructive path is not present as described on current main: hindsight_retain calls aretain_batch without a document_id at plugins/memory/hindsight/__init__.py:1710-1722, while automatic session retention supplies its document target through sync_turn().
  • The PR at ce9b6048373d751e4416488d973de96929241531 would instead add an opt-in per-tool schema exclusion.

The existing context mode preserves auto_retain while avoiding all manual Hindsight tool exposure.


Closed as not-planned per standing maintainer policy (tools-disabled). This is a design-direction decision, not a code-quality judgment — see the Contribution Rubric in AGENTS.md for what the project is looking for. If you believe this policy was misapplied to your change, comment here and a maintainer will take a look.

@teknium1 teknium1 closed this Jul 18, 2026
@teknium1 teknium1 added sweeper:not-planned Sweeper: closed per standing maintainer policy (design direction) sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users labels Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:not-planned Sweeper: closed per standing maintainer policy (design direction) sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades tool/memory Memory tool and memory providers type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants