Allow graceful session save/close when token limit is reached

Resolved 💬 3 comments Opened Jan 12, 2026 by peterdrier Closed Jan 16, 2026

Problem

When running out of tokens in a Claude Code session, users cannot effectively \"save and close\" until credits refresh (typically a few hours). This creates several pain points:

  1. Loss of context: Cannot properly wrap up work or save session state
  2. Connection issues: If the connection drops before credits refresh, the entire session can be lost
  3. Multi-session conflicts: Running parallel sessions makes it harder to preserve enough tokens for graceful shutdown

Use Case

As a user approaching token limits, I need a way to checkpoint my work and close the session gracefully, even when I have zero tokens remaining. This is especially critical when:

  • Working on long-running tasks that approach limits
  • Managing multiple parallel sessions
  • Dealing with unstable network connections

Proposed Solution

Implement a \"reserve tokens for shutdown\" mechanism, such as:

  • Option 1: Allow users to opt-in to reserving their last ~1k tokens specifically for save/close operations
  • Option 2: Implement a \"checkpoint to file\" command that works even at zero tokens remaining
  • Option 3: Auto-save session state periodically, allowing resume even after connection loss

Even with multi-session challenges, having some mechanism to preserve work when hitting token limits would significantly improve the user experience.

Current Workaround

None - users must wait for credit refresh or risk losing session context if connection drops.

---
Originally submitted via /feedback command

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗