Generate a comprehensive handoff document capturing the current state of work for seamless continuation by another agent or developer.
Workflow
Step 1: Gather Context
Run these commands in parallel to understand the current state:
git status — see all tracked/untracked files and staging state
git diff — see unstaged changes
git log --oneline -10 — recent commits to understand work trajectory
git branch --show-current — current branch name
git remote get-url origin — repository name (if available)
Also check for active todos in the todo system.
Step 2: Confirm Save Location
- List all folders in
.specs/
- Match the current branch name, modified files, or recent commit messages to spec folder names
- Use
AskUserQuestion to confirm the save location with the user:
- If a likely match is found, suggest it as the recommended option
- Always include other spec folders as alternatives
- Always allow the user to specify a custom path
- Only proceed after the user confirms the location
Step 3: Analyze Work State
- Work Completed — analyze recent git commits, review completed todos, identify patterns in changes made
- Work In Progress — active todo items, uncommitted changes, files currently being modified
- Work Remaining — pending todo items, blockers, dependencies, priorities
- Context — branch strategy, important decisions, known issues, relevant file paths with line numbers
Step 4: Write the Handoff Document
Save the file as handoff--{YYYY-MM-DD-HH-mm}--{brief-work-summary}.md in the confirmed location.
- Use
date +"%Y-%m-%d-%H-%M" to get the correct local timestamp
{brief-work-summary} is a short kebab-case description of the work (e.g., add-cart-api, fix-auth-redirect, refactor-review-section)
Use this structure:
# Handoff Context - {Date Time}
## Project
- Repository: {repo name if available}
- Branch: {current branch}
- Spec: {spec folder path if found}
- Last Updated: {timestamp}
## Current Status
### What's Been Done
{List completed work, recent commits, changes made}
### What's In Progress
{Current todo items, ongoing work}
### What's Next
{Pending tasks, blockers, priorities}
## Technical Context
### Modified Files
{List files changed with brief description}
### Key Decisions
{Important architectural or implementation decisions}
### Known Issues
{Bugs, blockers, or things to watch out for}
## Dependencies & Prerequisites
{External dependencies, required setup, environment notes}
## Additional Notes
{Any other relevant context for continuation}
Step 5: Report
After saving, display:
- The full file path where the handoff was saved
- A brief summary of the current state
User Arguments
$ARGUMENTS
Important Notes
- Be concise but comprehensive — focus on actionable information
- Include specific file paths with line numbers where relevant
- Do NOT commit the handoff file automatically
- If the user provided notes via arguments, include them in the "Additional Notes" section
1---2name: handoff3description: Capture current work context for handoff to another agent/developer. Gathers git state, todos, and modified files into a structured handoff document saved to the related spec folder.4---56Generate a comprehensive handoff document capturing the current state of work for seamless continuation by another agent or developer.78## Workflow910### Step 1: Gather Context1112Run these commands in parallel to understand the current state:13- `git status` — see all tracked/untracked files and staging state14- `git diff` — see unstaged changes15- `git log --oneline -10` — recent commits to understand work trajectory16- `git branch --show-current` — current branch name17- `git remote get-url origin` — repository name (if available)1819Also check for active todos in the todo system.2021### Step 2: Confirm Save Location22231. List all folders in `.specs/`242. Match the current branch name, modified files, or recent commit messages to spec folder names253. Use `AskUserQuestion` to confirm the save location with the user:26 - If a likely match is found, suggest it as the recommended option27 - Always include other spec folders as alternatives28 - Always allow the user to specify a custom path294. Only proceed after the user confirms the location3031### Step 3: Analyze Work State32331. **Work Completed** — analyze recent git commits, review completed todos, identify patterns in changes made342. **Work In Progress** — active todo items, uncommitted changes, files currently being modified353. **Work Remaining** — pending todo items, blockers, dependencies, priorities364. **Context** — branch strategy, important decisions, known issues, relevant file paths with line numbers3738### Step 4: Write the Handoff Document3940Save the file as `handoff--{YYYY-MM-DD-HH-mm}--{brief-work-summary}.md` in the confirmed location.4142- Use `date +"%Y-%m-%d-%H-%M"` to get the correct local timestamp43- `{brief-work-summary}` is a short kebab-case description of the work (e.g., `add-cart-api`, `fix-auth-redirect`, `refactor-review-section`)4445Use this structure:4647```markdown48# Handoff Context - {Date Time}4950## Project51- Repository: {repo name if available}52- Branch: {current branch}53- Spec: {spec folder path if found}54- Last Updated: {timestamp}5556## Current Status5758### What's Been Done59{List completed work, recent commits, changes made}6061### What's In Progress62{Current todo items, ongoing work}6364### What's Next65{Pending tasks, blockers, priorities}6667## Technical Context6869### Modified Files70{List files changed with brief description}7172### Key Decisions73{Important architectural or implementation decisions}7475### Known Issues76{Bugs, blockers, or things to watch out for}7778## Dependencies & Prerequisites79{External dependencies, required setup, environment notes}8081## Additional Notes82{Any other relevant context for continuation}83```8485### Step 5: Report8687After saving, display:88- The full file path where the handoff was saved89- A brief summary of the current state9091## User Arguments9293$ARGUMENTS9495## Important Notes9697- Be concise but comprehensive — focus on actionable information98- Include specific file paths with line numbers where relevant99- Do NOT commit the handoff file automatically100- If the user provided notes via arguments, include them in the "Additional Notes" section