[FEATURE] Preserve and reuse thinking trace when user interrupts mid-thinking
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 Claude Code is in an extended thinking phase and the user interrupts (via Escape or by sending a new message), the entire thinking trace is discarded. If the model has spent significant compute generating a rich reasoning trace — analysing the codebase, evaluating approaches, building up intermediate conclusions — that work is thrown away entirely. The next turn starts from scratch with no memory of that reasoning.
This is wasteful in two ways:
- Compute cost: Extended thinking tokens are expensive. Discarding them means paying for the same reasoning again on the next turn.
- Quality loss: The interrupted thinking trace may contain valuable intermediate conclusions (e.g. "file X is the root cause", "approach B is better than A because…") that would improve the model's response if carried forward.
Proposed Solution
When a turn is interrupted while in the thinking phase (before any tool calls or response text has been produced), Claude Code should:
- Capture the partial thinking trace accumulated so far.
- Prepend it to the next turn's context — either as a
thinkingblock in the message history, or as a summarised assistant note — so the model can build on rather than restart its reasoning. - Optionally surface a brief indicator in the UI: _"Resuming with prior thinking context"_ so the user knows the trace was preserved.
This is distinct from #39476 (which is about streaming thinking visibility in real-time). This request is specifically about the recycling of already-generated thinking tokens when the user sends a follow-up or correction mid-think, so that compute is not wasted and reasoning continuity is maintained.
Example Scenario
- User sends a complex debugging request.
- Model spends 30s in extended thinking, reasoning through 5 files, narrowing down to a likely root cause.
- User interrupts to add: _"Also check the config loader, it was recently changed."_
- Current behaviour: All 30s of thinking is discarded. Model restarts from scratch.
- Desired behaviour: The thinking trace is preserved. The new message is appended. The model continues from where it left off, incorporating the new context without re-deriving everything it already reasoned through.
Alternative Solutions
- Summarise rather than replay: If the raw thinking blocks can't be replayed verbatim (due to API constraints on thinking block ordering), a summarised version of key conclusions from the interrupted trace could be injected as a user-visible or system note.
- Opt-in only: Gate this behind a config flag (e.g.
preserveInterruptedThinking: true) for users who want the behaviour.
Related Issues
- #39476 — thinking visibility and correction queuing (related but distinct)
- #3074 — preserve plan progress on escape (similar spirit for planning phase)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗