mr-memory 2.3.1 → 2.4.0

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.
Files changed (2) hide show
  1. package/index.ts +11 -2
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -28,6 +28,15 @@ type MemoryRouterConfig = {
28
28
  mode?: "relay" | "proxy";
29
29
  };
30
30
 
31
+ // ──────────────────────────────────────────────────────
32
+ // Memory Context Formatting (matches proxy formatters)
33
+ // ──────────────────────────────────────────────────────
34
+
35
+ function wrapMemoryContext(context: string): string {
36
+ if (!context) return context;
37
+ return `<memory_context>\n${context}\n</memory_context>\n\nUse the above context from previous conversations to inform your response. Do not explicitly mention that you're using memory unless directly asked.`;
38
+ }
39
+
31
40
  // ──────────────────────────────────────────────────────
32
41
  // Helpers
33
42
  // ──────────────────────────────────────────────────────
@@ -212,7 +221,7 @@ const memoryRouterPlugin = {
212
221
  api.logger.info?.(
213
222
  `memoryrouter: injected ${data.memories_found || 0} memories on tool iteration (${data.tokens_billed || 0} tokens billed)`,
214
223
  );
215
- return { prependContext: data.context };
224
+ return { prependContext: wrapMemoryContext(data.context) };
216
225
  }
217
226
  } catch {
218
227
  // Silent fail on tool iterations — don't block the agent
@@ -310,7 +319,7 @@ const memoryRouterPlugin = {
310
319
  api.logger.info?.(
311
320
  `memoryrouter: injected ${data.memories_found || 0} memories (${data.tokens_billed || 0} tokens billed)`,
312
321
  );
313
- return { prependContext: data.context };
322
+ return { prependContext: wrapMemoryContext(data.context) };
314
323
  }
315
324
  } catch (err) {
316
325
  api.logger.warn?.(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mr-memory",
3
- "version": "2.3.1",
3
+ "version": "2.4.0",
4
4
  "description": "MemoryRouter persistent memory plugin for OpenClaw — your AI remembers every conversation",
5
5
  "type": "module",
6
6
  "files": [