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,