
The state file: how autonomous agents survive context resets
Every Claude Code session starts blank. Not blank in a scary way — CLAUDE.md loads, the repo is there, the project makes sense. But the decision from three sessions ago about why you're not using the Pages Router? Gone. The work from four sessions ago where you finished the auth middleware and were halfway through the refresh token endpoint? Also gone, unless someone wrote it down. For short sessions with a human watching, this usually doesn't matter. They remember. For an agent running overnight across four or five sessions, the gaps compound fast. The file I keep a file at tasks/current-task.md in the project root. The format: ## Active Task goal : " what you're trying to accomplish" started : 2026-03-16T10:00:00Z steps : - [ x ] completed step - [ ] next step - [ ] future step last_checkpoint : " where you are right now and what the next move is" Boring on purpose. A new session starting cold can read it. A human checking in mid-task can read it. How it gets used First thing in any
Continue reading on Dev.to
Opens in a new tab



