Follow Discord
Sweep 10 Nov 2026 · 02:18Z Build v2.1.322 539 read Stable v2.1.311 Latest v2.1.322 Next v2.1.322 Feeds RSS JSON llms.txt llms-full.txt Unofficial

Claude Code v2.1.268 ·

New --remove-session-state flag for self-hosted runner

Self-hosted runner can now delete a session's leftover files when the session ends

Use it now Notable New Features
JSON All of v2.1.268
Use it nowTier: how much it should matter to you
4Useful: my rating, 1 to 5
3Signal: worth watching, 1 to 5
Self-Hosted RunnerArea: what it touches
New FeaturesKind: in v2.1.268,
What probably matters to youSection of the release
What

The claude self-hosted-runner command line tool gets a new --remove-session-state flag (also settable via the SELF_HOSTED_RUNNER_REMOVE_SESSION_STATE environment variable). When enabled, ending a session now removes that session's stored state under its _sessions/ folder, including its Claude config directory (transcript copy, shell snapshots, session environment, file history, debug log), staged uploads, per-session git configuration, and the session's working directory.

  • Accepts true/false/1/0, and defaults to true if you pass the flag with no value.
  • Off by default, so existing behavior is unchanged unless you turn it on.
  • Cleanup is best-effort: files are safely renamed then deleted, and at startup the runner logs whether these per-session files will be removed or kept.
  • The runner logs how many of the targeted paths were actually removed versus already absent, and this also affects whether the debug log tail is sent to server-side session diagnostics or kept on disk.
Why

This lets self-hosted runner operators avoid accumulating leftover session files (transcripts, uploads, git config, working directories) on disk after each session, which matters for storage management and for not retaining session data longer than needed.

Read from
What the documentation says
Since it was published

The entry above is what we published on the day. These lines were added later, as Anthropic's own pages caught up, and they sit beside the original rather than replacing it.

Confirmed since Anthropic's documentation has since written up SELF_HOSTED_RUNNER_REMOVE_SESSION_STATE, on Self-hosted environments reference. | `--remove-session-state [bool]` | `SELF_HOSTED_RUNNER_REMOVE_SESSION_STATE` | off | Remove a session's per-session directories under `<base-dir>/_sessions/` when the session ends on this runner, whatever the outcome. [Reuse a pre-warmed … self-hosted-environments-reference see the edit
Added since A small documentation edit on Self-hosted environments reference touched a line naming SELF_HOSTED_RUNNER_REMOVE_SESSION_STATE after this was published. | `--remove-session-state [bool]` | `SELF_HOSTED_RUNNER_REMOVE_SESSION_STATE` | off | Remove a session's per-session directories under `<base-dir>/_sessions/` when the session ends on this runner, whatever the outcome. [Reuse a pre-warmed … self-hosted-environments-reference see the edit
How sure we are
Two sources agreeTwo things we can check say the same as this entry.
Anthropic's documentation agreesA small documentation edit on Self-hosted environments reference touched a line naming SELF_HOSTED_RUNNER_REMOVE_SESSION_STATE after this…
Anthropic's release notes agreeAdded claude self-hosted-runner --remove-session-state (default off): delete each session's per-session directories under…
The name it cites is new in this buildNew in this build: SELF_HOSTED_RUNNER_REMOVE_SESSION_STATE

See this entry in the whole of v2.1.268 →

Feedback