Worktree Close
Prints a /ship prompt at turn end when the current worktree has unshipped changes, so nothing gets forgotten.
Why use this
Unreviewed worktree branches pile up silently. This hook makes every turn end an explicit checkpoint — either ship the work or toss it — so nothing rots on a forgotten branch.
Lifecycle
Where in the Claude Code session this hook fires.
Fires when Claude finishes its turn and hands back control.
How it works
At every Stop event, checks whether the current worktree has commits ahead of the default branch or uncommitted changes. If so, prints guidance to /ship or discard. Clean worktrees are left in place — pruning happens at SessionStart, not here, because Stop fires after every assistant turn. Silent-fails on any error.
settings.json
What the hook configuration looks like in ~/.claude/settings.json after install.
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "node ~/.claude/plugins/tonone-ai/tonone/tonone-worktree-close.js"
}
]
}
]
}
}Install
This hook
Install Worktree Close
1. Add to marketplace
2. Install this hook
More worktree hooks
All hooksReady to use Worktree Close?