OpenClaw plugin: fix auto-recall injection and auto-capture message drop#4065
Merged
deshraj merged 2 commits intomem0ai:mainfrom Feb 17, 2026
Merged
Conversation
Change systemContext to prependContext in before_agent_start hook to match OpenClaw's expected property name. Memories were being fetched but never injected into prompts.
…nded Strip injected <relevant-memories> blocks instead of dropping entire messages, and accept any content block with string text during auto-capture parsing.
deshraj
approved these changes
Feb 17, 2026
Collaborator
|
Thanks for fixing this @Zlo7. |
Collaborator
|
Released the fix in https://www.npmjs.com/package/@mem0/openclaw-mem0/v/0.1.1 |
16 tasks
jamebobob
pushed a commit
to jamebobob/mem0-vigil-recall
that referenced
this pull request
Mar 29, 2026
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.
Fix OpenClaw auto-capture dropping valid user text when recall context is prepended, and include the prior recall injection key fix in the same patch set.
Description
This PR consolidates two related OpenClaw plugin bug fixes in
openclaw/index.ts:Auto-recall injection fix
before_agent_startnow returns{ prependContext: ... }(notsystemContext) so recalled memories are actually injected into prompts.Auto-capture preservation fix
In
agent_end, messages containing<relevant-memories>...</relevant-memories>are no longer skipped wholesale.Instead, injected recall context is stripped and the remaining real user/assistant text is captured if non-empty.
Root Cause #1: Hook return property mismatch (
systemContextvsprependContext)Impact #1: Auto-recall looked successful in logs but memories never reached the LLM
Root Cause #2: Marker-based hard skip in capture path
Impact #2: Valid user content was silently dropped whenever injected recall block was present
Fix #1: Rename
systemContext→prependContextFix #2: Replace skip-on-marker with strip-and-keep behavior; skip only empty leftovers
Fixes #4037
Fixes #4063
Type of change
How Has This Been Tested?
Manual testing steps performed:
<relevant-memories>appears in effective prompt logsChecklist: