mr-memory 2.10.0 → 2.11.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.
- package/index.ts +32 -0
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -549,6 +549,30 @@ const memoryRouterPlugin = {
|
|
|
549
549
|
// CLI Commands
|
|
550
550
|
// ==================================================================
|
|
551
551
|
|
|
552
|
+
// ── Helper: Optimize OpenClaw's built-in memorySearch config
|
|
553
|
+
// When MR is active, disable session transcript scanning (MR handles it)
|
|
554
|
+
// but keep workspace file search (local, fast, no conflict)
|
|
555
|
+
async function optimizeMemorySearchConfig(): Promise<void> {
|
|
556
|
+
try {
|
|
557
|
+
// Set sources to only "memory" (workspace files), remove "sessions"
|
|
558
|
+
await runOpenClawConfigSet("agents.defaults.memorySearch.sources", JSON.stringify(["memory"]), true);
|
|
559
|
+
// Disable experimental session memory
|
|
560
|
+
await runOpenClawConfigSet("agents.defaults.memorySearch.experimental.sessionMemory", "false", true);
|
|
561
|
+
} catch {
|
|
562
|
+
// Non-fatal — config optimization is best-effort
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
// ── Helper: Restore OpenClaw's built-in memorySearch config when MR is disabled
|
|
567
|
+
async function restoreMemorySearchConfig(): Promise<void> {
|
|
568
|
+
try {
|
|
569
|
+
await runOpenClawConfigSet("agents.defaults.memorySearch.sources", JSON.stringify(["memory", "sessions"]), true);
|
|
570
|
+
await runOpenClawConfigSet("agents.defaults.memorySearch.experimental.sessionMemory", "true", true);
|
|
571
|
+
} catch {
|
|
572
|
+
// Non-fatal
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
552
576
|
api.registerCli(
|
|
553
577
|
({ program }) => {
|
|
554
578
|
const applyKey = async (key: string) => {
|
|
@@ -559,7 +583,12 @@ const memoryRouterPlugin = {
|
|
|
559
583
|
try {
|
|
560
584
|
await setPluginConfig(api, { key });
|
|
561
585
|
await setPluginEnabled(api, true);
|
|
586
|
+
// Optimize OpenClaw's built-in memorySearch: keep workspace file search
|
|
587
|
+
// but disable session transcript scanning (MR handles conversational memory)
|
|
588
|
+
await optimizeMemorySearchConfig();
|
|
562
589
|
console.log(`✓ MemoryRouter enabled. Key: ${key.slice(0, 6)}...${key.slice(-3)}`);
|
|
590
|
+
console.log(` • Session memory scanning disabled (MR handles this)`);
|
|
591
|
+
console.log(` • Workspace file search kept active`);
|
|
563
592
|
console.log(`\nRun: openclaw mr upload to upload your memories`);
|
|
564
593
|
} catch (err) {
|
|
565
594
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -587,7 +616,10 @@ const memoryRouterPlugin = {
|
|
|
587
616
|
try {
|
|
588
617
|
await setPluginConfig(api, {});
|
|
589
618
|
await setPluginEnabled(api, false);
|
|
619
|
+
// Restore OpenClaw's built-in session memory scanning
|
|
620
|
+
await restoreMemorySearchConfig();
|
|
590
621
|
console.log("✓ MemoryRouter disabled.");
|
|
622
|
+
console.log(" • Session memory scanning restored");
|
|
591
623
|
} catch (err) {
|
|
592
624
|
console.error(`Failed to disable: ${err instanceof Error ? err.message : String(err)}`);
|
|
593
625
|
}
|