How to delete OpenClaw session history, and what you lose

a deleted session leaves an archive behind

OpenClaw keeps every agent's sessions under that agent's state directory: since 2026.8 as rows in one SQLite database per agent, before that as one JSONL file per session. Either way, deleting a session through OpenClaw keeps a copy of its transcript as an archive, so removing the text takes two steps.

Where the sessions are

${OPENCLAW_STATE_DIR:-~/.openclaw}/agents/<agentId>/agent/openclaw-agent.sqlite
${OPENCLAW_STATE_DIR:-~/.openclaw}/agents/<agentId>/sessions/

openclaw-agent.sqlite holds the agent's session rows and transcript events since 2026.8, and also the agent's own credential store, so it is not a file to delete to clear history. The sessions directory beside it held the transcripts before 2026.8 (<sessionId>.jsonl, with sessions.json mapping session keys such as agent:main:main to ids); the upgrade moves them into the database and leaves the old files behind as archives. The same directory collects the archives resets and deletes write. openclaw sessions --all-agents lists every agent's sessions with their keys.

How to delete one session

With the Gateway running, preview the delete and then run it, using the key the list shows:

openclaw sessions --agent main
openclaw sessions delete "agent:main:scratch-1" --dry-run
openclaw sessions delete "agent:main:scratch-1"

It asks once in a terminal; a script passes --yes. OpenClaw removes the session's row and transcript and keeps an archive of the transcript twice: compressed in the database's session_transcript_archives table, and as <sessionId>.jsonl.deleted.<timestamp>.zst in the agent's sessions directory (plain JSONL where zstd is unavailable). An incognito session is removed without one. An agent's protected main session is refused; /reset there starts a new window and keeps the earlier one in the database.

The deleted text can still turn up in OpenClaw's memory search. Remove it there too, on the Gateway host:

openclaw memory forget --agent main --session "agent:main:scratch-1"

Removing the archives

By default OpenClaw keeps reset and delete archives until the agent's disk budget (session.maintenance.maxDiskBytes, 10 GB) pushes them out. To have them expire, set session.maintenance.resetArchiveRetention to a duration such as "30d"; the Gateway applies it at startup and once a minute. Deleting the .zst file by hand removes only one of the two copies.

Older stores keep each session as sessions/<sessionId>.jsonl, and a reset or delete there renamed it to .jsonl.reset.<timestamp> or .jsonl.deleted.<timestamp>. deja delete <id> removes such a file, live or archived, together with deja's copy, and --dry-run lists it first. It leaves the key in sessions.json and any compaction checkpoint beside it (<sessionId>.checkpoint.<uuid>.jsonl, the restore points versions before 2026.9.6 wrote), which can hold the conversation from before a compaction; delete those by hand if the text has to go. For a session in openclaw-agent.sqlite it refuses, since that database holds every session of the agent.

How to delete all of it

No single command empties a store. openclaw sessions delete takes several keys at once, so delete the ones openclaw sessions --agent <agentId> --limit all lists, then let the archives expire as above. openclaw agents delete <agentId> removes an agent with its sessions, its workspace and its configuration, moving the files to the Trash rather than deleting them, and refuses the only configured agent. Removing ~/.openclaw removes everything, including configuration and credentials.

What you lose

The session's turns, its tool calls and their results, and its row in openclaw sessions. Once its archive has expired too, OpenClaw keeps no copy, and after memory forget its memory search no longer returns the text.

Keeping it searchable instead

deja reads the SQLite stores (with the sqlite3 CLI), the JSONL transcripts and the reset and delete archives (.zst with zstd) into one local index with every other agent's history. Run deja index before you delete: a session that leaves OpenClaw stays in the index, so deja <query> finds it and deja show <id> prints it.

curl -fsSL https://raw.githubusercontent.com/vshulcz/deja-vu/main/install.sh | sh
deja index
deja "openclaw session about the deploy"

deja resume <id> --write-back puts a deleted transcript back for a pre-2026.8 session whose key in sessions.json still points at it, and prints the openclaw chat --session command that reopens it; it refuses sessions in openclaw-agent.sqlite and archived ones. Indexing and search stay local, credentials are stripped as the index is built, and deja forget --session <id> removes a session from the index for good. DEJA_OPENCLAW_ROOT points deja at an agents directory other than $OPENCLAW_STATE_DIR/agents.

Where every agent keeps its history · Memory for OpenClaw · The OpenClaw format

Found this useful? Star deja-vu on GitHub.