n8n-nodes-mem0-self 0.2.9 → 0.2.10

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.
Files changed (2) hide show
  1. package/README.md +318 -19
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,42 +1,341 @@
1
1
  # n8n-nodes-mem0-self
2
2
 
3
- Community node for Mem0 Self-Hosted memory in n8n.
3
+ Community node package for using **Mem0 Self-Hosted** as memory in n8n AI workflows.
4
4
 
5
- ## Included Node
5
+ This package currently provides one memory node:
6
6
 
7
7
  - `Mem0 Chat Memory` (`mem0Memory`)
8
8
 
9
- This package is focused on AI Agent memory usage (safe profile) and intentionally avoids admin/destructive operations.
9
+ ---
10
10
 
11
- ## What It Does
11
+ ## Quick Start (3 minutes)
12
12
 
13
- - Stores conversation turns in Mem0 using `POST /memories`
14
- - Retrieves contextual memory using `POST /search`
15
- - Scopes memory by:
16
- - `user_id` (required)
17
- - `agent_id` (required)
18
- - `run_id` (optional)
13
+ 1. Install via n8n Community Nodes:
14
+ - Go to `Settings` -> `Community Nodes` -> `Install`
15
+ - Package: `n8n-nodes-mem0-self`
16
+ - Restart n8n
19
17
 
20
- ## Credential Setup
18
+ 2. Create credentials:
19
+ - Open `Credentials` in n8n
20
+ - Create `Mem0 Self-Hosted API`
21
+ - Set `Base URL` (example: `http://localhost:8000`)
22
+ - Set `API Key` (`X-API-Key`)
21
23
 
22
- Credential type: `Mem0 Self-Hosted API`
24
+ 3. Wire your workflow:
25
+ - Add `AI Agent`
26
+ - Connect your chat model to `ai_languageModel`
27
+ - Add `Mem0 Chat Memory` and connect it to `ai_memory`
28
+ - Set `User ID` and `Agent ID` (required), and `Run ID` (recommended)
23
29
 
24
- - Base URL default: `http://localhost:8000`
25
- - Header auth: `X-API-Key`
30
+ 4. Run a basic validation:
31
+ - Ask a message that contains a personal fact (for example, your name)
32
+ - Send another message asking the agent to recall it
33
+ - Confirm recall works and context size remains controlled by your chosen mode/settings
26
34
 
27
- ## Safe Profile Notes
35
+ ---
28
36
 
29
- - `clear()` is non-destructive (no-op) in this node.
30
- - If `run_id` is omitted, memory context is shared across sessions for the same `user_id + agent_id`.
31
- - Keep API keys only in n8n credential storage.
37
+ ## Introduction
32
38
 
33
- ## Build
39
+ Mem0 is an intelligent memory layer for AI agents and applications.
40
+
41
+ This package provides custom n8n memory integration for Mem0 **Self-Hosted (OSS REST API)**, enabling persistent memory directly in n8n AI Agent workflows with:
42
+
43
+ 1. Semantic memory retrieval (`POST /search`)
44
+ 2. Conversation-pair buffering (`human + ai`)
45
+ 3. Session/user/agent memory scoping
46
+ 4. Token-aware context controls
47
+
48
+ ---
49
+
50
+ ## Overview
51
+
52
+ `Mem0 Chat Memory` is designed for n8n AI Agents and supports:
53
+
54
+ 1. Storing memory with `POST /memories`
55
+ 2. Retrieving memory with:
56
+ - semantic search (`POST /search`)
57
+ - conversation buffer mode (latest human+ai turns)
58
+ 3. Scoped memory isolation by:
59
+ - `user_id` (required)
60
+ - `agent_id` (required)
61
+ - `run_id` (optional but strongly recommended for session isolation)
62
+
63
+ It is built for Mem0 OSS/self-hosted REST API usage.
64
+
65
+ ---
66
+
67
+ ## Installation
68
+
69
+ ## Community Nodes panel (recommended)
70
+
71
+ In n8n:
72
+
73
+ 1. Go to `Settings` -> `Community Nodes`
74
+ 2. Click `Install`
75
+ 3. Enter package name: `n8n-nodes-mem0-self`
76
+ 4. Confirm installation
77
+ 5. Restart n8n
78
+
79
+ ## Manual installation
80
+
81
+ Install the package in your n8n runtime environment:
82
+
83
+ ```bash
84
+ npm install n8n-nodes-mem0-self@latest
85
+ ```
86
+
87
+ Restart n8n after installation.
88
+
89
+ ## Local development install
34
90
 
35
91
  ```bash
36
92
  npm install
37
93
  npm run build
38
94
  ```
39
95
 
96
+ If testing with local n8n, make sure this package is available in the n8n runtime environment, then restart n8n.
97
+
98
+ ---
99
+
100
+ ## n8n Setup
101
+
102
+ Typical workflow wiring:
103
+
104
+ 1. Trigger node (`Manual Trigger`, `Chat Trigger`, etc.)
105
+ 2. `AI Agent`
106
+ 3. `Chat Model` node connected to Agent `ai_languageModel`
107
+ 4. `Mem0 Chat Memory` connected to Agent `ai_memory`
108
+
109
+ Without the `ai_memory` connection, the AI Agent will not use this memory node.
110
+
111
+ ---
112
+
113
+ ## Credentials
114
+
115
+ Credential type: **Mem0 Self-Hosted API**
116
+
117
+ Required values:
118
+
119
+ 1. `Base URL`
120
+ - Example: `http://localhost:8000`
121
+ - Purpose: base endpoint for Mem0 REST API
122
+
123
+ 2. `API Key` (header: `X-API-Key`)
124
+ - Purpose: authenticates requests against your Mem0 server
125
+
126
+ ---
127
+
128
+ ## Included Nodes
129
+
130
+ This package currently includes:
131
+
132
+ 1. `Mem0 Chat Memory`
133
+ - n8n AI memory provider for Mem0 Self-Hosted
134
+ - Supports semantic memory retrieval and conversation-pair buffering
135
+ - Connects directly to AI Agent via `ai_memory`
136
+
137
+ Note:
138
+
139
+ 1. This package is focused on Self-Hosted memory workflows.
140
+ 2. It does not expose Mem0 Cloud credential flow in this package line.
141
+
142
+ ---
143
+
144
+ ## Node Parameters (Detailed)
145
+
146
+ Below is a complete reference for every field in `Mem0 Chat Memory`.
147
+
148
+ ## Identity and Scope
149
+
150
+ ### `User ID` (`userId`)
151
+ - Required: **Yes**
152
+ - What it is: unique identifier of the end user.
153
+ - Why it exists: isolates memory by user.
154
+ - Importance: **Critical**. Incorrect value can mix memory between users.
155
+
156
+ ### `Agent ID` (`agentId`)
157
+ - Required: **Yes**
158
+ - What it is: identifier of the agent/persona using memory.
159
+ - Why it exists: isolates memory per assistant/agent.
160
+ - Importance: **Critical**.
161
+
162
+ ### `Run ID` (`runId`)
163
+ - Required: **No**
164
+ - What it is: session/conversation identifier.
165
+ - Why it exists: allows per-session memory partitioning.
166
+ - Importance: **High** for multi-session use cases.
167
+ - Recommendation: set this for strict conversation boundaries.
168
+
169
+ ## Retrieval Controls
170
+
171
+ ### `Top K` (`topK`)
172
+ - Required: **No** (default provided)
173
+ - What it is: max number of relevant memory items to retrieve in search mode.
174
+ - Why it exists: controls retrieval size and token usage.
175
+ - Importance: **High** for cost/performance tuning.
176
+
177
+ ### `Memory Mode` (`memoryMode`)
178
+ - Required: **No**
179
+ - Options:
180
+ - `semantic_facts`: semantic retrieval focused on relevant facts.
181
+ - `conversation_pairs`: chronological conversation retrieval (`human + ai`).
182
+ - Why it exists: supports different memory strategies for different workflows.
183
+ - Importance: **High** (primary behavior selector).
184
+
185
+ ### `Buffer Limit (Interactions)` (`bufferLimit`) *(shown when `memoryMode=conversation_pairs`)*
186
+ - Required: **No** (default `20`)
187
+ - What it is: number of latest user+assistant interactions to load.
188
+ - Technical behavior: each interaction is two messages, so max messages = `bufferLimit * 2`.
189
+ - Why it exists: prevents loading full conversation history by default.
190
+ - Importance: **High** for token control.
191
+
192
+ ### `Fallback to Search on Buffer Miss` (`fallbackToSearchOnBufferMiss`) *(shown when `memoryMode=conversation_pairs`)*
193
+ - Required: **No** (default `true`)
194
+ - What it is: if buffer seems unrelated to current query, fallback to semantic search.
195
+ - Why it exists: combines low-cost recent context with semantic recovery when needed.
196
+ - Importance: **High** for recall quality.
197
+
198
+ ### `Search Mode` (`searchMode`)
199
+ - Required: **No**
200
+ - Options:
201
+ - `balanced` (recommended): factual prioritization + safe fallback behavior.
202
+ - `strict_facts`: stricter factual preference.
203
+ - `legacy`: compatibility behavior.
204
+ - Why it exists: controls post-processing strategy for search results.
205
+ - Importance: **Medium/High**.
206
+
207
+ ### `Max Context Characters` (`maxContextChars`)
208
+ - Required: **No** (default `700`)
209
+ - What it is: max total characters injected into AI memory context.
210
+ - Why it exists: direct cap on memory payload size (and token growth).
211
+ - Importance: **High** for predictable token usage.
212
+
213
+ ### `Default Query` (`defaultQuery`)
214
+ - Required: **No**
215
+ - What it is: fallback search query when no user input can be extracted.
216
+ - Why it exists: avoids empty retrieval queries in edge workflows.
217
+ - Importance: **Medium**.
218
+
219
+ ### `Rerank` (`rerank`)
220
+ - Required: **No** (default `false`)
221
+ - What it is: enables Mem0 reranking on search.
222
+ - Why it exists: can improve relevance in some datasets.
223
+ - Importance: **Situational** (quality vs latency/cost tradeoff).
224
+
225
+ ### `Fields (Comma Separated)` (`fields`)
226
+ - Required: **No**
227
+ - What it is: optional fields sent in search payload.
228
+ - Why it exists: advanced response shaping/customization.
229
+ - Importance: **Advanced usage**.
230
+
231
+ ### `Include Assistant Memories` (`includeAssistantMemories`)
232
+ - Required: **No** (default `false`)
233
+ - What it is: include assistant-generated memory entries in retrieval.
234
+ - Why it exists: some scenarios need full dialog context; others prefer user facts only.
235
+ - Importance: **Medium**.
236
+
237
+ ### `Search Filters (JSON)` (`searchFilters`)
238
+ - Required: **No**
239
+ - What it is: JSON filters passed to Mem0 `POST /search`.
240
+ - Why it exists: metadata-filtered retrieval (precision control).
241
+ - Importance: **High** for advanced production tuning.
242
+ - Note: invalid JSON returns a validation error.
243
+
244
+ ### `Allow Empty Context` (`allowEmptyContext`)
245
+ - Required: **No** (default `false`)
246
+ - What it is: allows returning empty context without aggressive fallback.
247
+ - Why it exists: explicit control over strict retrieval behavior.
248
+ - Importance: **Medium**.
249
+
250
+ ## Storage Controls
251
+
252
+ ### `Store Strategy` (`storeStrategy`)
253
+ - Required: **No**
254
+ - Options:
255
+ - `conversation` (compatible default): store user and assistant turns.
256
+ - `facts_only`: store user-side factual signals only.
257
+ - Why it exists: lets you choose between conversational trace and lower-noise factual memory.
258
+ - Importance: **High** for long-term memory quality.
259
+
260
+ ### `Infer on Store` (`infer`)
261
+ - Required: **No** (default `false`)
262
+ - What it is: passes infer flag to Mem0 on memory write.
263
+ - Why it exists: enables Mem0 inference/extraction workflows where appropriate.
264
+ - Importance: **Situational**.
265
+
266
+ ---
267
+
268
+ ## Recommended Configurations
269
+
270
+ ## A) Low-token factual memory
271
+
272
+ Use:
273
+
274
+ 1. `memoryMode = semantic_facts`
275
+ 2. `searchMode = balanced`
276
+ 3. `topK = 3..6`
277
+ 4. `maxContextChars = 500..900`
278
+ 5. `storeStrategy = facts_only`
279
+ 6. `includeAssistantMemories = false`
280
+
281
+ ## B) Recent conversation memory
282
+
283
+ Use:
284
+
285
+ 1. `memoryMode = conversation_pairs`
286
+ 2. `bufferLimit = 10..20`
287
+ 3. `fallbackToSearchOnBufferMiss = true`
288
+ 4. `storeStrategy = conversation`
289
+
290
+ ---
291
+
292
+ ## Troubleshooting
293
+
294
+ ### 1) `chat_history` is empty
295
+
296
+ Check:
297
+
298
+ 1. `userId` and `agentId` values are correct and consistent.
299
+ 2. `runId` matches the same session where memory was stored.
300
+ 3. `searchFilters` is valid and not overly restrictive.
301
+ 4. `allowEmptyContext` behavior matches your expectations.
302
+
303
+ ### 2) Token usage is too high
304
+
305
+ Tune:
306
+
307
+ 1. Lower `topK`
308
+ 2. Lower `maxContextChars`
309
+ 3. Use `facts_only`
310
+ 4. Use `conversation_pairs` + smaller `bufferLimit`
311
+
312
+ ### 3) Memory quality is noisy
313
+
314
+ Try:
315
+
316
+ 1. `searchMode = balanced` or `strict_facts`
317
+ 2. `includeAssistantMemories = false`
318
+ 3. `storeStrategy = facts_only`
319
+ 4. Add `searchFilters` based on metadata
320
+
321
+ ---
322
+
323
+ ## Safety Notes
324
+
325
+ 1. Keep API keys only in n8n credentials.
326
+ 2. Use stable ID design (`userId`, `agentId`, `runId`) to avoid context leakage.
327
+ 3. This node is intended for safe memory operations in normal workflow usage.
328
+
329
+ ---
330
+
331
+ ## Changelog
332
+
333
+ See detailed release history in:
334
+
335
+ - [CHANGELOG.md](./CHANGELOG.md)
336
+
337
+ ---
338
+
40
339
  ## License
41
340
 
42
341
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-mem0-self",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "n8n community node for Mem0 Self-Hosted REST API",
5
5
  "license": "MIT",
6
6
  "author": {