What
A worktree is a separate working copy of your project that a session can work in. The ExitWorktree tool can remove it, and with discard_changes it throws away any work in it. That case is now handled more strictly:
- The removal now goes through the permission step and asks you, instead of being checked earlier and refused there.
- If the session has already left the worktree, the call is denied with the message
The session left its worktree before this call ran. - Auto mode's safety check now sees the action described as
remove the worktree and discard any work in it, not only the bare action name. - An always-allow rule, which would approve the action without asking again, can no longer be used for this case.
Why
Deleting a worktree together with its unsaved work cannot be undone, so it now asks each time and cannot be pre-approved permanently.
Names in the bundlediscard_changes
The entry above is what we published on the day. These lines were added later, as Anthropic's own pages caught up, and they sit beside the original rather than replacing it.
Confirmed since
Anthropic's documentation has since written up discard_changes, on Hooks reference.
When `claude remote-control` cleans up a worktree, expect your hook to run without a prompt. If you ask Claude to remove a hook-created worktree, expect `ExitWorktree` to refuse unless Claude passes [`discard_changes: true`](https://code.c…hooks see the edit
Added since
A small documentation edit on Hooks reference touched a line naming discard_changes after this was published.
For a `claude remote-control` cleanup, Claude Code runs your hook without prompting you. `ExitWorktree` refuses to remove a hook-created worktree unless the call passes [`discard_changes: true`](https://code.claude.com/docs/en/agent-sdk/ty…hooks see the edit
One source agreesOne thing we can check says the same as this entry.
Anthropic's documentation agrees
A small documentation edit on Hooks reference touched a line naming discard_changes after this was published.