---
name: handoff
description: Write HANDOFF.md for a context rollover so the user can /clear and continue in a fresh session. Use when the context-rollover warning fires, when context usage is high, or when the user asks to hand off / roll over / continue in a new session.
argument-hint: "[optional extra notes to carry over]"
allowed-tools: Read, Write, Bash(git status:*), Bash(git branch:*), Bash(git log:*), Bash(git diff:*), Bash(date:*)
---

# Context rollover handoff

Current repo state (captured at invocation):

- Date: !`date '+%Y-%m-%d %H:%M'`
- Branch: !`git branch --show-current`
- Working tree: !`git status --short`
- Diff summary: !`git diff --stat HEAD`
- Recent commits: !`git log --oneline -5`

## Task

Write `HANDOFF.md` at the project root, following the section structure in
[.claude/templates/HANDOFF.template.md](.claude/templates/HANDOFF.template.md)
exactly (same headings, same order). Read the template first.

Fill every section from THIS conversation - not from generic project knowledge:

- Be information-dense and concrete: real file paths, real command names, real
  error messages. No filler prose. Target <= 150 lines total.
- **Failed Attempts / Avoid** is the most valuable section: anything tried in
  this session that did not work goes here, with the reason, so the next
  session never retries it.
- **Next Concrete Step** must be immediately executable by a fresh session with
  zero conversation history (file + action, not a goal).
- **User Preferences / Constraints**: only session-specific instructions; do
  not repeat CLAUDE.md / AGENTS.md content.
- If a section truly has nothing, write `None.` - do not pad.
- Never include secrets, tokens, credentials, or customer data - reference env
  var names or config paths instead.
- Write in English. Overwrite any existing HANDOFF.md.
- If the current task list / TODOs exist in this conversation, they go into
  **Open Tasks** verbatim (minus completed ones).

Extra notes from the user to include, if any: $ARGUMENTS

## After writing

Do not commit anything (HANDOFF.md is gitignored). End your reply with exactly
this instruction to the user:

> HANDOFF.md is ready. Now run `/clear` - when the new session starts,
> HANDOFF.md will be loaded automatically and we will continue from there.
