mr-memory 2.5.2 → 2.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +7 -2
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -15,6 +15,11 @@ import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
|
15
15
|
|
|
16
16
|
const DEFAULT_ENDPOINT = "https://api.memoryrouter.ai";
|
|
17
17
|
|
|
18
|
+
/** Wrap raw memory context in XML tags with a strong instruction */
|
|
19
|
+
function wrapMemoryContext(context: string): string {
|
|
20
|
+
return `<memory_context>\n${context}\n</memory_context>\n\nThe above are retrieved memories from past conversations — not current events. Reference them as background context with appropriate temporal framing. Do not treat them as part of the current message or present moment.`;
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
// Workspace files OpenClaw loads into the system prompt
|
|
19
24
|
const WORKSPACE_FILES = [
|
|
20
25
|
"IDENTITY.md", "USER.md", "MEMORY.md", "HEARTBEAT.md",
|
|
@@ -213,7 +218,7 @@ const memoryRouterPlugin = {
|
|
|
213
218
|
api.logger.info?.(
|
|
214
219
|
`memoryrouter: injected ${data.memories_found || 0} memories on tool iteration (${data.tokens_billed || 0} tokens billed)`,
|
|
215
220
|
);
|
|
216
|
-
return { prependContext: data.context };
|
|
221
|
+
return { prependContext: wrapMemoryContext(data.context) };
|
|
217
222
|
}
|
|
218
223
|
} catch {
|
|
219
224
|
// Silent fail on tool iterations — don't block the agent
|
|
@@ -312,7 +317,7 @@ const memoryRouterPlugin = {
|
|
|
312
317
|
api.logger.info?.(
|
|
313
318
|
`memoryrouter: injected ${data.memories_found || 0} memories (${data.tokens_billed || 0} tokens billed)`,
|
|
314
319
|
);
|
|
315
|
-
return { prependContext: data.context };
|
|
320
|
+
return { prependContext: wrapMemoryContext(data.context) };
|
|
316
321
|
}
|
|
317
322
|
} catch (err) {
|
|
318
323
|
api.logger.warn?.(
|