Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

OpenClaw plugin: fix auto-recall injection and auto-capture message drop (#4065)

Zlo7a6810819ca02
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: `<relevant-memories>\nThe following memories may be relevant to this conversation:\n${memoryContext}\n</relevant-memories>`,
+ prependContext: `<relevant-memories>\nThe following memories may be relevant to this conversation:\n${memoryContext}\n</relevant-memories>`,
};
} 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<string, unknown>).type === "text" &&
"text" in block &&
typeof (block as Record<string, unknown>).text === "string"
) {
@@ -1331,8 +1329,11 @@ const memoryPlugin = {
}
if (!textContent) continue;
- // Skip injected memory context
- if (textContent.includes("<relevant-memories>")) continue;
+ // Strip injected memory context, keep the actual user text
+ if (textContent.includes("<relevant-memories>")) {
+ textContent = textContent.replace(/<relevant-memories>[\s\S]*?<\/relevant-memories>\s*/g, "").trim();
+ if (!textContent) continue;
+ }
formattedMessages.push({
role: role as string,