{"version":"2.1.268","anchor":"new-remove-session-state-flag-for-self-hosted-runner","canonical_anchor":"new-remove-session-state-flag-for-self-hosted-runner","heading":"New --remove-session-state flag for self-hosted runner","tier":"use","area":"Self-Hosted Runner","scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.268\/e\/new-remove-session-state-flag-for-self-hosted-runner","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.268","markdown":"### New --remove-session-state flag for self-hosted runner\n\nSelf-hosted runner can now delete a session's leftover files when the session ends\n\n**What**\n\nThe `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.\n\n- Accepts `true`\/`false`\/`1`\/`0`, and defaults to `true` if you pass the flag with no value.\n\n- Off by default, so existing behavior is unchanged unless you turn it on.\n\n- 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.\n\n- 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.\n\n**Why**\n\nThis 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.\n\n- Area: Self-Hosted Runner\n- Names: `SELF_HOSTED_RUNNER_REMOVE_SESSION_STATE`\n- Tier: Use it now\n- Useful: 4\/5\n- Signal: 3\/5"}