Write a handoff document that summarizes the current conversation so that a brand-new agent can continue the work seamlessly.
Output location
First resolve the system temporary directory of the current platform, then save it as handoff-YYYY-MM-DD-HHMM.md(replace with the actual timestamp). Prefer platform APIs, such as Python's tempfile.gettempdir(); on Unix environments you can use $TMPDIR, and if it is not set, fall back to /tmp. After generating it, tell the user the full absolute path.
Document structure
Organize the handoff document according to the following structure:
- Background and goals — summarize the current task in one sentence
- Completed work — with path/URL references
- Current status — how far it has progressed and where it is stuck
- To-do items — what the next agent needs to do
- Recommended skills — a list of skills suggested for invocation
- Key context — necessary information such as environment, branch, and configuration
Rules
- Do not repeat content that already exists in other artifacts (spec documents, plans, ADRs, issues, commits, diffs); instead, reference it by path or URL.
- Redaction: remove sensitive content such as API keys, passwords, and personally identifiable information.
- If the user passes in parameters, treat them as the focus direction for the next session and adjust the document content accordingly.
- If there is no substantial progress in the conversation worth handing off, state that honestly and hand over the small amount of existing content; do not fabricate just to fill out the structure.