fix(openclaw): retain routing context for extraction#1921
Open
de1tydev wants to merge 3 commits into
Open
Conversation
e66b7ca to
bea4338
Compare
…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(+).
bea4338 to
4667d84
Compare
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.
Problem
Hindsight's fact extraction could misinterpret OpenClaw routing metadata in retained transcripts. Values such as
[context]sender/channel/provider, bank IDs, session keys, source systems, and tags are operational routing identifiers, but without explicit retain API guidance they can be treated as people, organizations, or project names.Root Cause
The OpenClaw plugin built and sent retain requests without passing interpretation guidance through the retain API
contextfield across all retain paths.Solution
DEFAULT_RETAIN_CONTEXTand wire it through live retain, queued retain flushes, and the backfill CLI.retainContextin the plugin manifest, config parsing, README, and types.retainContextvalues and test that the manifest default stays in sync with the code constant.distbuild.Validation
npm testinhindsight-integrations/openclaw(8 files, 248 tests)npm run buildinhindsight-integrations/openclawgit diff --check origin/main...HEAD