From a6810819ca029ab484baf4387b68dba0e0f44d00 Mon Sep 17 00:00:00 2001 From: Zlo7 <70218222+Zlo7@users.noreply.github.com> Date: Tue, 17 Feb 2026 15:26:45 -0600 Subject: [PATCH] OpenClaw plugin: fix auto-recall injection and auto-capture message drop (#4065) --- openclaw/index.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/openclaw/index.ts b/openclaw/index.ts index 09097761d..a25034c13 100644 --- a/openclaw/index.ts +++ b/openclaw/index.ts @@ -1274,7 +1274,7 @@ const memoryPlugin = { ); return { - systemContext: `\nThe following memories may be relevant to this conversation:\n${memoryContext}\n`, + prependContext: `\nThe following memories may be relevant to this conversation:\n${memoryContext}\n`, }; } catch (err) { api.logger.warn(`openclaw-mem0: recall failed: ${String(err)}`); @@ -1318,8 +1318,6 @@ const memoryPlugin = { if ( block && typeof block === "object" && - "type" in block && - (block as Record).type === "text" && "text" in block && typeof (block as Record).text === "string" ) { @@ -1331,8 +1329,11 @@ const memoryPlugin = { } if (!textContent) continue; - // Skip injected memory context - if (textContent.includes("")) continue; + // Strip injected memory context, keep the actual user text + if (textContent.includes("")) { + textContent = textContent.replace(/[\s\S]*?<\/relevant-memories>\s*/g, "").trim(); + if (!textContent) continue; + } formattedMessages.push({ role: role as string,