Interrupt-Resumable Thought
Preserve multi-step reasoning chains across interrupts using a push/pop thought-frame stack — so new messages are handled cleanly without clobbering in-flight work.
Intent & Description
🎯 Intent
Without a paused-thought primitive, every incoming message lands on whatever the model was mid-way through — and the prior reasoning chain is lost silently.
📋 Context
The agent’s reasoning chains take longer than a single turn — a 6-step synthesis, a multi-stage debugging walkthrough, a careful document comparison. While the chain is mid-flight, new messages arrive. There’s no built-in concept of a paused thought, so every interrupt overwrites the in-progress frame.
💡 Solution
Introduce an explicit thought-frame stack. When starting a multi-step chain, push a frame with the goal, completed steps, and next step. On interrupt: briefly acknowledge (“hold on — finishing X first” or “switching: Y”), handle the interrupt, then explicitly resume from the top frame (“back to X — I was at step 3/6”). Cap stack depth to prevent infinite suspension. Frames older than a configurable window expire — the agent admits the resume would be reconstruction, not continuation.
Real-world Use Case
- The agent supports incoming interrupts (new user messages) while it is mid-reasoning.
- Multi-step reasoning chains are common enough that losing one is a meaningful quality regression.
- The transport allows paused chains to persist into subsequent turns.
Source
Advantages
- Coherent long-form work survives interruptions
- The user gets quick acknowledgement without the agent losing its place
- Failure mode (forgetting to resume) is observable as a stack with un-popped frames
Disadvantages
- Stack management adds complexity to the agent loop
- Paused frames carry token cost while sitting in context
- Resume distortion over long pauses is a real failure mode — the agent is reconstructing, not continuing