Write a handoff document summarising the current conversation so a fresh agent can continue the work via the companion /resume-session-handoff skill. The file is saved to a predictable, discoverable location inside the project — the next session does not need to be told the path.
Do not duplicate content already captured in other artifacts (PRDs, plans, ADRs, issues, commits, diffs). Reference them by path or URL instead.
If the user passed arguments, treat them as a description of what the next session will focus on, write them into the focus frontmatter field, and tailor the document body accordingly.
Workflow
- Resolve the project root. Try in order:
git rev-parse --show-toplevel 2>/dev/null— if non-empty, that is the root.- Else walk upward from
pwdlooking for the first ancestor that contains a.claude/directory; that ancestor is the root. - Else fall back to
pwditself and warn the user: "not in a git repo and no.claude/ancestor found — writing to./.claude/handoffs/. Discovery from sibling dirs may be inconsistent."
- Ensure the handoff directory exists.
mkdir -p <root>/.claude/handoffs. Theresumed/subdir is created lazily by/resume-session-handoff, not here. - Auto-add gitignore entry (only when step 1 resolved via git):
- If
<root>/.gitignoreexists and does not already contain a line matching/.claude/handoffs/(or a broader pattern that covers it), append/.claude/handoffs/on its own line, preceded by a blank line if the file does not end with one. - If
<root>/.gitignoredoes not exist, create it with the single line/.claude/handoffs/. - Skip this step entirely when not in a git repo.
- If
- Pick a slug.
- If
$ARGUMENTSis non-empty, slugify it: lowercase, replace any run of non-[a-z0-9]with-, trim leading/trailing-, collapse repeated-, cap at 40 characters (cut on a-boundary if possible). - Else pick a 2–3 word slug from the conversation goal, then slugify the same way.
- Slug must be non-empty; if slugification yields the empty string, use
session-handoff.
- If
- Compose the filename.
YYYY-MM-DD-HHMM-<slug>.mdusing local time. If a file with that exact name already exists (same minute + same slug), append-2,-3, ... before.mduntil you find an unused name. - Scan the conversation. Pull out: the user's goal, decisions made, blockers hit, what's been tried, what's been ruled out, files touched, commands run, and any uncommitted state.
- Find the artifacts. Note every PRD / plan / ADR / issue / commit / PR / diff / log produced this session. Reference them by absolute path or URL — never paste their content.
- Tailor to the focus. If
$ARGUMENTSdescribes what the next session will do, prune the body to what that session needs. Drop history irrelevant to the next move. - Suggest skills. Recommend specific skills the next agent should invoke (e.g.
/tdd,/eng-spec,/repo-context-scan). Only suggest skills you actually know exist in the user's environment. - Atomic write. Write the document to
<filename>.tmpfirst, thenmvit to the final name. This avoids leaving a half-written file if anything dies mid-write. Read the temp file before writing it (required by the Write tool contract). - Print the resume hint. On its own line, print exactly:
Print the absolute path of the written file on a second line so the user can grep for it if needed, but make clear they do not need to remember the path —Next session: run /resume-session-handoff (or install with `npx skills@latest add amit-t/skills --skill resume-session-handoff`)./resume-session-handoffdiscovers it automatically. (Note: the skill isresume-session-handoff, notresume, because most agents already ship a built-in/resumethat restores the previous conversation transcript and would shadow this skill. The write side is namedsession-handoff, nothandoff, because Devin already ships a built-in/handoffthat would shadow it.)
Document structure
YAML frontmatter for machine-readable fields (parsed by /resume-session-handoff's preflight), markdown body for the human-readable prose. Skip body sections that don't apply — empty sections are noise.
---
focus: "<from $ARGUMENTS, empty string if absent>"
created: <ISO-8601 local timestamp, e.g. 2026-05-13T14:30:00-07:00>
cwd: <absolute path of pwd at write time>
project_root: <absolute path resolved in step 1>
branch: <current git branch, or "" if not in git>
worktree: <git worktree path if different from project_root, else "">
uncommitted_files: <integer count of `git status --porcelain` lines, or 0>
status: open
resumed_at: null
---
# Handoff — <one-line title>
## Goal
<what the user is ultimately trying to do — 1–3 sentences>
## State right now
- Where execution stopped and why.
- What is committed vs. uncommitted vs. lost-if-not-resumed.
## Decisions made
- <decision> — <one-line rationale>
## Ruled out
- <approach> — <why it was rejected> (so next agent doesn't re-try it)
## Open questions / blockers
- <question> — <what would unblock it>
## Artifacts (do not re-derive)
- `path/to/prd.md` — <what it covers>
- `https://github.com/.../pull/123` — <status>
- commit `abc1234` — <what it landed>
## Next moves
1. <concrete first step>
2. <second step>
3. ...
## Suggested skills for next session
- `/skill-name` — <why it fits the next move>
## Environment notes
- Tools, env vars, secrets, services, running processes — anything the next agent must know that isn't obvious from the repo.
Rules
- Reference, don't duplicate. If a PRD already says it, link the PRD. If a commit already does it, cite the SHA.
- Be specific. "Fix the bug" is useless; "rerun
pnpm test packages/api/auth.test.tsafter changingverifyTokento readreq.cookies.session" is a handoff. - Capture failures. What was tried and didn't work matters as much as what worked.
- Cite paths absolutely. Use absolute paths so the next agent doesn't have to guess
cwd. - No emojis, no filler, no apologies. This document is operational, not narrative.
- Frontmatter is the source of truth for machine fields.
/resume-session-handoffonly reads frontmatter for its preflight checks (branch, cwd, uncommitted count, status). Keep the body for humans. - Don't move the file yourself.
/resume-session-handoffmoves it to.claude/handoffs/resumed/on user confirmation./session-handoffonly writes.
Companion skill
/resume-session-handoff is the read side of this pair. Whenever a fresh session needs to pick up where this one left off, the user invokes /resume-session-handoff and the newest open handoff in .claude/handoffs/ is loaded automatically. Install both skills together:
npx skills@latest add amit-t/skills --skill session-handoff
npx skills@latest add amit-t/skills --skill resume-session-handoff
When NOT to use
- Conversation is short and the next agent can read the transcript directly.
- A plan, PRD, or issue already captures the state — point at it instead.
- Mid-debugging on a single bug where transferring context costs more than just finishing it.