Task state is a call stack for agent work
I was one hero image away from publishing a post about sprint planning . Generate it, wire the manifest, build the route. Three steps, then done. I opened the image prompt for one last look and found it arguing with itself. It named colours in the same prompt that told the generator to avoid them. I asked why. That small question pulled us out of publishing and into an audit of every image…
Task state functions as a call stack for agent work, akin to a to-do list recording remaining tasks and a call stack tracking current frames, local variables, and return addresses. The current frame represents the immediate question, local variables encompass working hypotheses, evidence, rejected paths, blockers, and decisions, while the return address indicates the next step waiting in the ledger.
Before changing focus, the instruction prompts the agent to checkpoint the ledger, ensuring the current work is recorded while the unfinished task remains in the ledger. The publishing task can be broken down as follows:
1. Publish sprint-planning post
2. Create hero
3. Notice excluded colors inside the positive prompt
4. Inspect the prompt rules
5. Return with corrected sidecar
6. Question the 1.63 MB render
7. Audit the export settings
8. Return with normalized hero
9. Wire manifest
10. Remove unpublished forward link
11. Build and inspect route shell
Task state must be shared to prevent the loss of active context when focusing on a tangent. It is not the agent's private plan or the reporter's private browser tabs; rather, it is the handoff surface between the agent's and reporter's attention streams. The internal todo tracker helps decompose requested work and mark steps in progress but does not serve as durable task memory.
A snapshot should be taken before the new question consumes the active context, ensuring the deep dive remains reversible. The task state file, located at .local/scratch/task-state.md, is visible to both the agent and the reporter, allowing for corrections, updates, and review. The file is stored in the repository and persists across sessions, enabling smooth transitions and reducing the risk of context loss.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.