Wraps up a session so the next one starts from the repo, not from chat, by saving every worktree's work, updating docs and tracker, merging a finished pull request when the owner says so, removing merged worktrees, and writing a handoff for work that continues. Use for "wrap up", "wrap up and merge", "end the session", or "hand off".
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Wrap Up?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/dubbl-a-wrap-up)
---
name: wrap-up
description: Wraps up a session so the next one starts from the repo, not from chat, by saving every worktree's work, updating docs and tracker, merging a finished pull request when the owner says so, removing merged worktrees, and writing a handoff for work that continues. Use for "wrap up", "wrap up and merge", "end the session", or "hand off".
disable-model-invocation: true
---
# Wrap up
Wrap-up ends a session so nothing that matters lives only in this conversation, this machine, or
an unpushed branch. The next session may be a different person, a cloud run, or this one after
`/clear`, and it reads the repo, the pull request, and the tracker, not the chat. So the work is
saved and pushed, the docs and tracker match what changed, finished worktrees are gone, and work
that continues carries one handoff note in the place its setup decides.
The handoff stands alone for a fresh session after `/clear`, which is the normal next start: a
large idle session resumed with --continue or --resume pays to rewrite its whole history into the
cache and carries its failed approaches with it. Resume is the exception, for picking up mid-step
on the same machine within the cache lifetime. So the handoff carries what a fresh session cannot
get from the repo or machine-local auto memory: state, findings, what was tried and failed,
decisions, and the next step, where another
machine or person will find them. Gate verdicts and count tables stay out of it when they re-run in
seconds, and a re-run number cannot be fabricated the way a copied one can; what is costly to
re-derive goes in Findings.
This skill pushes branches, opens draft PRs, edits PR descriptions, files issues, merges, and
removes worktrees, so it never fires on its own. Run it only when asked, and only when a session is
actually ending. A plain "wrap up" never merges on its own; "wrap up and merge" is the owner's
word to merge, per the rules below.
## Repo settings and extension
A repo shapes this skill with lines in its CLAUDE.md, beside `Tracker: Linear` and `Project:`:
- `Handoff: CURRENT.md` keeps the whole handoff in the live file (step 9).
- `Merge: explicit` never offers a merge on a plain "wrap up" (step 5).
A repo may also have `.claude/wrap-up.md`, read if present. Its steps run at three fixed points:
before the merge decision (step 5), after the tracker update (step 7), and at the end, after the
step 10 report is drafted. They add to the house steps and never override them: where one conflicts
with a house safety step (a merge without the owner's word, a red or stuck check, the release
question, `--force`, `--allow-unmerged`, the delete-branch rule), the house step wins and the report says so. A setting
stays a CLAUDE.md line, not a line in that file.
## Default path
Read-only first: a session that wrote nothing (no file edits, commits, pushes, PRs, tracker writes,
handoff edits or other external writes) and has nothing still running says so in one line and
stops. Check, do not recall, since after a compaction the session may not remember its writes:
the skip applies only when every worktree in `git worktree list` has an empty
`git status --short` and no commits ahead of `origin/<default>` (`git log origin/<default>..HEAD`,
run in each),
no open pull request exists from any of their branches (`gh pr list --head <branch>`), and
nothing is running. Any check that fails or cannot run means the full path below; passing them
does not prove the session wrote nothing, so a write the session does remember also runs it.
1. Wait for whatever is still writing (stop it only on the owner's yes).
2. Save and push every worktree of this repo.
3. Finish the docs inside the pull request, and name the session's lessons.
4. Set the tracker links before any merge.
5. Decide whether to merge.
6. On yes, mark ready, wait for green, merge.
7. Update the tracker after the merge.
8. Clean up worktrees from the main checkout.
9. Write the handoff, only for work still continuing.
10. Verify and report.
## 1. Stop
Wait for this session's running subagents and background jobs to report, and end any dev
server or watcher you started. Handing off a tree something is still writing records a state
that is already out of date, and a late write lands on a branch the report said was clean.
Wrap-up never cuts an agent off on its own: a stopped agent sends no final report, and its tree
may be half-edited. When one is still running and would hold the wrap-up up, ask the owner
whether to keep waiting or stop it. Only on a yes, stop it (TaskStop), and say in the handoff
that its tree may be half-edited and its tests must be rerun. Never stop or message another
session's agents, and never end the session itself; the owner closes it.
## 2. Save and push
For each worktree this session created or worked in, not only the one it is standing in (read
`git worktree list`, then keep the ones this session's work touched). Another live session or
builder may be writing in its own worktree (`.claude/worktrees/agent-*` is the usual place), and
committing and pushing its half-written tree would publish work its owner has not finished: report
any other dirty worktree by path and leave it untouched.
- Read `git status --short` for tracked and untracked changes, and `git stash list`. A stash is
never pushed and is shared by every worktree and session on the machine, so it is invisible to
the next session: turn each stash that belongs to this work into a commit by running
`git stash apply <sha>` on the right branch (the sha from `git stash list --format='%H %gs'`),
then drop it by its re-found `stash@{n}`. Never `git stash pop`, since the stack moves under
concurrent sessions and a pop can take someone else's entry; report a stash that is not this
work's by name.
- If the main checkout is dirty on the default branch, move the changes to a new branch in a
worktree and commit there. Never commit on the default branch: the branch guard refuses it, and
it publishes unreviewed work.
- Commit with a descriptive message that says what changed and why. A work-in-progress commit is
fine when the repo squash-merges, because the history collapses and the message is what the next
session reads on the branch. Stage explicit paths, never `git add -A` blindly, so a secret or a
stray build artifact does not ride along.
- Push, then confirm an upstream exists and nothing is ahead of it
(`git status -sb`, or `git rev-list --count @{u}..HEAD` for 0). A push that failed quietly is
work that exists only here.
- If the branch has no pull request, open a draft one with `gh pr create --draft`, so the work has
a page the handoff and the tracker can point to.
## 3. Docs
Finish these inside the pull request, before any merge: a docs edit opened afterwards drifts, and
a merged pull request cannot take it. Where behaviour changed, the README, handbook, CHANGELOG, or
decision record is updated in the same pull request as the change. A pull request that already
merged with its docs lagging gets a follow-up pull request. A lasting learning that is not tied to
a change goes through `/house-rules:revise-docs`. Run the repo's own check command (its CLAUDE.md
or package scripts name it) and read its result; do not copy a verdict from earlier in the
session, because the tree has moved since.
Lessons come before any merge. Run any end-of-session review a skill used in this session defines,
then name the session's lessons, each with its evidence (the `file:line`, command or message that
showed it). Route a lesson through `/house-rules:revise-docs`, or a tracker issue, only on the
owner's yes. When the owner also said merge and a lesson's edit belongs in this same pull request,
ask once whether to hold the merge for it: a merge before the lessons forces a second pull request.
For a release, put that in the release question rather than asking twice.
## 4. Tracker, before the merge
The tracker is the one the repo's CLAUDE.md names, GitHub issues by default. A closing keyword is
parsed when the merge lands, so the words must be right before it, not fixed after.
- **Link each pull request to what it serves, in its title and body.** Use `Part of #N` or
`Refs #N` for partial work, and a closing keyword only on the pull request that finishes its
issue. Never write a closing word beside an ID meant to stay open: GitHub and Linear parse the
keyword and not the words around it, so "does not close #N" still closes it.
- **File each next-cycle item as an issue** after searching for one that already covers it
(`gh issue list --search "<item summary>" --state open`, or the Linear equivalent); use that
issue's number when one does. An issue exists for work someone will do, and a next-cycle item
that never becomes one is a list in prose the next session has to trust.
- **Record anything deferred by decision, with its reason, where the decision already lives** (the
CHANGELOG, a decision record, the code comment at the site), and point to it in the handoff. File
an issue closed as not planned (`gh issue create`, then `gh issue close <N> --reason "not
planned"`), in the tracker above, only when no such place exists. Something simply not done is
not deferred by decision: it stays a next-cycle item or drops.
- **Legacy.** If an open issue titled "Session carryover" exists, close it with a comment pointing
to the issues its content was split into.
## 5. Merge decision
Nothing here merges unprompted: a merge is hard to undo and spends the owner's say. For each pull
request this session owns, decide by what the owner said and what the pull request is. Run the
extension's before-merge steps first.
- **`Merge: explicit` in CLAUDE.md.** Never offer a merge on a plain "wrap up". Merge only on
"wrap up and merge", or on an owner merge word earlier in this same session; a merge relayed from
another session does not count. Otherwise the pull request stays open and step 9 writes the
handoff. The release rule below still asks.
- **It does not look finished** (still a draft by intent, work left, a check red or pending that
is not yet worth waiting for): do not offer. It takes the continuing path, step 9.
- **It looks finished** (not a draft by intent, every check green or about to be, the work done):
with a plain "wrap up", ask the owner once for that pull request, a yes/no `AskUserQuestion`.
Asking again after a no turns the question into pressure. Yes takes the merge path, no keeps the
pull request and writes the handoff.
- **"Wrap up and merge"** takes the merge path without asking, for a pull request that looks
finished.
- **A release always asks.** A pull request whose diff bumps the `version` in any `plugin.json`
(`gh pr diff <N>` on the changed `plugin.json` files) is a release, and the release workflow
(`release.yml`) syncs adopters within minutes of the merge, so a merged release reaches other
repos before anyone can stop it. Ask the owner, even under "wrap up and merge", and in the same
question ask whether to hold that adopter sync first. On a hold, use the repo's hold mechanism
(in house-rules, the `hold-sync` label, which `release.yml` reads from the merged pull request
and so must be on before the merge): run `gh pr edit <N> --add-label hold-sync` and confirm the
label is on (`gh pr view <N> --json labels`) before merging. A repo with no such mechanism has
nothing to hold; say so rather than promise a hold. Merge only on a yes.
## 6. Merge
Only on a yes or "wrap up and merge". The risk is merging unproven work.
- Mark it ready if it is a draft (`gh pr ready <N>`), then wait for the checks:
`gh pr checks <N> --watch`. Green means every required check reported and passed. No checks at
all is not green: on a pull request it usually means a conflict with the default branch or CI
disabled at the repo, so rebase, or report it, and never merge on silence.
- A red or stuck check means no merge. Stuck means a check still pending well past its usual
time; report it instead of watching forever. Say which check, fall back to the continuing path
(step 9), and record the failure, with its exact error, in the handoff. Do not retry the merge,
bypass the check, or merge past it.
- Merge with the repo's method (house squash-merges), and never pass a delete-branch flag from the
worktree holding the branch: the branch is pinned there, and the flag fails noisily. The rules
"Never delete the branch from the worktree being merged" and "Close an issue only on purpose, and
only on claims you checked" in the github rule file govern this step.
- Confirm the pull request's state is merged (`gh pr view <N> --json state`) before treating it as
done. If the merge looked to fail locally, check the state before retrying, since it may have
landed.
## 7. Tracker, after the merge
- **Check what the merge closed.** List the issues the pull request referenced and confirm each is
in the state intended: the finishing one closed, every `Part of` and `Refs` one still open. An
unintended close reads as done to every later reader, so reopen it with a comment saying why.
- **GitHub Projects, only when the repo's CLAUDE.md names a project**, with a line such as
`Project: <owner>/<number>`. Add the pull request or issue with `gh project item-add <number>
--owner <owner> --url <url>`, then set Status with `gh project item-edit`. Adding is idempotent,
but Status is a single-select field set on each call, so read the item's current value first and
skip a field already at the target. If the call fails for the missing scope, print
`gh auth refresh -s project` for the user to run and carry on; do not run it yourself, because it
opens a browser sign-in. The same applies on the continuing path for work still open.
- **Linear, when CLAUDE.md says `Tracker: Linear`**, through its MCP tool. Rely on the pull
request automation to move status, and add one comment on the issue only when state changed in a
way the PR link does not show. Whether a link moves the issue at merge differs by word, so keep
to `Part of` for phased work.
Then run the extension's after-tracker steps.
## 8. Worktree cleanup
Run from the main checkout, which stays on the default branch for reading, merging, and cleanup.
For each worktree this session created or worked in (another session's worktree is its owner's to
remove):
- **Its pull request merged.** The session must leave a worktree before it is removed: if it is
standing in this one, leave it with ExitWorktree, or name its path in the report for the harness
to remove on exit, because removing the directory under a running shell breaks the session. Then
run `scripts/house/cleanup-worktree.sh <worktree-path>` once. It first brings the main checkout
up to origin (so the current copy of the script runs), then removes the worktree, the local
branch, and the remote branch, then prunes the deleted remote ref. Exit 3 means it refused and
left the worktree and branches untouched: report its reasons from stderr and leave the
worktree. It refuses before it removes, so a dry run adds a step and no safety.
`git worktree remove` checks only for dirtiness, and a squash merge leaves the branch looking
unmerged to git, so the script's check against the PR's state is what makes removal safe.
- **Merged, but the owner keeps it for continued work.** When the owner says to keep it, or the
next branch starts there, skip the script: keep the worktree, pull the main checkout
(`git pull --ff-only`), and name the path in the handoff. The next branch starts in it from
`origin/<default>` per the worktree rule.
- **Open or draft pull request, or work continuing.** Keep it, and name its path in the handoff.
- **Pull request closed unmerged.** Ask the user before running the script with `--allow-unmerged`,
since removal throws away work that never landed.
- **Where the script is absent** (a repo not on the github module), make the same checks by hand:
clean tree, nothing ahead of upstream, PR state merged. Never use `--force`; it overrides the
one check that protects uncommitted work. Then run `git fetch --prune` and `git pull --ff-only`
in the main checkout, so the next session starts from the merged state.
## 9. Handoff
Write one only for work still continuing: an open pull request (including one the owner declined
to merge, or whose check failed), a half-finished investigation, or a next step someone else will
take. A merged and finished pull request needs none; say so in the report.
**Where it goes** depends on the repo's setup, so the next session has one place to look:
- `Handoff: CURRENT.md` in the repo's CLAUDE.md: the whole handoff, every field below, goes in the
gitignored live file (see "Keep uncommittable detail in one live file"), with no tracker comment
and no PR `## Handoff` section. The SessionStart handoff pointer reads the PR, so it then finds
nothing in this repo.
- GitHub-only repo: a `## Handoff` section in the pull request description, replaced on each
wrap-up rather than appended, so the description never holds two stale ones.
- Linear repo: a comment on the Linear issue, and the pull request's `## Handoff` section holds
only a one-line pointer to that issue. The SessionStart pointer reads the PR, so the section
must exist.
- No pull request (a research-only session): a comment on the tracker issue.
**Fields**, about one screen, pointers and not copies:
- Updated date and commit SHA.
- Goal.
- State: what works, what is broken, and the exact error text (including a failed check).
- Tried and failed, so the next session does not repeat it.
- Decisions, each with where it is recorded.
- Findings: facts the work established that a re-run would not cheaply reproduce, each with its
source (`file:line`, URL, or the command that showed it).
- One concrete next step.
- Resume checks: the commands the next session runs first and the result to expect, since notes
describe a past tree and the baseline is what it can verify.
- Worktree path, and the `CURRENT.md` path if any. In a public repo give the worktree path
relative to the repo (such as `.claude/worktrees/<name>`), never an absolute home path.
- The staleness disclaimer: "Verify anything here before relying on it, this is a snapshot and the
repo moves."
When this session's context began from a compaction summary, say so in the handoff. Check State
and each recorded Decision against the repo, the pull request, and the tracker before writing
them, since a summary keeps the gist and drops exact values. Carry Tried and failed and the Findings
field forward from the summary, which may be the only place they survive, and mark them as
from the summary. A wrap-up before a planned break beats letting auto-compact summarize.
Write no secret, token, or private URL in any public surface, whether a pull request, an issue, or
a tracker comment, since the comment handoff is as public as the description; those go in
`CURRENT.md`. Write no closing keyword beside an issue ID anywhere in the handoff: the platform
parses it on merge whatever the sentence around it says, so refer to an issue as "see #N" or
`Part of #N`.
### Keep uncommittable detail in one live file
Do this under `Handoff: CURRENT.md`, or when the handoff carries detail that cannot go in an issue,
a tracker, or a commit (record IDs, rollback snapshot paths). Without the setting, status and
decisions still go to the handoff location above.
1. Pick the gitignored directory the repo uses for handoffs, and run
`git check-ignore <dir>/<work>/CURRENT.md` to confirm the file will be ignored (the path need
not exist yet). If it is not, stop and say so; do not write the detail anywhere else. Under
`Handoff: CURRENT.md`, print the handoff in the report instead, for the owner to place.
The directory is in the main checkout, never inside a worktree: a file written under
`.claude/worktrees/` is invisible to the next session started in the main checkout, and the
archive step would miss the live file there. A worktree-isolated session cannot write there,
so leave the worktree first (keep it), then run the ignore check and write from the main
checkout. If it cannot leave, print the handoff in the report for the owner to place.
2. The live file is `<dir>/<work>/CURRENT.md`, one per workstream. If one exists, move it to
`<dir>/<work>/archive/`, renamed by date, before writing the new one.
3. The handoff and the next session's start prompt name that `CURRENT.md`.
## 10. Verify and report
Re-read what was written rather than trusting the command that wrote it: `gh pr view <N>` for the
state and the description, the issue, Linear comment or `CURRENT.md` for the handoff, and
`git status -sb` in each kept worktree for a clean tree with nothing ahead. Then report briefly, in
a form someone skims:
- what was pushed, and to which branches;
- pull requests, opened, updated, or merged, and any merge declined or blocked with why;
- tracker changes, with issue numbers;
- worktrees kept and removed, with the reasons for any kept;
- where the handoff is.
With the report drafted, run the extension's end steps, then give it.
## Escape hatches
- **No `gh` CLI, or it is not authenticated.** Do the local steps (save, commit, docs), say that no
push-side step could run, and print the handoff and the next-cycle items for the person to place
by hand. Nothing merges.
- **The named tracker has no connected tool.** Print the next-cycle and deferred-by-decision items
and let the person file them there by hand.
- **Nothing to hand off, no next-cycle items, or nothing deferred by decision.** Say so plainly in
the report rather than padding it.
## Don't
- Don't run this on its own. It pushes, files issues, merges, and removes worktrees, and fires only
on request.
- Don't merge on a plain "wrap up", ask twice about the same pull request, or merge a release
without asking, including about holding the adopter sync. Under `Merge: explicit`, don't offer a
merge; a release still asks.
- Don't let `.claude/wrap-up.md` or a setting override a house safety step.
- Don't merge past a red or stuck check, and don't pass a delete-branch flag from the worktree
being merged.
- Don't hand off a tree something is still writing.
- Don't use `git add -A` blindly, and don't leave a stash as the only copy of the work.
- Don't put a closing keyword beside an ID meant to stay open, and don't set link words after the
merge that needed them.
- Don't use `--force` to remove a worktree, and don't pass `--allow-unmerged` without asking.
- Don't copy a gate verdict or a counts table into the handoff; they re-run, and a reader trusts
the re-run, not the copy.
- Don't open an issue for a next-cycle item without checking for one that already covers it, and
don't open one for something simply not done.
- Don't skip the staleness disclaimer because the session feels current.
- Don't write handoff detail to a directory the ignore check has not confirmed, and don't leave
more than one live `CURRENT.md` per workstream.
- Don't leave a "Session carryover" issue open once this has run.