Write a handoff document summarizing the current conversation so that a brand-new agent can seamlessly continue the work.
Output location
Save to $TMPDIR/handoff-YYYY-MM-DD-HHMM.md(replace with the actual timestamp). After generating, inform the user of the full path.
Document structure
Organize the handoff document according to the following structure:
- Background and goals — one-sentence overview of the current task
- Completed work — with path/URL references
- Current status — what step has been reached, where it is stuck
- To-do items — what the next agent needs to do
- Recommended skills — list of skills suggested for invocation
- Key context — necessary information such as environment, branch, configuration, etc.
Rules
- Do not repeat content that already exists in other artifacts (spec documents, plans, ADRs, issues, commits, diffs); instead, reference them by path or URL.
- Redaction: remove sensitive content such as API keys, passwords, and personally identifiable information.
- If the user passed in parameters, treat them as the focus direction for the next session and adjust the document content accordingly.
- If the current conversation is extremely short (fewer than 3 substantive exchanges), directly tell the user that there is no need to generate a handoff document, unless the user insists.