neuralmemory 1.14.0 → 1.15.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/README.md +1 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +148 -14
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +13 -0
- package/openclaw.plugin.json +19 -1
- package/package.json +1 -1
- package/src/index.ts +534 -342
- package/src/types.ts +16 -0
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ Add to `~/.openclaw/openclaw.json`:
|
|
|
54
54
|
|
|
55
55
|
**v1.7.0+**: The plugin dynamically fetches **all tools** from the MCP server at startup. Whatever version of `neural-memory` you have installed, the plugin automatically exposes every tool it provides — no plugin update needed when new tools are added.
|
|
56
56
|
|
|
57
|
-
With `neural-memory>=4.6.0`, this includes **
|
|
57
|
+
With `neural-memory>=4.6.0`, this includes **50 tools**:
|
|
58
58
|
|
|
59
59
|
| Category | Tools |
|
|
60
60
|
|----------|-------|
|
package/dist/index.d.ts
CHANGED
|
@@ -28,14 +28,28 @@
|
|
|
28
28
|
* Registers:
|
|
29
29
|
* N tools — dynamically from MCP server (fallback: 5 core + 2 compat)
|
|
30
30
|
* 1 service — MCP process lifecycle (start/stop)
|
|
31
|
-
*
|
|
31
|
+
* 6 hooks — before_agent_start (auto-context), agent_end (auto-capture),
|
|
32
|
+
* session:compact:before (flush), command:new/reset (flush),
|
|
33
|
+
* gateway:startup (consolidation)
|
|
32
34
|
*/
|
|
33
35
|
import type { OpenClawPluginDefinition } from "./types.js";
|
|
36
|
+
/**
|
|
37
|
+
* Strip metadata preamble from raw prompts before recall.
|
|
38
|
+
*
|
|
39
|
+
* OpenClaw + Telegram injects JSON metadata, NeuralMemory context blocks,
|
|
40
|
+
* env vars, and system boilerplate into ev.prompt. Passing these raw to
|
|
41
|
+
* nmem_recall creates junk neurons like "[concept] json message id".
|
|
42
|
+
*
|
|
43
|
+
* Stripping order matters — later passes clean up residue from earlier ones.
|
|
44
|
+
*/
|
|
45
|
+
export declare function stripPromptMetadata(raw: string): string;
|
|
34
46
|
type PluginConfig = {
|
|
35
47
|
pythonPath: string;
|
|
36
48
|
brain: string;
|
|
37
49
|
autoContext: boolean;
|
|
38
50
|
autoCapture: boolean;
|
|
51
|
+
autoFlush: boolean;
|
|
52
|
+
autoConsolidate: boolean;
|
|
39
53
|
contextDepth: number;
|
|
40
54
|
maxContextTokens: number;
|
|
41
55
|
timeout: number;
|
package/dist/index.js
CHANGED
|
@@ -28,10 +28,46 @@
|
|
|
28
28
|
* Registers:
|
|
29
29
|
* N tools — dynamically from MCP server (fallback: 5 core + 2 compat)
|
|
30
30
|
* 1 service — MCP process lifecycle (start/stop)
|
|
31
|
-
*
|
|
31
|
+
* 6 hooks — before_agent_start (auto-context), agent_end (auto-capture),
|
|
32
|
+
* session:compact:before (flush), command:new/reset (flush),
|
|
33
|
+
* gateway:startup (consolidation)
|
|
32
34
|
*/
|
|
33
35
|
import { NeuralMemoryMcpClient } from "./mcp-client.js";
|
|
34
36
|
import { createToolsFromMcp, createFallbackTools, createCompatibilityTools } from "./tools.js";
|
|
37
|
+
// ── Prompt metadata stripping ─────────────────────────────
|
|
38
|
+
/**
|
|
39
|
+
* Strip metadata preamble from raw prompts before recall.
|
|
40
|
+
*
|
|
41
|
+
* OpenClaw + Telegram injects JSON metadata, NeuralMemory context blocks,
|
|
42
|
+
* env vars, and system boilerplate into ev.prompt. Passing these raw to
|
|
43
|
+
* nmem_recall creates junk neurons like "[concept] json message id".
|
|
44
|
+
*
|
|
45
|
+
* Stripping order matters — later passes clean up residue from earlier ones.
|
|
46
|
+
*/
|
|
47
|
+
export function stripPromptMetadata(raw) {
|
|
48
|
+
let cleaned = raw;
|
|
49
|
+
// 1. Remove JSON blocks (Telegram metadata, conversation info)
|
|
50
|
+
cleaned = cleaned.replace(/^\{[\s\S]*?"(?:conversation|message_id|sender_id|sender|chat_id|update_id)"[\s\S]*?\}$/gm, "");
|
|
51
|
+
// 2. Remove NeuralMemory context sections (## Relevant Memories, etc.)
|
|
52
|
+
// The |$ ensures sections at end-of-string are also stripped.
|
|
53
|
+
cleaned = cleaned.replace(/^#{1,3}\s*(?:Relevant Memories|Related Information|Relevant Context|Neural Memory)[\s\S]*?(?=\n#{1,3}\s|\n\n(?![-•*\s])|$)/gim, "");
|
|
54
|
+
// 3. Remove neuron-type bullet lines injected by NM context
|
|
55
|
+
cleaned = cleaned.replace(/^-\s*\[(?:concept|entity|decision|error|preference|insight|memory|fact|workflow|instruction|pattern)\].*$/gim, "");
|
|
56
|
+
// 4. Remove [NeuralMemory — ...] wrapper lines
|
|
57
|
+
cleaned = cleaned.replace(/^\[NeuralMemory\s*[—–-].*\]$/gm, "");
|
|
58
|
+
// 5. Remove metadata labels (untrusted metadata lines)
|
|
59
|
+
cleaned = cleaned.replace(/^(?:Conversation info|Sender|Context|System)\s*\(.*?\)\s*:?\s*$/gim, "");
|
|
60
|
+
// 6. Remove env/export lines
|
|
61
|
+
cleaned = cleaned.replace(/^export\s+\w+=.*$/gm, "");
|
|
62
|
+
// 7. Collapse whitespace runs
|
|
63
|
+
cleaned = cleaned.replace(/\n{3,}/g, "\n\n").trim();
|
|
64
|
+
// Fallback: if everything was stripped, use last non-empty line of raw
|
|
65
|
+
if (!cleaned) {
|
|
66
|
+
const lines = raw.split("\n").filter((l) => l.trim());
|
|
67
|
+
cleaned = lines[lines.length - 1]?.trim() ?? raw.trim();
|
|
68
|
+
}
|
|
69
|
+
return cleaned;
|
|
70
|
+
}
|
|
35
71
|
// ── System prompt for tool awareness ──────────────────────
|
|
36
72
|
/**
|
|
37
73
|
* Build a system prompt listing all registered tool names.
|
|
@@ -41,21 +77,43 @@ function buildToolInstructions(tools) {
|
|
|
41
77
|
const toolList = tools
|
|
42
78
|
.map((t) => `- ${t.name}: ${t.description.slice(0, 100)}`)
|
|
43
79
|
.join("\n");
|
|
44
|
-
return `
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
80
|
+
return `Neural Memory gives you persistent memory across sessions. Use it proactively — each session starts fresh, so without explicit saves ALL discoveries are lost.
|
|
81
|
+
|
|
82
|
+
These are TOOL CALLS, not CLI commands. Do NOT run "nmem remember" in terminal.
|
|
83
|
+
|
|
84
|
+
## Available Tools
|
|
85
|
+
${toolList}
|
|
86
|
+
|
|
87
|
+
nmem_* is your primary memory system. memory_search/memory_get are legacy aliases for nmem_recall.
|
|
88
|
+
|
|
89
|
+
## WHEN TO RECALL
|
|
90
|
+
- New session starts → nmem_recall("current project context")
|
|
91
|
+
- User references past event → nmem_recall("<that topic>")
|
|
92
|
+
- Prefix queries with project name for precision
|
|
93
|
+
|
|
94
|
+
## WHEN TO SAVE
|
|
95
|
+
After each task: did you make a decision (type="decision", priority=7), fix a bug (type="error", priority=7), learn a preference (type="preference", priority=8), or discover an insight (type="insight", priority=6)?
|
|
96
|
+
|
|
97
|
+
Save with: nmem_remember(content="Chose X over Y because Z", type="decision", priority=7, tags=["project", "topic"])
|
|
98
|
+
|
|
99
|
+
## CONTENT QUALITY
|
|
100
|
+
- Max 1-3 sentences. Use causal language: "Chose X because Y", "Root cause was X, fixed by Y".
|
|
101
|
+
- Always include project name + topic in tags (lowercase).
|
|
102
|
+
- For temporary scratch notes: nmem_remember(content="...", ephemeral=true) — auto-expires, never synced.
|
|
103
|
+
|
|
104
|
+
## SESSION END
|
|
105
|
+
nmem_auto(action="process", text="<brief session summary>")
|
|
106
|
+
|
|
107
|
+
## COMPACT MODE
|
|
108
|
+
All tools support compact=true (saves 60-80% tokens) and token_budget=N.`;
|
|
53
109
|
}
|
|
54
110
|
const DEFAULT_CONFIG = {
|
|
55
111
|
pythonPath: "python",
|
|
56
112
|
brain: "default",
|
|
57
113
|
autoContext: true,
|
|
58
114
|
autoCapture: true,
|
|
115
|
+
autoFlush: true,
|
|
116
|
+
autoConsolidate: true,
|
|
59
117
|
contextDepth: 1,
|
|
60
118
|
maxContextTokens: 500,
|
|
61
119
|
timeout: 30_000,
|
|
@@ -78,6 +136,12 @@ export function resolveConfig(raw) {
|
|
|
78
136
|
autoCapture: typeof merged.autoCapture === "boolean"
|
|
79
137
|
? merged.autoCapture
|
|
80
138
|
: DEFAULT_CONFIG.autoCapture,
|
|
139
|
+
autoFlush: typeof merged.autoFlush === "boolean"
|
|
140
|
+
? merged.autoFlush
|
|
141
|
+
: DEFAULT_CONFIG.autoFlush,
|
|
142
|
+
autoConsolidate: typeof merged.autoConsolidate === "boolean"
|
|
143
|
+
? merged.autoConsolidate
|
|
144
|
+
: DEFAULT_CONFIG.autoConsolidate,
|
|
81
145
|
contextDepth: typeof merged.contextDepth === "number" &&
|
|
82
146
|
Number.isInteger(merged.contextDepth) &&
|
|
83
147
|
merged.contextDepth >= 0 &&
|
|
@@ -112,7 +176,7 @@ function getOrCreateMcpClient(cfg, logger) {
|
|
|
112
176
|
const key = `${cfg.pythonPath}::${cfg.brain}`;
|
|
113
177
|
const existing = mcpClients.get(key);
|
|
114
178
|
if (existing) {
|
|
115
|
-
logger.
|
|
179
|
+
logger.debug?.(`Reusing existing MCP client for brain "${cfg.brain}"`);
|
|
116
180
|
return existing;
|
|
117
181
|
}
|
|
118
182
|
const mcp = new NeuralMemoryMcpClient({
|
|
@@ -130,7 +194,7 @@ const plugin = {
|
|
|
130
194
|
id: "neuralmemory",
|
|
131
195
|
name: "NeuralMemory",
|
|
132
196
|
description: "Brain-inspired persistent memory for AI agents — neurons, synapses, and fibers",
|
|
133
|
-
version: "1.
|
|
197
|
+
version: "1.15.0",
|
|
134
198
|
kind: "memory",
|
|
135
199
|
register(api) {
|
|
136
200
|
const cfg = resolveConfig(api.pluginConfig);
|
|
@@ -186,8 +250,9 @@ const plugin = {
|
|
|
186
250
|
if (cfg.autoContext && mcp.connected) {
|
|
187
251
|
const ev = event;
|
|
188
252
|
try {
|
|
253
|
+
const query = stripPromptMetadata(ev.prompt);
|
|
189
254
|
const raw = await mcp.callTool("nmem_recall", {
|
|
190
|
-
query
|
|
255
|
+
query,
|
|
191
256
|
depth: cfg.contextDepth,
|
|
192
257
|
max_tokens: cfg.maxContextTokens,
|
|
193
258
|
});
|
|
@@ -232,9 +297,78 @@ const plugin = {
|
|
|
232
297
|
}
|
|
233
298
|
}, { priority: 90 });
|
|
234
299
|
}
|
|
300
|
+
// ── Hook: flush memories before context compaction ──
|
|
301
|
+
if (cfg.autoFlush) {
|
|
302
|
+
api.on("session:compact:before", async (_event, _ctx) => {
|
|
303
|
+
if (!mcp.connected)
|
|
304
|
+
return;
|
|
305
|
+
try {
|
|
306
|
+
await mcp.callTool("nmem_auto", {
|
|
307
|
+
action: "process",
|
|
308
|
+
text: "[pre-compact emergency flush]",
|
|
309
|
+
});
|
|
310
|
+
api.logger.info("Pre-compact flush completed");
|
|
311
|
+
}
|
|
312
|
+
catch (err) {
|
|
313
|
+
api.logger.warn(`Pre-compact flush failed: ${err.message}`);
|
|
314
|
+
}
|
|
315
|
+
}, { priority: 5 });
|
|
316
|
+
// Flush on session boundary (new/reset commands)
|
|
317
|
+
api.on("command:new", async (_event, _ctx) => {
|
|
318
|
+
if (!mcp.connected)
|
|
319
|
+
return;
|
|
320
|
+
try {
|
|
321
|
+
await mcp.callTool("nmem_auto", {
|
|
322
|
+
action: "process",
|
|
323
|
+
text: "[session boundary — command:new]",
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
catch (err) {
|
|
327
|
+
api.logger.warn(`Session boundary flush failed: ${err.message}`);
|
|
328
|
+
}
|
|
329
|
+
}, { priority: 10 });
|
|
330
|
+
api.on("command:reset", async (_event, _ctx) => {
|
|
331
|
+
if (!mcp.connected)
|
|
332
|
+
return;
|
|
333
|
+
try {
|
|
334
|
+
await mcp.callTool("nmem_auto", {
|
|
335
|
+
action: "process",
|
|
336
|
+
text: "[session boundary — command:reset]",
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
catch (err) {
|
|
340
|
+
api.logger.warn(`Session reset flush failed: ${err.message}`);
|
|
341
|
+
}
|
|
342
|
+
}, { priority: 10 });
|
|
343
|
+
}
|
|
344
|
+
// ── Hook: consolidation on gateway startup ───────────
|
|
345
|
+
if (cfg.autoConsolidate) {
|
|
346
|
+
api.on("gateway:startup", async (_event, _ctx) => {
|
|
347
|
+
if (!mcp.connected) {
|
|
348
|
+
try {
|
|
349
|
+
await mcp.ensureConnected();
|
|
350
|
+
}
|
|
351
|
+
catch (err) {
|
|
352
|
+
api.logger.warn(`MCP connect on startup failed: ${err.message}`);
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
try {
|
|
357
|
+
await mcp.callTool("nmem_consolidate", {
|
|
358
|
+
strategy: "enrich",
|
|
359
|
+
compact: true,
|
|
360
|
+
});
|
|
361
|
+
api.logger.info("Startup consolidation completed");
|
|
362
|
+
}
|
|
363
|
+
catch (err) {
|
|
364
|
+
api.logger.warn(`Startup consolidation failed: ${err.message}`);
|
|
365
|
+
}
|
|
366
|
+
}, { priority: 50 });
|
|
367
|
+
}
|
|
235
368
|
// ── Done ────────────────────────────────────────────
|
|
236
369
|
api.logger.info(`NeuralMemory registered (brain: ${cfg.brain}, ` +
|
|
237
|
-
`autoContext: ${cfg.autoContext}, autoCapture: ${cfg.autoCapture}
|
|
370
|
+
`autoContext: ${cfg.autoContext}, autoCapture: ${cfg.autoCapture}, ` +
|
|
371
|
+
`autoFlush: ${cfg.autoFlush}, autoConsolidate: ${cfg.autoConsolidate}) — ` +
|
|
238
372
|
`tools will be loaded dynamically from MCP on service start`);
|
|
239
373
|
},
|
|
240
374
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AASH,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAE,kB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Ae,EAAE,IAAa,EAAiB,EAAE;gBACtD,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;oBACnB,IAAI,CAAC;wBACH,MAAM,GAAG,CAAC,eAAe,EAAE,CAAC;oBAC9B,CAAC;oBAAC,OAAO,GAAG,EAAE,CAAC;wBACb,GAAG,CAAC,MAAM,CAAC,IAAI,CACb,kCAAmC,GAAa,CAAC,OAAO,EAAE,CAC3D,CAAC;wBACF,OAAO;oBACT,CAAC;gBACH,CAAC;gBAED,IAAI,CAAC;oBACH,MAAM,GAAG,CAAC,QAAQ,CAAC,kBAAkB,EAAE;wBACrC,QAAQ,EAAE,QAAQ;wBAClB,OAAO,EAAE,IAAI;qBACd,CAAC,CAAC;oBACH,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;gBACrD,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,GAAG,CAAC,MAAM,CAAC,IAAI,CACb,iCAAkC,GAAa,CAAC,OAAO,EAAE,CAC1D,CAAC;gBACJ,CAAC;YACH,CAAC,EACD,EAAE,QAAQ,EAAE,EAAE,EAAE,CACjB,CAAC;QACJ,CAAC;QAED,uDAAuD;QAEvD,GAAG,CAAC,MAAM,CAAC,IAAI,CACb,mCAAmC,GAAG,CAAC,KAAK,IAAI;YAC9C,gBAAgB,GAAG,CAAC,WAAW,kBAAkB,GAAG,CAAC,WAAW,IAAI;YACpE,cAAc,GAAG,CAAC,SAAS,sBAAsB,GAAG,CAAC,eAAe,MAAM;YAC1E,4DAA4D,CAC/D,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -41,6 +41,19 @@ export type AgentContext = {
|
|
|
41
41
|
sessionKey?: string;
|
|
42
42
|
workspaceDir?: string;
|
|
43
43
|
};
|
|
44
|
+
export type SessionCompactEvent = {
|
|
45
|
+
reason?: string;
|
|
46
|
+
messagesBeforeCompact?: number;
|
|
47
|
+
};
|
|
48
|
+
export type CommandEvent = {
|
|
49
|
+
command: string;
|
|
50
|
+
sessionKey?: string;
|
|
51
|
+
workspaceDir?: string;
|
|
52
|
+
};
|
|
53
|
+
export type GatewayStartupEvent = {
|
|
54
|
+
version?: string;
|
|
55
|
+
workspaceDir?: string;
|
|
56
|
+
};
|
|
44
57
|
export type OpenClawPluginApi = {
|
|
45
58
|
id: string;
|
|
46
59
|
name: string;
|
package/openclaw.plugin.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"kind": "memory",
|
|
4
4
|
"name": "NeuralMemory",
|
|
5
5
|
"description": "Brain-inspired persistent memory for AI agents — neurons, synapses, and fibers. REQUIRED: set plugins.slots.memory = \"neuralmemory\" in openclaw.json to disable the default memory-core plugin and activate NeuralMemory as the exclusive memory provider.",
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.15.0",
|
|
7
7
|
"configSchema": {
|
|
8
8
|
"jsonSchema": {
|
|
9
9
|
"type": "object",
|
|
@@ -30,6 +30,16 @@
|
|
|
30
30
|
"description": "Auto-extract and store memories after each agent run",
|
|
31
31
|
"default": true
|
|
32
32
|
},
|
|
33
|
+
"autoFlush": {
|
|
34
|
+
"type": "boolean",
|
|
35
|
+
"description": "Flush memories before context compaction and on session boundaries (new/reset)",
|
|
36
|
+
"default": true
|
|
37
|
+
},
|
|
38
|
+
"autoConsolidate": {
|
|
39
|
+
"type": "boolean",
|
|
40
|
+
"description": "Run consolidation on gateway startup to enrich and merge memories",
|
|
41
|
+
"default": true
|
|
42
|
+
},
|
|
33
43
|
"contextDepth": {
|
|
34
44
|
"type": "integer",
|
|
35
45
|
"minimum": 0,
|
|
@@ -76,6 +86,14 @@
|
|
|
76
86
|
"label": "Auto-capture Memories",
|
|
77
87
|
"help": "Automatically extract facts, decisions, and insights after each agent run"
|
|
78
88
|
},
|
|
89
|
+
"autoFlush": {
|
|
90
|
+
"label": "Auto-flush on Compact/Reset",
|
|
91
|
+
"help": "Flush unsaved memories before context compaction and when starting a new session"
|
|
92
|
+
},
|
|
93
|
+
"autoConsolidate": {
|
|
94
|
+
"label": "Auto-consolidate on Startup",
|
|
95
|
+
"help": "Run memory consolidation (enrich strategy) when the OpenClaw gateway starts"
|
|
96
|
+
},
|
|
79
97
|
"contextDepth": {
|
|
80
98
|
"label": "Context Depth",
|
|
81
99
|
"help": "How deep to search: 0=instant lookup, 1=contextual, 2=habit patterns, 3=full graph traversal"
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,342 +1,534 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NeuralMemory — OpenClaw Memory Plugin
|
|
3
|
-
*
|
|
4
|
-
* Brain-inspired persistent memory for AI agents.
|
|
5
|
-
* Occupies the exclusive "memory" plugin slot.
|
|
6
|
-
*
|
|
7
|
-
* Architecture:
|
|
8
|
-
* OpenClaw ←→ Plugin (TypeScript) ←→ MCP stdio ←→ NeuralMemory (Python)
|
|
9
|
-
*
|
|
10
|
-
* v1.7.0: Dynamic tool proxy — fetches all tools from MCP `tools/list`
|
|
11
|
-
* instead of hardcoding 6 tools. Automatically exposes every tool the
|
|
12
|
-
* MCP server provides (39+ tools in NM v2.28.0).
|
|
13
|
-
*
|
|
14
|
-
* v1.8.0: Compatible with NM v2.29.0 — RRF score fusion, graph-based
|
|
15
|
-
* query expansion, and Personalized PageRank activation.
|
|
16
|
-
*
|
|
17
|
-
* v1.8.1: Fix async register() — OpenClaw requires synchronous registration.
|
|
18
|
-
* Fallback tools registered sync; MCP connection deferred to service.start().
|
|
19
|
-
*
|
|
20
|
-
* v1.9.0: Backward-compat shim tools (memory_search, memory_get) to prevent
|
|
21
|
-
* "allowList contains unknown entries" warnings when NM replaces memory-core.
|
|
22
|
-
*
|
|
23
|
-
* v1.10.0: Singleton MCP client — multiple workspaces (multi-agent) share
|
|
24
|
-
* the same connected client instance, keyed by (pythonPath, brain). Fixes
|
|
25
|
-
* "NeuralMemory service not running" when OpenClaw registers the plugin
|
|
26
|
-
* for a second workspace after gateway startup.
|
|
27
|
-
*
|
|
28
|
-
* Registers:
|
|
29
|
-
* N tools — dynamically from MCP server (fallback: 5 core + 2 compat)
|
|
30
|
-
* 1 service — MCP process lifecycle (start/stop)
|
|
31
|
-
*
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
|
|
1
|
+
/**
|
|
2
|
+
* NeuralMemory — OpenClaw Memory Plugin
|
|
3
|
+
*
|
|
4
|
+
* Brain-inspired persistent memory for AI agents.
|
|
5
|
+
* Occupies the exclusive "memory" plugin slot.
|
|
6
|
+
*
|
|
7
|
+
* Architecture:
|
|
8
|
+
* OpenClaw ←→ Plugin (TypeScript) ←→ MCP stdio ←→ NeuralMemory (Python)
|
|
9
|
+
*
|
|
10
|
+
* v1.7.0: Dynamic tool proxy — fetches all tools from MCP `tools/list`
|
|
11
|
+
* instead of hardcoding 6 tools. Automatically exposes every tool the
|
|
12
|
+
* MCP server provides (39+ tools in NM v2.28.0).
|
|
13
|
+
*
|
|
14
|
+
* v1.8.0: Compatible with NM v2.29.0 — RRF score fusion, graph-based
|
|
15
|
+
* query expansion, and Personalized PageRank activation.
|
|
16
|
+
*
|
|
17
|
+
* v1.8.1: Fix async register() — OpenClaw requires synchronous registration.
|
|
18
|
+
* Fallback tools registered sync; MCP connection deferred to service.start().
|
|
19
|
+
*
|
|
20
|
+
* v1.9.0: Backward-compat shim tools (memory_search, memory_get) to prevent
|
|
21
|
+
* "allowList contains unknown entries" warnings when NM replaces memory-core.
|
|
22
|
+
*
|
|
23
|
+
* v1.10.0: Singleton MCP client — multiple workspaces (multi-agent) share
|
|
24
|
+
* the same connected client instance, keyed by (pythonPath, brain). Fixes
|
|
25
|
+
* "NeuralMemory service not running" when OpenClaw registers the plugin
|
|
26
|
+
* for a second workspace after gateway startup.
|
|
27
|
+
*
|
|
28
|
+
* Registers:
|
|
29
|
+
* N tools — dynamically from MCP server (fallback: 5 core + 2 compat)
|
|
30
|
+
* 1 service — MCP process lifecycle (start/stop)
|
|
31
|
+
* 6 hooks — before_agent_start (auto-context), agent_end (auto-capture),
|
|
32
|
+
* session:compact:before (flush), command:new/reset (flush),
|
|
33
|
+
* gateway:startup (consolidation)
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
import type {
|
|
37
|
+
OpenClawPluginDefinition,
|
|
38
|
+
OpenClawPluginApi,
|
|
39
|
+
BeforeAgentStartEvent,
|
|
40
|
+
BeforeAgentStartResult,
|
|
41
|
+
AgentEndEvent,
|
|
42
|
+
SessionCompactEvent,
|
|
43
|
+
CommandEvent,
|
|
44
|
+
GatewayStartupEvent,
|
|
45
|
+
} from "./types.js";
|
|
46
|
+
import { NeuralMemoryMcpClient } from "./mcp-client.js";
|
|
47
|
+
import type { PluginLogger } from "./types.js";
|
|
48
|
+
import { createToolsFromMcp, createFallbackTools, createCompatibilityTools } from "./tools.js";
|
|
49
|
+
import type { ToolDefinition } from "./tools.js";
|
|
50
|
+
|
|
51
|
+
// ── Prompt metadata stripping ─────────────────────────────
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Strip metadata preamble from raw prompts before recall.
|
|
55
|
+
*
|
|
56
|
+
* OpenClaw + Telegram injects JSON metadata, NeuralMemory context blocks,
|
|
57
|
+
* env vars, and system boilerplate into ev.prompt. Passing these raw to
|
|
58
|
+
* nmem_recall creates junk neurons like "[concept] json message id".
|
|
59
|
+
*
|
|
60
|
+
* Stripping order matters — later passes clean up residue from earlier ones.
|
|
61
|
+
*/
|
|
62
|
+
export function stripPromptMetadata(raw: string): string {
|
|
63
|
+
let cleaned = raw;
|
|
64
|
+
|
|
65
|
+
// 1. Remove JSON blocks (Telegram metadata, conversation info)
|
|
66
|
+
cleaned = cleaned.replace(
|
|
67
|
+
/^\{[\s\S]*?"(?:conversation|message_id|sender_id|sender|chat_id|update_id)"[\s\S]*?\}$/gm,
|
|
68
|
+
"",
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
// 2. Remove NeuralMemory context sections (## Relevant Memories, etc.)
|
|
72
|
+
// The |$ ensures sections at end-of-string are also stripped.
|
|
73
|
+
cleaned = cleaned.replace(
|
|
74
|
+
/^#{1,3}\s*(?:Relevant Memories|Related Information|Relevant Context|Neural Memory)[\s\S]*?(?=\n#{1,3}\s|\n\n(?![-•*\s])|$)/gim,
|
|
75
|
+
"",
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
// 3. Remove neuron-type bullet lines injected by NM context
|
|
79
|
+
cleaned = cleaned.replace(
|
|
80
|
+
/^-\s*\[(?:concept|entity|decision|error|preference|insight|memory|fact|workflow|instruction|pattern)\].*$/gim,
|
|
81
|
+
"",
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
// 4. Remove [NeuralMemory — ...] wrapper lines
|
|
85
|
+
cleaned = cleaned.replace(/^\[NeuralMemory\s*[—–-].*\]$/gm, "");
|
|
86
|
+
|
|
87
|
+
// 5. Remove metadata labels (untrusted metadata lines)
|
|
88
|
+
cleaned = cleaned.replace(
|
|
89
|
+
/^(?:Conversation info|Sender|Context|System)\s*\(.*?\)\s*:?\s*$/gim,
|
|
90
|
+
"",
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
// 6. Remove env/export lines
|
|
94
|
+
cleaned = cleaned.replace(/^export\s+\w+=.*$/gm, "");
|
|
95
|
+
|
|
96
|
+
// 7. Collapse whitespace runs
|
|
97
|
+
cleaned = cleaned.replace(/\n{3,}/g, "\n\n").trim();
|
|
98
|
+
|
|
99
|
+
// Fallback: if everything was stripped, use last non-empty line of raw
|
|
100
|
+
if (!cleaned) {
|
|
101
|
+
const lines = raw.split("\n").filter((l) => l.trim());
|
|
102
|
+
cleaned = lines[lines.length - 1]?.trim() ?? raw.trim();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return cleaned;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ── System prompt for tool awareness ──────────────────────
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Build a system prompt listing all registered tool names.
|
|
112
|
+
* This makes the agent aware of which nmem_* tools are available.
|
|
113
|
+
*/
|
|
114
|
+
function buildToolInstructions(tools: ToolDefinition[]): string {
|
|
115
|
+
const toolList = tools
|
|
116
|
+
.map((t) => `- ${t.name}: ${t.description.slice(0, 100)}`)
|
|
117
|
+
.join("\n");
|
|
118
|
+
|
|
119
|
+
return `Neural Memory gives you persistent memory across sessions. Use it proactively — each session starts fresh, so without explicit saves ALL discoveries are lost.
|
|
120
|
+
|
|
121
|
+
These are TOOL CALLS, not CLI commands. Do NOT run "nmem remember" in terminal.
|
|
122
|
+
|
|
123
|
+
## Available Tools
|
|
124
|
+
${toolList}
|
|
125
|
+
|
|
126
|
+
nmem_* is your primary memory system. memory_search/memory_get are legacy aliases for nmem_recall.
|
|
127
|
+
|
|
128
|
+
## WHEN TO RECALL
|
|
129
|
+
- New session starts → nmem_recall("current project context")
|
|
130
|
+
- User references past event → nmem_recall("<that topic>")
|
|
131
|
+
- Prefix queries with project name for precision
|
|
132
|
+
|
|
133
|
+
## WHEN TO SAVE
|
|
134
|
+
After each task: did you make a decision (type="decision", priority=7), fix a bug (type="error", priority=7), learn a preference (type="preference", priority=8), or discover an insight (type="insight", priority=6)?
|
|
135
|
+
|
|
136
|
+
Save with: nmem_remember(content="Chose X over Y because Z", type="decision", priority=7, tags=["project", "topic"])
|
|
137
|
+
|
|
138
|
+
## CONTENT QUALITY
|
|
139
|
+
- Max 1-3 sentences. Use causal language: "Chose X because Y", "Root cause was X, fixed by Y".
|
|
140
|
+
- Always include project name + topic in tags (lowercase).
|
|
141
|
+
- For temporary scratch notes: nmem_remember(content="...", ephemeral=true) — auto-expires, never synced.
|
|
142
|
+
|
|
143
|
+
## SESSION END
|
|
144
|
+
nmem_auto(action="process", text="<brief session summary>")
|
|
145
|
+
|
|
146
|
+
## COMPACT MODE
|
|
147
|
+
All tools support compact=true (saves 60-80% tokens) and token_budget=N.`;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// ── Config ─────────────────────────────────────────────────
|
|
151
|
+
|
|
152
|
+
type PluginConfig = {
|
|
153
|
+
pythonPath: string;
|
|
154
|
+
brain: string;
|
|
155
|
+
autoContext: boolean;
|
|
156
|
+
autoCapture: boolean;
|
|
157
|
+
autoFlush: boolean;
|
|
158
|
+
autoConsolidate: boolean;
|
|
159
|
+
contextDepth: number;
|
|
160
|
+
maxContextTokens: number;
|
|
161
|
+
timeout: number;
|
|
162
|
+
initTimeout: number;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const DEFAULT_CONFIG: Readonly<PluginConfig> = {
|
|
166
|
+
pythonPath: "python",
|
|
167
|
+
brain: "default",
|
|
168
|
+
autoContext: true,
|
|
169
|
+
autoCapture: true,
|
|
170
|
+
autoFlush: true,
|
|
171
|
+
autoConsolidate: true,
|
|
172
|
+
contextDepth: 1,
|
|
173
|
+
maxContextTokens: 500,
|
|
174
|
+
timeout: 30_000,
|
|
175
|
+
initTimeout: 90_000,
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export const BRAIN_NAME_RE = /^[a-zA-Z0-9_\-.]{1,64}$/;
|
|
179
|
+
export const MAX_AUTO_CAPTURE_CHARS = 50_000;
|
|
180
|
+
|
|
181
|
+
export function resolveConfig(raw?: Record<string, unknown>): PluginConfig {
|
|
182
|
+
const merged = { ...DEFAULT_CONFIG, ...(raw ?? {}) };
|
|
183
|
+
|
|
184
|
+
return {
|
|
185
|
+
pythonPath:
|
|
186
|
+
typeof merged.pythonPath === "string" && merged.pythonPath.length > 0
|
|
187
|
+
? merged.pythonPath
|
|
188
|
+
: DEFAULT_CONFIG.pythonPath,
|
|
189
|
+
brain:
|
|
190
|
+
typeof merged.brain === "string" && BRAIN_NAME_RE.test(merged.brain)
|
|
191
|
+
? merged.brain
|
|
192
|
+
: DEFAULT_CONFIG.brain,
|
|
193
|
+
autoContext:
|
|
194
|
+
typeof merged.autoContext === "boolean"
|
|
195
|
+
? merged.autoContext
|
|
196
|
+
: DEFAULT_CONFIG.autoContext,
|
|
197
|
+
autoCapture:
|
|
198
|
+
typeof merged.autoCapture === "boolean"
|
|
199
|
+
? merged.autoCapture
|
|
200
|
+
: DEFAULT_CONFIG.autoCapture,
|
|
201
|
+
autoFlush:
|
|
202
|
+
typeof merged.autoFlush === "boolean"
|
|
203
|
+
? merged.autoFlush
|
|
204
|
+
: DEFAULT_CONFIG.autoFlush,
|
|
205
|
+
autoConsolidate:
|
|
206
|
+
typeof merged.autoConsolidate === "boolean"
|
|
207
|
+
? merged.autoConsolidate
|
|
208
|
+
: DEFAULT_CONFIG.autoConsolidate,
|
|
209
|
+
contextDepth:
|
|
210
|
+
typeof merged.contextDepth === "number" &&
|
|
211
|
+
Number.isInteger(merged.contextDepth) &&
|
|
212
|
+
merged.contextDepth >= 0 &&
|
|
213
|
+
merged.contextDepth <= 3
|
|
214
|
+
? merged.contextDepth
|
|
215
|
+
: DEFAULT_CONFIG.contextDepth,
|
|
216
|
+
maxContextTokens:
|
|
217
|
+
typeof merged.maxContextTokens === "number" &&
|
|
218
|
+
Number.isInteger(merged.maxContextTokens) &&
|
|
219
|
+
merged.maxContextTokens >= 100 &&
|
|
220
|
+
merged.maxContextTokens <= 10_000
|
|
221
|
+
? merged.maxContextTokens
|
|
222
|
+
: DEFAULT_CONFIG.maxContextTokens,
|
|
223
|
+
timeout:
|
|
224
|
+
typeof merged.timeout === "number" &&
|
|
225
|
+
Number.isFinite(merged.timeout) &&
|
|
226
|
+
merged.timeout >= 5_000 &&
|
|
227
|
+
merged.timeout <= 120_000
|
|
228
|
+
? merged.timeout
|
|
229
|
+
: DEFAULT_CONFIG.timeout,
|
|
230
|
+
initTimeout:
|
|
231
|
+
typeof merged.initTimeout === "number" &&
|
|
232
|
+
Number.isFinite(merged.initTimeout) &&
|
|
233
|
+
merged.initTimeout >= 10_000 &&
|
|
234
|
+
merged.initTimeout <= 300_000
|
|
235
|
+
? merged.initTimeout
|
|
236
|
+
: DEFAULT_CONFIG.initTimeout,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// ── Singleton MCP client pool ────────────────────────────────
|
|
241
|
+
// Multiple workspaces may call register() independently, but all
|
|
242
|
+
// should share the same MCP process per (pythonPath, brain) combo.
|
|
243
|
+
|
|
244
|
+
const mcpClients = new Map<string, NeuralMemoryMcpClient>();
|
|
245
|
+
|
|
246
|
+
function getOrCreateMcpClient(
|
|
247
|
+
cfg: PluginConfig,
|
|
248
|
+
logger: PluginLogger,
|
|
249
|
+
): NeuralMemoryMcpClient {
|
|
250
|
+
const key = `${cfg.pythonPath}::${cfg.brain}`;
|
|
251
|
+
|
|
252
|
+
const existing = mcpClients.get(key);
|
|
253
|
+
if (existing) {
|
|
254
|
+
logger.debug?.(`Reusing existing MCP client for brain "${cfg.brain}"`);
|
|
255
|
+
return existing;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const mcp = new NeuralMemoryMcpClient({
|
|
259
|
+
pythonPath: cfg.pythonPath,
|
|
260
|
+
brain: cfg.brain,
|
|
261
|
+
logger,
|
|
262
|
+
timeout: cfg.timeout,
|
|
263
|
+
initTimeout: cfg.initTimeout,
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
mcpClients.set(key, mcp);
|
|
267
|
+
return mcp;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// ── Plugin definition ──────────────────────────────────────
|
|
271
|
+
|
|
272
|
+
const plugin: OpenClawPluginDefinition = {
|
|
273
|
+
id: "neuralmemory",
|
|
274
|
+
name: "NeuralMemory",
|
|
275
|
+
description:
|
|
276
|
+
"Brain-inspired persistent memory for AI agents — neurons, synapses, and fibers",
|
|
277
|
+
version: "1.15.0",
|
|
278
|
+
kind: "memory",
|
|
279
|
+
|
|
280
|
+
register(api: OpenClawPluginApi): void {
|
|
281
|
+
const cfg = resolveConfig(api.pluginConfig);
|
|
282
|
+
|
|
283
|
+
const mcp = getOrCreateMcpClient(cfg, api.logger);
|
|
284
|
+
|
|
285
|
+
// ── Register fallback tools synchronously ────────────
|
|
286
|
+
// OpenClaw requires register() to be synchronous.
|
|
287
|
+
// Register stable fallback tools immediately; MCP connection
|
|
288
|
+
// and dynamic tool discovery happen in service.start().
|
|
289
|
+
// Fallback tools auto-reconnect MCP on first call.
|
|
290
|
+
|
|
291
|
+
const registeredTools = createFallbackTools(mcp);
|
|
292
|
+
const compatTools = createCompatibilityTools(mcp);
|
|
293
|
+
|
|
294
|
+
for (const t of [...registeredTools, ...compatTools]) {
|
|
295
|
+
api.registerTool(t, { name: t.name });
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
api.logger.info(
|
|
299
|
+
`Registered ${registeredTools.length} NeuralMemory tools + ${compatTools.length} compat shims (sync)`,
|
|
300
|
+
);
|
|
301
|
+
|
|
302
|
+
// ── Service: MCP process lifecycle ───────────────────
|
|
303
|
+
|
|
304
|
+
api.registerService({
|
|
305
|
+
id: "neuralmemory-mcp",
|
|
306
|
+
|
|
307
|
+
async start(): Promise<void> {
|
|
308
|
+
if (!mcp.connected) {
|
|
309
|
+
try {
|
|
310
|
+
await mcp.connect();
|
|
311
|
+
api.logger.info("NeuralMemory MCP connected in service.start()");
|
|
312
|
+
|
|
313
|
+
// Log discovered tools for diagnostics (cannot re-register
|
|
314
|
+
// after register() — OpenClaw freezes the tool list).
|
|
315
|
+
try {
|
|
316
|
+
const dynamicTools = await createToolsFromMcp(mcp);
|
|
317
|
+
api.logger.info(
|
|
318
|
+
`NeuralMemory MCP discovered ${dynamicTools.length} tools`,
|
|
319
|
+
);
|
|
320
|
+
} catch (err) {
|
|
321
|
+
api.logger.warn(
|
|
322
|
+
`Tool discovery failed: ${(err as Error).message}`,
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
} catch (err) {
|
|
326
|
+
api.logger.error(
|
|
327
|
+
`Failed to start NeuralMemory MCP: ${(err as Error).message}`,
|
|
328
|
+
);
|
|
329
|
+
throw err;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
|
|
334
|
+
async stop(): Promise<void> {
|
|
335
|
+
// Remove from singleton pool so next register() creates fresh client
|
|
336
|
+
const key = `${cfg.pythonPath}::${cfg.brain}`;
|
|
337
|
+
mcpClients.delete(key);
|
|
338
|
+
await mcp.close();
|
|
339
|
+
api.logger.info("NeuralMemory MCP service stopped");
|
|
340
|
+
},
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
// ── Hook: tool awareness + auto-context before agent start ───
|
|
344
|
+
|
|
345
|
+
api.on(
|
|
346
|
+
"before_agent_start",
|
|
347
|
+
async (
|
|
348
|
+
event: unknown,
|
|
349
|
+
_ctx: unknown,
|
|
350
|
+
): Promise<BeforeAgentStartResult | void> => {
|
|
351
|
+
const result: BeforeAgentStartResult = {
|
|
352
|
+
systemPrompt: buildToolInstructions(registeredTools),
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
if (cfg.autoContext && mcp.connected) {
|
|
356
|
+
const ev = event as BeforeAgentStartEvent;
|
|
357
|
+
|
|
358
|
+
try {
|
|
359
|
+
const query = stripPromptMetadata(ev.prompt);
|
|
360
|
+
const raw = await mcp.callTool("nmem_recall", {
|
|
361
|
+
query,
|
|
362
|
+
depth: cfg.contextDepth,
|
|
363
|
+
max_tokens: cfg.maxContextTokens,
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
const data = JSON.parse(raw) as {
|
|
367
|
+
answer?: string;
|
|
368
|
+
confidence?: number;
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
if (data.answer && (data.confidence ?? 0) > 0.1) {
|
|
372
|
+
result.prependContext = `[NeuralMemory — relevant context]\n${data.answer}`;
|
|
373
|
+
}
|
|
374
|
+
} catch (err) {
|
|
375
|
+
api.logger.warn(
|
|
376
|
+
`Auto-context failed: ${(err as Error).message}`,
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
return result;
|
|
382
|
+
},
|
|
383
|
+
{ priority: 10 },
|
|
384
|
+
);
|
|
385
|
+
|
|
386
|
+
// ── Hook: auto-capture after agent completes ────────
|
|
387
|
+
|
|
388
|
+
if (cfg.autoCapture) {
|
|
389
|
+
api.on(
|
|
390
|
+
"agent_end",
|
|
391
|
+
async (event: unknown, _ctx: unknown): Promise<void> => {
|
|
392
|
+
if (!mcp.connected) return;
|
|
393
|
+
|
|
394
|
+
const ev = event as AgentEndEvent;
|
|
395
|
+
if (!ev.success) return;
|
|
396
|
+
|
|
397
|
+
try {
|
|
398
|
+
const messages = ev.messages?.slice(-5) ?? [];
|
|
399
|
+
const text = messages
|
|
400
|
+
.filter(
|
|
401
|
+
(m: unknown): m is { role: string; content: string } =>
|
|
402
|
+
typeof m === "object" &&
|
|
403
|
+
m !== null &&
|
|
404
|
+
(m as { role?: string }).role === "assistant" &&
|
|
405
|
+
typeof (m as { content?: unknown }).content === "string",
|
|
406
|
+
)
|
|
407
|
+
.map((m) => m.content)
|
|
408
|
+
.join("\n")
|
|
409
|
+
.slice(0, MAX_AUTO_CAPTURE_CHARS);
|
|
410
|
+
|
|
411
|
+
if (text.length > 50) {
|
|
412
|
+
await mcp.callTool("nmem_auto", {
|
|
413
|
+
action: "process",
|
|
414
|
+
text,
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
} catch (err) {
|
|
418
|
+
api.logger.warn(
|
|
419
|
+
`Auto-capture failed: ${(err as Error).message}`,
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
{ priority: 90 },
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// ── Hook: flush memories before context compaction ──
|
|
428
|
+
|
|
429
|
+
if (cfg.autoFlush) {
|
|
430
|
+
api.on(
|
|
431
|
+
"session:compact:before",
|
|
432
|
+
async (_event: unknown, _ctx: unknown): Promise<void> => {
|
|
433
|
+
if (!mcp.connected) return;
|
|
434
|
+
|
|
435
|
+
try {
|
|
436
|
+
await mcp.callTool("nmem_auto", {
|
|
437
|
+
action: "process",
|
|
438
|
+
text: "[pre-compact emergency flush]",
|
|
439
|
+
});
|
|
440
|
+
api.logger.info("Pre-compact flush completed");
|
|
441
|
+
} catch (err) {
|
|
442
|
+
api.logger.warn(
|
|
443
|
+
`Pre-compact flush failed: ${(err as Error).message}`,
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
{ priority: 5 },
|
|
448
|
+
);
|
|
449
|
+
|
|
450
|
+
// Flush on session boundary (new/reset commands)
|
|
451
|
+
api.on(
|
|
452
|
+
"command:new",
|
|
453
|
+
async (_event: unknown, _ctx: unknown): Promise<void> => {
|
|
454
|
+
if (!mcp.connected) return;
|
|
455
|
+
|
|
456
|
+
try {
|
|
457
|
+
await mcp.callTool("nmem_auto", {
|
|
458
|
+
action: "process",
|
|
459
|
+
text: "[session boundary — command:new]",
|
|
460
|
+
});
|
|
461
|
+
} catch (err) {
|
|
462
|
+
api.logger.warn(
|
|
463
|
+
`Session boundary flush failed: ${(err as Error).message}`,
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
},
|
|
467
|
+
{ priority: 10 },
|
|
468
|
+
);
|
|
469
|
+
|
|
470
|
+
api.on(
|
|
471
|
+
"command:reset",
|
|
472
|
+
async (_event: unknown, _ctx: unknown): Promise<void> => {
|
|
473
|
+
if (!mcp.connected) return;
|
|
474
|
+
|
|
475
|
+
try {
|
|
476
|
+
await mcp.callTool("nmem_auto", {
|
|
477
|
+
action: "process",
|
|
478
|
+
text: "[session boundary — command:reset]",
|
|
479
|
+
});
|
|
480
|
+
} catch (err) {
|
|
481
|
+
api.logger.warn(
|
|
482
|
+
`Session reset flush failed: ${(err as Error).message}`,
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
{ priority: 10 },
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// ── Hook: consolidation on gateway startup ───────────
|
|
491
|
+
|
|
492
|
+
if (cfg.autoConsolidate) {
|
|
493
|
+
api.on(
|
|
494
|
+
"gateway:startup",
|
|
495
|
+
async (_event: unknown, _ctx: unknown): Promise<void> => {
|
|
496
|
+
if (!mcp.connected) {
|
|
497
|
+
try {
|
|
498
|
+
await mcp.ensureConnected();
|
|
499
|
+
} catch (err) {
|
|
500
|
+
api.logger.warn(
|
|
501
|
+
`MCP connect on startup failed: ${(err as Error).message}`,
|
|
502
|
+
);
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
try {
|
|
508
|
+
await mcp.callTool("nmem_consolidate", {
|
|
509
|
+
strategy: "enrich",
|
|
510
|
+
compact: true,
|
|
511
|
+
});
|
|
512
|
+
api.logger.info("Startup consolidation completed");
|
|
513
|
+
} catch (err) {
|
|
514
|
+
api.logger.warn(
|
|
515
|
+
`Startup consolidation failed: ${(err as Error).message}`,
|
|
516
|
+
);
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
{ priority: 50 },
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
// ── Done ────────────────────────────────────────────
|
|
524
|
+
|
|
525
|
+
api.logger.info(
|
|
526
|
+
`NeuralMemory registered (brain: ${cfg.brain}, ` +
|
|
527
|
+
`autoContext: ${cfg.autoContext}, autoCapture: ${cfg.autoCapture}, ` +
|
|
528
|
+
`autoFlush: ${cfg.autoFlush}, autoConsolidate: ${cfg.autoConsolidate}) — ` +
|
|
529
|
+
`tools will be loaded dynamically from MCP on service start`,
|
|
530
|
+
);
|
|
531
|
+
},
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
export default plugin;
|
package/src/types.ts
CHANGED
|
@@ -50,6 +50,22 @@ export type AgentContext = {
|
|
|
50
50
|
workspaceDir?: string;
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
export type SessionCompactEvent = {
|
|
54
|
+
reason?: string;
|
|
55
|
+
messagesBeforeCompact?: number;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export type CommandEvent = {
|
|
59
|
+
command: string; // "new", "reset", "stop"
|
|
60
|
+
sessionKey?: string;
|
|
61
|
+
workspaceDir?: string;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export type GatewayStartupEvent = {
|
|
65
|
+
version?: string;
|
|
66
|
+
workspaceDir?: string;
|
|
67
|
+
};
|
|
68
|
+
|
|
53
69
|
export type OpenClawPluginApi = {
|
|
54
70
|
id: string;
|
|
55
71
|
name: string;
|