fix(openclaw): strip runtime metadata from memory content
Depends on #1921. This branch is stacked on the retain-context PR; after #1921 merges, this PR should shrink to the runtime metadata cleanup commit.
Problem
OpenClaw/Feishu runtime identifiers can appear in message text as retain/recall input, for example [message_id: om_x...], standalone om_/ou_/oc_ values, or ou_x...: user text sender prefixes. If passed through to Hindsight, those opaque IDs can pollute recall queries, temporal retrieval, retained transcripts, and later extracted memories.
Root Cause
The OpenClaw Hindsight plugin stripped metadata envelopes and memory tags, but it did not consistently strip inline runtime message IDs or opaque sender prefixes before composing recall queries or retained transcript content. It also still supported prepending sender/channel/provider context into retained content, which made routing metadata part of the semantic transcript.
Solution
- Add
stripRuntimeEnvelope()for Feishu/OpenClaw runtime IDs and sender prefixes. - Apply the cleanup in recall query extraction, prior-context recall composition, text retain, and structured retain paths.
- Stop prepending sender/channel/provider context into retained transcript content; keep that information in retain metadata/context instead.
- Update
retainContextguidance and deprecateincludeSenderContextas a content-writing option. - Add tests for recall cleanup, retained transcript cleanup, metadata preservation, and the no-context-in-content contract.
Validation
npm test -- --run src/index.test.tsinhindsight-integrations/openclaw(8 files, 257 tests)npm run buildinhindsight-integrations/openclawgit diff --check 4667d84742efdb599bc93ae2c523ff5217924acd...HEAD- repository pre-commit hooks during commit