Skip to content

fix(hindsight): frame recalled memories as external evidence - #23933

Open
EndeavorYen wants to merge 1 commit into
NousResearch:mainfrom
EndeavorYen:codex/hindsight-persona-boundary
Open

fix(hindsight): frame recalled memories as external evidence#23933
EndeavorYen wants to merge 1 commit into
NousResearch:mainfrom
EndeavorYen:codex/hindsight-persona-boundary

Conversation

@EndeavorYen

@EndeavorYen EndeavorYen commented May 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Frame default Hindsight retain context as conversation evidence rather than identity.
  • Strengthen the default recall preamble so retrieved memories are not treated as system instructions.
  • Add regression coverage for the default retain and recall framing.

Problem / Root Cause

Hindsight auto-retains full conversation transcripts. When a user discusses fiction, roleplay, documents, or code, later recall could present that content without enough provenance, making it easier for the agent to treat external content as user or agent identity.

Fix

The built-in defaults now distinguish stable user/session facts from external content discussed in past conversations, while preserving user-provided retain_context and recall_prompt_preamble overrides.

This is intentionally narrower than a full content-type classifier: it adds a low-risk boundary at both retain and recall time while keeping existing Hindsight behavior and APIs intact.

Addresses #21709.

Limitations / Future Work

This PR reduces identity drift risk by adding provenance framing. It does not classify, drop, or tag fiction/document content at ingestion time; a future follow-up could add explicit content-type metadata if Hindsight exposes the right storage/retrieval hooks.

Related PRs Checked

Validation

  • .venv/bin/python -m pytest tests/plugins/memory/test_hindsight_provider.py -q
  • .venv/bin/python -m py_compile plugins/memory/hindsight/__init__.py

Platforms Tested

  • macOS, Python 3.11.15

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins tool/memory Memory tool and memory providers labels May 11, 2026
@EndeavorYen
EndeavorYen marked this pull request as ready for review May 11, 2026 18:19
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused provenance-boundary mitigation. The reported path is still present on current main: Hindsight retains the full serialized transcript with the generic default context (plugins/memory/hindsight/__init__.py:688, :1621-1673) and injects recalled results under a generic header (:1477-1482). The proposed default framing therefore addresses the direct current behavior.

Problems

  • The changed README is not the only user-facing configuration reference. website/docs/user-guide/features/memory-providers.md:432 and website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/features/memory-providers.md:362 would still publish the old default after this change.

Suggested changes

  • Update those two configuration tables when salvaging the README/runtime change.
  • GitHub currently reports this PR mergeable=false; replay the small default substitutions against the current provider rather than relying on the stale line positions.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform area/memory Memory subsystem: store, providers, sync, background reviews labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/memory Memory subsystem: store, providers, sync, background reviews comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data tool/memory Memory tool and memory providers type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants