neuralmemory 1.15.0 → 1.16.1
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 +14 -3
- package/dist/index.js +49 -27
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/openclaw.plugin.json +111 -111
- package/package.json +53 -53
- package/src/index.ts +76 -38
- package/src/types.ts +12 -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 **55 tools**:
|
|
58
58
|
|
|
59
59
|
| Category | Tools |
|
|
60
60
|
|----------|-------|
|
package/dist/index.d.ts
CHANGED
|
@@ -28,9 +28,9 @@
|
|
|
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
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* 5 hooks — before_prompt_build (auto-context), agent_end (auto-capture),
|
|
32
|
+
* before_compaction (flush), before_reset (flush),
|
|
33
|
+
* gateway_start (consolidation)
|
|
34
34
|
*/
|
|
35
35
|
import type { OpenClawPluginDefinition } from "./types.js";
|
|
36
36
|
/**
|
|
@@ -43,6 +43,17 @@ import type { OpenClawPluginDefinition } from "./types.js";
|
|
|
43
43
|
* Stripping order matters — later passes clean up residue from earlier ones.
|
|
44
44
|
*/
|
|
45
45
|
export declare function stripPromptMetadata(raw: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Strip NeuralMemory context noise and metadata from auto-capture text.
|
|
48
|
+
*
|
|
49
|
+
* When agent_end forwards assistant messages to nmem_auto, those messages
|
|
50
|
+
* may contain NM context wrappers that were injected by before_prompt_build.
|
|
51
|
+
* Re-ingesting these creates junk neurons like "[concept] json message id".
|
|
52
|
+
*
|
|
53
|
+
* This is defense-in-depth — the Python input_firewall also strips these,
|
|
54
|
+
* but catching them here avoids wasting network round-trips.
|
|
55
|
+
*/
|
|
56
|
+
export declare function sanitizeAutoCapture(raw: string): string;
|
|
46
57
|
type PluginConfig = {
|
|
47
58
|
pythonPath: string;
|
|
48
59
|
brain: string;
|
package/dist/index.js
CHANGED
|
@@ -28,9 +28,9 @@
|
|
|
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
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* 5 hooks — before_prompt_build (auto-context), agent_end (auto-capture),
|
|
32
|
+
* before_compaction (flush), before_reset (flush),
|
|
33
|
+
* gateway_start (consolidation)
|
|
34
34
|
*/
|
|
35
35
|
import { NeuralMemoryMcpClient } from "./mcp-client.js";
|
|
36
36
|
import { createToolsFromMcp, createFallbackTools, createCompatibilityTools } from "./tools.js";
|
|
@@ -68,6 +68,33 @@ export function stripPromptMetadata(raw) {
|
|
|
68
68
|
}
|
|
69
69
|
return cleaned;
|
|
70
70
|
}
|
|
71
|
+
// ── Auto-capture sanitization ─────────────────────────────
|
|
72
|
+
/**
|
|
73
|
+
* Strip NeuralMemory context noise and metadata from auto-capture text.
|
|
74
|
+
*
|
|
75
|
+
* When agent_end forwards assistant messages to nmem_auto, those messages
|
|
76
|
+
* may contain NM context wrappers that were injected by before_prompt_build.
|
|
77
|
+
* Re-ingesting these creates junk neurons like "[concept] json message id".
|
|
78
|
+
*
|
|
79
|
+
* This is defense-in-depth — the Python input_firewall also strips these,
|
|
80
|
+
* but catching them here avoids wasting network round-trips.
|
|
81
|
+
*/
|
|
82
|
+
export function sanitizeAutoCapture(raw) {
|
|
83
|
+
let cleaned = raw;
|
|
84
|
+
// Strip NM context section headers
|
|
85
|
+
cleaned = cleaned.replace(/^#{1,3}\s*(?:Relevant Memories|Related Information|Relevant Context|Neural Memory)\b.*$/gim, "");
|
|
86
|
+
// Strip [NeuralMemory — ...] wrapper lines
|
|
87
|
+
cleaned = cleaned.replace(/^\[NeuralMemory\s*[—–-].*\]$/gm, "");
|
|
88
|
+
// Strip neuron-type bullet lines (- [concept] ..., - [error] ...)
|
|
89
|
+
cleaned = cleaned.replace(/^-\s*\[(?:concept|entity|decision|error|preference|insight|memory|fact|workflow|instruction|pattern)\]\s.*$/gim, "");
|
|
90
|
+
// Strip metadata labels
|
|
91
|
+
cleaned = cleaned.replace(/^(?:Conversation info|Sender|Context)\s*\(.*?\)\s*:?\s*$/gim, "");
|
|
92
|
+
// Strip short acknowledgement lines (< 20 chars, common filler)
|
|
93
|
+
cleaned = cleaned.replace(/^(?:OK|Sure|Done|Got it|Understood|Noted|Alright|I see|Thanks|Thank you|Okay)\.?\s*$/gim, "");
|
|
94
|
+
// Collapse whitespace
|
|
95
|
+
cleaned = cleaned.replace(/\n{3,}/g, "\n\n").trim();
|
|
96
|
+
return cleaned;
|
|
97
|
+
}
|
|
71
98
|
// ── System prompt for tool awareness ──────────────────────
|
|
72
99
|
/**
|
|
73
100
|
* Build a system prompt listing all registered tool names.
|
|
@@ -192,9 +219,9 @@ function getOrCreateMcpClient(cfg, logger) {
|
|
|
192
219
|
// ── Plugin definition ──────────────────────────────────────
|
|
193
220
|
const plugin = {
|
|
194
221
|
id: "neuralmemory",
|
|
195
|
-
name: "
|
|
222
|
+
name: "Neural Memory",
|
|
196
223
|
description: "Brain-inspired persistent memory for AI agents — neurons, synapses, and fibers",
|
|
197
|
-
version: "1.
|
|
224
|
+
version: "1.16.0",
|
|
198
225
|
kind: "memory",
|
|
199
226
|
register(api) {
|
|
200
227
|
const cfg = resolveConfig(api.pluginConfig);
|
|
@@ -242,8 +269,10 @@ const plugin = {
|
|
|
242
269
|
api.logger.info("NeuralMemory MCP service stopped");
|
|
243
270
|
},
|
|
244
271
|
});
|
|
245
|
-
// ── Hook: tool awareness + auto-context before
|
|
246
|
-
|
|
272
|
+
// ── Hook: tool awareness + auto-context before prompt build ──
|
|
273
|
+
// Migrated from legacy before_agent_start to before_prompt_build
|
|
274
|
+
// per OpenClaw compatibility guidance (issue #116).
|
|
275
|
+
api.on("before_prompt_build", async (event, _ctx) => {
|
|
247
276
|
const result = {
|
|
248
277
|
systemPrompt: buildToolInstructions(registeredTools),
|
|
249
278
|
};
|
|
@@ -255,6 +284,7 @@ const plugin = {
|
|
|
255
284
|
query,
|
|
256
285
|
depth: cfg.contextDepth,
|
|
257
286
|
max_tokens: cfg.maxContextTokens,
|
|
287
|
+
clean_for_prompt: true,
|
|
258
288
|
});
|
|
259
289
|
const data = JSON.parse(raw);
|
|
260
290
|
if (data.answer && (data.confidence ?? 0) > 0.1) {
|
|
@@ -277,7 +307,7 @@ const plugin = {
|
|
|
277
307
|
return;
|
|
278
308
|
try {
|
|
279
309
|
const messages = ev.messages?.slice(-5) ?? [];
|
|
280
|
-
const
|
|
310
|
+
const rawText = messages
|
|
281
311
|
.filter((m) => typeof m === "object" &&
|
|
282
312
|
m !== null &&
|
|
283
313
|
m.role === "assistant" &&
|
|
@@ -285,6 +315,8 @@ const plugin = {
|
|
|
285
315
|
.map((m) => m.content)
|
|
286
316
|
.join("\n")
|
|
287
317
|
.slice(0, MAX_AUTO_CAPTURE_CHARS);
|
|
318
|
+
// Strip NM context noise and short acknowledgements before re-ingest
|
|
319
|
+
const text = sanitizeAutoCapture(rawText);
|
|
288
320
|
if (text.length > 50) {
|
|
289
321
|
await mcp.callTool("nmem_auto", {
|
|
290
322
|
action: "process",
|
|
@@ -298,8 +330,9 @@ const plugin = {
|
|
|
298
330
|
}, { priority: 90 });
|
|
299
331
|
}
|
|
300
332
|
// ── Hook: flush memories before context compaction ──
|
|
333
|
+
// Migrated from legacy session:compact:before to before_compaction
|
|
301
334
|
if (cfg.autoFlush) {
|
|
302
|
-
api.on("
|
|
335
|
+
api.on("before_compaction", async (_event, _ctx) => {
|
|
303
336
|
if (!mcp.connected)
|
|
304
337
|
return;
|
|
305
338
|
try {
|
|
@@ -313,37 +346,26 @@ const plugin = {
|
|
|
313
346
|
api.logger.warn(`Pre-compact flush failed: ${err.message}`);
|
|
314
347
|
}
|
|
315
348
|
}, { priority: 5 });
|
|
316
|
-
// Flush on session boundary (new/reset
|
|
317
|
-
|
|
349
|
+
// Flush on session boundary (/new and /reset)
|
|
350
|
+
// Migrated from legacy command:new + command:reset to before_reset
|
|
351
|
+
api.on("before_reset", async (_event, _ctx) => {
|
|
318
352
|
if (!mcp.connected)
|
|
319
353
|
return;
|
|
320
354
|
try {
|
|
321
355
|
await mcp.callTool("nmem_auto", {
|
|
322
356
|
action: "process",
|
|
323
|
-
text: "[session boundary —
|
|
357
|
+
text: "[session boundary — reset]",
|
|
324
358
|
});
|
|
325
359
|
}
|
|
326
360
|
catch (err) {
|
|
327
361
|
api.logger.warn(`Session boundary flush failed: ${err.message}`);
|
|
328
362
|
}
|
|
329
363
|
}, { 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
364
|
}
|
|
344
|
-
// ── Hook: consolidation on gateway
|
|
365
|
+
// ── Hook: consolidation on gateway start ─────────────
|
|
366
|
+
// Migrated from legacy gateway:startup to gateway_start
|
|
345
367
|
if (cfg.autoConsolidate) {
|
|
346
|
-
api.on("
|
|
368
|
+
api.on("gateway_start", async (_event, _ctx) => {
|
|
347
369
|
if (!mcp.connected) {
|
|
348
370
|
try {
|
|
349
371
|
await mcp.ensureConnected();
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAYH,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAG/F,6DAA6D;AAE7D;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,IAAI,OAAO,GAAG,GAAG,CAAC;IAElB,+DAA+D;IAC/D,OAAO,GAAG,OAAO,CAAC,OAAO,CACvB,0FAA0F,EAC1F,EAAE,CACH,CAAC;IAEF,uEAAuE;IACvE,iEAAiE;IACjE,OAAO,GAAG,OAAO,CAAC,OAAO,CACvB,+HAA+H,EAC/H,EAAE,CACH,CAAC;IAEF,4DAA4D;IAC5D,OAAO,GAAG,OAAO,CAAC,OAAO,CACvB,8GAA8G,EAC9G,EAAE,CACH,CAAC;IAEF,+CAA+C;IAC/C,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,gCAAgC,EAAE,EAAE,CAAC,CAAC;IAEhE,uDAAuD;IACvD,OAAO,GAAG,OAAO,CAAC,OAAO,CACvB,oEAAoE,EACpE,EAAE,CACH,CAAC;IAEF,6BAA6B;IAC7B,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;IAErD,8BAA8B;IAC9B,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IAEpD,uEAAuE;IACvE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,KAAK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C,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
|
@@ -30,6 +30,15 @@ export type BeforeAgentStartResult = {
|
|
|
30
30
|
modelOverride?: string;
|
|
31
31
|
providerOverride?: string;
|
|
32
32
|
};
|
|
33
|
+
export type BeforePromptBuildEvent = {
|
|
34
|
+
prompt: string;
|
|
35
|
+
messages?: unknown[];
|
|
36
|
+
systemPrompt?: string;
|
|
37
|
+
};
|
|
38
|
+
export type BeforePromptBuildResult = {
|
|
39
|
+
systemPrompt?: string;
|
|
40
|
+
prependContext?: string;
|
|
41
|
+
};
|
|
33
42
|
export type AgentEndEvent = {
|
|
34
43
|
messages: unknown[];
|
|
35
44
|
success: boolean;
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "neuralmemory",
|
|
3
|
-
"kind": "memory",
|
|
4
|
-
"name": "
|
|
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.
|
|
7
|
-
"configSchema": {
|
|
8
|
-
"jsonSchema": {
|
|
9
|
-
"type": "object",
|
|
10
|
-
"additionalProperties": false,
|
|
11
|
-
"properties": {
|
|
12
|
-
"pythonPath": {
|
|
13
|
-
"type": "string",
|
|
14
|
-
"description": "Path to Python executable with neural-memory installed",
|
|
15
|
-
"default": "python"
|
|
16
|
-
},
|
|
17
|
-
"brain": {
|
|
18
|
-
"type": "string",
|
|
19
|
-
"pattern": "^[a-zA-Z0-9_\\-.]{1,64}$",
|
|
20
|
-
"description": "Brain name to use for this workspace",
|
|
21
|
-
"default": "default"
|
|
22
|
-
},
|
|
23
|
-
"autoContext": {
|
|
24
|
-
"type": "boolean",
|
|
25
|
-
"description": "Inject relevant memory context before each agent run",
|
|
26
|
-
"default": true
|
|
27
|
-
},
|
|
28
|
-
"autoCapture": {
|
|
29
|
-
"type": "boolean",
|
|
30
|
-
"description": "Auto-extract and store memories after each agent run",
|
|
31
|
-
"default": true
|
|
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
|
-
},
|
|
43
|
-
"contextDepth": {
|
|
44
|
-
"type": "integer",
|
|
45
|
-
"minimum": 0,
|
|
46
|
-
"maximum": 3,
|
|
47
|
-
"description": "Recall depth for auto-context: 0=instant, 1=context, 2=habit, 3=deep",
|
|
48
|
-
"default": 1
|
|
49
|
-
},
|
|
50
|
-
"maxContextTokens": {
|
|
51
|
-
"type": "integer",
|
|
52
|
-
"minimum": 100,
|
|
53
|
-
"maximum": 10000,
|
|
54
|
-
"description": "Maximum tokens for auto-context injection",
|
|
55
|
-
"default": 500
|
|
56
|
-
},
|
|
57
|
-
"timeout": {
|
|
58
|
-
"type": "integer",
|
|
59
|
-
"minimum": 5000,
|
|
60
|
-
"maximum": 120000,
|
|
61
|
-
"description": "MCP request timeout in milliseconds",
|
|
62
|
-
"default": 30000
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
"uiHints": {
|
|
67
|
-
"_setup": {
|
|
68
|
-
"label": "Required Setup",
|
|
69
|
-
"help": "Add to openclaw.json: { \"plugins\": { \"slots\": { \"memory\": \"neuralmemory\" } } } — this disables the default memory-core plugin so agents use NeuralMemory exclusively. Without this, agents may still call memory_search (memory-core) even with AGENTS.MD rules."
|
|
70
|
-
},
|
|
71
|
-
"pythonPath": {
|
|
72
|
-
"label": "Python Path",
|
|
73
|
-
"placeholder": "python",
|
|
74
|
-
"help": "Path to Python executable that has neural-memory installed (pip install neural-memory)"
|
|
75
|
-
},
|
|
76
|
-
"brain": {
|
|
77
|
-
"label": "Brain Name",
|
|
78
|
-
"placeholder": "default",
|
|
79
|
-
"help": "Which brain to use — each workspace can have its own brain"
|
|
80
|
-
},
|
|
81
|
-
"autoContext": {
|
|
82
|
-
"label": "Auto-inject Context",
|
|
83
|
-
"help": "Automatically query relevant memories and inject them before each agent run"
|
|
84
|
-
},
|
|
85
|
-
"autoCapture": {
|
|
86
|
-
"label": "Auto-capture Memories",
|
|
87
|
-
"help": "Automatically extract facts, decisions, and insights after each agent run"
|
|
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
|
-
},
|
|
97
|
-
"contextDepth": {
|
|
98
|
-
"label": "Context Depth",
|
|
99
|
-
"help": "How deep to search: 0=instant lookup, 1=contextual, 2=habit patterns, 3=full graph traversal"
|
|
100
|
-
},
|
|
101
|
-
"maxContextTokens": {
|
|
102
|
-
"label": "Max Context Tokens",
|
|
103
|
-
"help": "Maximum tokens to inject as context (higher = more context but uses more prompt space)"
|
|
104
|
-
},
|
|
105
|
-
"timeout": {
|
|
106
|
-
"label": "MCP Timeout (ms)",
|
|
107
|
-
"help": "How long to wait for MCP server responses. Increase if you see timeout errors on slow machines (default: 30000)"
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "neuralmemory",
|
|
3
|
+
"kind": "memory",
|
|
4
|
+
"name": "Neural Memory",
|
|
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.16.0",
|
|
7
|
+
"configSchema": {
|
|
8
|
+
"jsonSchema": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"additionalProperties": false,
|
|
11
|
+
"properties": {
|
|
12
|
+
"pythonPath": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "Path to Python executable with neural-memory installed",
|
|
15
|
+
"default": "python"
|
|
16
|
+
},
|
|
17
|
+
"brain": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"pattern": "^[a-zA-Z0-9_\\-.]{1,64}$",
|
|
20
|
+
"description": "Brain name to use for this workspace",
|
|
21
|
+
"default": "default"
|
|
22
|
+
},
|
|
23
|
+
"autoContext": {
|
|
24
|
+
"type": "boolean",
|
|
25
|
+
"description": "Inject relevant memory context before each agent run",
|
|
26
|
+
"default": true
|
|
27
|
+
},
|
|
28
|
+
"autoCapture": {
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"description": "Auto-extract and store memories after each agent run",
|
|
31
|
+
"default": true
|
|
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
|
+
},
|
|
43
|
+
"contextDepth": {
|
|
44
|
+
"type": "integer",
|
|
45
|
+
"minimum": 0,
|
|
46
|
+
"maximum": 3,
|
|
47
|
+
"description": "Recall depth for auto-context: 0=instant, 1=context, 2=habit, 3=deep",
|
|
48
|
+
"default": 1
|
|
49
|
+
},
|
|
50
|
+
"maxContextTokens": {
|
|
51
|
+
"type": "integer",
|
|
52
|
+
"minimum": 100,
|
|
53
|
+
"maximum": 10000,
|
|
54
|
+
"description": "Maximum tokens for auto-context injection",
|
|
55
|
+
"default": 500
|
|
56
|
+
},
|
|
57
|
+
"timeout": {
|
|
58
|
+
"type": "integer",
|
|
59
|
+
"minimum": 5000,
|
|
60
|
+
"maximum": 120000,
|
|
61
|
+
"description": "MCP request timeout in milliseconds",
|
|
62
|
+
"default": 30000
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"uiHints": {
|
|
67
|
+
"_setup": {
|
|
68
|
+
"label": "Required Setup",
|
|
69
|
+
"help": "Add to openclaw.json: { \"plugins\": { \"slots\": { \"memory\": \"neuralmemory\" } } } — this disables the default memory-core plugin so agents use NeuralMemory exclusively. Without this, agents may still call memory_search (memory-core) even with AGENTS.MD rules."
|
|
70
|
+
},
|
|
71
|
+
"pythonPath": {
|
|
72
|
+
"label": "Python Path",
|
|
73
|
+
"placeholder": "python",
|
|
74
|
+
"help": "Path to Python executable that has neural-memory installed (pip install neural-memory)"
|
|
75
|
+
},
|
|
76
|
+
"brain": {
|
|
77
|
+
"label": "Brain Name",
|
|
78
|
+
"placeholder": "default",
|
|
79
|
+
"help": "Which brain to use — each workspace can have its own brain"
|
|
80
|
+
},
|
|
81
|
+
"autoContext": {
|
|
82
|
+
"label": "Auto-inject Context",
|
|
83
|
+
"help": "Automatically query relevant memories and inject them before each agent run"
|
|
84
|
+
},
|
|
85
|
+
"autoCapture": {
|
|
86
|
+
"label": "Auto-capture Memories",
|
|
87
|
+
"help": "Automatically extract facts, decisions, and insights after each agent run"
|
|
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
|
+
},
|
|
97
|
+
"contextDepth": {
|
|
98
|
+
"label": "Context Depth",
|
|
99
|
+
"help": "How deep to search: 0=instant lookup, 1=contextual, 2=habit patterns, 3=full graph traversal"
|
|
100
|
+
},
|
|
101
|
+
"maxContextTokens": {
|
|
102
|
+
"label": "Max Context Tokens",
|
|
103
|
+
"help": "Maximum tokens to inject as context (higher = more context but uses more prompt space)"
|
|
104
|
+
},
|
|
105
|
+
"timeout": {
|
|
106
|
+
"label": "MCP Timeout (ms)",
|
|
107
|
+
"help": "How long to wait for MCP server responses. Increase if you see timeout errors on slow machines (default: 30000)"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
package/package.json
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "neuralmemory",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "NeuralMemory plugin for OpenClaw — brain-inspired persistent memory for AI agents",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"openclaw": {
|
|
9
|
-
"id": "neuralmemory",
|
|
10
|
-
"extensions": [
|
|
11
|
-
"./dist/index.js"
|
|
12
|
-
],
|
|
13
|
-
"source": "./src/index.ts"
|
|
14
|
-
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "tsc",
|
|
17
|
-
"typecheck": "tsc --noEmit",
|
|
18
|
-
"prepublishOnly": "npm run build",
|
|
19
|
-
"test": "vitest run",
|
|
20
|
-
"test:watch": "vitest",
|
|
21
|
-
"test:coverage": "vitest run --coverage"
|
|
22
|
-
},
|
|
23
|
-
"peerDependencies": {},
|
|
24
|
-
"keywords": [
|
|
25
|
-
"openclaw",
|
|
26
|
-
"openclaw-plugin",
|
|
27
|
-
"memory",
|
|
28
|
-
"neuralmemory",
|
|
29
|
-
"ai-agent",
|
|
30
|
-
"persistent-memory"
|
|
31
|
-
],
|
|
32
|
-
"author": "NeuralMemory Contributors",
|
|
33
|
-
"license": "MIT",
|
|
34
|
-
"homepage": "https://github.com/nhadaututtheky/neural-memory#readme",
|
|
35
|
-
"repository": {
|
|
36
|
-
"type": "git",
|
|
37
|
-
"url": "https://github.com/nhadaututtheky/neural-memory"
|
|
38
|
-
},
|
|
39
|
-
"files": [
|
|
40
|
-
"src/",
|
|
41
|
-
"dist/",
|
|
42
|
-
"openclaw.plugin.json"
|
|
43
|
-
],
|
|
44
|
-
"engines": {
|
|
45
|
-
"node": ">=18.0.0"
|
|
46
|
-
},
|
|
47
|
-
"devDependencies": {
|
|
48
|
-
"@types/node": "^25.2.2",
|
|
49
|
-
"@vitest/coverage-v8": "^3.2.4",
|
|
50
|
-
"typescript": "^5.9.3",
|
|
51
|
-
"vitest": "^3.0.0"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "neuralmemory",
|
|
3
|
+
"version": "1.16.1",
|
|
4
|
+
"description": "NeuralMemory plugin for OpenClaw — brain-inspired persistent memory for AI agents",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"openclaw": {
|
|
9
|
+
"id": "neuralmemory",
|
|
10
|
+
"extensions": [
|
|
11
|
+
"./dist/index.js"
|
|
12
|
+
],
|
|
13
|
+
"source": "./src/index.ts"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"typecheck": "tsc --noEmit",
|
|
18
|
+
"prepublishOnly": "npm run build",
|
|
19
|
+
"test": "vitest run",
|
|
20
|
+
"test:watch": "vitest",
|
|
21
|
+
"test:coverage": "vitest run --coverage"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"openclaw",
|
|
26
|
+
"openclaw-plugin",
|
|
27
|
+
"memory",
|
|
28
|
+
"neuralmemory",
|
|
29
|
+
"ai-agent",
|
|
30
|
+
"persistent-memory"
|
|
31
|
+
],
|
|
32
|
+
"author": "NeuralMemory Contributors",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"homepage": "https://github.com/nhadaututtheky/neural-memory#readme",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/nhadaututtheky/neural-memory"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"src/",
|
|
41
|
+
"dist/",
|
|
42
|
+
"openclaw.plugin.json"
|
|
43
|
+
],
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=18.0.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^25.2.2",
|
|
49
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
50
|
+
"typescript": "^5.9.3",
|
|
51
|
+
"vitest": "^3.0.0"
|
|
52
|
+
}
|
|
53
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -28,16 +28,16 @@
|
|
|
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
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* 5 hooks — before_prompt_build (auto-context), agent_end (auto-capture),
|
|
32
|
+
* before_compaction (flush), before_reset (flush),
|
|
33
|
+
* gateway_start (consolidation)
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
36
|
import type {
|
|
37
37
|
OpenClawPluginDefinition,
|
|
38
38
|
OpenClawPluginApi,
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
BeforePromptBuildEvent,
|
|
40
|
+
BeforePromptBuildResult,
|
|
41
41
|
AgentEndEvent,
|
|
42
42
|
SessionCompactEvent,
|
|
43
43
|
CommandEvent,
|
|
@@ -105,6 +105,54 @@ export function stripPromptMetadata(raw: string): string {
|
|
|
105
105
|
return cleaned;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
// ── Auto-capture sanitization ─────────────────────────────
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Strip NeuralMemory context noise and metadata from auto-capture text.
|
|
112
|
+
*
|
|
113
|
+
* When agent_end forwards assistant messages to nmem_auto, those messages
|
|
114
|
+
* may contain NM context wrappers that were injected by before_prompt_build.
|
|
115
|
+
* Re-ingesting these creates junk neurons like "[concept] json message id".
|
|
116
|
+
*
|
|
117
|
+
* This is defense-in-depth — the Python input_firewall also strips these,
|
|
118
|
+
* but catching them here avoids wasting network round-trips.
|
|
119
|
+
*/
|
|
120
|
+
export function sanitizeAutoCapture(raw: string): string {
|
|
121
|
+
let cleaned = raw;
|
|
122
|
+
|
|
123
|
+
// Strip NM context section headers
|
|
124
|
+
cleaned = cleaned.replace(
|
|
125
|
+
/^#{1,3}\s*(?:Relevant Memories|Related Information|Relevant Context|Neural Memory)\b.*$/gim,
|
|
126
|
+
"",
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
// Strip [NeuralMemory — ...] wrapper lines
|
|
130
|
+
cleaned = cleaned.replace(/^\[NeuralMemory\s*[—–-].*\]$/gm, "");
|
|
131
|
+
|
|
132
|
+
// Strip neuron-type bullet lines (- [concept] ..., - [error] ...)
|
|
133
|
+
cleaned = cleaned.replace(
|
|
134
|
+
/^-\s*\[(?:concept|entity|decision|error|preference|insight|memory|fact|workflow|instruction|pattern)\]\s.*$/gim,
|
|
135
|
+
"",
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
// Strip metadata labels
|
|
139
|
+
cleaned = cleaned.replace(
|
|
140
|
+
/^(?:Conversation info|Sender|Context)\s*\(.*?\)\s*:?\s*$/gim,
|
|
141
|
+
"",
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
// Strip short acknowledgement lines (< 20 chars, common filler)
|
|
145
|
+
cleaned = cleaned.replace(
|
|
146
|
+
/^(?:OK|Sure|Done|Got it|Understood|Noted|Alright|I see|Thanks|Thank you|Okay)\.?\s*$/gim,
|
|
147
|
+
"",
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
// Collapse whitespace
|
|
151
|
+
cleaned = cleaned.replace(/\n{3,}/g, "\n\n").trim();
|
|
152
|
+
|
|
153
|
+
return cleaned;
|
|
154
|
+
}
|
|
155
|
+
|
|
108
156
|
// ── System prompt for tool awareness ──────────────────────
|
|
109
157
|
|
|
110
158
|
/**
|
|
@@ -271,10 +319,10 @@ function getOrCreateMcpClient(
|
|
|
271
319
|
|
|
272
320
|
const plugin: OpenClawPluginDefinition = {
|
|
273
321
|
id: "neuralmemory",
|
|
274
|
-
name: "
|
|
322
|
+
name: "Neural Memory",
|
|
275
323
|
description:
|
|
276
324
|
"Brain-inspired persistent memory for AI agents — neurons, synapses, and fibers",
|
|
277
|
-
version: "1.
|
|
325
|
+
version: "1.16.0",
|
|
278
326
|
kind: "memory",
|
|
279
327
|
|
|
280
328
|
register(api: OpenClawPluginApi): void {
|
|
@@ -340,20 +388,22 @@ const plugin: OpenClawPluginDefinition = {
|
|
|
340
388
|
},
|
|
341
389
|
});
|
|
342
390
|
|
|
343
|
-
// ── Hook: tool awareness + auto-context before
|
|
391
|
+
// ── Hook: tool awareness + auto-context before prompt build ──
|
|
392
|
+
// Migrated from legacy before_agent_start to before_prompt_build
|
|
393
|
+
// per OpenClaw compatibility guidance (issue #116).
|
|
344
394
|
|
|
345
395
|
api.on(
|
|
346
|
-
"
|
|
396
|
+
"before_prompt_build",
|
|
347
397
|
async (
|
|
348
398
|
event: unknown,
|
|
349
399
|
_ctx: unknown,
|
|
350
|
-
): Promise<
|
|
351
|
-
const result:
|
|
400
|
+
): Promise<BeforePromptBuildResult | void> => {
|
|
401
|
+
const result: BeforePromptBuildResult = {
|
|
352
402
|
systemPrompt: buildToolInstructions(registeredTools),
|
|
353
403
|
};
|
|
354
404
|
|
|
355
405
|
if (cfg.autoContext && mcp.connected) {
|
|
356
|
-
const ev = event as
|
|
406
|
+
const ev = event as BeforePromptBuildEvent;
|
|
357
407
|
|
|
358
408
|
try {
|
|
359
409
|
const query = stripPromptMetadata(ev.prompt);
|
|
@@ -361,6 +411,7 @@ const plugin: OpenClawPluginDefinition = {
|
|
|
361
411
|
query,
|
|
362
412
|
depth: cfg.contextDepth,
|
|
363
413
|
max_tokens: cfg.maxContextTokens,
|
|
414
|
+
clean_for_prompt: true,
|
|
364
415
|
});
|
|
365
416
|
|
|
366
417
|
const data = JSON.parse(raw) as {
|
|
@@ -396,7 +447,7 @@ const plugin: OpenClawPluginDefinition = {
|
|
|
396
447
|
|
|
397
448
|
try {
|
|
398
449
|
const messages = ev.messages?.slice(-5) ?? [];
|
|
399
|
-
const
|
|
450
|
+
const rawText = messages
|
|
400
451
|
.filter(
|
|
401
452
|
(m: unknown): m is { role: string; content: string } =>
|
|
402
453
|
typeof m === "object" &&
|
|
@@ -408,6 +459,9 @@ const plugin: OpenClawPluginDefinition = {
|
|
|
408
459
|
.join("\n")
|
|
409
460
|
.slice(0, MAX_AUTO_CAPTURE_CHARS);
|
|
410
461
|
|
|
462
|
+
// Strip NM context noise and short acknowledgements before re-ingest
|
|
463
|
+
const text = sanitizeAutoCapture(rawText);
|
|
464
|
+
|
|
411
465
|
if (text.length > 50) {
|
|
412
466
|
await mcp.callTool("nmem_auto", {
|
|
413
467
|
action: "process",
|
|
@@ -425,10 +479,11 @@ const plugin: OpenClawPluginDefinition = {
|
|
|
425
479
|
}
|
|
426
480
|
|
|
427
481
|
// ── Hook: flush memories before context compaction ──
|
|
482
|
+
// Migrated from legacy session:compact:before to before_compaction
|
|
428
483
|
|
|
429
484
|
if (cfg.autoFlush) {
|
|
430
485
|
api.on(
|
|
431
|
-
"
|
|
486
|
+
"before_compaction",
|
|
432
487
|
async (_event: unknown, _ctx: unknown): Promise<void> => {
|
|
433
488
|
if (!mcp.connected) return;
|
|
434
489
|
|
|
@@ -447,16 +502,17 @@ const plugin: OpenClawPluginDefinition = {
|
|
|
447
502
|
{ priority: 5 },
|
|
448
503
|
);
|
|
449
504
|
|
|
450
|
-
// Flush on session boundary (new/reset
|
|
505
|
+
// Flush on session boundary (/new and /reset)
|
|
506
|
+
// Migrated from legacy command:new + command:reset to before_reset
|
|
451
507
|
api.on(
|
|
452
|
-
"
|
|
508
|
+
"before_reset",
|
|
453
509
|
async (_event: unknown, _ctx: unknown): Promise<void> => {
|
|
454
510
|
if (!mcp.connected) return;
|
|
455
511
|
|
|
456
512
|
try {
|
|
457
513
|
await mcp.callTool("nmem_auto", {
|
|
458
514
|
action: "process",
|
|
459
|
-
text: "[session boundary —
|
|
515
|
+
text: "[session boundary — reset]",
|
|
460
516
|
});
|
|
461
517
|
} catch (err) {
|
|
462
518
|
api.logger.warn(
|
|
@@ -466,32 +522,14 @@ const plugin: OpenClawPluginDefinition = {
|
|
|
466
522
|
},
|
|
467
523
|
{ priority: 10 },
|
|
468
524
|
);
|
|
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
525
|
}
|
|
489
526
|
|
|
490
|
-
// ── Hook: consolidation on gateway
|
|
527
|
+
// ── Hook: consolidation on gateway start ─────────────
|
|
528
|
+
// Migrated from legacy gateway:startup to gateway_start
|
|
491
529
|
|
|
492
530
|
if (cfg.autoConsolidate) {
|
|
493
531
|
api.on(
|
|
494
|
-
"
|
|
532
|
+
"gateway_start",
|
|
495
533
|
async (_event: unknown, _ctx: unknown): Promise<void> => {
|
|
496
534
|
if (!mcp.connected) {
|
|
497
535
|
try {
|
package/src/types.ts
CHANGED
|
@@ -37,6 +37,18 @@ export type BeforeAgentStartResult = {
|
|
|
37
37
|
providerOverride?: string; // Override provider for this run — first defined wins
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
// New hook types — preferred over legacy before_agent_start
|
|
41
|
+
export type BeforePromptBuildEvent = {
|
|
42
|
+
prompt: string;
|
|
43
|
+
messages?: unknown[];
|
|
44
|
+
systemPrompt?: string;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type BeforePromptBuildResult = {
|
|
48
|
+
systemPrompt?: string; // Appended to system prompt
|
|
49
|
+
prependContext?: string; // Prepended to conversation context
|
|
50
|
+
};
|
|
51
|
+
|
|
40
52
|
export type AgentEndEvent = {
|
|
41
53
|
messages: unknown[];
|
|
42
54
|
success: boolean;
|