n8n AI agent memory per user that survives restarts
说明与用途
在 n8n AI Agent 中,Simple Memory 由于按 sessionId 键存储,页面刷新后会丢失历史记录。将其替换为 MemorySync Chat Memory,可将事实绑定到稳定的 End User ID,跨会话和重启保持记忆,并消除 "No session ID found" 错误。
问题
An n8n AI Agent loses conversation history after a page refresh or when a new session ID is generated, and users encounter errors like "No session ID found" when using Simple Memory.
结果
Switching to MemorySync Chat Memory allows an n8n AI Agent to retain user facts across page refreshes, new sessions, and worker restarts, eliminating the "No session ID found" error when the trigger outputs a sessionId.
工作流
- 1. Verify the Chat Trigger outputs a sessionId; if not, manage sessions manually.
- 2. Install the MemorySync n8n nodes (requires n8n 2.16.0+).
- 3. Create a MemorySync API key with Write permission enabled.
- 4. Replace the Simple Memory node on the AI Agent’s Memory port with the MemorySync Chat Memory node.
- 5. Configure the MemorySync node to use the End User ID (e.g., {{ $json.userId }}) and the sessionId (e.g., {{ $json.sessionId }}).
- 6. Test the workflow by sending messages and refreshing the page to confirm memory persists.
证据
Simple Memory keys history by session ID, so a new session ID means an empty window.
MemorySync Chat Memory replaces Simple Memory on the agent's Memory port.
MemorySync Chat Memory needs a Session ID too (the guide uses {{ $json.sessionId }} for the Chat Trigger).
n8n Cloud only lists nodes n8n has verified (MemorySync's verification is in progress).
- 记录日期: 2026-10-28T00:14:00.213Z