AGENT SKILL

memory-dream

Memory consolidation protocol. Reviews all stored memories, merges duplicates, removes noise and credentials, rewrites unclear entries, and enforces TTL expiration. Use when the user asks to clean up, consolidate, or review their memories. Also triggers automatically after sufficient activity (configurable).

License 许可
Apache-2.0
最近更新
2026-08-12
Stars
★ 2
Forks
0

01 前言 Front Matter

name
memory-dream
metadata
{ "openclaw": { "emoji": "💤", "injected": true, "requires": { "env": [ "MEM0_API_KEY", "OPENAI_API_KEY", "ANTHROPIC_API_KEY" ], "bins": [] } } }
description
Memory consolidation protocol. Reviews all stored memories, merges duplicates, removes noise and credentials, rewrites unclear entries, and enforces TTL expiration. Use when the user asks to clean up, consolidate, or review their memories. Also triggers automatically after sufficient activity (configurable).
user-invocable
true

03 SKILL.md 正文

Memory Consolidation

You are performing a memory consolidation pass. Your goal is to review all stored memories for this user and improve their overall quality. Think of this as compressing raw observations into clean, durable knowledge.

Available Tools

memory_search

Semantic search across stored memories.

  • query (required): search query
  • limit: max results
  • userId, agentId: scope overrides
  • scope: "all" (default), "session", or "long-term"
  • categories: filter by category array

memory_add

Store new facts in long-term memory.

  • facts (required): array of facts — ALL must share the same category
  • category: "identity", "preference", "decision", "rule", "project", "configuration", "technical", "relationship"
  • importance: 0.0–1.0

memory_get

Retrieve a single memory by ID.

  • memoryId (required): the memory ID

memory_list

List all stored memories for a user or agent.

  • userId, agentId: scope overrides
  • scope: "all" (default), "session", or "long-term"

memory_update

Update an existing memory's text in place. Atomic and preserves edit history.

  • memoryId (required): the memory ID to update
  • text (required): the new text (replaces old)

memory_delete

Delete memories by ID, query, or bulk.

  • memoryId: specific memory ID to delete
  • all: delete ALL memories (requires confirm: true)
  • userId, agentId: scope overrides

memory_event_list

List recent background processing events (platform mode only).

memory_event_status

Get status of a specific background event.

  • event_id (required): the event ID to check

Follow these four phases in order. Do not skip phases.

Phase 1: Orient

Survey the current memory landscape before making any changes.

  1. Call memory_list to load all stored memories.
  2. Count memories by category. Note the total.
  3. Identify the oldest and newest memories by their timestamps.
  4. Note any obvious problems visible in the list: duplicates, very short entries, entries without temporal anchors.

Do not modify anything in this phase. The goal is to understand what you are working with.

Phase 2: Gather Targets

Identify which memories need action. Use the tools to investigate.

Search for recent additions: Call memory_search with a created_at filter to find memories added since the last consolidation. These are the most likely to need merging or cleanup.

Classify each target into one of these actions:

  • DELETE: contains credentials, expired by TTL, pure noise, raw tool output, standalone timestamps
  • MERGE: two or more memories express the same fact in different words, or a series tracks incremental changes to the same entity
  • REWRITE: vague, missing temporal anchor, uses first person instead of third, wrong category, overly verbose

Phase 3: Consolidate

Execute the actions identified in Phase 2. Work in this priority order:

3a. Delete dangerous and expired entries

Delete immediately using memory_delete:

  • Credentials, API keys, tokens, passwords, secrets (matching known credential prefixes and auth patterns injected by the plugin at runtime)
  • Pure timestamps with no context
  • Raw tool output stored as memory
  • Heartbeat or cron execution records
  • Generic acknowledgments stored as memory ("ok", "got it")
  • Operational memories older than 7 days
  • Project memories older than 90 days

3b. Merge duplicates

When two or more memories express the same fact:

  1. Pick the most complete version as the base
  2. Call memory_update on the best version to incorporate missing details from the others
  3. Call memory_delete on the redundant entries

memory_update is preferred over forget-then-store because it is atomic and preserves edit history.

When merging, follow these rules:

  • Keep the user's original words for opinions and preferences
  • Preserve temporal anchors from both versions
  • Do not exceed 50 words in the merged result
  • The merged memory must be self-contained (understandable without the deleted ones)

3c. Rewrite unclear entries

When a memory needs improvement but is not a duplicate:

  1. Call memory_update with the improved text

Rewrite when:

  • Memory uses first person ("I prefer") instead of third ("User prefers")
  • Memory lacks a temporal anchor for time-sensitive information
  • Memory is vague ("likes python") and can be made specific ("User prefers Python for backend development")
  • Memory has the wrong category assignment
  • Memory is over 50 words and can be compressed without losing information

Phase 4: Report

After completing all operations, summarize what you did:

Consolidation complete.
- Reviewed: [total count]
- Deleted (credentials/secrets): [count]
- Deleted (expired/stale): [count]
- Merged: [count] groups into [count] memories
- Rewritten: [count]
- Final count: [total remaining]
- Issues found: [any notable problems or observations]

Quality Targets

After consolidation, the memory store should have:

  • Zero memories containing credentials or secrets
  • Zero duplicate memories (same fact in different words)
  • All project and operational memories have temporal anchors ("As of YYYY-MM-DD")
  • All memories use third person voice
  • All memories are correctly categorized
  • Each memory is 15-50 words, self-contained, and atomic (one fact per memory)

04 同仓库更多 Skills

zhangmask
zhangmask/C_AnimeCompanion

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).

★ 2
zhangmask
zhangmask/C_AnimeCompanion

mem0-vercel-ai-sdk

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).

★ 2
zhangmask
zhangmask/C_AnimeCompanion

mem0-test-integration

Verify a Mem0 integration produced by /mem0-integrate. Runs in the same workspace on the same branch (loose coupling) — installs dependencies, runs the repo's native test suite, then exercises a real end-to-end smoke flow against the user's API key. Produces a scorecard. TRIGGER when: user has just run /mem0-integrate and says "verify", "test the integration", "run /mem0-test-integration", or when a .mem0-integration/ directory exists and tests have not been run yet on the current branch. DO NOT TRIGGER when: the user wants to run general project tests (defer to the repo's native test command), or when no prior /mem0-integrate run exists in the current branch (ask them to run /mem0-integrate first). This skill ONLY catches compile and runtime bugs by design. Logical integration errors — wrong data stored, wrong time retrieved, wrong user scoping — are on the human reviewer.

★ 2
zhangmask
zhangmask/C_AnimeCompanion

mem0-oss-to-platform

Plan and then execute a migration of a project from the mem0 open-source / self-hosted SDK (the local `Memory` class) to the mem0 Platform / hosted / managed SDK (the `MemoryClient` class). Use this whenever a developer wants to move, switch, or migrate their mem0 usage off OSS/self-hosted to the hosted API — e.g. "migrate my mem0 setup to the platform", "switch from self-hosted mem0 to MemoryClient", "use my mem0 API key instead of a local Qdrant", "move mem0 to the cloud/hosted/managed service", or "replace my local mem0 vector store + embedder config with the platform". Applies to Python (`from mem0 import Memory` → `from mem0 import MemoryClient`) and TypeScript/JavaScript (`import { Memory } from "mem0ai/oss"` → `import MemoryClient from "mem0ai"`). Trigger even when the user doesn't say the word "migrate" but clearly wants their existing mem0 integration to run against the hosted platform. It first produces a reviewable migration plan, then executes it after the developer approves. Strictly scoped to the mem0 integration — it does not refactor, restructure, or "improve" any unrelated code.

★ 2
zhangmask
zhangmask/C_AnimeCompanion

mem0-integrate

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 <repo>", 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).

★ 2
zhangmask
zhangmask/C_AnimeCompanion

mem0-cli

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).

★ 2