hermes - 💡(How to fix) Fix Hindsight plugin: sync_turn resends full session transcript on every retain, duplicating content with update_mode=append

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

Each duplicated chunk gets independently extracted, producing 3-4x duplicate facts per session. The delta-retain chunk dedup mentioned in vectorize-io/hindsight#932 doesn't prevent this (presumably because chunk boundaries shift as the document grows with each append).

Fix Action

Fix

One line after building content in sync_turn():

content = "[" + ",".join(self._session_turns) + "]"
self._session_turns = []  # only send new turns next time; append preserves earlier content server-side

update_mode='append' on the server already preserves prior document content. The client doesn't need to resend it.

The session-switch path (on_session_switch / c38dac74) already flushes _session_turns before clearing, so it handles the edge case of buffered turns at switch time. This fix covers the normal within-session retain path.

Code Example

chunk 0: "Let's reframe from home lab..."
chunk 2: "Let's reframe from home lab..."   # same content

chunk 1: "Rename Bob to..."
chunk 3: "Rename Bob to..."                 # same content

---

content = "[" + ",".join(self._session_turns) + "]"
self._session_turns = []  # only send new turns next time; append preserves earlier content server-side
RAW_BUFFERClick to expand / collapse

sync_turn() accumulates every turn in self._session_turns and never clears the list after a retain call. On the update_mode='append' path (Hindsight >= 0.5.0), this means each retain appends the full growing transcript to the document, not just the new turns since last retain.

In a 30-turn session with retain_every_n_turns=3, retain #1 sends turns 1-3, retain #2 sends turns 1-6, retain #3 sends turns 1-9, etc. The server appends each payload, so turns 1-3 end up in the document 10 times.

Introduced in 3082fa0 (probe API for update_mode='append' support). Before that commit, each retain replaced the document (idempotent). The switch to append semantics didn't adjust _session_turns to only send deltas.

Observed impact

Querying document chunks for a live session (20260511_144205_620bda, 6 chunks) shows identical user turns appearing in multiple chunks:

chunk 0: "Let's reframe from home lab..."
chunk 2: "Let's reframe from home lab..."   # same content

chunk 1: "Rename Bob to..."
chunk 3: "Rename Bob to..."                 # same content

Each duplicated chunk gets independently extracted, producing 3-4x duplicate facts per session. The delta-retain chunk dedup mentioned in vectorize-io/hindsight#932 doesn't prevent this (presumably because chunk boundaries shift as the document grows with each append).

Practical cost: ~80% more extraction LLM tokens than necessary, and a bank full of duplicate memories that the consolidation layer then has to clean up.

Fix

One line after building content in sync_turn():

content = "[" + ",".join(self._session_turns) + "]"
self._session_turns = []  # only send new turns next time; append preserves earlier content server-side

update_mode='append' on the server already preserves prior document content. The client doesn't need to resend it.

The session-switch path (on_session_switch / c38dac74) already flushes _session_turns before clearing, so it handles the edge case of buffered turns at switch time. This fix covers the normal within-session retain path.

Environment

  • Hermes: latest main as of 2026-05-11 (a63a2b7)
  • Hindsight API: 0.6.1 (self-hosted)
  • retain_every_n_turns: 3
  • retain_async: true

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix Hindsight plugin: sync_turn resends full session transcript on every retain, duplicating content with update_mode=append