Live handoff
A long session fills its context with work that is already finished. This skill keeps the part worth carrying forward in one small file, TODO.md in the project root, and updates it the moment anything changes. A fresh context (a new session, /clear, compaction) then needs that file and nothing else to carry on.
Write TODO.md for a reader who has no memory of this session, because that reader will be you.
The five rules
TODO.mdis the live state. It sits in the project root and is the handoff document for the task in progress. If the project has none, create it at the first file change. Keep it under 100 lines, always (blank lines count).- Five sections, exactly these, in this order:
Current Goal,Checklist,Recent Changes (Max 5),Key Decisions & Pitfalls,Next Immediate Step. Do not add, rename or reorder sections. - Update it right after every edit. After any
Edit,WriteorMultiEditcall on a project file other thanTODO.md, updateTODO.mdbefore the next action: before another tool call, before running anything, before replying. A hook reminds you each time. Edits sent together in one message count as one step: update once, straight after, covering all of them. - Read it first. At session start, on resume, and after
/clearor compaction, readTODO.mdbefore anything else and continue fromNext Immediate Step. Do not re-scan the codebase to rebuild context: open only the files that step names. A hook prints the file into your context at those moments. Before your first update, open it once with the Read tool, because Edit refuses a file that was not read. - Prune on every update. Each update removes as well as adds, so the file never grows into the context problem it exists to solve.
Rule 3 is the easy one to skip and the expensive one to skip. A context can end at any moment, and whatever is not in the file by then is gone.
Two limits come before all five rules. A TODO.md that this skill did not write belongs to the user: leave it alone. And where the user has switched live-handoff off, do nothing. Both are under Edge cases.
The file
Use exactly this shape:
# TODO
## Current Goal
One or two sentences: what is being built or fixed, and what done looks like.
## Checklist
- [x] Step that is finished
- [ ] Step still to do
- [!] Step that is blocked: what blocks it
## Recent Changes (Max 5)
- `path/to/file`: what changed and why (newest first)
## Key Decisions & Pitfalls
- A decision and its reason, or a trap and how to avoid it
## Next Immediate Step
The single next action, concrete enough to start cold: the file, the function, the command.
What belongs in each section:
- Current Goal: the task as the user would recognise it. It changes only when the task changes.
- Checklist: the steps of the plan, usually 3 to 12 lines.
[x]done,[ ]to do,[!]blocked or failed, with the reason on the same line. - Recent Changes (Max 5): one line per change, newest first: the file, what changed, and why. A sixth entry pushes the oldest out. Git keeps the full history; this is only the last few moves.
- Key Decisions & Pitfalls: whatever would cost the next reader time to find out again. A choice and its reason, an approach that failed, a limit the user set, a command that must not be run. It is not a diary.
- Next Immediate Step: one action, written as an instruction, for example: "In
src/auth/session.ts, makerefresh()retry once on 401, then runnpm test -- auth." When the work is finished, say so here and name what the user should check.
Updating after an edit
- Add the change to
Recent Changes. If that makes six, delete the oldest. - Tick, add or mark as blocked the
Checklistitems the change affects. - Rewrite
Next Immediate Stepso it describes what happens next from here. - Add to
Key Decisions & Pitfallsonly when you learned something the next reader needs. - Prune, then carry on with the task.
Use Edit on the lines that changed instead of writing the whole file again, and do not narrate the update to the user: the file is the record.
Project files are the ones the task is about. Claude Code's own files (its memory, plans and scratchpad, anything in the temp folder, unless the project itself lives there) and the snapshots in .handoff/ are not, and need no entry. A project file changed some other way (a shell command, a notebook edit, a formatter) gets no reminder from the hook: record it the same way.
Pruning
Check the size at every update. When the file comes near 100 lines, or its lines grow long:
- fold finished checklist items into one line ("- [x] Steps 1 to 4: schema, migration, API, tests");
- delete decisions that no longer affect anything still to do;
- keep one short line per item: no nested lists, no code blocks, no pasted output or logs;
- do not move the overflow into another file. What does not fit was not needed.
Resuming
When a session starts, or after /clear or compaction, the SessionStart hook prints TODO.md under a "LIVE HANDOFF" header. Trust it over your own impression of earlier work and start on Next Immediate Step straight away. Read other files only when that step needs them.
- The user asks for something else first. Do it. For a side request (a question, a small fix) leave
Current Goal,ChecklistandNext Immediate Stepas they are; a project file you changed still gets its line inRecent Changes. Rewrite the file for new work only when it replaces the task, and if the checklist still has open items, tell the user before you drop them. - The file disagrees with the code. The code is right. Correct the file first, then continue.
Edge cases
- A
TODO.mdthat live-handoff did not write. Many projects have their ownTODO.md. If the one you find is not empty and has fewer than three of these five section headings, it is the user's file: do not restructure it, prune it or add sections to it, and do not keep live-handoff state in that project. Reminders and snapshots stop there, and the session-start hook says so in one line. Convert it only when the user asks: save the original under another name first (for exampleTODO.original.md), never delete content you did not write, and say what you did. An emptyTODO.md, or a live-handoff file that has lost a section, is still live-handoff's: put the five sections back at the next update. - Subagents do not touch
TODO.md. Several helpers rewriting one file collide. If you are a subagent, list every file you changed, and why, in your final report. If you are the main session, record a subagent's changes when it returns. - Nothing was edited. A session that only reads or answers questions has nothing to record. Do not create
TODO.mdfor it. .handoff/is not yours to edit. It holds a snapshot ofTODO.mdtaken before each compaction (.handoff/latest-handoff.mdis the newest), as a fallback ifTODO.mdis lost or damaged.- Switched off. The user turns live-handoff off with a file named
.live-handoff-offin the project root, or withLIVE_HANDOFF_DISABLE=1in the environment. The session-start hook then says so in one line. Where it is off, do not create or updateTODO.md, whatever the rules above say.
How the hooks help
Three hooks in the user's Claude Code settings run scripts/sync_state.py from this skill's folder:
- after
Edit,WriteorMultiEditon a project file: a short reminder to updateTODO.md, or to create it when the project has none; - at session start, on resume, after
/clearand after compaction: printsTODO.md; - before compaction: copies
TODO.mdinto.handoff/.
The reminders are a safety net. The rules above apply with or without them, except where live-handoff is switched off or the TODO.md is not its own.