mr-memory 3.13.0 → 3.13.2

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/README.md CHANGED
@@ -9,10 +9,10 @@ Use it when you want OpenClaw memory that does not restart from zero every sessi
9
9
  ## Install
10
10
 
11
11
  ```bash
12
- openclaw plugins install npm:mr-memory@3.12.0
12
+ openclaw plugins install npm:mr-memory@3.13.2
13
13
  ```
14
14
 
15
- The explicit `npm:` source and version make the audited install deterministic. `mr-memory@3.12.0` is published on npm. A ClawHub listing has not been verified and is not required for this path.
15
+ The explicit `npm:` source and version make the audited install deterministic. `mr-memory@3.13.2` is published on npm. A ClawHub listing has not been verified and is not required for this path.
16
16
 
17
17
  ## Setup
18
18
 
@@ -30,8 +30,17 @@ openclaw mr upload --brain ~/.notopenclaw # Upload from a different agent
30
30
  openclaw mr off # Disable
31
31
  openclaw mr delete # Clear vault
32
32
  openclaw mr <key> # Enable with key
33
+ openclaw mr low # Up to 21 memories (12 raw + 6 tier 2 + 3 tier 3)
34
+ openclaw mr medium # Up to 43 memories (25 + 12 + 6), balanced default
35
+ openclaw mr high # Up to 87 memories (50 + 25 + 12)
33
36
  ```
34
37
 
38
+ ## Memory Density
39
+
40
+ The current density choices are `low`, `medium`, and `high`. New installs and configs without an explicit density use `medium`, the balanced default. Existing explicit `low` or `high` settings are unchanged. Legacy `xhigh` configs remain valid so upgrades do not break the gateway, but the plugin normalizes `xhigh` to `high` and no longer advertises it as a current option.
41
+
42
+ The totals are tier-aware retrieval budgets, not raw-memory-only limits. Actual results can be lower when fewer relevant memories match.
43
+
35
44
  ## Upload Options
36
45
 
37
46
  ```bash
package/index.js CHANGED
@@ -290,6 +290,25 @@ const WORKSPACE_FILES = [
290
290
  "IDENTITY.md", "USER.md", "MEMORY.md", "HEARTBEAT.md",
291
291
  "TOOLS.md", "AGENTS.md", "SOUL.md", "BOOTSTRAP.md",
292
292
  ];
293
+ // ──────────────────────────────────────────────────────
294
+ // Helpers
295
+ // ──────────────────────────────────────────────────────
296
+ /** Current densities are low, medium, and high. Legacy xhigh remains valid in
297
+ * existing configs but is deliberately hidden from current choices and sent
298
+ * to MemoryRouter as high. Missing or invalid values use the balanced medium
299
+ * default. */
300
+ function normalizeMemoryDensity(value) {
301
+ switch (value) {
302
+ case "low":
303
+ case "medium":
304
+ case "high":
305
+ return value;
306
+ case "xhigh":
307
+ return "high";
308
+ default:
309
+ return "medium";
310
+ }
311
+ }
293
312
  function openClawConfigPath() {
294
313
  return process.env.OPENCLAW_CONFIG_PATH || process.env.OPENCLAW_CONFIG || join(os.homedir(), ".openclaw", "openclaw.json");
295
314
  }
@@ -474,7 +493,7 @@ const memoryRouterPlugin = {
474
493
  const cfg = api.pluginConfig;
475
494
  const endpoint = cfg?.endpoint?.replace(/\/v1\/?$/, "") || DEFAULT_ENDPOINT;
476
495
  const memoryKey = cfg?.key;
477
- const density = cfg?.density || "high";
496
+ const density = normalizeMemoryDensity(cfg?.density);
478
497
  const mode = cfg?.mode || "relay";
479
498
  const logging = cfg?.logging ?? false;
480
499
  const embeddings = cfg?.embeddings; // undefined = bge (default), "qwen" = qwen3-8b
@@ -688,6 +707,8 @@ If setting up MemoryRouter for another agent:
688
707
  // On stock OpenClaw, the return value is ignored (fire-and-forget).
689
708
  // When PR #24122 merges, OpenClaw will use the returned prependContext.
690
709
  // This gives forward compatibility — no plugin update needed.
710
+ // Current stock SDK typings still mark llm_input as observation-only;
711
+ // runtime builds that support returned context consume this value.
691
712
  api.on("llm_input", async (event, ctx) => {
692
713
  // Auto-consolidation runs are single-purpose tool sessions: no memory
693
714
  // injection (their prompt must stay exactly the consolidation
@@ -1016,7 +1037,7 @@ If setting up MemoryRouter for another agent:
1016
1037
  return {
1017
1038
  label: "Memory Search",
1018
1039
  name: "memory_search",
1019
- description: "Search memories from past conversations and your workspace by meaning. Use when relevant. Tier guide: tier 3 holds the highest-level consolidated reflections (identity, principles, what matters most), tier 2 holds reflections of specific meaningful events, tier 1 holds raw verbatim memories. Match filters to the question. Broad 'most important things we have done' questions: tiers [3], importance 8 or higher, large maxResults such as 100. Big-picture overviews like 'what do you know about this area or period': tiers [3] with no importance filter. Specific lookups like 'find the decision about X': omit tiers to search all tiers blended and leave importance unset; a high importance filter hides the specific detail you are looking for. Specific meaningful events without raw noise: tiers [2] or [2, 3]. Exact verbatim detail: tiers [1]. Mixing tiers is legitimate; adjust the importance threshold to the question rather than always setting it high. Only reflections (tiers 2 and 3) carry importance ratings. For time-window questions like 'what happened last week' or 'lately' use memory_date_search instead.",
1040
+ description: "Search memories from past conversations and your workspace by meaning. Use when relevant. Tier guide: tier 3 holds the highest-level consolidated reflections (identity, principles, what matters most), tier 2 holds reflections of specific meaningful events, tier 1 holds raw verbatim memories. Match filters to the question. Broad 'most important things we have done' questions: tiers [3], importance 8 or higher, large maxResults such as 250. Big-picture overviews like 'what do you know about this area or period': tiers [3] with no importance filter. Specific lookups like 'find the decision about X': omit tiers to search all tiers blended and leave importance unset; a high importance filter hides the specific detail you are looking for. Specific meaningful events without raw noise: tiers [2] or [2, 3]. Exact verbatim detail: if the detail is not already in context, drill down by lineage: search tiers [3] to find the relevant thread, then use memory_inspect on the result to see the tier 2 reflections it consolidated, then inspect those to reach the raw memories underneath. Direct tiers [1] search works when you know exact wording to match. Mixing tiers is legitimate; adjust the importance threshold to the question rather than always setting it high. Only reflections (tiers 2 and 3) carry importance ratings. For time-window questions like 'what happened last week' or 'lately' use memory_date_search instead.",
1020
1041
  parameters: {
1021
1042
  type: "object",
1022
1043
  properties: {
@@ -1026,7 +1047,7 @@ If setting up MemoryRouter for another agent:
1026
1047
  tiers: {
1027
1048
  type: "array",
1028
1049
  items: { type: "integer", enum: [1, 2, 3] },
1029
- description: "Restrict results to these memory tiers. 3 highest-level consolidated reflections (identity, principles, what matters most), 2 reflections of specific meaningful events, 1 raw verbatim memories. Use [3] for broad 'most important' or big-picture questions, [2] or [2, 3] for specific meaningful events, [1] for exact verbatim detail. Omit to search all tiers blended, the right default for specific lookups. Mixing tiers is fine. Only tiers 2 and 3 carry importance ratings.",
1050
+ description: "Restrict results to these memory tiers. 3 highest-level consolidated reflections (identity, principles, what matters most), 2 reflections of specific meaningful events, 1 raw verbatim memories. Use [3] for broad 'most important' or big-picture questions, [2] or [2, 3] for specific meaningful events, [1] for exact verbatim detail when you know the wording to match; otherwise drill down from [3] with memory_inspect. Omit to search all tiers blended, the right default for specific lookups. Mixing tiers is fine. Only tiers 2 and 3 carry importance ratings.",
1030
1051
  },
1031
1052
  importance: {
1032
1053
  type: "integer",
@@ -1094,7 +1115,7 @@ If setting up MemoryRouter for another agent:
1094
1115
  return {
1095
1116
  label: "Memory Date Search",
1096
1117
  name: "memory_date_search",
1097
- description: "Retrieve memories from a specific time window. Use for questions like 'what happened last week' or 'most important things this month or lately'. Tier guide: tier 3 holds the highest-level consolidated reflections (identity, principles, what matters most), tier 2 holds reflections of specific meaningful events, tier 1 holds raw verbatim memories. Match filters to the question. Time-bounded 'most important things last month' questions: tiers [3], importance 8 or higher, generous maxTokens. Big-picture overviews of a period like 'what do you know about July': tiers [3] with no importance filter. Specific lookups in a window like 'find the decision about X': omit tiers to include all tiers and leave importance unset; a high importance filter hides the specific detail you are looking for. Specific meaningful events without raw noise: tiers [2] or [2, 3]. Exact verbatim detail: tiers [1]. Mixing tiers is legitimate; adjust the importance threshold to the question rather than always setting it high. Only reflections (tiers 2 and 3) carry importance ratings. Omit query for a chronological review; include query to rank by relevance within the window. Resolve relative phrases like 'lately' to concrete ISO dates before calling.",
1118
+ description: "Retrieve memories from a specific time window. Use for questions like 'what happened last week' or 'most important things this month or lately'. Tier guide: tier 3 holds the highest-level consolidated reflections (identity, principles, what matters most), tier 2 holds reflections of specific meaningful events, tier 1 holds raw verbatim memories. Match filters to the question. Time-bounded 'most important things last month' questions: tiers [3], importance 8 or higher, generous maxTokens. Big-picture overviews of a period like 'what do you know about July': tiers [3] with no importance filter. Specific lookups in a window like 'find the decision about X': omit tiers to include all tiers and leave importance unset; a high importance filter hides the specific detail you are looking for. Specific meaningful events without raw noise: tiers [2] or [2, 3]. Exact verbatim detail: if the detail is not already in context, drill down by lineage: search tiers [3] to find the relevant thread, then use memory_inspect on the result to see the tier 2 reflections it consolidated, then inspect those to reach the raw memories underneath. Direct tiers [1] search works when you know exact wording to match. Mixing tiers is legitimate; adjust the importance threshold to the question rather than always setting it high. Only reflections (tiers 2 and 3) carry importance ratings. Omit query for a chronological review; include query to rank by relevance within the window. Resolve relative phrases like 'lately' to concrete ISO dates before calling.",
1098
1119
  parameters: {
1099
1120
  type: "object",
1100
1121
  properties: {
@@ -1113,7 +1134,7 @@ If setting up MemoryRouter for another agent:
1113
1134
  tiers: {
1114
1135
  type: "array",
1115
1136
  items: { type: "integer", enum: [1, 2, 3] },
1116
- description: "Restrict results to these memory tiers. 3 highest-level consolidated reflections (identity, principles, what matters most), 2 reflections of specific meaningful events, 1 raw verbatim memories. Use [3] for broad 'most important' or big-picture questions, [2] or [2, 3] for specific meaningful events, [1] for exact verbatim detail. Omit to search all tiers blended, the right default for specific lookups. Mixing tiers is fine. Only tiers 2 and 3 carry importance ratings.",
1137
+ description: "Restrict results to these memory tiers. 3 highest-level consolidated reflections (identity, principles, what matters most), 2 reflections of specific meaningful events, 1 raw verbatim memories. Use [3] for broad 'most important' or big-picture questions, [2] or [2, 3] for specific meaningful events, [1] for exact verbatim detail when you know the wording to match; otherwise drill down from [3] with memory_inspect. Omit to search all tiers blended, the right default for specific lookups. Mixing tiers is fine. Only tiers 2 and 3 carry importance ratings.",
1117
1138
  },
1118
1139
  importance: {
1119
1140
  type: "integer",
@@ -1352,7 +1373,7 @@ If setting up MemoryRouter for another agent:
1352
1373
  return {
1353
1374
  label: "Memory Inspect",
1354
1375
  name: "memory_inspect",
1355
- description: "Inspect a memory's consolidation lineage by memory_id: its tier, the batch it came from, the sources it consolidated, and what it was consolidated into. Read-only.",
1376
+ description: "Inspect a memory's consolidation lineage by memory_id: its tier, the batch it came from, the sources it consolidated, and what it was consolidated into. Use repeatedly to drill down from a high-level reflection to the tier 2 reflections and raw memories beneath it. Read-only.",
1356
1377
  parameters: {
1357
1378
  type: "object",
1358
1379
  properties: {
@@ -1499,11 +1520,12 @@ If setting up MemoryRouter for another agent:
1499
1520
  console.log("Then restart gateway:");
1500
1521
  console.log(" openclaw gateway restart");
1501
1522
  });
1502
- // Density commands
1523
+ // Current density commands. Legacy xhigh configs still load as high,
1524
+ // but xhigh is intentionally not advertised as a command.
1503
1525
  for (const [name, desc] of [
1504
- ["xhigh", "Set density to xhigh (160 results, ~50k tokens)"],
1505
- ["high", "Set density to high (80 results, ~24k tokens) [default]"],
1506
- ["low", "Set density to low (40 results, ~12k tokens)"],
1526
+ ["low", "Set density to low: up to 21 memories (12 raw + 6 tier 2 + 3 tier 3)"],
1527
+ ["medium", "Set density to medium: up to 43 memories (25 raw + 12 tier 2 + 6 tier 3) [default, balanced]"],
1528
+ ["high", "Set density to high: up to 87 memories (50 raw + 25 tier 2 + 12 tier 3)"],
1507
1529
  ]) {
1508
1530
  mr.command(name)
1509
1531
  .description(desc)
package/index.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  */
10
10
 
11
11
  import { readFile, readdir, stat, lstat, writeFile, copyFile, mkdir } from "node:fs/promises";
12
- import { commitReflections, consolidateCheckout, dateSearch, deleteMemories, deleteMemoryIds, getMemoryStats, ingestMemory, inspectMemory, prepareMemory, searchMemory, warmupMemory } from "./memoryrouter-api.js";
12
+ import { commitReflections, consolidateCheckout, dateSearch, deleteMemories, deleteMemoryIds, getMemoryStats, ingestMemory, inspectMemory, prepareMemory, searchMemory, warmupMemory, type MemoryDensity } from "./memoryrouter-api.js";
13
13
  import { isAutoConsolidationSession, maybeTriggerAutoConsolidate } from "./auto-consolidate.js";
14
14
  import { join, resolve, relative, isAbsolute, sep, dirname } from "node:path";
15
15
  import path from "node:path";
@@ -316,7 +316,8 @@ const WORKSPACE_FILES = [
316
316
  type MemoryRouterConfig = {
317
317
  key: string;
318
318
  endpoint?: string;
319
- density?: "low" | "high" | "xhigh";
319
+ /** xhigh is accepted only for backward compatibility and normalizes to high. */
320
+ density?: MemoryDensity | "xhigh";
320
321
  mode?: "relay" | "proxy";
321
322
  logging?: boolean;
322
323
  embeddings?: string;
@@ -334,6 +335,23 @@ type MemoryRouterConfig = {
334
335
  // Helpers
335
336
  // ──────────────────────────────────────────────────────
336
337
 
338
+ /** Current densities are low, medium, and high. Legacy xhigh remains valid in
339
+ * existing configs but is deliberately hidden from current choices and sent
340
+ * to MemoryRouter as high. Missing or invalid values use the balanced medium
341
+ * default. */
342
+ function normalizeMemoryDensity(value?: MemoryRouterConfig["density"]): MemoryDensity {
343
+ switch (value) {
344
+ case "low":
345
+ case "medium":
346
+ case "high":
347
+ return value;
348
+ case "xhigh":
349
+ return "high";
350
+ default:
351
+ return "medium";
352
+ }
353
+ }
354
+
337
355
  type CompatApi = OpenClawPluginApi & {
338
356
  updatePluginConfig?: (config: Record<string, unknown>) => Promise<void>;
339
357
  updatePluginEnabled?: (enabled: boolean) => Promise<void>;
@@ -525,7 +543,7 @@ const memoryRouterPlugin = {
525
543
  const cfg = api.pluginConfig as MemoryRouterConfig | undefined;
526
544
  const endpoint = cfg?.endpoint?.replace(/\/v1\/?$/, "") || DEFAULT_ENDPOINT;
527
545
  const memoryKey = cfg?.key;
528
- const density = cfg?.density || "high";
546
+ const density = normalizeMemoryDensity(cfg?.density);
529
547
  const mode = cfg?.mode || "relay";
530
548
  const logging = cfg?.logging ?? false;
531
549
  const embeddings = cfg?.embeddings; // undefined = bge (default), "qwen" = qwen3-8b
@@ -744,7 +762,9 @@ If setting up MemoryRouter for another agent:
744
762
  // On stock OpenClaw, the return value is ignored (fire-and-forget).
745
763
  // When PR #24122 merges, OpenClaw will use the returned prependContext.
746
764
  // This gives forward compatibility — no plugin update needed.
747
- api.on("llm_input", async (event, ctx) => {
765
+ // Current stock SDK typings still mark llm_input as observation-only;
766
+ // runtime builds that support returned context consume this value.
767
+ (api as any).on("llm_input", async (event: any, ctx: any) => {
748
768
  // Auto-consolidation runs are single-purpose tool sessions: no memory
749
769
  // injection (their prompt must stay exactly the consolidation
750
770
  // mission) and no re-trigger loops.
@@ -1095,7 +1115,7 @@ If setting up MemoryRouter for another agent:
1095
1115
  return {
1096
1116
  label: "Memory Search",
1097
1117
  name: "memory_search",
1098
- description: "Search memories from past conversations and your workspace by meaning. Use when relevant. Tier guide: tier 3 holds the highest-level consolidated reflections (identity, principles, what matters most), tier 2 holds reflections of specific meaningful events, tier 1 holds raw verbatim memories. Match filters to the question. Broad 'most important things we have done' questions: tiers [3], importance 8 or higher, large maxResults such as 100. Big-picture overviews like 'what do you know about this area or period': tiers [3] with no importance filter. Specific lookups like 'find the decision about X': omit tiers to search all tiers blended and leave importance unset; a high importance filter hides the specific detail you are looking for. Specific meaningful events without raw noise: tiers [2] or [2, 3]. Exact verbatim detail: tiers [1]. Mixing tiers is legitimate; adjust the importance threshold to the question rather than always setting it high. Only reflections (tiers 2 and 3) carry importance ratings. For time-window questions like 'what happened last week' or 'lately' use memory_date_search instead.",
1118
+ description: "Search memories from past conversations and your workspace by meaning. Use when relevant. Tier guide: tier 3 holds the highest-level consolidated reflections (identity, principles, what matters most), tier 2 holds reflections of specific meaningful events, tier 1 holds raw verbatim memories. Match filters to the question. Broad 'most important things we have done' questions: tiers [3], importance 8 or higher, large maxResults such as 250. Big-picture overviews like 'what do you know about this area or period': tiers [3] with no importance filter. Specific lookups like 'find the decision about X': omit tiers to search all tiers blended and leave importance unset; a high importance filter hides the specific detail you are looking for. Specific meaningful events without raw noise: tiers [2] or [2, 3]. Exact verbatim detail: if the detail is not already in context, drill down by lineage: search tiers [3] to find the relevant thread, then use memory_inspect on the result to see the tier 2 reflections it consolidated, then inspect those to reach the raw memories underneath. Direct tiers [1] search works when you know exact wording to match. Mixing tiers is legitimate; adjust the importance threshold to the question rather than always setting it high. Only reflections (tiers 2 and 3) carry importance ratings. For time-window questions like 'what happened last week' or 'lately' use memory_date_search instead.",
1099
1119
  parameters: {
1100
1120
  type: "object",
1101
1121
  properties: {
@@ -1105,7 +1125,7 @@ If setting up MemoryRouter for another agent:
1105
1125
  tiers: {
1106
1126
  type: "array",
1107
1127
  items: { type: "integer", enum: [1, 2, 3] },
1108
- description: "Restrict results to these memory tiers. 3 highest-level consolidated reflections (identity, principles, what matters most), 2 reflections of specific meaningful events, 1 raw verbatim memories. Use [3] for broad 'most important' or big-picture questions, [2] or [2, 3] for specific meaningful events, [1] for exact verbatim detail. Omit to search all tiers blended, the right default for specific lookups. Mixing tiers is fine. Only tiers 2 and 3 carry importance ratings.",
1128
+ description: "Restrict results to these memory tiers. 3 highest-level consolidated reflections (identity, principles, what matters most), 2 reflections of specific meaningful events, 1 raw verbatim memories. Use [3] for broad 'most important' or big-picture questions, [2] or [2, 3] for specific meaningful events, [1] for exact verbatim detail when you know the wording to match; otherwise drill down from [3] with memory_inspect. Omit to search all tiers blended, the right default for specific lookups. Mixing tiers is fine. Only tiers 2 and 3 carry importance ratings.",
1109
1129
  },
1110
1130
  importance: {
1111
1131
  type: "integer",
@@ -1175,7 +1195,7 @@ If setting up MemoryRouter for another agent:
1175
1195
  return {
1176
1196
  label: "Memory Date Search",
1177
1197
  name: "memory_date_search",
1178
- description: "Retrieve memories from a specific time window. Use for questions like 'what happened last week' or 'most important things this month or lately'. Tier guide: tier 3 holds the highest-level consolidated reflections (identity, principles, what matters most), tier 2 holds reflections of specific meaningful events, tier 1 holds raw verbatim memories. Match filters to the question. Time-bounded 'most important things last month' questions: tiers [3], importance 8 or higher, generous maxTokens. Big-picture overviews of a period like 'what do you know about July': tiers [3] with no importance filter. Specific lookups in a window like 'find the decision about X': omit tiers to include all tiers and leave importance unset; a high importance filter hides the specific detail you are looking for. Specific meaningful events without raw noise: tiers [2] or [2, 3]. Exact verbatim detail: tiers [1]. Mixing tiers is legitimate; adjust the importance threshold to the question rather than always setting it high. Only reflections (tiers 2 and 3) carry importance ratings. Omit query for a chronological review; include query to rank by relevance within the window. Resolve relative phrases like 'lately' to concrete ISO dates before calling.",
1198
+ description: "Retrieve memories from a specific time window. Use for questions like 'what happened last week' or 'most important things this month or lately'. Tier guide: tier 3 holds the highest-level consolidated reflections (identity, principles, what matters most), tier 2 holds reflections of specific meaningful events, tier 1 holds raw verbatim memories. Match filters to the question. Time-bounded 'most important things last month' questions: tiers [3], importance 8 or higher, generous maxTokens. Big-picture overviews of a period like 'what do you know about July': tiers [3] with no importance filter. Specific lookups in a window like 'find the decision about X': omit tiers to include all tiers and leave importance unset; a high importance filter hides the specific detail you are looking for. Specific meaningful events without raw noise: tiers [2] or [2, 3]. Exact verbatim detail: if the detail is not already in context, drill down by lineage: search tiers [3] to find the relevant thread, then use memory_inspect on the result to see the tier 2 reflections it consolidated, then inspect those to reach the raw memories underneath. Direct tiers [1] search works when you know exact wording to match. Mixing tiers is legitimate; adjust the importance threshold to the question rather than always setting it high. Only reflections (tiers 2 and 3) carry importance ratings. Omit query for a chronological review; include query to rank by relevance within the window. Resolve relative phrases like 'lately' to concrete ISO dates before calling.",
1179
1199
  parameters: {
1180
1200
  type: "object",
1181
1201
  properties: {
@@ -1194,7 +1214,7 @@ If setting up MemoryRouter for another agent:
1194
1214
  tiers: {
1195
1215
  type: "array",
1196
1216
  items: { type: "integer", enum: [1, 2, 3] },
1197
- description: "Restrict results to these memory tiers. 3 highest-level consolidated reflections (identity, principles, what matters most), 2 reflections of specific meaningful events, 1 raw verbatim memories. Use [3] for broad 'most important' or big-picture questions, [2] or [2, 3] for specific meaningful events, [1] for exact verbatim detail. Omit to search all tiers blended, the right default for specific lookups. Mixing tiers is fine. Only tiers 2 and 3 carry importance ratings.",
1217
+ description: "Restrict results to these memory tiers. 3 highest-level consolidated reflections (identity, principles, what matters most), 2 reflections of specific meaningful events, 1 raw verbatim memories. Use [3] for broad 'most important' or big-picture questions, [2] or [2, 3] for specific meaningful events, [1] for exact verbatim detail when you know the wording to match; otherwise drill down from [3] with memory_inspect. Omit to search all tiers blended, the right default for specific lookups. Mixing tiers is fine. Only tiers 2 and 3 carry importance ratings.",
1198
1218
  },
1199
1219
  importance: {
1200
1220
  type: "integer",
@@ -1448,7 +1468,7 @@ If setting up MemoryRouter for another agent:
1448
1468
  return {
1449
1469
  label: "Memory Inspect",
1450
1470
  name: "memory_inspect",
1451
- description: "Inspect a memory's consolidation lineage by memory_id: its tier, the batch it came from, the sources it consolidated, and what it was consolidated into. Read-only.",
1471
+ description: "Inspect a memory's consolidation lineage by memory_id: its tier, the batch it came from, the sources it consolidated, and what it was consolidated into. Use repeatedly to drill down from a high-level reflection to the tier 2 reflections and raw memories beneath it. Read-only.",
1452
1472
  parameters: {
1453
1473
  type: "object",
1454
1474
  properties: {
@@ -1590,11 +1610,12 @@ If setting up MemoryRouter for another agent:
1590
1610
  console.log(" openclaw gateway restart");
1591
1611
  });
1592
1612
 
1593
- // Density commands
1613
+ // Current density commands. Legacy xhigh configs still load as high,
1614
+ // but xhigh is intentionally not advertised as a command.
1594
1615
  for (const [name, desc] of [
1595
- ["xhigh", "Set density to xhigh (160 results, ~50k tokens)"],
1596
- ["high", "Set density to high (80 results, ~24k tokens) [default]"],
1597
- ["low", "Set density to low (40 results, ~12k tokens)"],
1616
+ ["low", "Set density to low: up to 21 memories (12 raw + 6 tier 2 + 3 tier 3)"],
1617
+ ["medium", "Set density to medium: up to 43 memories (25 raw + 12 tier 2 + 6 tier 3) [default, balanced]"],
1618
+ ["high", "Set density to high: up to 87 memories (50 raw + 25 tier 2 + 12 tier 3)"],
1598
1619
  ] as const) {
1599
1620
  mr.command(name)
1600
1621
  .description(desc)
@@ -1,8 +1,10 @@
1
1
  const JSON_HEADERS = { "Content-Type": "application/json" };
2
2
 
3
+ export type MemoryDensity = "low" | "medium" | "high";
4
+
3
5
  type PreparePayload = {
4
6
  messages: Array<{ role: string; content: string }>;
5
- density: string;
7
+ density: MemoryDensity;
6
8
  embeddings?: string;
7
9
  };
8
10
 
@@ -18,9 +18,9 @@
18
18
  },
19
19
  "density": {
20
20
  "label": "Memory Density",
21
- "placeholder": "high",
21
+ "placeholder": "medium",
22
22
  "advanced": true,
23
- "help": "Amount of memory to inject: low (40), high (80), xhigh (160)"
23
+ "help": "Current choices: low, up to 21 memories (12 raw + 6 tier 2 + 3 tier 3); medium, up to 43 (25 + 12 + 6), balanced default; high, up to 87 (50 + 25 + 12)."
24
24
  },
25
25
  "keepWarmMs": {
26
26
  "label": "Keep Warm Window (ms)",
@@ -48,7 +48,9 @@
48
48
  },
49
49
  "density": {
50
50
  "type": "string",
51
- "enum": ["low", "high", "xhigh"]
51
+ "pattern": "^(low|medium|high|xhigh)$",
52
+ "default": "medium",
53
+ "description": "Current densities are low, medium, and high. Legacy xhigh configs remain valid and are treated as high."
52
54
  },
53
55
  "logging": {
54
56
  "type": "boolean"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mr-memory",
3
- "version": "3.13.0",
3
+ "version": "3.13.2",
4
4
  "description": "Persistent memory for OpenClaw, powered by MemoryRouter. Relay-based AI agent memory across sessions, compaction, and model changes.",
5
5
  "type": "module",
6
6
  "files": [