name: handoff description: Save a checkpoint and a handoff that a fresh session, another agent, another machine or another person can continue from cold. Use when the user says handoff, hand off, hand this over, save state, save where we are, wrap up, before /compact or compaction, context is almost full, switching to Codex or Claude, moving to another laptop or machine, going offline, signing off for the day, or asks for a git bundle or patches of unpushed work. Not for resuming saved work (pickup) or answering a status question (report). disable-model-invocation: true argument-hint: "[task] [package, for another machine or person]" metadata: phase: ledger
Handoff
Save a ledger checkpoint and a verified HANDOFF.md, plus a portable package when the work leaves this machine or this person.
When to use
- Before compaction, an agent or host switch, going offline, or the end of a work stretch.
- Before the work moves to another machine or another person (add the package, step 7).
- The
pause-safelyplaybook calls this for its checkpoint.
Not for: resuming saved work (../pickup/SKILL.md), or answering a status question (../report/SKILL.md).
Steps
Select the task. Use
../ledger/scripts/ledger.py(in Claude Code${CLAUDE_SKILL_DIR}/../ledger/scripts/ledger.py) withpython3 -Iand--root DIR; syntax is in../ledger/references/commands.md. Take the task bound to this session or the one the user names, never the newest by default. Runstatusand notecheckpoint_revisionas N. If no task exists, start one with../ledger/SKILL.mdfirst. Done when: you can name the task and N.Fold in what only you know. Bring the ledger up to date before writing state: user steering since the last checkpoint, scope changes through
goal-revise --from-file --expected-revision --reason(never silently in the handoff), tracker states withtrack, decisions withdecide, human-only steps withblock --id --need --command. Done when: nothing the next agent needs lives only in this conversation.Make the work durable. In each repository you touched, commit unfinished edits on the feature branch as one
wip:commit, or writegit diff --binary > <task>-uncommitted.patchoutside the repo. Never a baregit stash; never push unless the tier allows it. Stop processes you started unless the next agent needs them, and record the ones you leave running. Done when:git statusis clean, or each leftover change is named in the draft.Draft the six sections. Write a file outside the repo with
## Current state,## Decisions,## Verification,## Dead ends,## Next actions,## Open questions(shape:../ledger/assets/state.example.md). Aim for 2,000–5,000 characters; the cap is 7,000. WriteNonein an empty section. Followevidence-not-diary:- Current state: repo, branch, commit, PR and deploy per change; paths and symbols, not prose.
- Verification: each check with its command, the commit it ran on and the result. Never claim a check you didn't run.
- Dead ends: what failed and why, so nobody repeats it.
- Next actions: numbered; the first is an exact command or edit.
- Point to bulky output by path. No transcript text, no secrets (
secrets-stay-out).
Done when: the draft has all six sections and is under 7,000 characters.
Save the checkpoint. Run
checkpoint --task T --from-file DRAFT --expected-revision N, with--host claude --session ${CLAUDE_SESSION_ID}or--host codex --session "$CODEX_THREAD_ID"before the subcommand. On a revision conflict, read the newer state, merge the facts, and retry with the new N; never retry blindly. In run mode, also runsummary. Done when:statusshows revision N+1.Read it cold. Run
doctor, then read.context-ledger/tasks/T/HANDOFF.mdas an agent with no chat history would. Done when: it shows the new revision, the goal, all six sections, and a first next action you could run without this conversation.Package it for another machine or person. Skip on the same machine. Create a folder outside every repo,
handoff-<task>-<date>/, and write itsREADME.mdfromassets/package.md:- Read this first, in this order.
- Sources of truth, and which one wins (default order from
ledger-is-truth). - State pinned per repo: remote, branch, full commit SHA, PR URL, deployed version.
- Unpushed work as
git bundle create <repo>.bundle <base>..<branch>(thengit bundle verify), orgit format-patch <base>..<branch> -o patches/<repo>/, plus the patch from step 3; a restore command beside each file. - The ledger task:
tar -czf ledger-<task>.tgz -C <root>/.context-ledger tasks/<task>. - What is deliberately not included (secrets,
.env, credentials, transcripts, the private profile) and how the receiver gets each one.
Done when: every bundle verifies, every restore command worked in a scratch clone, and the secret scan in Verify is clean.
Say what is parked. If the session is ending, list what is still running and what was stopped. Done when: the reply below is sent.
Red flags
| If you're thinking | Do this instead |
|---|---|
| "The PreCompact hook will save it." | The hook copies the last saved state; it can't know today's facts. Checkpoint now. |
| "I'll describe what I did today." | Write what is true, why, what was checked and what's next (evidence-not-diary). |
| "Tests passed earlier, so I'll list them as passing." | Record the commit they ran on. If files changed since, mark the result stale. |
| "I'll stash it so the tree looks clean." | Commit wip: on the branch or write a patch file. Every worktree shares the stash (clean-shared-hosts). |
| "The receiver needs the token, I'll put it in the package." | Name the secret and how to sign in, never the value (secrets-stay-out). |
| "The checkpoint conflicted; I'll bump the revision and retry." | Another agent wrote it. Read the newer state and merge first. |
| "We're pausing, so I'll mark the goal complete." | A checkpoint is not completion. Set paused only if the user asked to pause. |
Verify
-
statusshows the new checkpoint revision anddoctorreports no integrity problem. -
HANDOFF.mdhas all six sections and an executable first next action. - Every touched repo is clean, or its leftover change is named with a path.
- Package only: each bundle passes
git bundle verifyand each restore command was run in a scratch clone. - Package only: for every text file, this prints nothing:
python3 -I -c 'import json,sys; print(json.dumps({"hook_event_name":"UserPromptSubmit","prompt":open(sys.argv[1]).read()}))' FILE | ISTACK_GUARD=on ISTACK_GUARD_SECRETS=block python3 -I ../istack-mode/scripts/guard.py
Reply
Handoff <task>: checkpoint r<N> saved (<chars> chars); HANDOFF.md verified at <path>.
Repos: <repo>@<branch> <short sha> <clean | wip commit | patch path>, one per line.
Next action: <one exact command or edit>.
Still running: <process or worker and why, or "nothing">.
Package: <folder> (<files>); receiver starts with pickup, then <command>. [package only]
Waiting on you: <numbered exact commands; omit if none>.
Credits
The six-section checkpoint and the revision-checked write come from context-ledger's context-handoff, by the same author. Referencing existing artifacts instead of copying them, and redacting before handing over, follow Matt Pocock's handoff. Committing work in progress before a pause follows pstack's pause-safely playbook by Lauren Tan.