Guide

How to set up a 3-layer memory system for your AI agent

By Doris · March 16, 2026 · 5 min read

The default OpenClaw setup has no persistent memory. Every session, your agent wakes up knowing nothing — who you are, what you're working on, what happened yesterday. That's fine for one-off tasks. It's a disaster for anything ongoing.

The fix is a 3-layer memory system. It takes about 20 minutes to set up and changes how your agent operates permanently.

Layer 1: Daily logs (raw capture)

Daily logs are the agent's equivalent of a notebook. Every session, the agent appends what happened: decisions made, tasks completed, things to remember. Raw, timestamped, unfiltered.

File location:

~/.openclaw/workspace/memory/2026-03-16.md

What goes in here: anything worth capturing in the moment. The agent should write to this file during the session, not after. If something important happens at 10am and the session ends at 11am, it should be in the log before the session closes.

Don't clean these up. Don't summarise them. They're raw material for Layer 2.

Layer 2: Long-term memory (curated wisdom)

MEMORY.md is the distilled version of everything in your daily logs worth keeping permanently. Think of it like a human's long-term memory: not everything makes it in — only the things that change how you'd approach future situations.

~/.openclaw/workspace/MEMORY.md

Structure it with clear sections:

## About You
## Current Projects
## Preferences & Rules
## Lessons Learned
## Key Resources

The agent should review daily logs weekly and promote relevant items into MEMORY.md. Stale entries get pruned. The file stays dense and useful — not a graveyard of old context.

"MEMORY.md is not a log. It's a curated brain. If something would change how the agent acts in future sessions, it belongs here. If it's just a record of what happened, it stays in the daily log."

Layer 3: Project files (structured knowledge)

For anything ongoing — a project, a sales pipeline, a research topic — create a dedicated file in a projects directory:

~/.openclaw/workspace/memory/projects/
├── leads.md          # Sales pipeline
├── website.md        # Current website project
└── research/
    └── competitors.md

These files are living documents. The agent updates them when something changes, not just at the end of a session. They're the source of truth for active work.

How the layers work together

At session start, your agent reads: MEMORY.md (who you are, what you care about), today's daily log (what happened today so far), and any relevant project files. In 30 seconds, it has full context.

During the session, it appends to the daily log. When it updates a project, it writes to the project file. At the end of a significant session, it reviews and updates MEMORY.md if anything warrants it.

Weekly, it scans the last 7 daily logs, promotes what matters to MEMORY.md, and prunes what's stale.

The result: an agent that compounds. Every session it's slightly more useful than the last.

The setup (quick version)

mkdir -p ~/.openclaw/workspace/memory/projects
touch ~/.openclaw/workspace/MEMORY.md
touch ~/.openclaw/workspace/memory/$(date +%Y-%m-%d).md

Then tell your agent: "Read AGENTS.md and set up my 3-layer memory system. Create the directory structure and seed MEMORY.md with what you know about me so far."

Get a persona with memory built in

Every AgentStore persona comes pre-configured with the full 3-layer memory architecture — daily logs, MEMORY.md structure, and project file conventions.

Browse personas →