Skip to content

fix(hindsight): use descriptive context and stable document_id in sync_turn - #8463

Closed
mattverlaque wants to merge 1 commit into
NousResearch:mainfrom
mattverlaque:fix/hindsight-sync-turn-context
Closed

fix(hindsight): use descriptive context and stable document_id in sync_turn#8463
mattverlaque wants to merge 1 commit into
NousResearch:mainfrom
mattverlaque:fix/hindsight-sync-turn-context

Conversation

@mattverlaque

Copy link
Copy Markdown

Summary

  • sync_turn() now passes a descriptive context field (includes session_id) instead of the generic "conversation" string
  • Uses a stable document_id keyed to session-{session_id} so repeated retains upsert instead of creating duplicate documents

Why

Per Hindsight best practices:

  • Context field: "High-impact on extraction quality. Always set it." — the generic "conversation" provides no signal to the extraction LLM
  • document_id: "Always use the same ID for growing conversations. Do NOT use random UUIDs per retain call; this creates duplicates." — without document_id, every turn creates a new document, leading to 100+ near-duplicate memories per session

Test plan

  • Verified aretain accepts document_id kwarg (hindsight-client SDK)
  • Run with active Hindsight instance, confirm single document per session in bank
  • Verify no invalid JSON regressions

🤖 Generated with Claude Code

…c_turn

Per Hindsight best practices, the `context` field on retain calls should
describe the nature of the content (not just "conversation"), and
`document_id` should use a stable session-keyed ID so repeated retains
upsert instead of creating duplicate documents.

- context: includes session_id when available
- document_id: `session-{session_id}` for upsert behavior

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@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 Apr 28, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused Hindsight retention improvement. This is an automated hermes-sweeper review; current main already provides the requested behavior through a more complete implementation.

  • 3082fa0829e0df4ce682358481fb59275b31a46e added capability-gated deduplication and is included in v2026.5.7.
  • plugins/memory/hindsight/__init__.py:1631-1686 uses a stable session ID plus update_mode="append" on supported Hindsight APIs, while retaining configurable descriptive context.
  • plugins/memory/hindsight/__init__.py:1181-1200 preserves a per-process document ID for legacy APIs, avoiding the resume-overwrite behavior that an unconditional stable ID would cause.
  • tests/plugins/memory/test_hindsight_provider.py:1346-1378 covers both the legacy fallback and stable append-capable path.

@teknium1 teknium1 closed this Jul 12, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 12, 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:implemented-on-main Sweeper: behavior already present on current main 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