fix(openclaw): strip runtime metadata from memory content#1968
Open
de1tydev wants to merge 4 commits into
Open
fix(openclaw): strip runtime metadata from memory content#1968de1tydev wants to merge 4 commits into
de1tydev wants to merge 4 commits into
Conversation
…ata misattribution Hindsight's fact extraction LLM was misinterpreting routing identifiers (sender open_id, bank ID, channel, provider) as semantic actors, project names, or organizations. After many conversation turns, the bank name (e.g. saber-prod) would override the actual project being discussed (e.g. x-power-cli). This adds interpretation guidance via the retain API 'context' field: - New DEFAULT_RETAIN_CONTEXT constant explains that [context] block sender/channel/provider are routing identifiers, not human names - Bank IDs, session keys, agent IDs, thread IDs, and tags are also marked as operational routing identifiers, not project names - Assistant-role first-person statements are attributed to the AI - Context is passed through the full chain: buildRetainRequest → scopeClient.retain → Hindsight SDK API - RetainQueue persists and flushes context correctly - Backfill CLI also passes context - New 'retainContext' config option allows customization includeSenderContext behavior is unchanged; the [context] block remains in transcript content, but extraction LLM now knows how to interpret it. 7 files changed, 97 insertions(+).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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...], standaloneom_/ou_/oc_values, orou_x...: user textsender 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
stripRuntimeEnvelope()for Feishu/OpenClaw runtime IDs and sender prefixes.retainContextguidance and deprecateincludeSenderContextas a content-writing option.Validation
npm test -- --run src/index.test.tsinhindsight-integrations/openclaw(8 files, 257 tests)npm run buildinhindsight-integrations/openclawgit diff --check 4667d84742efdb599bc93ae2c523ff5217924acd...HEAD