Get started
All recipes

Handing work between agent sessions

End a session so the next one - or the next person - starts from what happened, not from an empty context window.

Anyone whose work is done across many short agent sessions.15 minutes
save_documentget_product_contextappend_log_entrylist_changes

The situation

An agent session ends. The next one starts with nothing, so the first ten minutes are spent re-reading code to rebuild a picture that existed an hour ago - and the parts that were never in the code, the reasons, are simply lost.

1. Keep one handoff document

The convention is a document with the slug agent-handoff inside the product. It rides in get_product_context automatically, so the next session gets it without being told to look.

Write it as the state of play, not a diary: what is in flight, what was decided and why, what is blocked and on whom, what to do next.

2. End every session with the same instruction

Update the agent-handoff document with save_document. Replace it, do not append - it is the CURRENT state. Then append one line to the changelog log with append_log_entry, saying what actually shipped.

The two are different on purpose. A document is rewritten whole and keeps a revision history; a log is appended to and read from the tail. Using a document as a log means every append copies the whole body, which is how a changelog grows to a hundred kilobytes and gets slower with every entry.

3. Start every session with the other half

Call get_product_context. Read the handoff and the open decisions before proposing anything.

4. Catch up on what happened elsewhere

If work continued while this agent was away - other people, other sessions - list_changes with a stored cursor answers "what moved since I last looked", by kind, so it re-reads only what matters.

What this buys you

The handoff stops depending on whoever remembers to write one. The document has revisions, so you can see what the picture was last Tuesday; the log has a strict order, so "when did that ship" has an answer. And the decisions - the part that never survives in code - are recorded where the next agent already looks.