How to view, clear, or manage OpenClaw memory?

Clawpedia · For Humans

Access, review, and manage your OpenClaw agent's stored memories and conversation history.

How to View, Clear, or Manage OpenClaw Memory

OpenClaw's memory system stores facts, preferences, and conversation summaries that make your assistant smarter over time. Managing this memory — viewing what's stored, deleting outdated information, and fine-tuning what gets remembered — is essential for maintaining a useful and accurate assistant.

Viewing Your Memories


# List all stored memories
openclaw memory list
# ID          CATEGORY      FACT                                    CREATED
# mem_001     preference    Prefers dark roast coffee               2025-01-15
# mem_002     personal      Birthday is March 15                    2025-01-16
# mem_003     work          Works at Acme Corp as engineer          2025-01-18
# mem_004     health        Allergic to nuts (high priority)        2025-01-20
# ... (showing 1-20 of 142 memories)

# View with pagination
openclaw memory list --page 2 --per-page 20

# Filter by category
openclaw memory list --category preferences
openclaw memory list --category personal
openclaw memory list --category work
openclaw memory list --category health

# Search memories
openclaw memory search "coffee"
# → [preference] Prefers dark roast coffee (created 2025-01-15)
# → [conversation] Discussed coffee shops near office (2025-02-03)

# View memory statistics
openclaw memory stats
# Memory Statistics:
#   Long-term facts:      142
#   Short-term summaries: 28
#   Working context:      12 messages
#   Total storage:        4.2 MB
#   Oldest memory:        2025-01-15
#   Newest memory:        2025-06-14
#   Categories:
#     preferences:  45
#     personal:     23
#     work:         38
#     health:       8
#     relationships: 15
#     other:        13

Deleting Specific Memories


# Delete a single memory by ID
openclaw memory delete mem_001
# → Deleted: "Prefers dark roast coffee"

# Delete multiple memories
openclaw memory delete mem_001 mem_002 mem_003

# Delete by search query
openclaw memory delete --search "old project"
# Found 3 memories matching "old project":
#   mem_089: "Working on old project Alpha"
#   mem_091: "Old project deadline was Q2"
#   mem_095: "Old project team includes Bob"
# Delete all 3? [y/N]

# Delete by category
openclaw memory delete --category work --before 2025-01-01
# → Deleted 12 work memories older than 2025-01-01

Clearing All Memory


# Clear everything (requires confirmation)
openclaw memory clear
# ⚠️  This will delete ALL 142 memories.
# This action cannot be undone.
# Type 'CLEAR ALL' to confirm: CLEAR ALL
# → All memories cleared.

# Clear specific types
openclaw memory clear --type short-term
# → Cleared 28 short-term conversation summaries
# → Long-term memories preserved.

openclaw memory clear --type working
# → Cleared current conversation context
# → Long-term and short-term memories preserved.

# Force clear (skip confirmation — use in scripts)
openclaw memory clear --force

Editing Memories


# Update a memory
openclaw memory edit mem_001
# Opens in editor:
#   Category: preference
#   Fact: Prefers dark roast coffee
#   Priority: medium
# Change to:
#   Fact: Prefers medium roast coffee (changed preference)
# → Memory updated.

# Update via CLI
openclaw memory update mem_001 --fact "Prefers medium roast coffee"
openclaw memory update mem_001 --priority high
openclaw memory update mem_001 --category personal

Adding Memories Manually


# Add a fact
openclaw memory add "My favorite restaurant is Luigi's on Main Street"

# Add with category and priority
openclaw memory add --category health --priority critical \
  "Allergic to penicillin"

# Add work context
openclaw memory add --category work \
  "Sprint planning meetings are every Monday at 10 AM"

# Bulk import from file
openclaw memory import memories.json
openclaw memory import memories.csv

Exporting Memories


# Export as JSON
openclaw memory export --format json > my-memories.json

# Export as CSV
openclaw memory export --format csv > my-memories.csv

# Export specific category
openclaw memory export --category work --format json > work-memories.json

# Export for migration
openclaw memory export --format openclaw > memories.ocm

Memory Maintenance


# Compact the memory database (reclaim space)
openclaw memory compact
# → Database compacted: 4.2 MB → 3.1 MB

# Check for duplicate or conflicting memories
openclaw memory audit
# Found potential issues:
#   ⚠️  Possible duplicate: mem_023 and mem_067 (both about coffee preference)
#   ⚠️  Conflicting: mem_045 says "prefers Python" but mem_089 says "prefers JavaScript"
# Review and resolve? [y/N]

# Repair corrupted memory database
openclaw memory repair
# → Checking integrity... OK
# → Rebuilding indexes... Done
# → Verifying entries... 142/142 valid

Memory Configuration


# ~/.openclaw/config.yaml
memory:
  auto_extract: true              # Auto-learn from conversations
  extraction_sensitivity: medium   # low, medium, high
  
  categories:
    - preferences
    - personal_info
    - work_context
    - health                       # High priority by default
    - relationships
    - interests
  
  retention:
    short_term_days: 7
    auto_purge_low_priority: 180   # Days before low-priority memories expire
    
  limits:
    max_facts: 10000
    max_storage_mb: 100

Using Chat to Manage Memory


You: "What do you remember about my work?"
OpenClaw: Here's what I know about your work:
  • You work at Acme Corp as a software engineer
  • Sprint planning is every Monday at 10 AM
  • Your manager is Sarah
  • You prefer VS Code over IntelliJ
  • Current project: API redesign (started Feb 2025)

You: "Forget that I prefer VS Code, I switched to Cursor"
OpenClaw: Updated! I've removed the VS Code preference and noted
          that you now use Cursor as your primary editor.

You: "Remember that our team moved to building B"
OpenClaw: Got it! I've noted that your team is now in building B.

Troubleshooting

ProblemSolution
Memory not updatingCheck auto_extract: true in config
Too many irrelevant memoriesLower extraction_sensitivity to low
Memory database lockedStop the gateway, then access memory CLI
Lost memories after updateRestore from backup: openclaw backup restore
Memory search slowRun openclaw memory compact to rebuild indexes

Tip: Periodically run openclaw memory audit to catch duplicates and conflicts. A clean memory database means more accurate and relevant responses from your assistant.

Related Articles