n8n Workflow & Agent Memory
Two nodes give n8n long-term memory: workflow operations (add, search, recall, list, delete) that an AI Agent can also call as a tool, and a Chat Memory sub-node that makes agent conversations persist across executions, restarts and redeploys. Install n8n-nodes-memorysync from the community-nodes panel.
Two nodes, one package
| Node | Plugs into | What it does |
|---|---|---|
| MemorySync | Any workflow (and AI Agents as a tool) | Six operations: Add Memory, Add Conversation Turn, Search, Recall Context, Get Many, Delete |
| MemorySync Chat Memory | The AI Agent’s *memory* port | The agent’s conversation history lives in MemorySync — sessions survive restarts, redeploys, and weeks between chats |
| Mem0 | Supermemory | Zep | MemorySync | |
|---|---|---|---|---|
| Community node ships | △ workflow ops only | ✗ HTTP-request recipes in docs | △ built-in node deprecated; hard-removed in n8n v3 | ✓ n8n-nodes-memorysync |
| AI Agent memory sub-node | ✗ none | ✗ | was the removed node | ✓ maintained, on the official @n8n/ai-node-sdk path |
| Agent can call memory as a tool | ✗ not marked usable | ✗ | ✗ | ✓ usableAsTool |
| Credential test | ✗ none — bad keys fail mid-workflow | — | — | ✓ real query at setup time |
| Retry safety | ✗ re-runs re-store | — | — | ✓ deterministic idempotency seeds |
| Runtime dependencies | several | — | — | ✓ zero (verified-program rule) |
Install
Settings → Community Nodes → InstallPackage name: n8n-nodes-memorysync→ restart is handled by n8n; both nodes appear in the node picker
Create a MemorySync API credential with a key from the dashboard. The credential test performs a real one-result query, so a wrong key fails at connect time — not three steps into a production workflow. n8n Cloud lists only verified community nodes; the verification submission is in progress, so Cloud users should watch the community-nodes panel.
The AI Agent memory sub-node
Chat Trigger ─▶ AI Agent ◀─memory─ MemorySync Chat Memory◀─model── OpenAI Chat Model◀─tool─── MemorySync (Search Memories)
| Guarantee | How |
|---|---|
| Sessions survive anything | History lives in MemorySync, not in-process — restarts, redeploys and scale-out don’t lose a turn |
| Retries never duplicate | Every stored turn carries a deterministic idempotency seed derived from role, session and content |
| An outage never breaks the agent | getMessages fails open to “no history this run”; the agent still answers |
| Agents cannot bulk-delete | clear() is a deliberate no-op — deleting a customer’s history stays an explicit human action (the workflow node’s Delete operation) |
| Same memory everywhere | Turns store under the n8n::<session> transcript scope — separate history, same shared user memories as every other MemorySync surface |
Workflow operations
| Operation | Use it for |
|---|---|
| Add Memory | “Remember this fact” — server-side extraction keeps only durable content |
| Add Conversation Turn | Verbatim transcript capture with duplicate-proof retries |
| Search Memories | Semantic lookup — results fan out as n8n items |
| Recall Context | A grouped, prompt-ready context block for a downstream AI step (no competitor node has this) |
| Get Many | Newest-first listing for an end user |
| Delete Memories | Explicit deletion by ID (m_123) |
curl --request POST https://api.memorysync.io/v1/memory/add_turn \--header "X-API-Key: $MEMORYSYNC_API_KEY" \--header "Content-Type: application/json" \--data '{"tenant_id":"acme","user_id":"customer-42","source":"n8n","text":"human: I always take the window seat","speaker":"human@n8n::support#h<content-hash>","metadata":{"session_id":"n8n::support"}}'
Quota behaviour is explicit: free-tier exhaustion reports stored: false, accepted: true instead of failing the workflow, and evaluation keys surface a truthful 429. Bad metadata JSON and malformed memory IDs raise clear node errors before any network call.
Supported versions
| Surface | Requires | Verified on |
|---|---|---|
n8n-nodes-memorysync 1.0.0 | Self-hosted n8n with community nodes enabled; the Chat Memory sub-node needs an n8n release that ships @n8n/ai-node-sdk (current releases do) | 23 CI checks: the registry contract (package keyword, dist wiring, zero runtime deps), the fnv1a64 idempotency parity vector, and the memory node driven through the REAL @n8n/ai-node-sdk → LangChain adapter chain — windowed history, session isolation, both metadata envelopes (nested production + legacy flat), duplicate-proof retries, fail-open outages, no-op clear — plus a live production round-trip |