Files
openclaw/docs/cli/sessions.md
pashpashpash 6ce1058296 Wire diagnostics through the core chat command (#72936)
* feat: wire codex diagnostics feedback

* fix: harden codex diagnostics hints

* fix: neutralize codex diagnostics output

* fix: tighten codex diagnostics safeguards

* fix: bound codex diagnostics feedback output

* fix: tighten codex diagnostics throttling

* fix: confirm codex diagnostics uploads

* docs: clarify codex diagnostics add-on

* fix: route diagnostics through core command

* fix: tighten diagnostics authorization

* fix: pin diagnostics to bundled codex command

* fix: limit owner status in plugin commands

* fix: scope diagnostics confirmations

* fix: scope codex diagnostics cooldowns

* fix: harden codex diagnostics ownership scopes

* fix: harden diagnostics command trust and display

* fix: keep diagnostics command trust internal

* fix: clarify diagnostics exec boundary

* fix: consume codex diagnostics confirmations atomically

* test: include codex diagnostics binding metadata

* test: use string codex binding timestamps

* fix: keep reserved command trust host-only

* fix: harden diagnostics trust and resume hints

* wire diagnostics through exec approval

* fix: keep diagnostics tests aligned with bundled root trust

* fix telegram diagnostics owner auth

* route trajectory exports through exec approval

* fix trajectory exec command encoding

* fix telegram group owner auth

* fix export trajectory approval hardening

* fix pairing command owner bootstrap

* fix telegram owner exec approvals

* fix: make diagnostics approval flow pasteable

* fix: route native sensitive command followups

* fix: invoke diagnostics exports with current cli

* fix: refresh exec approval protocol models

* fix: list codex diagnostics from thread bindings

* fix: fold codex diagnostics into exec approval

* fix: preserve diagnostics approval line breaks

* docs: clarify diagnostics codex workflow
2026-04-29 07:40:37 +09:00

4.3 KiB

summary, read_when, title
summary read_when title
CLI reference for `openclaw sessions` (list stored sessions + usage)
You want to list stored sessions and see recent activity
Sessions

openclaw sessions

List stored conversation sessions.

openclaw sessions
openclaw sessions --agent work
openclaw sessions --all-agents
openclaw sessions --active 120
openclaw sessions --verbose
openclaw sessions --json

Scope selection:

  • default: configured default agent store
  • --verbose: verbose logging
  • --agent <id>: one configured agent store
  • --all-agents: aggregate all configured agent stores
  • --store <path>: explicit store path (cannot be combined with --agent or --all-agents)

Export a trajectory bundle for a stored session:

openclaw sessions export-trajectory --session-key "agent:main:telegram:direct:123" --workspace .
openclaw sessions export-trajectory --session-key "agent:main:telegram:direct:123" --output bug-123 --json

This is the command path used by the /export-trajectory slash command after the owner approves the exec request. The output directory is always resolved inside .openclaw/trajectory-exports/ under the selected workspace.

openclaw sessions --all-agents reads configured agent stores. Gateway and ACP session discovery are broader: they also include disk-only stores found under the default agents/ root or a templated session.store root. Those discovered stores must resolve to regular sessions.json files inside the agent root; symlinks and out-of-root paths are skipped.

JSON examples:

openclaw sessions --all-agents --json:

{
  "path": null,
  "stores": [
    { "agentId": "main", "path": "/home/user/.openclaw/agents/main/sessions/sessions.json" },
    { "agentId": "work", "path": "/home/user/.openclaw/agents/work/sessions/sessions.json" }
  ],
  "allAgents": true,
  "count": 2,
  "activeMinutes": null,
  "sessions": [
    { "agentId": "main", "key": "agent:main:main", "model": "gpt-5" },
    { "agentId": "work", "key": "agent:work:main", "model": "claude-opus-4-6" }
  ]
}

Cleanup maintenance

Run maintenance now (instead of waiting for the next write cycle):

openclaw sessions cleanup --dry-run
openclaw sessions cleanup --agent work --dry-run
openclaw sessions cleanup --all-agents --dry-run
openclaw sessions cleanup --enforce
openclaw sessions cleanup --enforce --active-key "agent:main:telegram:direct:123"
openclaw sessions cleanup --json

openclaw sessions cleanup uses session.maintenance settings from config:

  • Scope note: openclaw sessions cleanup maintains session stores, transcripts, and trajectory sidecars. It does not prune cron run logs (cron/runs/<jobId>.jsonl), which are managed by cron.runLog.maxBytes and cron.runLog.keepLines in Cron configuration and explained in Cron maintenance.

  • --dry-run: preview how many entries would be pruned/capped without writing.

    • In text mode, dry-run prints a per-session action table (Action, Key, Age, Model, Flags) so you can see what would be kept vs removed.
  • --enforce: apply maintenance even when session.maintenance.mode is warn.

  • --fix-missing: remove entries whose transcript files are missing, even if they would not normally age/count out yet.

  • --active-key <key>: protect a specific active key from disk-budget eviction.

  • --agent <id>: run cleanup for one configured agent store.

  • --all-agents: run cleanup for all configured agent stores.

  • --store <path>: run against a specific sessions.json file.

  • --json: print a JSON summary. With --all-agents, output includes one summary per store.

openclaw sessions cleanup --all-agents --dry-run --json:

{
  "allAgents": true,
  "mode": "warn",
  "dryRun": true,
  "stores": [
    {
      "agentId": "main",
      "storePath": "/home/user/.openclaw/agents/main/sessions/sessions.json",
      "beforeCount": 120,
      "afterCount": 80,
      "pruned": 40,
      "capped": 0
    },
    {
      "agentId": "work",
      "storePath": "/home/user/.openclaw/agents/work/sessions/sessions.json",
      "beforeCount": 18,
      "afterCount": 18,
      "pruned": 0,
      "capped": 0
    }
  ]
}

Related: