🦞OpenClaw Guide
← Back to BlogTutorial

How to Give OpenClaw Permanent Memory (2026 Guide)

2026-02-258 min read

Last Updated: February 2026

"My agent keeps forgetting things" is the most common complaint from OpenClaw users after the first week.

It's not a bug. It's how language models work. Every conversation has a context window — once you hit the limit, older context falls off. Your agent isn't stupid; it literally can't see what happened before.

But there are real, working solutions. Here's how to give OpenClaw a memory that actually sticks.


Why Memory Fails by Default

OpenClaw loads context from files in your workspace at the start of each session. If a fact isn't in those files, your agent doesn't know it.

The problem: most people never update those files. They correct their agent in chat ("no, I told you before that…"), the agent acknowledges — and forgets it the next day because nothing was written to disk.

The fix is simple: write things down.


The Three-Layer Memory System

OpenClaw's memory works best as three distinct layers:

Layer 1: MEMORY.md — Permanent Preferences and Patterns

This is your agent's long-term brain. It should contain:

  • Your communication preferences
  • Recurring facts that never change
  • Lessons your agent has learned about how you work
  • Any rules or constraints you've set

Keep it under 3,000 tokens. Quality over quantity — only put things that are truly permanent here.

# MEMORY.md

## Communication Style
- Keep replies under 3 sentences unless I ask for detail
- Never say "Great!" or "Certainly!" — be direct
- Use bullet points for lists, not paragraphs

## Key Facts
- My main project: [project name and description]
- My timezone: Asia/Bangkok (UTC+7)
- I wake at 6am, check messages at 7am

## What I'm Working On
- [Current focus / goals]

## Rules
- Always confirm before sending emails on my behalf
- Never delete files without asking

Layer 2: Daily Notes — memory/YYYY-MM-DD.md

For time-sensitive context that doesn't belong in MEMORY.md. Things like:

  • What happened in meetings today
  • Decisions made
  • Tasks started but not finished
  • People you talked to

Your agent can write to these automatically, or you can keep them manually.

# memory/2026-02-25.md

## Today's Events
- Talked to [client] — they want to postpone the launch by 2 weeks
- Fixed the billing bug (PR #247 merged)
- Need to follow up with [name] tomorrow

## Decisions Made
- Going with Resend instead of Beehiiv for newsletter sending

Layer 3: Entity Files — Knowledge Graph

For people, companies, and projects that need persistent structured context:

life/areas/
  people/
    [name]/
      summary.md     ← 3-5 sentence current state
      items.json     ← append-only fact log
  projects/
    [project]/
      summary.md
      items.json

This is the heaviest layer — only use it for relationships and projects that matter over weeks or months.


Making Memory Automatic

The best memory system is one you don't have to think about. Here's how to make your agent update its own memory:

Auto-Extract Facts with a Heartbeat Cron

Set up a cron that runs every 30 minutes and extracts durable facts from recent conversations:

"Scan recent conversation history. Extract any durable facts (new people mentioned, decisions made, preferences expressed, status changes). Write them to the relevant files in ~/clawd/life/areas/. Skip casual chat, jokes, and temporary info. Use a cheap model."

This cron costs almost nothing (cheap model, small context) and means your memory files stay current without you lifting a finger.

Teach Your Agent to Self-Correct

Add this to your AGENTS.md or MEMORY.md:

## Memory Protocol
When I correct you or tell you something about my preferences:
1. Acknowledge it
2. Immediately update MEMORY.md with the correct information
3. Confirm what you wrote

Never make me repeat the same correction twice.

End-of-Day Summary

A nightly cron at 10pm:

"Review today's conversation. Write a memory/YYYY-MM-DD.md with: decisions made, things I mentioned wanting to follow up on, any new facts about my work or life. Keep it under 500 words."


The MEMORY.md Template (Copy-Paste Ready)

# MEMORY.md — Agent Long-Term Memory

## About Me
- Name: [Your Name]
- Timezone: [Your timezone]
- Location: [City, Country]

## Communication Style
- [How you like to be addressed]
- [Reply length preference]
- [Tone preference]

## Current Projects
- [Project 1]: [One line description]
- [Project 2]: [One line description]

## Key People
- [Name]: [Who they are, relationship]

## Rules & Constraints
- [Any hard rules for your agent]

## Recurring Preferences
- [Things your agent should always/never do]

## Lessons Learned
- [Things the agent got wrong and corrected]

Common Memory Problems (and Fixes)

"My agent forgot something I told it last week" → It wasn't in MEMORY.md. Add it there. Chat history is not memory.

"MEMORY.md is getting too long and things are getting lost" → Run a cleanup. Remove anything that's no longer relevant. Flag contradicted facts as "superseded." Keep only active, true information.

"My agent contradicts itself" → Two conflicting things are in memory. Find the conflict and remove the outdated one. The freshest fact should win.

"Memory works in one session but not another" → Check whether your workspace files are being loaded on startup. Your AGENTS.md should reference MEMORY.md explicitly.

"I want my agent to remember conversations from Telegram" → Set up the heartbeat cron above. It scans recent messages and extracts what's worth keeping.


What Not to Put in Memory

Memory files load on every request. Bloated files mean more tokens, higher cost, and slower responses.

Don't store in MEMORY.md:

  • ❌ Entire conversation logs
  • ❌ Full project documentation
  • ❌ Code or technical files
  • ❌ Anything that changes daily
  • ❌ Things that only matter for one task

Use project folders and daily notes for those instead. MEMORY.md is for things that are true across all contexts, indefinitely.


The Quick Version: Minimum Viable Memory

If you just want something working without the full system:

  1. Create ~/clawd/MEMORY.md with your name, timezone, current project, and 3–5 preferences
  2. Add this rule to AGENTS.md: "When I correct you, immediately update MEMORY.md with the correction."
  3. Set a weekly reminder to review and clean up MEMORY.md

That's it. Those three steps eliminate 90% of memory frustration.


Related Guides

Learn alongside 1,000+ operators

Ask questions, share workflows, and get help from people running OpenClaw every day.