openclaw-memory-decay 0.1.7 → 0.1.8

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
@@ -67,7 +67,7 @@ python3 -m venv ~/.openclaw/venvs/memory-decay
67
67
  openclaw plugins install openclaw-memory-decay
68
68
 
69
69
  # 3. (Optional but recommended) Restrict auto-load to trusted plugins only
70
- openclaw config set plugins.allow '["memory-decay"]'
70
+ openclaw config set plugins.allow '["openclaw-memory-decay"]'
71
71
 
72
72
  # 4. Restart the gateway
73
73
  openclaw gateway restart
@@ -93,14 +93,14 @@ openclaw plugins install openclaw-memory-decay
93
93
  openclaw gateway restart
94
94
 
95
95
  # 3. Verify
96
- openclaw plugins list | grep memory-decay # should show: memory-decay | loaded
96
+ openclaw plugins list | grep openclaw-memory-decay # should show: openclaw-memory-decay | loaded
97
97
  curl -s http://127.0.0.1:8100/health # should show: {"status":"ok","current_tick":0}
98
98
  ```
99
99
 
100
100
  If auto-detection does not recover your backend path after migration, set the interpreter explicitly:
101
101
 
102
102
  ```bash
103
- openclaw config set plugins.entries.memory-decay.config.pythonPath "~/.openclaw/venvs/memory-decay/bin/python"
103
+ openclaw config set plugins.entries.openclaw-memory-decay.config.pythonPath "~/.openclaw/venvs/memory-decay/bin/python"
104
104
  openclaw gateway restart
105
105
  ```
106
106
 
@@ -108,19 +108,19 @@ openclaw gateway restart
108
108
 
109
109
  To update in the future:
110
110
  ```bash
111
- openclaw plugins update memory-decay
111
+ openclaw plugins update openclaw-memory-decay
112
112
  openclaw gateway restart
113
113
  ```
114
114
 
115
115
  ## Configuration
116
116
 
117
- Add to `~/.openclaw/openclaw.json` under `plugins.entries.memory-decay.config`:
117
+ Add to `~/.openclaw/openclaw.json` under `plugins.entries.openclaw-memory-decay.config`:
118
118
 
119
119
  ```json
120
120
  {
121
121
  "plugins": {
122
122
  "entries": {
123
- "memory-decay": {
123
+ "openclaw-memory-decay": {
124
124
  "enabled": true,
125
125
  "config": {
126
126
  "dbPath": "~/.openclaw/memory-decay-data/memories.db",
@@ -243,7 +243,7 @@ The plugin registers these tools:
243
243
  This warning appears when `plugins.allow` is not set. While the plugin still loads (since it is explicitly configured in `plugins.entries`), it is good practice to restrict auto-load to trusted plugins only:
244
244
 
245
245
  ```bash
246
- openclaw config set plugins.allow '["memory-decay"]'
246
+ openclaw config set plugins.allow '["openclaw-memory-decay"]'
247
247
  openclaw gateway restart
248
248
  ```
249
249
 
@@ -304,7 +304,7 @@ openclaw gateway restart
304
304
 
305
305
  # 4. Verify plugin is loaded
306
306
  openclaw plugins list
307
- # Look for: memory-decay | loaded
307
+ # Look for: openclaw-memory-decay | loaded
308
308
 
309
309
  # 5. Check server health
310
310
  curl -s http://127.0.0.1:8100/health
@@ -1,8 +1,8 @@
1
1
  {
2
- "id": "memory-decay",
2
+ "id": "openclaw-memory-decay",
3
3
  "name": "Memory Decay",
4
4
  "description": "Human-like memory with decay and reinforcement for OpenClaw agents",
5
- "version": "0.1.7",
5
+ "version": "0.1.8",
6
6
  "configSchema": {
7
7
  "type": "object",
8
8
  "additionalProperties": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-memory-decay",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "description": "OpenClaw memory plugin backed by memory-decay engine",
6
6
  "main": "./src/index.js",
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
2
2
  import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
3
3
  import { MemoryDecayClient } from "./client.js";
4
+ import { loadLegacyPluginConfig } from "./legacy-config.js";
4
5
  import { MemoryDecayService, type ServiceConfig } from "./service.js";
5
6
  import { shouldMigrate, migrateMarkdownMemories } from "./migrator.js";
6
7
  import { detectPythonEnv, mergePythonEnv } from "./python-env.js";
@@ -39,14 +40,14 @@ Your memories naturally decay over time. Frequently recalled memories grow stron
39
40
  const MIN_MESSAGE_LENGTH = 20;
40
41
 
41
42
  const memoryDecayPlugin = {
42
- id: "memory-decay",
43
+ id: "openclaw-memory-decay",
43
44
  name: "Memory Decay",
44
45
  description: "Human-like memory with decay and reinforcement",
45
46
  kind: "memory" as const,
46
47
  configSchema: emptyPluginConfigSchema(),
47
48
 
48
49
  register(api: OpenClawPluginApi) {
49
- const cfg = api.pluginConfig ?? {};
50
+ const cfg = loadLegacyPluginConfig((api.pluginConfig ?? {}) as Record<string, unknown>);
50
51
  const port = (cfg.serverPort as number) ?? 8100;
51
52
  const autoSave = cfg.autoSave !== false; // default true
52
53
 
@@ -0,0 +1,35 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { join, resolve } from "node:path";
4
+
5
+ export type PluginConfigLike = Record<string, unknown>;
6
+
7
+ function resolveOpenClawConfigPath(env: NodeJS.ProcessEnv = process.env): string {
8
+ return resolve(env.OPENCLAW_HOME || homedir(), ".openclaw", "openclaw.json");
9
+ }
10
+
11
+ export function loadLegacyPluginConfig(
12
+ currentConfig: PluginConfigLike,
13
+ {
14
+ env = process.env,
15
+ configPath = resolveOpenClawConfigPath(env),
16
+ }: { env?: NodeJS.ProcessEnv; configPath?: string } = {},
17
+ ): PluginConfigLike {
18
+ if (Object.keys(currentConfig).length > 0) {
19
+ return currentConfig;
20
+ }
21
+
22
+ if (!existsSync(configPath)) {
23
+ return currentConfig;
24
+ }
25
+
26
+ try {
27
+ const root = JSON.parse(readFileSync(configPath, "utf8"));
28
+ const legacyConfig = root?.plugins?.entries?.["memory-decay"]?.config;
29
+ return legacyConfig && typeof legacyConfig === "object"
30
+ ? { ...legacyConfig }
31
+ : currentConfig;
32
+ } catch {
33
+ return currentConfig;
34
+ }
35
+ }