Openclaw: Retain documents ignore /new resets: session-scoped doc id accumulates across resets and window retains re-ingest pre-reset turns
Summary
When a user runs /new (or /reset) inside an OpenClaw session, the hindsight-openclaw plugin does not start a new Hindsight document. All conversation generations of the same session accumulate into a single ever-growing document, and window retains can re-ingest turns from before the reset boundary.
Environment
- hindsight-openclaw plugin 0.13.0 (retainToolCalls=false, retainEveryNTurns was 3+1/2+1, now per-turn 1+0 as workaround)
- hindsight-api 0.10.1 (latest-slim, image digest sha256:26f9a62a..., current latest release v0.10.1)
- Observed on Telegram group forum topics (sessionKey
agent:main:telegram:group:-100...:topic:194) and other channel types
Observed behavior
No new document on
/new.buildRetainRequestderives the document id asopenclaw:<sessionKey>withupdate_mode: append(plugindist/index.js, ~lines 2778-2848). OpenClaw's/new/resetonly sets a reset boundary inside the same session (sessionKey and sessionId are unchanged), so the document id is unchanged and every generation appends into one document. Example from production: documentopenclaw:agent:main:telegram:group:-100...:topic:194was created 2026-08-11, is now ~103 KB, and was still appended to today - across many/newresets.Pre-reset turns re-enter the retain window. OpenClaw's reset does not truncate the transcript. The plugin filters only the bootstrap line
A new session was started via /new.(dist/index.jsline ~1258) but does not slice the transcript at the reset boundary. With chunked retention (retainEveryNTurns > 1),sliceLastTurnsByUserBoundarytakes the last N turns of the full message list, which after a reset with few new turns includes turns from before/new- so old turns get retained again (and the user perceives the document as fully re-ingested).Interaction with the delta-retain seam. Because an overlapping window is appended to the same document, the chunk-boundary shift at the text seam can make the API delta-diff find "no unchanged chunks" and fall back to full retain (
Delta retain: no unchanged chunks ... falling back to full retain, observed 2026-09-22 07:42 UTC on the same document). Since the document is never reset, that full re-extraction cost grows with total session history.
Root cause
The document id has no reset-generation component, and the plugin has no knowledge of the reset boundary: OpenClaw does not expose the reset generation/boundary in the hook payload, and the plugin does not cut the transcript at it.
Suggested fixes (upstream options)
- a) OpenClaw exposes a reset generation counter in the hook payload (agent_end / session_end), and the plugin appends it to the document id, e.g.
openclaw:<sessionKey>:g<N>. Each/newthen starts a fresh document: keeps documents small, avoids re-ingesting pre-reset turns, and makes the delta-retain fallback cheaper. - b) Alternatively, the plugin slices the transcript at the last reset boundary before windowing (so no pre-reset turns are retained), even if the document keeps accumulating.
Option (a) seems strictly better for long-lived group topics. Either way, the current behavior (silent accumulation + window bleeding across resets) is at least worth documenting.
Happy to provide API request/response dumps, doc metadata, or logs if useful.
Source: vectorize-io/hindsight