skip to content

A security reviewer asks where an OpenClaw Gateway keeps session transcripts and when they are actually removed — what do you answer?

level: seniorimportance: should knowfreq 6%

answer

  1. the Gateway owns all of it
  2. one SQLite file per agent
  3. archive is not delete
  4. 30 days, 5000 rows, 10gb
  5. a deleted session still leaves a copy

basics

~20 s

As of OpenClaw 2026.9.9, the Gateway keeps session rows and transcripts in a per-agent SQLite database under ~/.openclaw/agents/<agentId>/. Resets, compaction and the 30-day cutoff keep or archive history instead of erasing it; even a deleted session leaves an archive.

solid answer

~40 s

All session state is owned by the Gateway. As of 2026.9.9 runtime rows and transcripts live in `~/.openclaw/agents/<agentId>/agent/openclaw-agent.sqlite`, with archived transcript files under `~/.openclaw/agents/<agentId>/sessions/`; an older install's `sessions.json` and JSONL files are imported by `openclaw doctor --fix`. Ordinary use does not erase conversations: `/new`, `/reset` and compaction keep earlier history, and `session.maintenance` (mode `enforce`) archives durable sessions in place after `pruneAfter` (`30d`) and archives the oldest beyond `maxEntries` (`5000`). Synthetic cron, hook and heartbeat sessions are the exception and age out. Old history is physically reclaimed mainly under the per-agent disk budget, `maxDiskBytes` (`10gb`). `openclaw sessions delete` removes the live row but keeps a `.jsonl.deleted.<timestamp>` archive, and derived memories need `openclaw memory forget`. Preview any of it with `openclaw sessions cleanup --dry-run`.

code

bash · 5 lines
bash
openclaw sessions cleanup --dry-run
openclaw sessions delete "agent:main:telegram:direct:123456789" --dry-run
openclaw sessions delete "agent:main:telegram:direct:123456789" --yes
openclaw memory forget --agent main --session "agent:main:telegram:direct:123456789" --dry-run --json
openclaw memory forget --agent main --session "agent:main:telegram:direct:123456789"

go deeper

for a junior

Recall that the Gateway owns all session state and that resets and compaction do not delete transcripts; they stay in a per-agent store under ~/.openclaw/agents.

for a middle

Explain the session.maintenance defaults: enforce mode, a 30-day pruneAfter that archives, a 5000-row cap and a 10gb disk budget per agent, and how cleanup --dry-run previews them.

for a senior

Show the deletion path a reviewer will test: sessions delete keeps a deleted archive, memory forget removes derived memories, incognito threads skip the disk, and provider-side processing is outside the store.

for a principal

Turn retention into policy: decide whether the defaults match what the team promised users, whether resetArchiveRetention or a smaller disk budget is needed, and who may read ~/.openclaw at all.

## Where session state lives In OpenClaw the **Gateway** owns every session; the Control UI, the terminal and chat apps only ask it for data. The chat apps hold their own copies of the messages, but the conversation the model sees is OpenClaw's. As of 2026.9.9 the layout per agent is: | Path | What it holds | |---|---| | `~/.openclaw/agents/<agentId>/agent/openclaw-agent.sqlite` | Runtime session rows and transcripts | | `~/.openclaw/agents/<agentId>/sessions/` | Archived transcript files | | `~/.openclaw/agents/<agentId>/sessions/sessions.json` | Legacy index, used only as a migration source | Older installations kept a `sessions.json` index and JSONL transcripts. In 2026.9.9 startup refuses readiness when it finds such a legacy store and tells you to stop the Gateway, back up, and run `openclaw doctor --fix` to import it. `openclaw status` prints the store path, and `openclaw sessions --json` lists every session. These files are separate from the agent's workspace folder, where its Markdown and memory files live. ## What does not delete anything - `/new` and `/reset` start the conversation over, but the earlier transcript stays in the store and remains searchable. - Compaction adds a summary entry; the full history stays on disk. - Session pruning changes only the projected view the model sees; original tool results are kept. - `openclaw sessions archive <key>` marks a session archived and hides it from the active list, with its transcript intact. ## What `session.maintenance` does by default | Key | Default | Effect | |---|---|---| | `mode` | `enforce` | Applies cleanup; `warn` only reports | | `pruneAfter` | `30d` | Archives eligible durable sessions in place; disposable automation rows are removed | | `maxEntries` | `5000` | Caps unarchived rows by archiving the oldest eligible sessions | | `maxDiskBytes` | `10gb` | Per-agent disk budget; under pressure, cleanup removes old reset and delete artifacts, unreferenced history, then cap-created archives | | `resetArchiveRetention` | unset | Opt-in age limit for reset and deleted transcript archives | Synthetic runtime sessions such as cron, hooks, heartbeat and sub-agents are disposable and age out. Pinned sessions, active work and durable external conversation pointers are protected, so the store can stay above its caps. The disk budget is a target, not a guaranteed ceiling. ## Deleting on purpose When a conversation must go, do it explicitly and check each step: 1. Preview with `openclaw sessions cleanup --dry-run` or `openclaw sessions delete <key> --dry-run`. 2. Run `openclaw sessions delete <key>`. The Gateway removes the live row, transcript generations, bindings and other session-owned state, but for an ordinary session it keeps a verified `.jsonl.deleted.<timestamp>` archive. 3. Run `openclaw memory forget --agent <agentId> --session <key>` on the Gateway host to remove memories indexed from that session; deleted-session archives can otherwise stay eligible for memory search. 4. Remember the provider: messages already sent to a model provider were processed there, outside OpenClaw's store. ## Incognito threads The Control UI's **Incognito** option on a new thread keeps that session's entry, transcript and compaction state in process memory. It expires 24 hours after creation or on a Gateway restart, and its transcript is removed without an archive. Tool-driven file writes during the thread can still persist data. ## What to tell the reviewer Answer in this order, because it matches what a reviewer will try to verify: Transcripts are local to the Gateway host, per agent, in one SQLite database plus an archive folder; nothing about a reset or a 30-day cutoff erases them; physical removal comes from the disk budget, opt-in archive retention or an explicit delete followed by `openclaw memory forget`. Anyone who can read `~/.openclaw` can read them, which is why that directory is treated as operator territory.

  • Does `openclaw sessions delete` guarantee that the conversation is gone from the host?
    No. For an ordinary session it removes the live row and session-owned state but keeps a verified `.jsonl.deleted.<timestamp>` archive, which can stay eligible for memory search. Run `openclaw memory forget --agent <agentId> --session <key>` on the Gateway host for derived memories, and rely on the disk budget or an opt-in `resetArchiveRetention` for the archive. Incognito transcripts are the exception and are removed without an archive.
  • What does setting `session.maintenance.mode` to `warn` change?
    Maintenance then reports age, entry-count and disk-budget pressure without applying any cleanup. It is a way to measure how a store would be trimmed before you enforce it; `openclaw sessions cleanup --dry-run` gives the same preview on demand, and `--enforce` applies the cap immediately.

  • OpenClaw's /reset erases the old conversation from disk.
  • Sessions untouched for 30 days are deleted together with their transcripts by default.
  • openclaw sessions delete leaves no copy of the transcript anywhere.
  • Session transcripts are stored in the agent's workspace folder next to its memory files.
  • The chat apps hold the history, so the Gateway host stores no transcripts.

Assumes OpenClaw 2026.9.9, where sessions live in a per-agent SQLite database and a legacy sessions.json store must be imported with openclaw doctor --fix before startup.