Clearing or Resetting OpenClaw's Memory
Clawpedia · For Humans
Step-by-step instructions for clearing, resetting, or selectively removing OpenClaw memory data.
Overview
There are situations where you need to start fresh — clearing conversation history, removing stored preferences, or performing a complete memory reset. This guide covers every option, from selective cleanup to full factory reset, with safety precautions to prevent accidental data loss.
When to Clear Memory
Common reasons for memory management:
| Reason | What to Clear |
|---|
| Agent gives outdated information | Specific outdated entries |
|---|
| Testing a new configuration | Working + short-term memory |
|---|
| Privacy concern | All memory or specific entries |
|---|
| Preparing for a new user | Everything |
|---|
| Agent behavior degraded | Long-term memory (learned patterns) |
|---|
| Switching use case | Everything + reconfigure |
|---|
The safest option — only clears the current session:
# Clear current conversation context
openclaw memory clear --type working
# Or simply restart the conversation
openclaw chat # Start a fresh chat session
In a messaging platform, you can also use:
/clear
This resets the conversation as if you're talking to the agent for the first time today — but it still remembers your preferences and facts.
Clear Short-Term Memory
Removes recent conversation summaries and temporary context:
openclaw memory clear --type short-term
This keeps your long-term preferences intact but removes recent interactions.
Clear Specific Entries
Remove individual memory entries by searching and deleting:
# Search for specific memories
openclaw memory search "old project"
# Output:
# ID Type Content
# mem_abc123 fact "Working on Project Alpha"
# mem_def456 context "Project Alpha deadline is Dec 15"
# mem_ghi789 preference "Prefers daily standups for Project Alpha"
# Delete specific entries
openclaw memory delete --id mem_abc123
openclaw memory delete --id mem_def456
openclaw memory delete --id mem_ghi789
# Or delete all entries matching a search
openclaw memory delete --search "Project Alpha" --confirm
Clear by Type
Remove all entries of a specific type:
# Remove all learned preferences
openclaw memory clear --entry-type preferences
# Remove all stored facts
openclaw memory clear --entry-type facts
# Remove all conversation summaries
openclaw memory clear --entry-type summaries
Clear by Date
Remove entries older or newer than a specific date:
# Remove everything older than 30 days
openclaw memory prune --older-than 30d
# Remove everything from a specific date range
openclaw memory clear --since "2024-01-01" --until "2024-01-31"
Clear by Platform
If using per-platform memory, clear a specific platform:
# Clear only Telegram memories
openclaw memory clear --platform telegram
# Clear only Slack memories
openclaw memory clear --platform slack
Full Reset
Soft Reset (Recommended)
Clears all memory but keeps configuration and skills:
# Export backup first (always!)
openclaw memory export --output backup-$(date +%Y%m%d).json
# Clear all memory
openclaw memory clear --all --confirm
The agent forgets everything but retains its skills and configuration.
Hard Reset (Factory Reset)
Resets OpenClaw to its initial state:
# Full factory reset
openclaw reset --factory --confirm
# This clears:
# ✅ All memory (working, short-term, long-term)
# ✅ All conversation history
# ✅ Learned patterns and behaviors
# ❌ Does NOT remove skills
# ❌ Does NOT remove configuration
# ❌ Does NOT remove API keys
To also remove configuration:
openclaw reset --factory --include-config --confirm
Pre-Clear Safety Checklist
Before clearing memory:
| Step | Command | Why |
|---|
| 1. Check what exists | openclaw memory stats | Know what you're deleting |
|---|
| 2. Search for important data | openclaw memory search "important" | Find data worth keeping |
|---|
| 3. Export a backup | openclaw memory export --output backup.json | Recovery option |
|---|
| 4. Stop the agent | openclaw stop | Prevent new writes during clear |
|---|
| 5. Clear memory | openclaw memory clear --all --confirm | Perform the clear |
|---|
| 6. Verify | openclaw memory stats | Confirm it worked |
|---|
| 7. Restart | openclaw start | Resume operation |
|---|
Warning: Memory clearing is irreversible without a backup. Always export first.
Restoring from Backup
If you need to undo a clear:
# Import from backup
openclaw memory import backup-20240115.json
# Import selectively (only preferences)
openclaw memory import backup.json --type preferences
# Import with merge (don't overwrite existing)
openclaw memory import backup.json --merge
Automated Memory Maintenance
Configure automatic pruning to keep memory manageable:
memory:
maintenance:
auto_prune: true
prune_schedule: "0 3 * * 0" # Weekly, Sunday at 3 AM
rules:
- type: short-term
older_than: 7d
- type: summaries
older_than: 30d
- type: facts
confidence_below: 0.3 # Remove low-confidence facts
- max_entries: 5000 # Hard cap on total entries
Memory Clear via Chat
You can also manage memory through natural conversation:
User: "Forget everything about Project Alpha"
Agent: "I've found 12 memory entries related to Project Alpha.
Should I delete all of them? This cannot be undone.
(Reply 'yes' to confirm)"
User: "Yes"
Agent: "Done. I've removed 12 entries about Project Alpha from my memory."
User: "Forget my food preferences"
Agent: "I'll remove these preferences:
- Prefers vegetarian options
- Allergic to shellfish
- Favorite restaurant: Pasta Palace
Confirm deletion? (Reply 'yes' to confirm)"
Troubleshooting
Memory Not Clearing
- Ensure the agent is stopped:
openclaw stop. - Check file permissions on the memory directory.
- For PostgreSQL storage, check database connectivity.
Agent Still References Cleared Data
The model's conversation context (working memory) may still contain references. Clear working memory too:
openclaw memory clear --type working
Or restart the agent: openclaw restart.
Backup File Is Too Large
# Export only specific types
openclaw memory export --type preferences --output prefs-backup.json
# Compress the export
openclaw memory export --output backup.json --compress
Next Steps
- Understand the memory system: Understanding OpenClaw's Memory System.
- Manage long-term memory: Managing Long-Term Memory in Your OpenClaw Assistant.
- Keep your data safe: Privacy and Memory: Ensuring Your Data Stays Safe.
Related Articles
- Privacy and Memory: Ensuring Your Data Stays Safe — Best practices for managing memory data privacy and ensuring sensitive information stays protected.
- Where does OpenClaw store its data and memory? — Learn where OpenClaw saves configuration files, memory data, and logs on your local system or server.
- Letta (formerly MemGPT): Agents with Persistent Long-Term Memory — How Letta, formerly MemGPT, gives AI agents persistent memory that survives across sessions instead of resetting every time.
- Uninstall OpenClaw — Complete Removal Guide for macOS, Linux & Windows — How to uninstall OpenClaw completely: uninstall commands for macOS, Linux and Windows, plus removing config, memory, skills, services and Docker leftovers.