Why Your OpenClaw Agent Forgets Everything (And How to Fix It)
Youâve been working with your OpenClaw agent for weeks. It knows your preferences, your projects, your communication style. Then you start a new session and it asks you the same questions it asked on day one.
Sound familiar?
This isnât a bug. Itâs a fundamental limitation of how LLMs work â and itâs solvable. But first, letâs understand why it happens.
The Context Window Illusion
Large language models donât have memory. They have context windows.
When you chat with your OpenClaw agent, every message â yours and the agentâs â gets packed into a context window. The model processes this entire window on every turn. It looks like the agent remembers your conversation, but itâs actually re-reading the entire transcript every time it responds.
This creates two problems:
Problem 1: Sessions Are Isolated
When a session ends, the context window is gone. The next session starts with a blank slate. Your agent doesnât remember that you prefer TypeScript over Python, that your project uses PostgreSQL, or that you hate verbose output.
Problem 2: Context Windows Have Limits
Even within a session, thereâs a ceiling. Models have context limits (128K tokens for Claude, 200K+ for some models), and once you hit them, older messages get dropped. Long conversations lose their beginning.
The bigger your conversation, the more expensive each turn becomes (youâre paying for the model to re-read everything). And the modelâs attention to older context degrades â information at the edges is recalled less reliably than recent messages.
The MEMORY.md Approach
OpenClaw has a built-in solution: MEMORY.md and daily memory files.
# MEMORY.md
- User prefers concise responses
- Main project: content-engine (TypeScript, Node.js)
- Timezone: UTC+1
- Deploys to Railway
- Prefers dark mode in all tools
Your agent reads this file at the start of every session. It works. Itâs simple. And for many users, itâs enough.
But it has real limitations:
Every Line Eats Context
MEMORY.md gets loaded into the context window. A 50-line memory file might be 2,000 tokens. A 200-line file: 8,000 tokens. Thatâs context space that could be used for your actual conversation.
# Context budget for a 128K model:
System prompt: ~2,000 tokens
MEMORY.md: ~4,000 tokens â competing with your conversation
SOUL.md: ~1,000 tokens
Conversation: ~121,000 tokens
As your agent learns more about you, the memory file grows, and the available conversation space shrinks. Youâre paying (literally â in API costs) for the model to re-read your entire memory on every single turn.
No Semantic Search
MEMORY.md is a flat file. Your agent reads the whole thing or nothing. It canât search for âwhat does the user think about React?â and get just the relevant memories. It gets everything â your React preferences, your lunch habits, your SSH config notes â all loaded into context whether relevant or not.
Manual Maintenance
Someone has to maintain the file. Either you write entries manually, or your agent appends to it (and the file grows forever). Thereâs no automatic pruning, no importance ranking, no way to say âthis memory matters more than that one.â
No Sharing Between Agents
If you run multiple OpenClaw agents â a coding agent, a research agent, a writing agent â each has its own MEMORY.md. Knowledge doesnât flow between them unless you manually copy it.
Enter Semantic Memory
MemoClaw takes a different approach. Instead of dumping everything into a text file that gets loaded wholesale, it stores memories as vectors and retrieves only whatâs relevant.
Hereâs the difference:
MEMORY.md approach:
Session starts â Load entire MEMORY.md (200 lines, 8K tokens) â Start conversation
MemoClaw approach:
Session starts â Agent encounters a topic â Recall relevant memories (3-5 results, ~500 tokens) â Continue
Instead of front-loading everything, MemoClaw lets your agent pull memories on demand. The context stays lean. Only relevant information gets loaded.
How It Works in Practice
Install the MemoClaw skill on your OpenClaw agent:
clawhub install anajuliabit/memoclaw
Now your agent can store and recall memories:
# Store a memory with importance and tags
memoclaw store "User's project uses Next.js 14 with App Router" \
--importance 0.8 \
--tags tech-stack,frontend
# Store a preference
memoclaw store "User hates long-winded explanations. Keep it concise." \
--importance 0.9 \
--tags preferences,communication
# Store project context
memoclaw store "content-engine deploys to Railway, auto-deploys from main branch" \
--importance 0.7 \
--tags project,infra,content-engine
When context is needed, the agent recalls semantically:
# Agent is working on a frontend task
memoclaw recall "what frontend framework does the user use"
# â "User's project uses Next.js 14 with App Router" (score: 0.94)
# Agent is writing a response
memoclaw recall "how does the user like responses formatted"
# â "User hates long-winded explanations. Keep it concise." (score: 0.91)
The recall is semantic, not keyword-based. âWhat frontend frameworkâ matches a memory about âNext.js 14 with App Routerâ because MemoClaw understands the meaning, not just the words.
Importance Scoring
Not all memories are equal. Your preference for concise responses matters more than the fact that you had pizza last Tuesday. MemoClaw lets you (or your agent) assign importance scores:
# Critical â agent should almost always recall this
memoclaw store "NEVER push directly to main. Always use PRs." \
--importance 1.0 \
--tags workflow,git
# Useful but not critical
memoclaw store "User usually works between 9am-6pm UTC+1" \
--importance 0.5 \
--tags schedule
# Low importance â nice to know
memoclaw store "User's favorite color is blue" \
--importance 0.2 \
--tags personal
When recalling, higher-importance memories get prioritized. Your agent surfaces the critical stuff first.
Namespaces for Projects
Working on multiple projects? Use namespaces to keep memory organized:
# Memories for the content engine project
memoclaw store "Blog posts go to blog.memoclaw.com, not /blog on main site" \
--namespace content-engine \
--importance 0.9
# Memories for a different project
memoclaw store "API uses GraphQL, not REST" \
--namespace client-project \
--importance 0.8
When your agent works on the content engine, it recalls from that namespace. When it switches to the client project, it gets that projectâs context. Clean separation, no cross-contamination.
MEMORY.md + MemoClaw: Better Together
Hereâs the thing â you donât have to choose. The best setup uses both:
MEMORY.md for the essentials your agent needs every session:
# MEMORY.md
- Name: Ana
- Timezone: UTC+1
- Tone: Direct, no fluff
Keep it short. 10-20 lines. The stuff thatâs relevant 100% of the time.
MemoClaw for everything else:
- Project-specific context (recalled when working on that project)
- Detailed preferences (recalled when relevant)
- Historical decisions (recalled when the topic comes up)
- Corrections and lessons learned (recalled when the agent is about to make the same mistake)
This way, your context window stays lean (small MEMORY.md), but your agent has access to a deep well of searchable, prioritized memory through MemoClaw.
Migration: From MEMORY.md to MemoClaw
Already have a long MEMORY.md? MemoClaw can ingest it:
# Migrate an existing memory file
memoclaw migrate ./MEMORY.md
This parses the file, splits it into individual memories, generates embeddings, and stores them. You can then trim your MEMORY.md down to just the essentials and let MemoClaw handle the rest.
The migration costs $0.01 per file (it uses GPT-4o-mini to parse and chunk intelligently). A one-time cost to upgrade from flat-file memory to semantic search.
The Numbers
Letâs compare context usage:
| MEMORY.md Only | MemoClaw + Slim MEMORY.md | |
|---|---|---|
| Baseline context | 8,000 tokens (200 lines) | 800 tokens (20 lines) |
| Per-query memory | 0 (already loaded) | ~500 tokens (5 results) |
| Relevance | Everything, always | Only whatâs needed |
| Cost per session | Higher (larger context every turn) | Lower (lean context + targeted recalls) |
| Search | Ctrl+F (exact match) | Semantic (meaning-based) |
| Multi-agent | Copy files manually | Shared via wallet |
For an agent that makes 20 turns per session, loading 8K tokens of memory every turn means 160K tokens of memory re-processing per session. With MemoClaw, you load 800 tokens baseline + maybe 2,500 tokens of recalled memories across 5 recall operations = 18,500 tokens total. Thatâs an order of magnitude less.
Getting Started
The fix is three commands:
# Install the skill
clawhub install anajuliabit/memoclaw
# Authenticate
memoclaw auth
# Migrate your existing memories
memoclaw migrate ./MEMORY.md
Then trim your MEMORY.md to the bare essentials and let MemoClaw handle the deep memory. Your first 100 API calls are free â enough to migrate a file and test recall for a few sessions before deciding if itâs worth the (very small) ongoing cost.
Your agent doesnât have to forget everything. It just needs a better place to remember.