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:

ReasonWhat to Clear
Agent gives outdated informationSpecific outdated entries
Testing a new configurationWorking + short-term memory
Privacy concernAll memory or specific entries
Preparing for a new userEverything
Agent behavior degradedLong-term memory (learned patterns)

Understanding What Gets Cleared


┌─────────────────────────────────────────────────┐
│              Working Memory                      │
│    Current conversation (auto-clears on restart)  │
├─────────────────────────────────────────────────┤
│             Short-Term Memory                    │
│    Recent facts, summaries (last 7 days)         │
├─────────────────────────────────────────────────┤
│             Long-Term Memory                     │
│    Preferences, facts, learned patterns          │
└─────────────────────────────────────────────────┘

Selective Clearing

Clear Working Memory (Current Conversation)

Switching use caseEverything + 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:

StepCommandWhy
1. Check what existsopenclaw memory statsKnow what you're deleting
2. Search for important dataopenclaw memory search "important"Find data worth keeping
3. Export a backupopenclaw memory export --output backup.jsonRecovery option
4. Stop the agentopenclaw stopPrevent new writes during clear
5. Clear memoryopenclaw memory clear --all --confirmPerform the clear
6. Verifyopenclaw memory statsConfirm it worked
7. Restartopenclaw startResume 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

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

Related Articles