Introduction

Every conversation with ChatGPT starts fresh. Close the tab, and the context is gone. Open a new one, and you're back to explaining who you are, what you're working on, and what you care about — again. This limitation isn't incidental. It's a product of how cloud AI services are architected, where statelessness is a feature for scalability reasons.

OpenClaw makes a different trade-off. It maintains persistent memory across all interactions, indefinitely, using the simplest possible storage format: plain Markdown files on your local disk. Your agent learns who you are, what you're working on, and what you prefer — and it remembers. It carries that knowledge into every subsequent conversation and every heartbeat task. This guide explains exactly how that works.

Why Markdown for Memory?

The choice of Markdown as the memory format is a deliberate design philosophy, not a technical limitation. Several properties make it ideal for this use case:

Human readability: Markdown files can be opened in any text editor. You can read exactly what your agent knows about you at any time, without special tools or interfaces. This transparency is qualitatively different from the opaque cloud memory systems used by other AI platforms.

Human editability: You can directly edit your memory files. If the agent learned something incorrect about you, you fix it in the Markdown file. If you want to ensure the agent knows something specific about an upcoming project, you write it directly into the relevant memory file. You have complete control over the agent's knowledge base.

LLM compatibility: Markdown is one of the formats LLMs are most trained on. When memory files are included in the context window, the model understands and processes them naturally — better than it would process raw JSON or database records.

Version control ready: Markdown files work perfectly with Git. You can version-control your agent's memory, track how its knowledge evolved over time, and roll back to earlier states if needed.

The Memory File Structure

OpenClaw's memory system is organized around several files in a configurable memory directory. The default structure:

memory/
├── profile.md          # Core personal profile
├── context.md          # Current ongoing projects and situations
├── preferences.md      # Communication and work preferences
├── contacts.md         # People and their relationship context
├── goals.md            # Long-term and short-term goals
├── decisions.md        # Important decisions and their rationale
└── skills_data/        # Data stored by individual Skills
    ├── calendar.md
    ├── health.md
    └── finance.md

A typical profile.md might contain:

# User Profile

## Basic Information
- Name: Alex Chen
- Role: Product Manager at a Series B SaaS company
- Location: San Francisco (PST timezone)
- Working hours: 9 AM – 6 PM weekdays, rarely on weekends

## Communication Style
- Prefers concise, bullet-pointed summaries over long paragraphs
- Wants data and sources when making recommendations
- Dislikes being asked for permission on routine tasks — just do them
- Morning briefings preferred between 7:30–8:00 AM

## Context
- Currently leading a major product launch scheduled for Q2 2026
- Reports to the CTO; manages a team of 5 PMs
- Uses Linear for project management, Notion for documentation

This file is built up over time through the agent's observations during conversations, explicit instructions from the user ("remember that I always want sources cited"), and Skills that gather context about the user's environment.

How the Agent Learns Over Time

Memory accumulation happens through several mechanisms:

Explicit instructions: When you tell the agent something to remember — "My CEO's name is Sarah Kim" or "Always CC my assistant on emails to executives" — it writes that information to the appropriate memory file immediately.

Observation during tasks: When the agent performs tasks, it encounters context about your environment. An agent that accesses your Google Calendar learns your regular commitments. An agent that reads your emails learns who you frequently interact with and what topics are important to you. It extracts and stores relevant facts automatically.

Inference from conversations: Over time, the agent notices patterns in how you work and what you care about. If you consistently ask it to be brief, it will eventually note in your preferences file that you prefer concise responses. If it notices you always follow up finance questions with specific metrics, it may add this as a preference.

Heartbeat updates: Some heartbeat tasks specifically update memory files with current-state information. A "daily briefing" heartbeat might update a today.md file each morning with the day's calendar and current status on tracked projects.

Managing & Editing Memory

The most powerful aspect of OpenClaw's memory system is that you maintain direct control. Managing your agent's memory is as simple as editing a text file.

Common memory management tasks:

  • Correcting errors: If the agent learned something wrong about you, open the relevant file and fix it. Changes take effect immediately on the next interaction.
  • Pruning outdated information: As projects end and circumstances change, old information in memory files can mislead the agent. Periodically review and delete outdated entries.
  • Adding important context proactively: Before a major project, add key facts directly to memory files — stakeholders, goals, constraints, deadlines. The agent will incorporate this into its reasoning immediately.
  • Managing memory size: Large memory files consume context window space on every interaction. Keep files focused and organized. Move completed project contexts to an archive directory rather than leaving them in the active memory.

You can also instruct the agent to manage memory on your behalf: "Clean up the project context file — Project Alpha is complete. Move it to archive." The agent will handle the file operations using its Skills.

Multi-Agent Shared Memory

OpenClaw's file-based memory architecture naturally supports multi-agent coordination. When multiple agents share the same memory directory, they share the same knowledge base. This is the mechanism behind OpenClaw's multi-agent team patterns — a strategy agent and an execution agent can share GOALS.md and DECISIONS.md, allowing them to coordinate without complex inter-agent messaging protocols.

The pattern is simple: define which files are "shared" (read and write by all agents) and which are "private" (read and write by only one agent). GOALS.md might be shared — all agents should know the current objectives. A specific agent's task queue might be private — only that agent needs to track its own pending work.

This simple, transparent coordination mechanism is one of OpenClaw's most elegant architectural choices. No message brokers, no databases, no custom APIs — just files that multiple processes can read and write, with the LLMs providing the intelligence to interpret and act on the shared information coherently.

Limitations of the Memory System

Understanding the memory system's limitations helps you work around them:

Context window limits: Memory files are included in the prompt context for each interaction. Very large memory files may exceed the model's context window, causing the agent to either truncate memory or fail. Keep individual memory files reasonably sized — under 20,000 tokens each is a good target.

No semantic retrieval by default: The basic memory system includes all relevant files in full. For large memory stores, this can be inefficient. The optional RAG (Retrieval-Augmented Generation) extension adds semantic search to retrieve only the most relevant memory sections — useful for users with extensive histories.

Write conflicts in multi-agent scenarios: If multiple agents write to the same file simultaneously, there can be conflicts. Use file locking mechanisms or designate a single "owner" for each shared file to prevent corruption.

Privacy risk: Memory files contain sensitive personal information. Ensure they're stored in a location not synced to cloud backup services and not indexed by desktop search if privacy is a concern.

Wrapping Up

OpenClaw's Markdown-based memory system is simple, powerful, and philosophically distinct from every cloud AI memory system in use today. Its transparency — files you can read, edit, and understand — represents a genuine advance in AI-human collaboration: one where the AI's knowledge is inspectable and correctable rather than locked in an opaque system you can only partially control. Over time, as the memory accumulates, your agent becomes increasingly effective and increasingly personalized — a compound return on the investment of using it consistently.