Building StareBrain, Part 20: Session Handoff — Resuming Mid-Task Without Repeating Yourself
Parts 1–19 built the execution pipeline, the overlay UI, and the input layer. Today we close the loop on something that affects every session: what happens when the user closes and reopens StareBrain mid-task.
The goal is simple to state and hard to get right — the user should be able to pick up exactly where they left off, without being asked to repeat anything.
What Needs to Survive a Session Close
Three things matter for resumption:
The task itself — which steps completed, which failed, where the cursor is
The agent context — what app was active, what the user was doing, what confidence level was inferred
The user's last intent — the instruction that started the task
If any of these is missing on reopen, the agent either has to ask the user to repeat themselves or makes a guess it shouldn't be making silently.
Persisting AgentTask
AgentTask is serialized to disk when the task enters IN_PROGRESS or…