Dify Memory Plugin
A first-party MemorySync Tool plugin for Dify: recall context before LLM nodes, remember facts after them, search with scores, and forget one memory at a time — the cross-conversation user memory Dify does not have natively. Install from a local .difypkg today; marketplace listing pending review.
What Dify cannot do natively
Dify’s built-in memory is per-conversation: the LLM-node memory toggle and conversation variables reset with every new thread, and the knowledge base is static documents. Nothing remembers the USER across conversations or apps — exactly the gap this plugin fills with four curated tools.
[User Input]│[Recall Context] ← MemorySync tool node│ {{recall_context.text}}[LLM Node] ← memory block in the prompt│[Remember] ← store what the user shared│[Answer]
| Mem0 (community plugin) | Zep | Supermemory | MemorySync | |
|---|---|---|---|---|
| Authorship | ✗ community (verified: false), 2 tools | — no plugin at all | — no plugin at all | ✓ first-party, 4 curated tools |
| User scoping | ✗ user_id is a free-form parameter — forget to wire it and every end user shares one memory | — | — | ✓ auto-resolved: parameter → Dify’s runtime user → default |
| Session scoping | ✗ none | — | — | ✓ dify::<conversation_id> recorded |
| Latency | ✗ 30s hard timeout — a hang blocks the workflow node | — | — | ✓ 10s budget, structured soft-fail |
| Errors | ✗ opaque blobs the LLM was never told to handle | — | — | ✓ branchable JSON with http_status + a friendly quota message |
| Schema drift | ✗ bare r["score"] KeyErrors | — | — | ✓ tolerant parsing, never raises |
| Retries | ✗ node re-runs duplicate extractions | — | — | ✓ deterministic idempotency seeds |
| Mass deletion | ✗ a fork exposes delete_all_memories to the LLM | — | — | ✓ single-id Forget only — no delete-everything tool exists |
The four tools
| Tool | What it does |
|---|---|
| Recall Context | Prompt-ready block of the user’s relevant memories (text + variable + JSON outputs) — drop before any LLM node |
| Remember | Store a fact/turn; re-running the node converges on one row; speaker role recorded |
| Search Memories | Scored JSON list, capped at 25 results, for branching or custom formatting |
| Forget Memory | Delete exactly ONE memory by id — loud on failure, never pretends |
User identity needs ZERO wiring: the plugin reads Dify’s own runtime user automatically, with an optional per-call override parameter and a deterministic default fallback. Memories flow to and from every other MemorySync surface — a fact learned in a Dify chatbot is recallable from LangChain agents, the CLI, or voice agents.
Install (Dify 1.14+)
# with the dify plugin CLIdify plugin package ./memorysync# → memorysync.difypkg
Dify → Plugins → Install Plugin → Install from Local Package File, then configure the MemorySync API key credential (app.memorysync.io). The marketplace listing is prepared and pending review.
Supported versions
| Surface | Requires | Verified on |
|---|---|---|
memorysync plugin 0.0.1 | Dify 1.14+ (plugin runner Python 3.12) | 32 CI checks via the SDK’s own offline harness (Tool.from_credentials) on the latest dify_plugin: the user ladder, idempotent Remember, capped scored Search with tolerant parsing, loud single-id Forget with the no-delete_all assertion, provider credential validation (200/403 valid, 401 invalid), quota modes, and manifest/provider/tool YAML schema sanity |