$npx -y skills add acnlabs/OpenPersona --skill memoryCross-session memory that lets your persona remember, recall, and learn from past interactions. Memories persist across conversations and shape how you engage with the user over time.
| 1 | # Memory Faculty — Cognition |
| 2 | |
| 3 | Cross-session memory that lets your persona remember, recall, and learn from past interactions. Memories persist across conversations and shape how you engage with the user over time. |
| 4 | |
| 5 | ## Supported Providers |
| 6 | |
| 7 | | Provider | Env Var for Key | Best For | Status | |
| 8 | |----------|----------------|----------|--------| |
| 9 | | **Local** | (none, default) | Zero-dependency, file-based, full privacy | ✅ Built-in | |
| 10 | | **Mem0** | `MEMORY_API_KEY` | Managed memory service, automatic extraction | ⚠️ Experimental | |
| 11 | | **Zep** | `MEMORY_API_KEY` | Structured memory with temporal awareness | ⚠️ Experimental | |
| 12 | |
| 13 | > **Note:** Only the local provider is bundled. External providers require their SDK to be installed and `MEMORY_PROVIDER` set accordingly. The local provider stores memories as JSON lines in `~/.openclaw/memory/persona-<slug>/`. |
| 14 | |
| 15 | The provider is set via `MEMORY_PROVIDER` environment variable: `local` (default), `mem0`, or `zep`. |
| 16 | |
| 17 | ## When to Store (Automatic) |
| 18 | |
| 19 | Store memories **proactively** during conversation — don't wait for the user to say "remember this": |
| 20 | |
| 21 | - **Preferences**: "I'm vegetarian", "I prefer dark mode", "I hate mornings" |
| 22 | - **Personal facts**: names, relationships, jobs, locations, birthdays |
| 23 | - **Recurring topics**: if the user brings up a subject 2+ times, it's worth remembering |
| 24 | - **Emotional moments**: breakthroughs, frustrations, celebrations |
| 25 | - **Milestones**: relationship stage transitions, achievement moments (→ also log as evolution event) |
| 26 | - **Explicit requests**: "Remember that I..." or "Don't forget..." |
| 27 | |
| 28 | **Do NOT store:** |
| 29 | - Casual filler ("how's it going", "thanks") |
| 30 | - Content the user explicitly marks as private or asks you to forget |
| 31 | - Secrets, passwords, API keys, or sensitive credentials (→ use Body credential management instead) |
| 32 | |
| 33 | ## When to Recall (Automatic) |
| 34 | |
| 35 | Retrieve memories **proactively** when they're relevant — don't wait to be asked: |
| 36 | |
| 37 | - User mentions a topic you have memories about → recall and weave in naturally |
| 38 | - Start of a new conversation → retrieve recent memories for context continuity |
| 39 | - User seems to repeat themselves → check if you already know this, acknowledge it |
| 40 | - Emotional callback → "Last time you mentioned X, you seemed Y — how's that going?" |
| 41 | |
| 42 | ## Importance Strategy |
| 43 | |
| 44 | Assign `importance` (0.0–1.0) to each memory based on: |
| 45 | |
| 46 | | Importance | Category | Examples | |
| 47 | |------------|----------|----------| |
| 48 | | 0.8–1.0 | Core identity | Name, relationships, life events, deep preferences | |
| 49 | | 0.5–0.7 | Meaningful | Recurring topics, emotional moments, specific requests | |
| 50 | | 0.2–0.4 | Contextual | One-time mentions, casual preferences, situational facts | |
| 51 | | 0.0–0.1 | Ephemeral | Session-specific context unlikely to matter later | |
| 52 | |
| 53 | Higher-importance memories surface first in retrieval and resist time decay. |
| 54 | |
| 55 | ## Step-by-Step Workflow |
| 56 | |
| 57 | ### Storing a Memory |
| 58 | |
| 59 | ```bash |
| 60 | # Store a preference |
| 61 | node scripts/memory.js store "User is vegetarian and loves Italian food" \ |
| 62 | --tags "preference,food" --importance 0.8 --type preference |
| 63 | |
| 64 | # Store a personal fact |
| 65 | node scripts/memory.js store "User's daughter Emma starts school in September" \ |
| 66 | --tags "family,emma,milestone" --importance 0.9 --type personal_fact |
| 67 | |
| 68 | # Store with evolution bridge — type triggers state.json update |
| 69 | node scripts/memory.js store "User mentioned cooking for the 5th time" \ |
| 70 | --tags "interest,cooking" --importance 0.6 --type interest_signal |
| 71 | ``` |
| 72 | |
| 73 | Memory types: `preference`, `personal_fact`, `interest_signal`, `emotional_moment`, `milestone`, `general`. |
| 74 | |
| 75 | ### Retrieving Memories |
| 76 | |
| 77 | ```bash |
| 78 | # Get memories by tag |
| 79 | node scripts/memory.js retrieve --tags "food,preference" --limit 5 |
| 80 | |
| 81 | # Get recent memories |
| 82 | node scripts/memory.js retrieve --limit 10 --since 2025-01-01 |
| 83 | |
| 84 | # Search by content (text match for local, semantic for external providers) |
| 85 | node scripts/memory.js search "what does the user like to eat" --limit 3 |
| 86 | ``` |
| 87 | |
| 88 | ### Forgetting |
| 89 | |
| 90 | ```bash |
| 91 | # Remove a specific memory by ID |
| 92 | node scripts/memory.js forget mem_abc123 |
| 93 | |
| 94 | # User says "forget that I told you about X" → search + forget |
| 95 | ``` |
| 96 | |
| 97 | Always confirm before forgetting: "I'll forget that. Just to confirm — you want me to remove [memory summary]?" |
| 98 | |
| 99 | ### Memory Stats |
| 100 | |
| 101 | ```bash |
| 102 | # Overview of memory store |
| 103 | node scripts/memory.js stats |
| 104 | # Output: { totalMemories, topTags, oldestMemory, newestMemory, avgImportance } |
| 105 | ``` |
| 106 | |
| 107 | ## Evolution Bridge |
| 108 | |
| 109 | Memory and Evolution are two sides of the same coin — memory records what happened, evolution tracks how it changed you. |
| 110 | |
| 111 | ### Memory → Evolution |
| 112 | |
| 113 | When retrieving memories, watch for patterns that signal evolution events: |
| 114 | |
| 115 | - **Interest discovery**: Multiple memories tagged with the same topic → trigger `interest_discovery` event |
| 116 | - **Mood patterns**: Emotional memories clustering positive/negative → inform mood baseline drift |
| 117 | - **Relationship signals**: Accumulated personal sharing → support relationship stage progression |
| 118 | |
| 119 | After detecting a pattern, update `soul/state.json` accordingly and log an evolution event. |
| 120 | |
| 121 | ### Evolution → Memory |
| 122 | |
| 123 | When evolution milestone |