Adding chat memory to an n8n agent with MemorySync Mohammed, founder of MemorySync, published a guide showing how to add persistent chat memory to an n8n AI Agent using the MemorySync community node. The walkthrough covers installing the n8n-nodes-memorysync package on a self-hosted instance, configuring an API credential, running a write-and-search smoke test, and wiring MemorySync Chat Memory into the agent's Memory port so conversations survive across executions. It also adds a tool for retrieving long-term facts about the user, and notes that MemorySync's n8n verification is still in progress, so n8n Cloud does not yet list the node. Disclosure: I'm Mohammed, founder of MemorySync. I drafted this article with AI assistance and reviewed it for accuracy against the official MemorySync and n8n docs. n8n's AI Agent node remembers a conversation only as long as its memory sub-node does. n8n's docs describe memory as keeping "a history of previous messages, allowing for an ongoing conversation with the AI, rather than every interaction starting fresh", and the simplest option, Simple Memory, "stores a customizable length of chat history for the current session" n8n: How memory works https://docs.n8n.io/advanced-ai/examples/understand-memory/ . This tutorial does two things with the MemorySync community node: 1. It moves the agent's chat history into MemorySync, so a conversation can pick up again in a later execution. 2. It gives the agent a tool for looking up long-term facts about the person it's talking to. Everything about MemorySync below comes from the MemorySync n8n guide https://docs.memorysync.io/guides/n8n?utm source=devto&utm medium=social&utm campaign=pivot oct19&utm content=n8n-agent-chat-memory-memorysync . Everything about n8n itself comes from n8n's own docs. What you need - A self-hosted n8n instance. n8n installs community nodes from npm on self-hosted instances. MemorySync's guide notes that n8n Cloud only lists nodes n8n has verified, and its verification is in progress. - An Owner or Admin role on that instance. n8n's docs say only those roles can install and manage community nodes from npm n8n: GUI installation https://docs.n8n.io/integrations/community-nodes/installation/gui-install/ . - n8n 2.16.0 or later for the Chat Memory sub-node. The plain MemorySync workflow node also works on older releases. - A MemorySync API key , created in the dashboard under Settings → API Keys inside the project whose memories you want to use. Step 1: Install the community node Following n8n's GUI installation steps: 1. Go to Settings → Community Nodes and select Install . 2. Enter the package name n8n-nodes-memorysync . 3. Select I understand the risks of installing unverified code from a public source . 4. Select Install . To check it worked, search the node picker for "MemorySync". You should see two entries: - MemorySync : six workflow operations Add Memory, Add Conversation Turn, Search Memories, Recall Context, Get Many, Delete Memories - MemorySync Chat Memory : the sub-node for an AI Agent's Memory port If you build your own Docker image, MemorySync's guide shows preinstalling the package instead: Step 2: Add the credential Add a MemorySync API credential and paste your key. The credential test runs a real one-result query, so a wrong or revoked key fails here rather than halfway through a workflow. Step 3: A two-node smoke test Before involving an agent, check that a write and a read work: 1. Manual Trigger → MemorySync Add Memory : set End User ID to alice and Text to Alice is vegetarian and never eats mushrooms. 2. → MemorySync Search Memories : use the same End User ID alice and Query what does Alice eat? 3. Select Test workflow . The search step returns the stored fact as a regular n8n item. If the add reports status: skipped , that's by design. MemorySync keeps only durable content, so small talk like "hello" isn't stored. Write a real fact and try again. Step 4: Give the AI Agent chat memory 1. Build the agent as usual: Chat Trigger → AI Agent , with your chat model connected. 2. On the agent's Memory port, select MemorySync Chat Memory . 3. Set Session ID to your conversation key. MemorySync's guide gives {{ $json.sessionId }} for the Chat Trigger. 4. Set End User ID to your own stable identifier for the person chatting, taken from your workflow for example, your app's internal user ID . 5. Leave Context Window Length at 10 . That's how many previous turn pairs the agent sees on each run. What gets stored, per MemorySync's guide: - The transcript is kept as the session's conversation history, separate from the user's memories. - MemorySync extracts durable facts from the user's turns. Only those facts show up as memories in Search, Recall, Get Many and the dashboard. - Nothing is extracted from the assistant's turns. Step 5: Let the agent look up long-term facts n8n's docs say you must connect at least one tool sub-node to an AI Agent n8n: AI Agent https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/ . A useful first tool is the MemorySync node itself: - Under the agent's Tools , attach a MemorySync node set to Search Memories , with the same End User ID expression. - The node is marked as usable as a tool, so the agent can decide on its own when to look something up. Use the same End User ID everywhere. MemorySync's guide is explicit: if Add, Search and Recall don't share the value, recall returns nothing. Outside the agent: Recall Context Not every workflow needs an agent. The Recall Context operation takes an End User ID and a query for example drafting a reply to their email and returns one prompt-ready context block. You can map it straight into a downstream AI step's system prompt instead of assembling search results yourself. Usage to expect MemorySync's guide spells out how the Chat Memory sub-node counts: - One AI Agent run is two adds and two retrievals . - The user's message and the agent's reply are saved as separate turns. - History is read once when the agent loads memory, and n8n reads it once more to show the conversation in the execution log. - Search Memories, Recall Context and Get Many count as one retrieval each, and deletes are free. On free and paid plans, hitting the monthly limit makes Add Memory report stored: false, accepted: true and makes reads return empty, so the workflow keeps running. Troubleshooting - The nodes don't appear in the picker: community nodes from npm need a self-hosted instance and an Owner or Admin role. - Chat Memory is missing from the Memory port, or says "update n8n": the sub-node needs n8n 2.16.0 or later. - Search returns nothing right after an add: check whether the add was skipped , and confirm both nodes use the same End User ID. - A conversation turn doesn't show up in Search or Get Many: that's by design. Turns live in the session history, and only facts extracted from user turns become memories. Give extraction a few seconds. Try it If you want to see the save, reload and recall loop before installing anything, the MemorySync playground runs it in your browser with every API call shown: memorysync.io/try https://memorysync.io/try?utm source=devto&utm medium=social&utm campaign=pivot oct19&utm content=n8n-agent-chat-memory-memorysync .