The OpenClaw agent memory stack — MEMORY.md, daily logs, and MemoClaw working together
If you run an OpenClaw agent, you already have a memory system. It’s just not very good.
Your agent wakes up, reads MEMORY.md, skims today’s daily log, maybe yesterday’s too. It gets enough context to not sound completely lost. Then it works, learns things, forms opinions, and writes some of that back to the files before the session ends.
This works. Sort of. Until it doesn’t.
Where file-based memory breaks
I ran my agent on MEMORY.md alone for months. Here’s what actually goes wrong.
Context window bloat. MEMORY.md grows. Every session, your agent reads the whole thing. At 50KB you’re burning tokens on stuff that hasn’t been relevant in weeks. At 100KB you’re in trouble. Your agent spends more time reading its own diary than doing actual work.
Daily logs pile up. The convention is memory/YYYY-MM-DD.md. Your agent reads today and yesterday. But what about that conversation from last Tuesday where your human explained exactly how they want error handling done? Gone. Buried in a file your agent will never look at again.
No search. This is the real problem. Your agent can read files, but it can’t search across them semantically. If it stored “Ana prefers dark mode in all her apps” three weeks ago in a daily log, there’s no way to find that when it’s configuring a new tool today. The information exists. Your agent just can’t reach it.
Manual curation is a chore. MEMORY.md is supposed to be “curated wisdom” distilled from daily logs. In practice, your agent either stuffs everything in there or forgets to update it. There’s no middle ground because there’s no system, just vibes and good intentions.
The three-layer stack
Here’s what actually works: use all three layers for what they’re good at.
Layer 1: Daily logs (memory/YYYY-MM-DD.md) These are scratch paper. Raw notes from today’s session. What happened, what was discussed, what changed. Your agent writes to these freely during work. They’re cheap, unstructured, and disposable after a few days.
Keep doing this exactly as you are now. Don’t change anything.
Layer 2: MEMORY.md This becomes your agent’s quick-reference card. The 10-20 most important things it needs every single session. User preferences, active projects, key decisions. Keep it short, under 5KB if you can manage it.
Stop using MEMORY.md as a comprehensive knowledge base. That’s not what it’s for.
Layer 3: MemoClaw Everything else goes here. MemoClaw stores memories with semantic embeddings, so your agent can recall them by meaning, not by filename. “What does Ana think about error handling?” returns the relevant memory even if the original note said something like “discussed try/catch preferences, Ana wants explicit error types, not generic catches.”
This layer costs nothing against your context window. The memories live in MemoClaw’s API, not in a file your agent has to read on startup.
Setting it up
Install the MemoClaw skill:
clawhub install anajuliabit/memoclaw
Your agent now has store and recall tools. That’s basically the whole API.
The daily migration pattern
At the end of each session (or during a heartbeat), your agent should do two things:
- Extract anything worth remembering from today’s daily log
- Store it in MemoClaw with appropriate tags and importance scores
store("Ana prefers explicit error types over generic try/catch blocks", importance: 0.8, tags: ["preferences", "coding-style"])
store("Deployed v2.3 of the dashboard app to production", importance: 0.5, tags: ["deployments", "dashboard"])
The importance score matters. User preferences and corrections get high scores (0.7-1.0). Routine events get lower ones (0.3-0.5). When your agent recalls memories, higher-importance ones rank first.
The startup routine
Update your AGENTS.md to include a recall step on session start:
## Every session
1. Read SOUL.md
2. Read USER.md
3. Read memory/YYYY-MM-DD.md (today + yesterday)
4. Read MEMORY.md (main session only)
5. Recall recent MemoClaw memories relevant to current context
Step 5 is the new one. Your agent runs a quick recall to pull in whatever’s relevant. If it’s about to work on the dashboard project, it searches for dashboard-related memories. If the human asks about something from two weeks ago, the agent can actually find it.
What stays in MEMORY.md vs MemoClaw
This is the part people overthink. Here’s a simple rule:
MEMORY.md: Things your agent needs literally every session. The human’s name, timezone, active projects, communication preferences. The stuff that would be weird to not know.
MemoClaw: Everything else. Project decisions, past conversations, technical preferences, deployment history, corrections, learned patterns. Things your agent needs sometimes, but not always.
MEMORY.md is your agent’s muscle memory. MemoClaw is its long-term memory. You don’t consciously recall how to type every time you sit at a keyboard, but you can remember what you had for dinner last Tuesday if someone asks.
What changes in practice
The shift is subtle but real.
Your agent stops forgetting things from last week. A human says “remember when we discussed the API rate limiting approach?” and the agent actually remembers, because it can search for it semantically instead of hoping it’s in one of two files it reads on startup.
MEMORY.md stops growing out of control. It stays small because it only holds the essentials. Everything else has a proper home.
Your agent’s context window gets lighter. Instead of reading 50KB of accumulated notes, it reads maybe 3KB of MEMORY.md plus whatever MemoClaw returns for the current task. More room for actual work.
And the daily logs become truly disposable. Write today’s notes, migrate the important bits to MemoClaw, move on. No guilt about losing old daily files.
The cost math
MemoClaw charges $0.005 per store and $0.005 per recall. If your agent stores 10 memories per session and recalls 5, that’s $0.075 per day. Under $2.50 a month for an agent that actually remembers things.
The free tier gives you 100 calls to start with. Enough to try the whole pattern without spending anything.
Compare that to the token cost of reading a bloated MEMORY.md every session. Depending on your model, 50KB of context costs somewhere between $0.01 and $0.05 per session. MemoClaw pays for itself pretty fast once your files get large enough.
Start small
You don’t have to restructure everything at once. Start with one change: at the end of each session, store the most important thing that happened in MemoClaw. One memory. That’s it.
After a week, your agent has 7 memories it can search semantically. After a month, 30. The value compounds quietly.
The file-based system isn’t broken. It’s just incomplete. MemoClaw fills the gap between “things my agent reads every time” and “things my agent will never find again.”