
dream
Consolidates stored memories by merging duplicates, resolving contradictions, and pruning stale entries. Use when memory count is high, search results feel noisy or repetitive, or periodic cleanup is needed to maintain memory quality.
- Installs
- 114
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/mem0ai/mem0 --skill dream- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads dream automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Mem0 Dream — Memory Consolidation
This skill performs a memory consolidation pass: it fetches all project memories, identifies near-duplicates, flags contradictions, and prunes stale entries based on configured retention policies. All proposed changes are shown as a diff for user approval before anything is modified.
IMPORTANT: Execute steps strictly in order (1 → 2 → 3 → 4 → 5 → 6). Each step depends on the previous one. Do NOT run steps in parallel or skip ahead.
Step 1: Load Retention Policies
Determine the active retention policy by running the parser script. Use the
appropriate PLUGIN_ROOT variable for the current platform (${CLAUDE_PLUGIN_ROOT},
${CODEX_PLUGIN_ROOT}, or ${CURSOR_PLUGIN_ROOT}):
python3 "<PLUGIN_ROOT>/scripts/parse_mem0_config.py" "<cwd>"
Parse the JSON output (a dict of category → days | null). If the script fails
or returns {}, fall back to these built-in defaults:
metadata.type | Default retention |
|---|---|
session_state | 90 days |
compact_summary | 90 days |
| all others | no pruning |
Store the resolved policies for use in Step 3.
Step 2: Fetch ALL Project Memories
Call get_memories to retrieve every memory for the active project:
get_memories(
filters={"AND": [{"user_id": "<active_user_id>"}, {"app_id": "<active_project_id>"}]},
page_size=200,
)
If the response indicates more pages exist, paginate until all memories are fetched. Collect the full list before proceeding. If zero memories are found, print:
No memories found for project <project_id>. Nothing to consolidate.
…and stop.
Step 3: Analyze — Find Issues
Work entirely in-memory; do not modify anything yet.
Group memories by metadata.type (use "unknown" when the field is absent).
For each group, identify the following:
3a. Near-duplicate pairs (merge candidates)
Two memories are near-duplicates when they express the same fact or decision but phrased differently (e.g., "Use PostgreSQL for auth" and "Auth DB is PostgreSQL").
Heuristics — two memories are near-duplicates if all of these hold:
- Similarity threshold: estimated cosine similarity > 0.9 (use noun/keyword overlap as proxy — if >60% of significant nouns overlap, treat as >0.9 similarity).
- Same
metadata.type. - Neither memory is pinned (
metadata.pinned != true).
For each qualifying pair, draft a merged version that is more complete and specific than either original.
3b. Contradictions
Two memories contradict when they assert opposing facts about the same topic (e.g., "Deploy to ECS" vs. "Deploy to Vercel").
Identify the likely winner: the more recent memory with higher confidence wins. Store both IDs and their content for user review.
3c. Prune candidates
A memory is a prune candidate when any of the following is true:
- Its
metadata.typehas a retention policy and the memory is older than the configured number of days (comparecreated_atto today). - Its confidence score is below 0.3 AND it contains no information unique to this project (no file paths, identifiers, or domain-specific nouns).
Always skip memories where metadata.pinned == true, regardless of age or
confidence.
Step 4: Print Diff Report
Print a structured diff to the terminal before making any changes. Use exactly this format:
## dream — consolidation report
Merges (<N>):
[mem0:<id1>] + [mem0:<id2>] → "<merged content, 100 chars>"
Conflicts (<N>):
[mem0:<idA>] vs [mem0:<idB>] — "<topic>" [A/B/skip]
Prune (<N>):
[mem0:<id>] — <type>, <age>d old
Proposed: <N> merges, <N> prunes, <N> conflicts. Apply? [Y/n]
If there are zero items in any category, omit that section entirely.
If there are zero total proposals (no merges, no prunes, no conflicts), print:
Dream complete. No duplicate, contradictory, or stale memories found.
…and stop.
Step 5: Wait for User Input and Apply
5a. Contradictions
For each CONFLICT pair in the report, wait for the user to type A, B, or
skip (case-insensitive). If they enter nothing (empty), treat as skip.
Record the winner for each pair before proceeding to the final apply confirmation.
5b. Final confirmation
After all conflict resolutions are collected, prompt:
Apply? [Y/n]
If the user types n or no (case-insensitive), print Cancelled. No changes made.
and stop.
If the user confirms (Y, yes, or empty / Enter), apply all changes in this order:
Merges
For each approved merge pair:
delete_memory(<id1>)delete_memory(<id2>)add_memorywith:text="<merged content>"user_id=<active_user_id>app_id=<active_project_id>(top-level, not in metadata)metadata={"type": "<original type>", "branch": "<active_branch>", "confidence": <higher of the two original scores>, "source": "mem0-dream"}infer=False
Contradictions (resolved)
For each resolved conflict where the user chose A or B:
- Delete the loser (the non-chosen memory):
delete_memory(memory_id=<loser_id>)
Contradictions where the user chose skip are left untouched.
Prunes
For each prune candidate:
delete_memory(<memory_id>)
Step 6: Print Summary
After all changes are applied, print:
Dream complete — merged: <N>, pruned: <N>, conflicts resolved: <N>, skipped: <N>
Auto mode
When invoked with --auto (e.g., /mem0:dream --auto), run non-interactively:
- Merges: applied automatically (no contradiction, both are compatible).
- Prunes: applied automatically (age/confidence-based, no ambiguity).
- Contradictions: skipped — they require human judgment.
Concurrency guard
Before doing any work, check for a lock file at /tmp/mem0_dream_auto.lock:
- If the lock file exists and is less than 10 minutes old, print
[mem0-dream --auto] Another run in progress — skipping.and stop. - Otherwise, create the lock file (write the current timestamp). Delete it when done (in all exit paths).
Execution
In auto mode:
- Load policies and fetch memories (Steps 1–3) as normal.
- Apply merges and prunes silently without printing the diff or prompting.
- Print a compact summary:
[mem0-dream --auto] project=<id> merged=<N> pruned=<N> conflicts_skipped=<N> - If contradictions were detected but skipped, check if a
mem0-dream-autoreminder already exists before storing one:- Search for existing reminders:
search_memories(query="mem0-dream contradictions manual review", filters={"AND": [{"user_id": "<active_user_id>"}, {"app_id": "<active_project_id>"}, {"metadata": {"source": "mem0-dream-auto"}}]}, top_k=1) - If a result exists with similarity > 0.9, skip storing the reminder (one already exists).
- If no match, store the reminder:
add_memory( text="mem0-dream detected <N> contradiction(s) requiring manual review. Run /mem0:dream to resolve them interactively.", user_id="<active_user_id>", app_id="<active_project_id>", metadata={"type": "task_learning", "source": "mem0-dream-auto", "branch": "<active_branch>"}, infer=False, ) - Search for existing reminders:
See also
/mem0:forget— targeted deletion of specific memories (search + confirm + delete)/mem0:health --deep— quick quality scan without applying changes
FAQ
What does the dream skill do?
Consolidates stored memories by merging duplicates, resolving contradictions, and pruning stale entries. Use when memory count is high, search results feel noisy or repetitive, or periodic cleanup is needed to maintain memory quality.
How do I install dream?
Run npx skills add https://github.com/mem0ai/mem0 --skill dream in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/dream/ (personal) or .claude/skills/dream/ (project).
Which AI agents can use dream?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is dream safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains dream?
It is published by mem0ai in mem0ai/mem0. It has 114 recorded installs.
More from mem0ai/mem0
mem0
mem0ai/mem0
Mem0 Platform SDK for adding persistent memory to AI applications. TRIGGER when: user mentions "mem0", "MemoryClient", "memory layer", "remember user preferences", "persistent context", "personalization", or needs to add long-term memory to chatbots, agents, or AI apps. Covers Python SDK (mem0ai), TypeScript SDK (mem0ai), and framework integrations (LangChain, CrewAI, OpenAI Agents SDK, Pipecat, LlamaIndex, AutoGen, LangGraph). Also covers the open-source self-hosted Memory class. This is the DEFAULT mem0 skill for ambiguous queries. DO NOT TRIGGER when: user asks about CLI commands, terminal usage, or shell scripts (use mem0-cli), or Vercel AI SDK / @mem0/vercel-ai-provider / createMem0 (use mem0-vercel-ai-sdk).
mem0-cli
mem0ai/mem0
Mem0 CLI -- the command-line interface for mem0 memory operations. TRIGGER when: user mentions "mem0 cli", "mem0 command line", "@mem0/cli", "mem0-cli", "pip install mem0-cli", "npm install -g @mem0/cli", or is running mem0 commands in a terminal/shell (mem0 add, mem0 search, mem0 list, mem0 get, mem0 init, mem0 config, mem0 import). Also triggers when query includes CLI flags like --user-id, --output, --json, --agent, or describes bash/zsh/terminal/shell usage. DO NOT TRIGGER when: user asks about programmatic SDK integration in Python/TS code (use mem0 skill), or Vercel AI SDK provider (use mem0-vercel-ai-sdk skill).
mem0-vercel-ai-sdk
mem0ai/mem0
Mem0 provider for Vercel AI SDK (@mem0/vercel-ai-provider). TRIGGER when: user mentions "vercel ai sdk", "@mem0/vercel-ai-provider", "createMem0", "retrieveMemories", "addMemories", "getMemories", "searchMemories", "mem0 vercel", "AI SDK provider", "AI SDK memory", or is using generateText/streamText with mem0. Also triggers for Next.js apps needing memory-augmented AI. DO NOT TRIGGER when: user asks about direct Python/TS SDK calls without Vercel (use mem0 skill), or CLI terminal commands (use mem0-cli skill).
mem0-integrate
mem0ai/mem0
Integrate Mem0 into an existing repository using a goal-driven, TDD pipeline. Detects the repo's language automatically and asks the user to pick between Mem0 Platform (managed) and Mem0 Open Source (self-hosted). Writes failing tests before any implementation. Produces a local feature branch plus .mem0-integration/ artifacts consumed by the paired verification skill. TRIGGER when: user says "integrate mem0", "add mem0 to this repo", "wire mem0 into ", or asks how to add memory to an existing project. DO NOT TRIGGER when: the user wants general SDK usage (use skill:mem0), CLI usage (use skill:mem0-cli), or Vercel AI SDK (use skill:mem0-vercel-ai-sdk). After success, invoke skill:mem0-test-integration to verify in the same workspace (loose coupling).
mem0-test-integration
mem0ai/mem0
Open the skill to read its SKILL.md instructions.
Popular other skills
hyperframes-cli
heygen-com/hyperframes
The HyperFrames CLI by job - scaffold, check, look at frames, edit the timeline, preview, render locally or in the cloud, publish, project history - plus reading its JSON and recovering from build or render failures.
triage
mattpocock/skills
Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.
ask-matt
mattpocock/skills
Ask which skill or flow fits your situation. A router over the skills in this repo.
to-questionnaire
mattpocock/skills
Turn a decision you can't fully answer into a questionnaire for someone else to fill in.
loop-me
mattpocock/skills
Grill me about specs for the workflows I want to build, within this workspace.