YOU MUST EXECUTE THIS WORKFLOW. Do not just describe it.
Create a handoff document that enables seamless session continuation.
Execution Steps
Given /handoff [topic]:
Step 1: Create Output Directory
mkdir -p .agents/handoff
Step 2: Identify Session Context
If topic provided: Use it as the handoff identifier.
If no topic: Derive from recent activity:
# Recent commits
git log --oneline -5 --format="%s" | head -1
# Check current issue
bd current 2>/dev/null | head -1
# Check ratchet state
ao ratchet status 2>/dev/null | head -3
Use the most descriptive source as the topic slug.
Topic slug format: 2-4 words, lowercase, hyphen-separated (e.g., auth-refactor, api-validation).
Fallback: If no good topic found, use session-$(date +%H%M) (e.g., session-1430).
Step 3: Gather Session Accomplishments
Review what was done this session:
# Recent commits this session (last 2 hours)
git log --oneline --since="2 hours ago" 2>/dev/null
# Recent file changes
git diff --stat HEAD~5 2>/dev/null | head -20
# Research producedls -lt .agents/research/*.md 2>/dev/null | head -3
# Plans createdls -lt .agents/plans/*.md 2>/dev/null | head -3
# Issues closed
bd list --status closed --since 2>/dev/null | -5
```
"2 hours ago"
head
Step 4: Identify Pause Point
Determine where we stopped:
What was the last thing done?
What was about to happen next?
Were we mid-task or between tasks?
Any blockers or decisions pending?
Check for in-progress work:
bd list --status in_progress 2>/dev/null | head -5
### Step 7: Write Continuation Prompt
**Write to:** `.agents/handoff/YYYY-MM-DD-<topic-slug>-prompt.md` (use `date +%Y-%m-%d`)
```markdown
# Continuation Prompt for New Session
Copy/paste this to start the next session:
---
## Context
<2-3 sentences describing the work and where we paused>
## Read First
1. The handoff doc: `.agents/handoff/YYYY-MM-DD-<topic-slug>.md`
2. <Other critical files>
## What I Need Help With
<Clear statement of what the next session should accomplish>
## Key Files
Open Questions
<Question 1>
<Question 2>
<Suggested skill to invoke, e.g., "Use /implement to continue">
### Step 8: Extract Learnings (Optional)
If significant learnings occurred this session, also run post-mortem:
```bash
# Check if post-mortem skill should be invoked
# (if >3 commits or major decisions made)
git log --oneline --since="2 hours ago" 2>/dev/null | wc -l
If ≥3 commits: Suggest running /post-mortem --quick to extract learnings.
If <3 commits: Handoff alone is sufficient; learnings are likely minimal.
Step 9: Report to User
Tell the user:
Handoff document location
Continuation prompt location
Summary of what was captured
Suggestion: Copy the continuation prompt for next session
If learnings detected, suggest /post-mortem --quick
Output completion marker:
<promise>DONE</promise>
If no context to capture (no commits, no changes):
<promise>EMPTY</promise>
Reason: No session activity found to hand off
Example Output
Handoff created:
.agents/handoff/20260131T143000Z-auth-refactor.md
.agents/handoff/20260131T143000Z-auth-refactor-prompt.md
Session captured:
- 5 commits, 12 files changed
- Paused: mid-implementation of OAuth flow
- Next: Complete token refresh logic
To continue: Copy the prompt from auth-refactor-prompt.md
<promise>DONE</promise>
Key Rules
Capture state, not just summary - next session needs to pick up exactly where we left off
Identify blockers clearly - don't leave the next session guessing
List files explicitly - paths, not descriptions
Write the continuation prompt - make resumption effortless
Cite everything - file:line for all references
Integration with /post-mortem
Handoff captures state for continuation.
Post-mortem captures learnings for the flywheel (full knowledge lifecycle).
For a clean session end:
/handoff # Capture state for continuation
/post-mortem --quick # Extract learnings for future
Both should be run when ending a productive session.
Without ao CLI
If ao CLI not available:
Skip the ao ratchet status check in Step 2
Step 8 retro suggestion still works (uses git commit count)
All handoff documents are still written to .agents/handoff/
Knowledge is captured for future sessions via handoff, just not indexed
Examples
Paused Mid-Implementation
User says:/handoff (after working on OAuth flow for 2 hours, need to stop)
What happens:
Agent detects recent commits (5 commits in last 2 hours, auth-related)
Agent checks in-progress work with bd list (issue #42 still open)
Agent identifies pause point: "Completed token generation, about to start refresh logic"
Agent lists key files: auth.go, token.go, research doc, plan doc
Agent writes handoff document with accomplishments and pause state
Agent writes continuation prompt with clear next action
Agent checks commits (5) and suggests running /post-mortem --quick to extract learnings