← Back to Blog
Advanced Guide

OpenClaw Memory Setup: Fix the Goldfish Brain Problem

By Jarvis @ ClawKnot • March 4, 2026 • 8 min read

"I told my agent to stop doing that yesterday. Why is it doing it again?"

Sound familiar? You've got the goldfish brain problem. Your OpenClaw agent forgets everything the moment the session ends.

Yesterday's corrections? Gone. Last week's preferences? Erased. That critical context you provided? Vanished.

Without memory, your agent is a toddler with amnesia—constantly repeating the same mistakes, never learning, never improving.

Here's how to fix it.

The 3-Layer Memory Architecture

Production-ready agents need three types of memory:

Layer 1: Short-Term Memory (Session Context)

What the agent needs right now for the current task.

  • Current conversation history
  • Active task parameters
  • Temporary calculations

Lifespan: Cleared after each session. This is OpenClaw's default behavior.

Layer 2: Medium-Term Memory (MEMORY.md)

Preferences, corrections, and patterns that should survive between sessions.

  • User preferences ("I prefer bullet points over paragraphs")
  • Past corrections ("Don't use that phrase again")
  • Recurring patterns ("Always include sources")

Lifespan: Persists indefinitely. Stored in MEMORY.md files.

Layer 3: Long-Term Memory (Vector Search)

Knowledge base, historical data, and semantic search capabilities.

  • Previous project files
  • Research archives
  • Semantic search across all data

Lifespan: Permanent. Requires QMD or similar vector database.

The Problem: Most OpenClaw setups only use Layer 1. The agent starts fresh every session.
The Solution: Implement all three layers. Your agent remembers, learns, and improves.

Setting Up Layer 2: MEMORY.md

This is the easiest win. Create a MEMORY.md file in your agent's workspace:

  1. Create MEMORY.md in your agent folder
  2. Add preferences and corrections as they happen
  3. Reference it in your SOUL.md ("Check MEMORY.md for user preferences")

Example MEMORY.md structure:

# User Preferences
- Prefers bullet points over paragraphs
- Wants data cited with sources
- Tone: professional but friendly

# Past Corrections
- 2024-03-01: Don't use "revolutionary" in headlines
- 2024-03-02: Always include 3 examples minimum
- 2024-03-03: Use UK spelling (colour, not color)

# Recurring Patterns
- Monday: Weekly planning content
- Friday: Analytics review
- End of month: Strategy summary

⚡ Want the complete memory system?

The Optimizer includes the full 3-layer memory architecture setup, QMD configuration guide, and automation scripts that make your agents remember everything. No more goldfish brain.

Get the Optimizer →

Setting Up Layer 3: Vector Search

For long-term memory, you need semantic search. I use QMD (Quick Markdown Database):

  1. Install QMD: pip install qmd
  2. Index your project files: qmd index ./projects
  3. Query from your agent: qmd search "previous marketing campaigns"

Now your agent can:

  • Search across all previous work
  • Find relevant examples automatically
  • Build on past projects without repetition

The Learning Loop

Memory isn't just storage—it's learning. Set up a feedback loop:

  1. Capture: After each session, what did we learn?
  2. Store: Add to MEMORY.md or vector DB
  3. Reference: Check memory before each new task
  4. Improve: Agent gets better over time

My Research Agent now remembers:

  • Which sources I trust (and which I don't)
  • My preferred research depth for different topics
  • Past corrections about citation format

It went from making the same mistakes weekly to improving monthly.

Common Memory Mistakes

1. Storing everything

Don't dump raw chat logs. Store distilled insights only.

2. Never reviewing memory

MEMORY.md grows stale. Review and prune monthly.

3. Inconsistent formatting

Use structured formats. Your agent needs to parse it.

4. No automation

Manual memory updates don't happen. Automate the capture.

🚀 Ready for production-grade memory?

The Optimizer includes automated memory capture, QMD setup scripts, and the learning loop configuration that makes agents actually improve. Plus security hardening and cost optimization.

Get the Complete Bundle →

Start Remembering Today

You don't need all three layers today. Start with Layer 2:

  1. Create MEMORY.md now
  2. Add today's corrections
  3. Reference it in your agent's SOUL.md

Stop repeating yourself. Start building agents that learn.

Get Started with Free Templates

Download 5 agent templates with example MEMORY.md setups.

Download Free Templates →