Where does OpenClaw store its config, memory, and workspace?
OpenClaw keeps its config, sessions, and your agent's memory under one home directory. Where it lives, what's inside, and what to back up.
Everything OpenClaw knows lives in one place: a hidden folder called .openclaw in the home directory of whichever user runs the Gateway (~/.openclaw on Mac and Linux, the same under your user profile on Windows). Config, sessions, and your agent’s workspace are all in there. Protect that folder and you’ve protected your agent; lose it and your agent starts over as a stranger.
What’s inside the state directory
Three kinds of things live under ~/.openclaw:
- Config is
openclaw.json, the settings file the Gateway and the CLI both read: which model provider you use, which channels are connected, how access control behaves. - Sessions are the running history of your conversations, kept by the Gateway so a chat can pick up where it left off. Since OpenClaw 2 they live in SQLite databases rather than loose files:
state/openclaw.sqlitefor shared setup state, and one database per agent underagents/holding its sessions, transcripts, model sign-ins and memory index. - The workspace is your agent’s own working folder: the files it creates, plus the plain-text notes that make it your agent (its identity, what it knows about you, the memory it accumulates). OpenClaw deliberately keeps this as ordinary files you can open and read, not a database you need tools for.
Your agent’s “memory” is just files
This is the most reassuring thing about OpenClaw’s design, and worth pausing on. The personality and accumulated knowledge of your agent aren’t locked inside a vendor’s cloud: they’re readable text on a disk you control. You can look at what your agent has written down about you. You can edit it. And because it’s just a directory, your agent is portable: the state directory on a machine running the same OpenClaw version is the agent.
The flip side is that those files include sensitive things: your conversations, your agent’s notes, and configuration that can contain credentials. Anything that copies the directory (including backups) copies the secrets too, so backups deserve the same care as the machine itself, and deleting an agent properly means deleting its backups as well.
Running in Docker? One rule matters
In a container setup, the state directory must be mounted as a volume, a folder that lives on the host machine and is handed into the container. Get this right and OpenClaw survives container restarts, recreations, and version upgrades with its memory intact. Get it wrong (state written inside the container’s own filesystem) and everything your agent learned disappears the first time the container is recreated. If you take one line from this guide: make sure .openclaw lives on the host, not in the container.
What to back up
Back up ~/.openclaw and you’ve backed up the agent: config, sessions, workspace, memory. One catch since OpenClaw 2: the Gateway writes its databases while it runs, and OpenClaw’s backup docs warn that a raw copy of a live database file “can be torn or corrupt.” So let OpenClaw make the copy: openclaw backup create --verify writes a checked archive of config, credentials, sessions and workspaces, and on a laptop your normal machine backup can then carry that archive. On a server, run the same command on a schedule, or keep your host’s whole-disk snapshots, which capture the disk at one instant rather than copying files one by one. Either way, test a restore once before you rely on it, because an untested backup is a hope, not a plan; the backup guide has the restore. (On Everpod’s OpenClaw pod, backups run every day with restores tested, as part of what’s managed for you.)