Write a handoff document summarising the current conversation so a fresh agent can continue the work. It MUST be saved to the user's OS temporary directory via $TMPDIR and nowhere else. Never write it into the project directory, the user's home directory, or any other location. Resolve the temp directory from the $TMPDIR environment variable (or os.tmpdir() in code) — on macOS this is typically ${TMPDIR} under /var/folders/..., so do not hardcode /tmp. Only deviate from the OS temp directory when the user explicitly specifies a different path; otherwise the temp directory is non-negotiable.
Include a "suggested skills" section in the document, which suggests skills that the agent should invoke.
Do not duplicate content already captured in other artifacts (specs, plans, ADRs, issues, commits, diffs). Reference them by path or URL instead.
Redact any sensitive information, such as API keys, passwords, or personally identifiable information.
If the user passed arguments, treat them as a description of what the next session will focus on and tailor the doc accordingly.
Output a copy-pasteable prompt
After saving the document, also print a ready-to-paste raw markdown prompt the user can copy to start the next session. It must be wrapped in a markdown code fence so it can be copied verbatim (including any code blocks inside it). The prompt should:
- Name the file to read first, e.g. "Read the handoff at
${TMPDIR}/<filename>." (The printed prompt must reference the$TMPDIR-based path the save used — if the user overrode the location, reference that path instead.) - Restate the next session's goal in one or two sentences (from the handoff's purpose).
- List the suggested skills as
/skillinvocations, one per line. - Tell the agent to work through the handoff and confirm once done.
Keep it short — it's a kickoff, not the handoff itself.