Skip to content
Guides

OpenClaw memory

The four workspace files that hold everything an agent remembers, what belongs in each, the three memory tools, the automatic flush before compaction, and the importers that bring notes over from other assistants

7 min read

An agent that forgets everything between sessions is a demo. OpenClaw's answer is deliberately unglamorous: plain markdown files in the workspace, loaded at the start of a session or searched on demand. That choice is what makes memory inspectable, editable and portable, and it sets up every other rule on this page.

Four files

  • A user file is the optional compact user-model layer holding stable preferences, communication style, relationships and active-project context written as directives; it loads at session start with its own small budget.
  • The long-term memory file is the curated layer for durable non-profile facts, standing decisions and short summaries that should be present at the start of a session; it is not a transcript, a daily log or an exhaustive archive.
  • Dated daily notes are the working layer for detailed observations, session summaries and raw context that may be useful later; today's and yesterday's notes load automatically on a bare new or reset, and slugged variants written by the session-memory hook are picked up alongside the plain dated file.
  • An optional dream diary holds sweep summaries and grounded backfill entries for human reading; if the long-term file outgrows the bootstrap budget the file on disk stays intact while the injected copy is truncated, which is the signal to move detail into daily notes.
The model only remembers what gets saved to disk; there is no hidden state.

Tools, search and engines

The agent has three memory tools. Search finds relevant notes semantically even when the wording differs, get reads a specific file or line range, and an intent tool creates, lists and explicitly cancels event-conditioned standing intents while time-based reminders stay with the scheduler. All three come from the active memory plugin, and when session indexing is on, search can also return transcript hits whose paths are references rather than readable files, so the documented route is a session search followed by a bounded history excerpt. With an embedding provider configured, search is hybrid: vector similarity for meaning combined with keyword matching for exact terms such as identifiers and code symbols, defaulting to one provider while several others can be selected explicitly. The storage engine itself is pluggable, with a built-in database backend by default and alternatives that add cross-session user modelling or a different vector store.

Flush, dreaming and imports

  • Before compaction summarizes a conversation, a silent turn reminds the agent to save important context to memory files; it uses a private copy of the conversation so its housekeeping never appears in later turns, its writes are saved normally, and it is skipped when a sandbox leaves the workspace read-only.
  • Dreaming is the default background consolidation path: it collects recall signals, scores candidates and promotes only qualified owner or agent-derived items into long-term memory, managing its own recurring job, gating promotions on score, recall frequency and query diversity, excluding untrusted and system-derived candidates, and writing phase summaries to the diary for review.
  • The control interface can import existing markdown memory from other coding assistants, copying only markdown into a separate imports folder that is indexed and searchable but never merged into the bootstrap file, marking destination conflicts in the preview and taking a verified backup before replacing anything.

OpenClaw memory architecture is the full picture behind these files and OpenClaw memory search explains the retrieval pipeline they feed.

Writing memories that stay safe to act on

Most notes are ordinary facts, but some change what the agent should do later, and those need their boundary captured rather than only their content. The docs list the cases: approval or permission requirements, temporary constraints, handoffs to another session or person, expiry conditions, safe-to-act timing, source or owner authority, and instructions to avoid a tempting action. A good action-sensitive note says what changes future behaviour, under what condition it applies, when it expires or what unlocks it, what to avoid, and who the source is. The caveat is stated plainly: memory can preserve approval context, but it does not enforce policy, so real controls stay with approvals, sandboxing and scheduled work. OpenClaw dreaming is the pass that decides what graduates and OpenClaw compaction the moment the flush protects.

On Diali

On Diali the workspace holding these files sits on a persistent volume, so memory survives restarts and releases rather than living in a container that disappears; daily snapshots and one-click restore are available through the Backups add-on (included on Max). Hosted OpenClaw on Diali describes the hosted assistant and Diali pricing the plans it ships in.

  • Four files: preferences, long-term memory, daily notes, diary.
  • The flush saves context before compaction can summarize it away.
  • Everything is markdown you can open, read and edit.
Get started

Stop reading about it, build one

Set up an agent, pick a channel, and have it working inside the app you already keep open.