Skip to main content

The Two-Tier Memory System

OpenClaw uses a smart two-tier approach to memory:

📝 Daily Notes

File: memory/YYYY-MM-DD.md

  • ✓ Raw, timestamped, verbose
  • ✓ Auto-written by agent after each session
  • ✓ Like a journal or transcript
  • ✓ Think of it as temporary storage

🧠 MEMORY.md

File: MEMORY.md (root)

  • ✓ Curated, permanent, concise
  • ✓ Only long-term facts
  • ✓ Manually edited by you (or agent suggests)
  • ✓ Think of it as a knowledge base
Session starts → loads MEMORY.md + recent daily notes ↓ Agent works, learns new things ↓ Session ends → agent writes to memory/YYYY-MM-DD.md ↓ Over days/weeks → agent curates key facts into MEMORY.md ↓ Next session → loads updated MEMORY.md + recent notes

What Goes in MEMORY.md

Keep these categories in your MEMORY.md:

💬

Preferences

Communication style, format preferences, tools you like, workflow quirks. Things that don't change.

👥

Key People

Contacts, their roles, how to reach them. People the agent interacts with regularly.

📋

Current Projects

What you're working on and the status. Updated as things progress or complete.

🎓

Lessons Learned

Things the agent got wrong and was corrected on. Mistakes to never repeat.

📌

Standing Instructions

Permanent rules that override defaults. "Always do X before Y" type rules.

📚

Context

Background info the agent needs long-term. Domain knowledge, business context, etc.

Complete MEMORY.md Template

Start with this template and customize it:

# MEMORY.md — Long-Term Memory

## Preferences

- Prefer bullet points over prose
- Use 24-hour time format
- Always confirm before sending emails
- Want code examples, not explanations

## Current Projects

- **Project A:** Building a mobile app (React Native). Status: in active development, backend needs work.
- **Project B:** Research on AI safety. Status: early stage, collecting papers.

## Key People

- **Alice** (co-founder, CTO) — alice@company.com, makes final decisions on architecture
- **Bob** (designer, old friend) — bob@design.io, works on UI/UX

## Lessons Learned

- 2024-01-15: Don't commit without showing diffs. Agent committed breaking code once.
- 2024-02-03: Always ask before deleting — lost a file once without confirmation.

## Standing Instructions

- Before any git push, show me the commits
- Always use descriptive commit messages
- Save backups before major refactors

## Context

- Work as a freelancer, not in an office
- Use MacBook Pro 16" with 32GB RAM
- Primary tech stack: Python, TypeScript, PostgreSQL
    

How Daily Notes Become Memory

1

Session Ends

Agent automatically creates memory/2024-12-15.md with everything that happened: decisions, code written, bugs fixed, preferences revealed, things learned.

2

Next Session Starts

Agent loads the last 2 days of notes (per AGENTS.md config). Also loads MEMORY.md. Now it has context from all recent work plus long-term facts.

3

Over Days/Weeks

Agent sees patterns. It notices: "This preference comes up a lot", "This person is important", "This lesson matters". It suggests updates to MEMORY.md.

4

You Review & Update

Every few weeks, review what's in MEMORY.md. Add important facts. Remove outdated things. This keeps it focused and fast.

How to Interact with Memory

These commands let you manage your agent's memory:

Command What It Does
/memory show Display the current MEMORY.md file in full.
/memory add "..." Append a new fact to MEMORY.md immediately. Example: /memory add "I prefer Python over Go"
/memory forget "..." Remove a fact from MEMORY.md. Example: /memory forget "old project name"
/memory search "..." Search across all daily notes and MEMORY.md. Great for finding past decisions.
/memory summary Ask agent to summarize recent daily notes and suggest what should go in MEMORY.md.

Memory Tips & Gotchas

  • 📏
    Keep MEMORY.md under 2,000 words Larger files slow down the agent. It has to read the whole thing every session. Be concise.
  • 🔄
    Review it monthly Go through MEMORY.md once a month. Delete outdated projects. Update statuses. Add new lessons learned.
  • 🔐
    Never write sensitive data No passwords, API keys, credit cards, or personal IDs in memory files. These are searchable and could be exposed.
  • ✏️
    Be specific, not vague "Prefers TypeScript over JavaScript" beats "likes coding". Details help the agent help you better.
  • 📅
    Include dates in lessons learned When recording a lesson ("Don't commit without diffs"), add the date. Helps you remember context later.
  • 🎯
    Focus on what's actionable MEMORY.md should help the agent do better work. Random facts that don't affect behavior don't belong.
💡

Best practice: Review and update MEMORY.md monthly. Spend 5 minutes removing old projects, updating status, adding new lessons. This keeps your agent sharp and focused on what actually matters.

Get OpenClaw tips in your inbox every week

New guides, workspace templates, and pro tips for getting more out of your AI agent.

We respect your inbox. Unsubscribe anytime.