Answer: Have your hook pass the runner flag `--release-idle-session-min 30` to every runner it starts; the runner releases its session after that many idle minutes and then exits 0. You can also pass `--kill-session-after-min 480` as a backstop and `--exit-if-unused-min 60` to standby runners. Status: Confirmed Entry: tool/claude-code/admin-and-enterprise/on-demand-runner-idle-exit Revision: 1 Digest: sha256:2da769d02d2d69bb (changes whenever the content changes) Timeline: Created: 2026-11-13T03:05:38Z Last changed: 2026-11-13T03:05:38Z Last verified: 2026-11-20T12:24:50Z Next check: 2026-11-21T12:24:50Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of idle exit flag | --release-idle-session-min 30 | [1] | 2026-11-20 idle exit behavior | The runner releases its session after that many idle minutes and then exits 0. | [1] | 2026-11-20 session backstop flag | --kill-session-after-min 480 | [1] | 2026-11-20 standby exit flag | --exit-if-unused-min 60 | [1] | 2026-11-20 Sources: [1] Anthropic. "Customize sessions in self-hosted environments". https://code.claude.com/docs/en/self-hosted-environments-configuration.md Role: primary. Accessed: 2026-11-20T12:24:50Z Quote: "`--release-idle-session-min 30`" (Supports: idle exit flag) Quote: "The runner releases its session after that many idle minutes and then exits 0." (Supports: idle exit behavior) Quote: "`--kill-session-after-min 480`" (Supports: session backstop flag) Quote: "`--exit-if-unused-min 60`" (Supports: standby exit flag) Published: 2026-11-20T03:01:10Z Snapshot SHA-256: 97cb122d0eb49028135f9c375d50d3b63c690e9e9c83d350930a583500d2d828 (captured 2026-11-20T12:24:49Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. Cross-check: not-available at 2026-11-20T12:24:50Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:24:50Z Last attempt: 2026-11-20T12:24:50Z Notes and limitations: Extracted automatically from a single official source (section "Make on-demand runners exit when idle"). Related: https://latestn.com/tool/claude-code/admin-and-enterprise/org-mod-controls How do I control mods for my organization in Claude Code? https://latestn.com/tool/claude-code/admin-and-enterprise/per-session-credentials-wrapper How do I provision per-session credentials in a Claude Code self-hosted environment wrapper script? https://latestn.com/tool/claude-code/admin-and-enterprise/plan-version-upgrades-gateway How do I plan Claude Code version upgrades when maintaining an LLM gateway? https://latestn.com/tool/claude-code/admin-and-enterprise/network-access-hipaa What network access does Claude Code need in a HIPAA configuration? https://latestn.com/tool/claude-code/admin-and-enterprise/network-settings-background-agents How do I apply proxy and network settings to Claude Code background agents? https://latestn.com/tool/claude-code/admin-and-enterprise/offer-claude-code-in-products Can I offer or preinstall Claude Code in my own product or hosted sandbox? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T03:05:38Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/claude-code/admin-and-enterprise/on-demand-runner-idle-exit/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/claude-code/admin-and-enterprise/on-demand-runner-idle-exit POST: https://latestn.com/dispute/tool/claude-code/admin-and-enterprise/on-demand-runner-idle-exit with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/claude-code/admin-and-enterprise/on-demand-runner-idle-exit?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I make Claude Code on-demand runners exit when idle? Revision 1, last verified 2026-11-20T12:24:50Z. https://latestn.com/tool/claude-code/admin-and-enterprise/on-demand-runner-idle-exit (accessed 2026-11-21T10:03:19Z). @misc{LatestN_tool_claude_code_admin_and_enterprise_on_demand_runner_idle_exit_r1, title = {How do I make Claude Code on-demand runners exit when idle?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/claude-code/admin-and-enterprise/on-demand-runner-idle-exit}}, note = {Revision 1; digest sha256:2da769d02d2d69bb; last verified 2026-11-20T12:24:50Z; accessed 2026-11-21T10:03:19Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/claude-code/admin-and-enterprise/on-demand-runner-idle-exit