hindsight icon indicating copy to clipboard operation
hindsight copied to clipboard

fix(openclaw): strip runtime metadata from memory content

Open 0xDe1ty opened this issue 5 months ago • 0 comments

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 retainContext guidance and deprecate includeSenderContext as 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.ts in hindsight-integrations/openclaw (8 files, 257 tests)
  • npm run build in hindsight-integrations/openclaw
  • git diff --check 4667d84742efdb599bc93ae2c523ff5217924acd...HEAD
  • repository pre-commit hooks during commit

0xDe1ty avatar Jun 04 '26 04:06 0xDe1ty