Auto-save session summary when context limit is reached
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)
Problem Statement
When working in VS Code and Claude Code reaches the context limit (the ~1M token cap), it displays a message informing the user but then becomes unresponsive — the session is effectively dead and the user loses all working context.
Proposed Solution
When Claude detects it is approaching the context limit (e.g., at 99% capacity), it should automatically save a structured session summary before becoming unable to respond. The summary should capture:
What was being worked on (files, features, bugs)
Current state (what's done, what's in progress, what's next)
Any relevant decisions, constraints, or context needed to resume
This could write to a file in the project (e.g., .claude/session-handoff.md) or to the memory system, so the user can open a new session, reference the summary, and continue without having to reconstruct context from scratch.
Current behavior: Context limit is hit → error message → session is dead. User loses all working context with no recovery path.
Expected behavior: Claude proactively saves a handoff summary before hitting the wall, so the next session can pick up seamlessly.
Use case: Active development sessions where incremental work spans many back-and-forth exchanges (e.g., firmware development, large refactors). Today, hitting the limit mid-task means significant rework to re-establish context.
Alternative Solutions
_No response_
Priority
High - Significant impact on productivity
Feature Category
CLI commands and flags
Use Case Example
_No response_
Additional Context
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗