Write a session handoff¶
The successor must reach its first useful action from the HeyAira task alone.
Use this procedure in any interactive MCP client when asked to hand off, at
task completion, a topic change, the end of the day, or when context is past
roughly half the window. Coding runs started with scripts/heyaira-run.sh
report to the coordinator, who records results with task_update. Write durable
fields in the project's working language; never copy conversation history,
repository contents or secrets into HeyAira.
- Check identity. Call
server_identityfor the intended project and compare resource, instance and project with the supplied profile. Stop on mismatch.write_contextuses that pinned profile, never guessed values. - Find the task. Use the supplied ID, the task already read in this
session, or
task_list(status=in_progress)matched by title/tags. If there is no single clear task, ask for clarification. If the work has no task, propose creating one and wait for authorization. - Read current state. Call
task_getfor the current version, description, handoff and receipts. Preserve earlier decisions and completed work. - Prepare the handoff and receipt. Record concrete, attributable facts:
handoff_completed: repository (owner/nameor URL), branch, commits and PR references; distinguish prepared code, tested behavior, deployed state and verification in production. Include actual commands and test totals; identify unrun checks. Do not imply a deployment from a passing test.handoff_next: the first executable command or instruction (with file, branch or PR), then remaining steps in order. End withPrevious session: <session-reference>using a native session ID if available, otherwise a stable label explicitly identified as a label.handoff_blockers: what blocks, who moves next and what is needed; empty when nothing blocks.summary: at most 280 characters describing the current state in one sentence for the next session's task list.work_receipt: actualsession_ref,harness,model,branch,base_commit,result_commit,tests,completed_work,next_stepandblockers. It has no repository field: put the repository in the handoff. Save decisions that must outlive the task withmemory_add(kind=decision)and name their IDs inhandoff_next; keep task-specific agreements in the handoff. Use a useful one-sentence summary for every write.- Write and verify. Call
task_updatewith matchingwrite_contextand currentexpected_version. Follow the project's work contract: usein_progressfor an authorized session continuation,todowhen releasing paused work with no owner,blockedwith the three-part blocker, ordoneonly when the completion criteria and required reviews are met (plusRESULT). Onversion_conflict, re-read and merge; never overwrite. Calltask_getagain and confirm the new version and saved fields. - Return a portable line. Say what was saved and give
handoff: <first 8 characters of task UUID> v<saved version>to paste into a fresh session. The successor followstake-over-session; no client slash command is required. This session stops working on the task after handoff. - Late messages. Do not act on new task messages in this old session. Find
the successor from the task's
Taken over by session ...line or available session metadata. Forward when messaging is available and authorized, with sender attribution; tell the sender where work moved. If there is no successor yet, return the versioned handoff line. Do not use messaging as durable project state.
If the client has session-management tools (for example Claude Desktop), use
get_session("self") for the actual session ID and client harness in the
receipt and Previous session: line; a scratchpad or transcript directory
name is not the session ID. The successor may use list_sessions,
archive_session and set_session_title to take over the old title and handle
messages. Do not archive this session yourself: the successor archives it
after confirming takeover and reading messages in flight. If these tools are
unavailable, report that fact without promising archival or message delivery.