neuralmemory 1.8.0 → 1.8.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/dist/index.d.ts +3 -0
- package/dist/index.js +22 -33
- package/dist/index.js.map +1 -1
- package/openclaw.plugin.json +93 -93
- package/package.json +1 -1
- package/src/index.ts +26 -42
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
* v1.8.0: Compatible with NM v2.29.0 — RRF score fusion, graph-based
|
|
15
15
|
* query expansion, and Personalized PageRank activation.
|
|
16
16
|
*
|
|
17
|
+
* v1.8.1: Fix async register() — OpenClaw requires synchronous registration.
|
|
18
|
+
* Fallback tools registered sync; MCP connection deferred to service.start().
|
|
19
|
+
*
|
|
17
20
|
* Registers:
|
|
18
21
|
* N tools — dynamically from MCP server (fallback: 5 core tools)
|
|
19
22
|
* 1 service — MCP process lifecycle (start/stop)
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
* v1.8.0: Compatible with NM v2.29.0 — RRF score fusion, graph-based
|
|
15
15
|
* query expansion, and Personalized PageRank activation.
|
|
16
16
|
*
|
|
17
|
+
* v1.8.1: Fix async register() — OpenClaw requires synchronous registration.
|
|
18
|
+
* Fallback tools registered sync; MCP connection deferred to service.start().
|
|
19
|
+
*
|
|
17
20
|
* Registers:
|
|
18
21
|
* N tools — dynamically from MCP server (fallback: 5 core tools)
|
|
19
22
|
* 1 service — MCP process lifecycle (start/stop)
|
|
@@ -98,9 +101,9 @@ const plugin = {
|
|
|
98
101
|
id: "neuralmemory",
|
|
99
102
|
name: "NeuralMemory",
|
|
100
103
|
description: "Brain-inspired persistent memory for AI agents — neurons, synapses, and fibers",
|
|
101
|
-
version: "1.8.
|
|
104
|
+
version: "1.8.1",
|
|
102
105
|
kind: "memory",
|
|
103
|
-
|
|
106
|
+
register(api) {
|
|
104
107
|
const cfg = resolveConfig(api.pluginConfig);
|
|
105
108
|
const mcp = new NeuralMemoryMcpClient({
|
|
106
109
|
pythonPath: cfg.pythonPath,
|
|
@@ -109,47 +112,33 @@ const plugin = {
|
|
|
109
112
|
timeout: cfg.timeout,
|
|
110
113
|
initTimeout: cfg.initTimeout,
|
|
111
114
|
});
|
|
112
|
-
// ──
|
|
113
|
-
//
|
|
114
|
-
//
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
api.logger.info("NeuralMemory MCP connected");
|
|
119
|
-
}
|
|
120
|
-
catch (err) {
|
|
121
|
-
api.logger.error(`Failed to connect NeuralMemory MCP: ${err.message}`);
|
|
122
|
-
// Register fallback tools so the plugin is still partially usable
|
|
123
|
-
registeredTools = createFallbackTools(mcp);
|
|
124
|
-
for (const t of registeredTools) {
|
|
125
|
-
api.registerTool(t, { name: t.name });
|
|
126
|
-
}
|
|
127
|
-
api.logger.warn(`Registered ${registeredTools.length} fallback tools (MCP not connected)`);
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
// Fetch tools dynamically from MCP server
|
|
131
|
-
try {
|
|
132
|
-
registeredTools = await createToolsFromMcp(mcp);
|
|
133
|
-
api.logger.info(`Fetched ${registeredTools.length} tools from MCP server`);
|
|
134
|
-
}
|
|
135
|
-
catch (err) {
|
|
136
|
-
api.logger.warn(`Failed to fetch MCP tools, using fallback: ${err.message}`);
|
|
137
|
-
registeredTools = createFallbackTools(mcp);
|
|
138
|
-
}
|
|
139
|
-
// Register all tools with OpenClaw
|
|
115
|
+
// ── Register fallback tools synchronously ────────────
|
|
116
|
+
// OpenClaw requires register() to be synchronous.
|
|
117
|
+
// Register stable fallback tools immediately; MCP connection
|
|
118
|
+
// and dynamic tool discovery happen in service.start().
|
|
119
|
+
// Fallback tools auto-reconnect MCP on first call.
|
|
120
|
+
const registeredTools = createFallbackTools(mcp);
|
|
140
121
|
for (const t of registeredTools) {
|
|
141
122
|
api.registerTool(t, { name: t.name });
|
|
142
123
|
}
|
|
143
|
-
api.logger.info(`Registered ${registeredTools.length} NeuralMemory tools`);
|
|
124
|
+
api.logger.info(`Registered ${registeredTools.length} NeuralMemory tools (sync)`);
|
|
144
125
|
// ── Service: MCP process lifecycle ───────────────────
|
|
145
126
|
api.registerService({
|
|
146
127
|
id: "neuralmemory-mcp",
|
|
147
128
|
async start() {
|
|
148
|
-
// MCP already connected during register()
|
|
149
129
|
if (!mcp.connected) {
|
|
150
130
|
try {
|
|
151
131
|
await mcp.connect();
|
|
152
|
-
api.logger.info("NeuralMemory MCP
|
|
132
|
+
api.logger.info("NeuralMemory MCP connected in service.start()");
|
|
133
|
+
// Log discovered tools for diagnostics (cannot re-register
|
|
134
|
+
// after register() — OpenClaw freezes the tool list).
|
|
135
|
+
try {
|
|
136
|
+
const dynamicTools = await createToolsFromMcp(mcp);
|
|
137
|
+
api.logger.info(`NeuralMemory MCP discovered ${dynamicTools.length} tools`);
|
|
138
|
+
}
|
|
139
|
+
catch (err) {
|
|
140
|
+
api.logger.warn(`Tool discovery failed: ${err.message}`);
|
|
141
|
+
}
|
|
153
142
|
}
|
|
154
143
|
catch (err) {
|
|
155
144
|
api.logger.error(`Failed to start NeuralMemory MCP: ${err.message}`);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AASH,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGrE,6DAA6D;AAE7D;;;GAGG;AACH,SAAS,qBAAqB,CAAC,KAAuB;IACpD,MAAM,QAAQ,GAAG,KAAK;SACnB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,K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AAC;oBACb,GAAG,CAAC,MAAM,CAAC,IAAI,CACb,wBAAyB,GAAa,CAAC,OAAO,EAAE,CACjD,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,MAAM;YACtE,4DAA4D,CAC/D,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "neuralmemory",
|
|
3
|
-
"kind": "memory",
|
|
4
|
-
"name": "NeuralMemory",
|
|
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.8.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
|
-
"contextDepth": {
|
|
34
|
-
"type": "integer",
|
|
35
|
-
"minimum": 0,
|
|
36
|
-
"maximum": 3,
|
|
37
|
-
"description": "Recall depth for auto-context: 0=instant, 1=context, 2=habit, 3=deep",
|
|
38
|
-
"default": 1
|
|
39
|
-
},
|
|
40
|
-
"maxContextTokens": {
|
|
41
|
-
"type": "integer",
|
|
42
|
-
"minimum": 100,
|
|
43
|
-
"maximum": 10000,
|
|
44
|
-
"description": "Maximum tokens for auto-context injection",
|
|
45
|
-
"default": 500
|
|
46
|
-
},
|
|
47
|
-
"timeout": {
|
|
48
|
-
"type": "integer",
|
|
49
|
-
"minimum": 5000,
|
|
50
|
-
"maximum": 120000,
|
|
51
|
-
"description": "MCP request timeout in milliseconds",
|
|
52
|
-
"default": 30000
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
"uiHints": {
|
|
57
|
-
"_setup": {
|
|
58
|
-
"label": "Required Setup",
|
|
59
|
-
"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."
|
|
60
|
-
},
|
|
61
|
-
"pythonPath": {
|
|
62
|
-
"label": "Python Path",
|
|
63
|
-
"placeholder": "python",
|
|
64
|
-
"help": "Path to Python executable that has neural-memory installed (pip install neural-memory)"
|
|
65
|
-
},
|
|
66
|
-
"brain": {
|
|
67
|
-
"label": "Brain Name",
|
|
68
|
-
"placeholder": "default",
|
|
69
|
-
"help": "Which brain to use — each workspace can have its own brain"
|
|
70
|
-
},
|
|
71
|
-
"autoContext": {
|
|
72
|
-
"label": "Auto-inject Context",
|
|
73
|
-
"help": "Automatically query relevant memories and inject them before each agent run"
|
|
74
|
-
},
|
|
75
|
-
"autoCapture": {
|
|
76
|
-
"label": "Auto-capture Memories",
|
|
77
|
-
"help": "Automatically extract facts, decisions, and insights after each agent run"
|
|
78
|
-
},
|
|
79
|
-
"contextDepth": {
|
|
80
|
-
"label": "Context Depth",
|
|
81
|
-
"help": "How deep to search: 0=instant lookup, 1=contextual, 2=habit patterns, 3=full graph traversal"
|
|
82
|
-
},
|
|
83
|
-
"maxContextTokens": {
|
|
84
|
-
"label": "Max Context Tokens",
|
|
85
|
-
"help": "Maximum tokens to inject as context (higher = more context but uses more prompt space)"
|
|
86
|
-
},
|
|
87
|
-
"timeout": {
|
|
88
|
-
"label": "MCP Timeout (ms)",
|
|
89
|
-
"help": "How long to wait for MCP server responses. Increase if you see timeout errors on slow machines (default: 30000)"
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "neuralmemory",
|
|
3
|
+
"kind": "memory",
|
|
4
|
+
"name": "NeuralMemory",
|
|
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.8.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
|
+
"contextDepth": {
|
|
34
|
+
"type": "integer",
|
|
35
|
+
"minimum": 0,
|
|
36
|
+
"maximum": 3,
|
|
37
|
+
"description": "Recall depth for auto-context: 0=instant, 1=context, 2=habit, 3=deep",
|
|
38
|
+
"default": 1
|
|
39
|
+
},
|
|
40
|
+
"maxContextTokens": {
|
|
41
|
+
"type": "integer",
|
|
42
|
+
"minimum": 100,
|
|
43
|
+
"maximum": 10000,
|
|
44
|
+
"description": "Maximum tokens for auto-context injection",
|
|
45
|
+
"default": 500
|
|
46
|
+
},
|
|
47
|
+
"timeout": {
|
|
48
|
+
"type": "integer",
|
|
49
|
+
"minimum": 5000,
|
|
50
|
+
"maximum": 120000,
|
|
51
|
+
"description": "MCP request timeout in milliseconds",
|
|
52
|
+
"default": 30000
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"uiHints": {
|
|
57
|
+
"_setup": {
|
|
58
|
+
"label": "Required Setup",
|
|
59
|
+
"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."
|
|
60
|
+
},
|
|
61
|
+
"pythonPath": {
|
|
62
|
+
"label": "Python Path",
|
|
63
|
+
"placeholder": "python",
|
|
64
|
+
"help": "Path to Python executable that has neural-memory installed (pip install neural-memory)"
|
|
65
|
+
},
|
|
66
|
+
"brain": {
|
|
67
|
+
"label": "Brain Name",
|
|
68
|
+
"placeholder": "default",
|
|
69
|
+
"help": "Which brain to use — each workspace can have its own brain"
|
|
70
|
+
},
|
|
71
|
+
"autoContext": {
|
|
72
|
+
"label": "Auto-inject Context",
|
|
73
|
+
"help": "Automatically query relevant memories and inject them before each agent run"
|
|
74
|
+
},
|
|
75
|
+
"autoCapture": {
|
|
76
|
+
"label": "Auto-capture Memories",
|
|
77
|
+
"help": "Automatically extract facts, decisions, and insights after each agent run"
|
|
78
|
+
},
|
|
79
|
+
"contextDepth": {
|
|
80
|
+
"label": "Context Depth",
|
|
81
|
+
"help": "How deep to search: 0=instant lookup, 1=contextual, 2=habit patterns, 3=full graph traversal"
|
|
82
|
+
},
|
|
83
|
+
"maxContextTokens": {
|
|
84
|
+
"label": "Max Context Tokens",
|
|
85
|
+
"help": "Maximum tokens to inject as context (higher = more context but uses more prompt space)"
|
|
86
|
+
},
|
|
87
|
+
"timeout": {
|
|
88
|
+
"label": "MCP Timeout (ms)",
|
|
89
|
+
"help": "How long to wait for MCP server responses. Increase if you see timeout errors on slow machines (default: 30000)"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
* v1.8.0: Compatible with NM v2.29.0 — RRF score fusion, graph-based
|
|
15
15
|
* query expansion, and Personalized PageRank activation.
|
|
16
16
|
*
|
|
17
|
+
* v1.8.1: Fix async register() — OpenClaw requires synchronous registration.
|
|
18
|
+
* Fallback tools registered sync; MCP connection deferred to service.start().
|
|
19
|
+
*
|
|
17
20
|
* Registers:
|
|
18
21
|
* N tools — dynamically from MCP server (fallback: 5 core tools)
|
|
19
22
|
* 1 service — MCP process lifecycle (start/stop)
|
|
@@ -138,10 +141,10 @@ const plugin: OpenClawPluginDefinition = {
|
|
|
138
141
|
name: "NeuralMemory",
|
|
139
142
|
description:
|
|
140
143
|
"Brain-inspired persistent memory for AI agents — neurons, synapses, and fibers",
|
|
141
|
-
version: "1.8.
|
|
144
|
+
version: "1.8.1",
|
|
142
145
|
kind: "memory",
|
|
143
146
|
|
|
144
|
-
|
|
147
|
+
register(api: OpenClawPluginApi): void {
|
|
145
148
|
const cfg = resolveConfig(api.pluginConfig);
|
|
146
149
|
|
|
147
150
|
const mcp = new NeuralMemoryMcpClient({
|
|
@@ -152,50 +155,19 @@ const plugin: OpenClawPluginDefinition = {
|
|
|
152
155
|
initTimeout: cfg.initTimeout,
|
|
153
156
|
});
|
|
154
157
|
|
|
155
|
-
// ──
|
|
156
|
-
//
|
|
157
|
-
//
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
try {
|
|
162
|
-
await mcp.connect();
|
|
163
|
-
api.logger.info("NeuralMemory MCP connected");
|
|
164
|
-
} catch (err) {
|
|
165
|
-
api.logger.error(
|
|
166
|
-
`Failed to connect NeuralMemory MCP: ${(err as Error).message}`,
|
|
167
|
-
);
|
|
168
|
-
// Register fallback tools so the plugin is still partially usable
|
|
169
|
-
registeredTools = createFallbackTools(mcp);
|
|
170
|
-
for (const t of registeredTools) {
|
|
171
|
-
api.registerTool(t, { name: t.name });
|
|
172
|
-
}
|
|
173
|
-
api.logger.warn(
|
|
174
|
-
`Registered ${registeredTools.length} fallback tools (MCP not connected)`,
|
|
175
|
-
);
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
158
|
+
// ── Register fallback tools synchronously ────────────
|
|
159
|
+
// OpenClaw requires register() to be synchronous.
|
|
160
|
+
// Register stable fallback tools immediately; MCP connection
|
|
161
|
+
// and dynamic tool discovery happen in service.start().
|
|
162
|
+
// Fallback tools auto-reconnect MCP on first call.
|
|
178
163
|
|
|
179
|
-
|
|
180
|
-
try {
|
|
181
|
-
registeredTools = await createToolsFromMcp(mcp);
|
|
182
|
-
api.logger.info(
|
|
183
|
-
`Fetched ${registeredTools.length} tools from MCP server`,
|
|
184
|
-
);
|
|
185
|
-
} catch (err) {
|
|
186
|
-
api.logger.warn(
|
|
187
|
-
`Failed to fetch MCP tools, using fallback: ${(err as Error).message}`,
|
|
188
|
-
);
|
|
189
|
-
registeredTools = createFallbackTools(mcp);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// Register all tools with OpenClaw
|
|
164
|
+
const registeredTools = createFallbackTools(mcp);
|
|
193
165
|
for (const t of registeredTools) {
|
|
194
166
|
api.registerTool(t, { name: t.name });
|
|
195
167
|
}
|
|
196
168
|
|
|
197
169
|
api.logger.info(
|
|
198
|
-
`Registered ${registeredTools.length} NeuralMemory tools`,
|
|
170
|
+
`Registered ${registeredTools.length} NeuralMemory tools (sync)`,
|
|
199
171
|
);
|
|
200
172
|
|
|
201
173
|
// ── Service: MCP process lifecycle ───────────────────
|
|
@@ -204,11 +176,23 @@ const plugin: OpenClawPluginDefinition = {
|
|
|
204
176
|
id: "neuralmemory-mcp",
|
|
205
177
|
|
|
206
178
|
async start(): Promise<void> {
|
|
207
|
-
// MCP already connected during register()
|
|
208
179
|
if (!mcp.connected) {
|
|
209
180
|
try {
|
|
210
181
|
await mcp.connect();
|
|
211
|
-
api.logger.info("NeuralMemory MCP
|
|
182
|
+
api.logger.info("NeuralMemory MCP connected in service.start()");
|
|
183
|
+
|
|
184
|
+
// Log discovered tools for diagnostics (cannot re-register
|
|
185
|
+
// after register() — OpenClaw freezes the tool list).
|
|
186
|
+
try {
|
|
187
|
+
const dynamicTools = await createToolsFromMcp(mcp);
|
|
188
|
+
api.logger.info(
|
|
189
|
+
`NeuralMemory MCP discovered ${dynamicTools.length} tools`,
|
|
190
|
+
);
|
|
191
|
+
} catch (err) {
|
|
192
|
+
api.logger.warn(
|
|
193
|
+
`Tool discovery failed: ${(err as Error).message}`,
|
|
194
|
+
);
|
|
195
|
+
}
|
|
212
196
|
} catch (err) {
|
|
213
197
|
api.logger.error(
|
|
214
198
|
`Failed to start NeuralMemory MCP: ${(err as Error).message}`,
|