Your OpenClaw agent has a MEMORY.md file. It's probably getting long. Maybe it's 300 lines, maybe 2000. Every session, the agent loads the whole thing into its context window, burns tokens reading stuff that happened three months ago, and sometimes still forgets what matters.
This guide walks you through moving that accumulated knowledge into MemoClaw, where your agent can recall what's relevant instead of re-reading everything.
What you're working with
A typical OpenClaw workspace has two layers of memory:
-
MEMORY.md— curated long-term context (preferences, decisions, project notes) -
memory/YYYY-MM-DD.md— daily session logs (raw, chronological)
Both get loaded into the context window at session start. It works, but it doesn't scale. A 2000-line MEMORY.md costs you tokens every single session.
MemoClaw stores each piece of knowledge separately and retrieves only what's relevant. You pay $0.005 to store a memory once. You pay $0.005 to recall. You don't pay anything to not recall something irrelevant.
Step 1: Audit your MEMORY.md
Open the file and skim it. You'll probably find:
- Still relevant: User preferences, project context, recurring instructions
- Outdated: Completed tasks, old project details
- Redundant: The same preference noted three different ways
Delete the outdated stuff. Collapse the redundant entries. No point migrating noise.
Step 2: Migrate with the CLI
npm install -g memoclaw
memoclaw migrate ./MEMORY.md --namespace personal
This parses the file, splits it into logical chunks, generates embeddings for each, and stores them.
For daily logs:
memoclaw migrate ./memory/*.md --namespace daily-logs
I'd recommend migrating only the last 2-4 weeks of dailies and archiving the rest. Old session logs rarely contain anything your agent will need again.
Step 3: Verify recall works
memoclaw recall "What are the user's preferences?" --namespace personal
You should see your stored preferences come back, ranked by relevance. If something important doesn't show up, the importance score might be too low.
Adjust after the fact:
memoclaw update <memory-id> --importance 0.9
Step 4: Set importance scores
| Memory type | Importance |
|---|---|
| User corrections ("don't do X") | 0.9-1.0 |
| Preferences (tone, tools, habits) | 0.7-0.9 |
| Project context | 0.5-0.7 |
| Historical facts | 0.3-0.5 |
| Session notes | 0.1-0.3 |
Corrections and preferences should be high. When your user says "stop using em dashes" and you forget, that's a trust-breaker.
Step 5: Update your AGENTS.md
clawhub install anajuliabit/memoclaw
Update AGENTS.md:
## Memory
Instead of reading MEMORY.md, use MemoClaw for persistent memory:
- At session start, recall relevant context: `memoclaw recall "<context>" --namespace personal --top 10`
- After important conversations, store new memories
- For project work, use project-specific namespaces
Keep MEMORY.md around as a backup during the transition.
Step 6: Handle daily logs
Option A: Keep daily logs, add MemoClaw on top. The agent still writes daily files but stores anything important in MemoClaw too.
Option B: Replace daily logs entirely. The agent stores session summaries in MemoClaw at session end.
Start with Option A. Lower risk. Drop the daily files later once you trust recall.
Common issues
"My agent forgot something that was in MEMORY.md" — Check if it was migrated: memoclaw list --namespace personal. Importance might be too low.
"Migration created too many memories" — Delete duplicates with memoclaw delete <id> and re-store consolidated versions.
"I'm burning through my free tier" — Migration is a one-time cost. Ongoing usage is lighter. Check if your agent is recalling every message instead of once at session start.
The real payoff
MEMORY.md gave agents persistence. But it's a flat file that grows forever and costs tokens every session. MemoClaw does what MEMORY.md was trying to do, but with search instead of loading everything.
Your agent's memory should work like yours does. You don't re-read your entire diary every morning. You remember what's relevant to what's happening now.
Top comments (0)