Follow Discord
Sweep 22 Sep 2026 · 17:19Z Build v2.1.280 501 read Stable v2.1.267 Latest v2.1.280 Next v2.1.280 Feeds RSS JSON llms.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

TierUse it nowhow much it should matter to you
Useful4my rating, 1 to 5
Signal3worth watching, 1 to 5
AreaSelf-Hosted Runnerwhat it touches
KindNew Featuresin v2.1.268,
Use it now Notable

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

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
Names in the bundleSELF_HOSTED_RUNNER_REMOVE_SESSION_STATE
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.

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