← All tutorials

Long-term memory in OpenClaw — facts, sessions and the second brain

How OpenClaw stores, indexes and recalls facts across sessions, channels and devices, plus how to inspect, edit and wipe memory safely.

One of OpenClaw's most loved features is that it actually remembers you. Every fact you tell it once — your partner's birthday, the name of your project, the URL of your internal dashboard — survives across sessions, channels and reboots. This tutorial explains how memory works, where it lives, and how to control it.

The two layers of memory

OpenClaw keeps memory in two layers:

  1. Episodic memory — every conversation is stored as a session. Sessions are full transcripts, indexed by channel, contact and timestamp.
  2. Semantic memory — distilled facts the assistant has decided are worth keeping long-term. Stored as structured rows in SQLite, retrievable by meaning rather than by exact keyword.

The assistant writes to semantic memory when it detects a durable fact ("My wife's name is Julia"), and reads from it on every turn to ground its replies.

Where memory lives

Everything is under one folder:

~/.openclaw/
├── memory.sqlite          # semantic memory
├── sessions/              # episodic memory (one .jsonl per session)
└── embeddings/            # vector index (sqlite-vec)
The default location is ~/.openclaw. You can move it with the OPENCLAW_HOME environment variable or the --home flag on every CLI command. There is no separate cloud storage — if you delete the folder, you delete the memory.

Inspecting memory from the CLI

openclaw memory list --limit 20

Prints the most recently updated semantic facts:

id    fact                                             tags                  updated
42    user.name = "Stefan"                              self                 2026-09-14
41    user.partner.name = "Julia"                        self,family          2026-09-14
40    user.work.role = "Staff Engineer at Acme"          self,work            2026-09-12
39    user.work.team = "Platform"                        self,work            2026-09-12

To see the raw row including provenance:

openclaw memory show 42
{
  "id": 42,
  "fact": "user.name = \"Stefan\"",
  "tags": ["self"],
  "source": "telegram/chat/123456789",
  "created_at": "2026-09-14T08:14:02Z",
  "updated_at": "2026-09-14T08:14:02Z",
  "embedding_model": "BAAI/bge-small-en-v1.5"
}

Telling the assistant to remember (or forget)

You can ask the assistant to remember a fact directly in chat:

remember that my API key rotation runs on the first of every month

To forget a fact, say:

forget the API key rotation reminder

Or, for surgical control:

openclaw memory delete 42
openclaw memory delete --tag family

Forcing a full rebuild

If memory has drifted (for example, you changed jobs and the assistant still references the old one), wipe semantic memory and let it re-extract from your last few sessions:

openclaw memory reset --confirm
openclaw memory rebuild --from-sessions=20

This keeps the last 20 sessions, throws away the rest, and asks the model to re-extract facts.

Backing up memory

The whole ~/.openclaw folder is a portable backup. To snapshot:

tar czf openclaw-memory-$(date +%F).tgz -C ~ .openclaw

Restore on a new machine by installing OpenClaw and unpacking the tarball into the new home.

Memory backups contain everything the assistant knows about you. Encrypt them before uploading to cloud storage. A simple way: gpg -c openclaw-memory-2026-09-21.tgz before copying.

Privacy implications

Because memory is local-first:

  • You can read every fact the assistant has stored (openclaw memory list).
  • You can delete any fact without contacting anyone.
  • No third party sees it unless you choose to install a hosted model provider that logs prompts (most reputable providers have a "do not train" toggle — check the provider's settings).

If you ever want to start over:

openclaw memory wipe --all --confirm

This deletes semantic memory, episodic memory and the embedding index. The Gateway keeps running with an empty slate.

Memory and channels

A useful pattern: scope memory per chat so personal chats stay personal and work chats stay work-specific.

openclaw memory scope add \\
  --match "channel=telegram,chat_id=123456789" \\
  --namespace personal

Facts in the personal namespace are only injected when you are chatting from that Telegram chat.

Next steps

  • Build on top of memory with skills — the assistant can recall facts inside any skill call.
  • Wire memory to multiple channels via integrations.
  • Diagnose memory issues in Troubleshooting.
OpenClaw Guide Editorial
Independently maintained walkthroughs and ecosystem notes for OpenClaw.

Found an issue or have a correction? Get in touch.