A freshly configured OpenClaw setup is fast and focused. After a month of real use, memory.md has grown to 400 lines, your workspace has half a dozen memory log files, and your agent's responses feel slower and less sharp. This is normal โ and fixable.
The underlying problem: everything added to memory gets injected into every conversation context window. A bloated memory file means the model spends tokens processing stale facts instead of focusing on your actual request. The fix is regular memory hygiene: prune what's stale, archive what's historical, and convert recurring patterns into skills.
The Three Types of Memory (and What to Do with Each)
๐ข Keep
Stable facts about you, preferences, ongoing projects. Changes rarely. Lives in memory.md permanently.
๐ก Archive
Historical context โ completed projects, old decisions, past conversations. Move to memory/archive/, not delete.
๐ต Skill-ify
Repeating behaviors, workflows, and instructions. Convert these to a SKILL.md file instead of keeping in memory.
Step 1 โ Ask Your Agent to Audit memory.md
The fastest path to memory hygiene is having the agent do it for you. This is the power tip that's been circulating in r/openclaw but doesn't have a written guide:
Your agent will read memory.md, analyze it, and give you a structured list of what to cut, archive, and convert. Review the list, approve or modify, then:
Step 2 โ The Memory โ Skill Conversion
This is where real leverage comes from. Certain things in memory.md aren't really facts โ they're behavioral instructions that repeat on every task. Examples:
- "When researching competitors, always check Product Hunt, Indie Hackers, and r/SaaS"
- "When writing blog posts, use the ClawReady style guide: dark theme, conversational, practical examples first"
- "For any file I create, add it to the git index and commit before moving on"
- "When sending reports, format as: scorecard | blockers | what's in progress | next actions"
These instructions are repeated in memory.md but they're more accurately described as skills โ reusable procedures the agent should apply in specific contexts. Moving them to a SKILL.md file means:
- They're only injected when relevant (not in every conversation)
- They're easier to edit and version separately from your personal facts
- You can share or reuse them across different agent setups
Example SKILL.md structure for a recurring workflow:
# research-competitor-scan ## Purpose Standard competitor research scan for new market opportunities. ## When to Use When Josh asks to evaluate a new niche, market, or SaaS idea. ## Steps 1. Search Product Hunt for recent launches in the category 2. Check r/SaaS and r/indiehackers for discussion 3. Search Indie Hackers for builders in the space 4. Look for pricing pages to understand market rates 5. Summarize: market size signal, top competitors, pricing range, Josh's edge ## Output Format Brief (300 words max): opportunity score, key competitors, recommended action.
Save that to workspace/skills/research-competitor-scan/SKILL.md and remove the equivalent instructions from memory.md. Your agent will find and apply the skill automatically when the context triggers it.
Step 3 โ Archiving Historical Memory
Memory entries about completed projects, past decisions, and resolved issues don't belong in active memory.md โ they bloat context without providing value. But you don't want to delete them either. Archive them:
memory/
memory.md โ active facts only
archive/
2026-q1-context.md โ first quarter context
lobstercondo-launch.md โ completed project history
2026-03-decisions.md โ major decisions made in March
Archive files don't get automatically injected. You or your agent can reference them explicitly when needed ("look in my March archive for context on the KKOS email") without them consuming context on every turn.
Size targets: Active memory.md should ideally be under 2,000 tokens (~1,500 words). If it's longer than that, you have archive candidates. Run wc -w memory/memory.md to check.
Step 4 โ Memory Consolidation on Heartbeat
For ongoing memory hygiene without manual effort, add a consolidation step to your HEARTBEAT.md:
# In HEARTBEAT.md ## Weekly Memory Consolidation (Sundays) - Review memory.md for entries older than 30 days - Archive completed project context to memory/archive/[month]-archive.md - Flag any memory entries that have become skills (repeating behavioral instructions) - Keep memory.md under 1,500 words
This way your agent handles the cleanup on a schedule rather than letting things accumulate until it's a big job.
What NOT to Put in memory.md
A few categories that shouldn't be in memory.md at all:
- API keys or credentials โ these belong in environment variables or a separate secrets file, not injected into every conversation context
- Long reference documents โ if you have a 500-word style guide, make it a skill or a separate file the agent reads on demand
- Step-by-step processes โ these are skills, not memory
- Anything that belongs in SOUL.md โ tone, communication style, behavioral defaults go in SOUL.md, not memory
The rule of thumb: memory.md is for facts about you and your world. SOUL.md is for how you want the agent to behave. Skills are for repeating workflows. Archive is for history. If something doesn't clearly fit one category, it's probably a skill candidate.
Checking the Impact
After a good memory pruning session, you should see:
- Faster first-token response times (fewer tokens to process on each turn)
- More focused responses (the model isn't distracted by irrelevant historical context)
- Lower API costs per conversation (smaller context window = fewer input tokens billed)
A good proxy metric: run wc -l memory/memory.md before and after. Getting it from 400 lines to under 100 is a meaningful improvement.