Most AI assistants forget everything the moment you close the chat. OpenClaw doesn’t. (This is one of the key differences covered in our OpenClaw vs ChatGPT comparison.) It has a layered memory system that gives your agent genuine continuity — it remembers your preferences, past decisions, project context, and lessons learned across sessions.
Here’s how it actually works, and how to configure it for maximum usefulness.
The Memory Stack
OpenClaw’s memory has four layers, from fastest to deepest:
┌─────────────────────────┐
│ Session Context │ ← Current conversation (ephemeral)
├─────────────────────────┤
│ Daily Notes │ ← memory/YYYY-MM-DD.md (raw logs)
├─────────────────────────┤
│ Long-term Memory │ ← MEMORY.md (curated insights)
├─────────────────────────┤
│ Semantic Search │ ← memory_search across all files
└─────────────────────────┘
Layer 1: Session Context
The current conversation. Limited by the model’s context window (200K tokens for Claude). When it fills up, older messages get compacted or dropped. This is why the other layers matter.
Layer 2: Daily Notes (memory/YYYY-MM-DD.md)
Raw logs of what happened each day. Your agent creates these automatically — decisions made, tasks completed, problems encountered. Think of these as a work journal.
# 2026-02-13 (Thursday)
## Morning
- Reviewed Q1 metrics with team
- Decided to pause Feature X (low ROI)
- Kai mentioned wanting to explore prediction markets
## Afternoon
- Shipped v2.3 hotfix
- Updated deployment docs
Layer 3: Long-term Memory (MEMORY.md)
The curated, distilled knowledge. While daily notes are raw, MEMORY.md contains what matters — preferences, patterns, important decisions, lessons learned. Your agent periodically reviews daily notes and promotes the important bits here.
## Preferences
- Kai prefers pnpm over npm
- Default TTS voice: Nova
- Timezone: GMT+8
## Decisions
- 2026-01: Chose Astro over Next.js for marketing site (SSG performance)
- 2026-02: Paused Feature X — revisit in Q2
## Lessons
- Always check git status before switching branches
- Kai works late but quality drops after 2am — suggest breaks
Layer 4: Semantic Search (memory_search)
When your agent needs to recall something specific, it doesn’t read every file. It runs a semantic search across all memory files, finding the most relevant snippets. This is how it can answer “what did we decide about the pricing page?” without loading gigabytes of history.
How Memory Gets Created
Memory isn’t magic — it follows a clear cycle:
- During conversation: Agent notes important decisions, preferences, and context in the current session
- End of session / compaction: Key information gets written to
memory/YYYY-MM-DD.md - Periodic review (via heartbeat or cron): Agent reads recent daily notes and promotes lasting insights to
MEMORY.md - On recall: Agent uses
memory_searchto find relevant context before answering questions about past work
You can also explicitly tell your agent to remember things:
- “Remember that I prefer dark mode in all demos”
- “Note: We decided to use Stripe for payments”
- “Add to memory: The client’s deadline is March 15”
Configuring Memory Behavior
Workspace Files
Your agent’s memory lives in the workspace directory (default: ~/.openclaw/workspace/). The key files:
| File | Purpose | Loaded When |
|---|---|---|
MEMORY.md | Long-term curated memory | Main session start |
memory/*.md | Daily notes | On demand / search |
SOUL.md | Agent personality | Every session |
USER.md | Info about you | Every session |
AGENTS.md | Operating instructions | Every session |
Memory in Multi-Agent Setups
Each agent can have its own memory scope:
- Shared workspace: All agents read the same
MEMORY.mdand daily notes - Agent-specific memory: Use subdirectories like
memory/builder/ormemory/strategist/ - Security boundary:
MEMORY.mdonly loads in main sessions — not in group chats or shared contexts (prevents personal info leakage)
Context Window Management
The biggest practical challenge is context limits. Here’s how to manage it:
Compaction: When context usage exceeds ~70%, write everything important to files before it gets lost. Your agent should do this automatically, but you can trigger it: “Save current context to memory.”
Selective loading: Don’t load everything at session start. Load SOUL.md and USER.md (small, essential), then use memory_search for specific recall as needed.
Archiving: Old daily notes (30+ days) can be moved to an archives/ folder. They’re still searchable but won’t be loaded by default.
Practical Patterns
The Morning Context Load
At session start, a well-configured agent:
- Reads
SOUL.md(who am I?) - Reads
USER.md(who am I helping?) - Reads today’s + yesterday’s daily notes (recent context)
- Checks
MEMORY.mdfor long-term context - Ready to work with full continuity
The Decision Log
For important decisions, create a structured format:
## Decision: Switch to Astro
- **Date**: 2026-01-15
- **Context**: Needed marketing site, evaluated Next.js vs Astro
- **Decision**: Astro (better SSG performance, simpler deployment)
- **Rationale**: Pure static site, no need for server-side rendering
- **Revisit**: If we need dynamic features later
This makes decisions searchable and provides the why — crucial when revisiting months later.
The Preference Registry
Instead of scattering preferences across conversations, maintain a section in MEMORY.md:
## Preferences
- Package manager: pnpm
- Code style: Prettier defaults
- Communication: Direct, no fluff
- Working hours: 10am-2am GMT+8
- Notification threshold: Only urgent after midnight
Your agent references this automatically, so it never asks “which package manager?” twice.
Memory Hygiene
Every few weeks, review and clean:
- Archive old daily notes — Move 30+ day files to
archives/ - Prune MEMORY.md — Remove outdated decisions, completed projects
- Check for contradictions — Old preferences that have changed
- Verify accuracy — Memory can drift; correct anything wrong
You can ask your agent to do this: “Review and clean up MEMORY.md — remove anything outdated.”
Common Issues
”My agent forgot something important”
Check if it was written to a file. If it only existed in conversation context, it may have been lost during compaction. Fix: Ask the agent to write important things to memory immediately.
”Context window fills up too fast”
You’re probably loading too many files at startup. Use selective loading and memory_search instead of reading entire directories.
”Agent keeps asking things I’ve already told it”
The information might not be in MEMORY.md or searchable files. Tell the agent: “Add this to MEMORY.md so you remember it permanently."
"Memory has wrong information”
Edit MEMORY.md directly, or tell your agent: “Update memory: we’re no longer using Stripe, we switched to Paddle.”
The Compound Effect
Here’s what makes OpenClaw’s memory special: it compounds. A new agent on day 1 knows nothing. By week 2, it knows your preferences. By month 3, it has your project history, decision patterns, and working style internalized.
This isn’t a chat history — it’s a knowledge base that grows smarter over time. The more you use it, the less you have to explain.
The agents that deliver the most value aren’t the ones with the best prompts. They’re the ones with the best memory.
For a technical deep dive into memory internals and limitations, read Inside OpenClaw’s Memory. To set up a multi-agent team that shares memory effectively, see our multi-agent setup guide.