Client-side soft session ceiling with graceful checkpoint for autonomous/subagent runs
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
https://github.com/anthropics/claude-code/issues/12657 similar issue - closed due to no-activity.
Problem Statement
The 5-hour session limit is enforced as a hard stop: when the budget is exhausted, Claude Code returns an error and refuses further prompts with no partial completion or graceful degradation. This is especially painful during long autonomous runs (an orchestrator dispatching subagents), which are uninterruptible without Esc killing the run mid-flight and losing in-progress state.
The model itself has no visibility into remaining session budget and cannot run /usage on its own, so it cannot wind down gracefully. External usage monitors can alert the user, but there is no mechanism to translate that awareness into a clean stop — the user can only watch the bar and hope to catch a turn boundary, which doesn't exist during a subagent batch.
Proposed Solution
Proposed Feature
A user-configurable soft session ceiling, enforced client-side (where the budget already lives — not by the model), e.g. in settings:
softSessionCeiling: 85 // percent of 5-hour window
When usage crosses the threshold, instead of continuing toward the hard limit, the client:
Lets the currently-executing subagent/task finish (no mid-edit kill).
Blocks any new subagent dispatch or new tool-heavy work.
Triggers a graceful wrap-up: commit/summarise in-progress work and write a resume note.
Surfaces a clear message that the soft ceiling was hit and real budget remains for the wrap-up.
Keeping enforcement in the client (not exposing the budget to the model) avoids the model trading correctness for token savings, while still solving the real gap: no graceful landing before the hard wall.
Alternative Solutions
more frequent checkpoint commits to make mid-stream failures more recoverable.
Priority
Medium - Would be very helpful
Feature Category
Performance and speed
Use Case Example
- Session limit is about to expire.
- Subagents are running for 2+ hours
- when session limit nearing completion a graceful interrupt is added to allow the agents to gracefully exit, document the progress, commit if needed.
Additional Context
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗