Sweep 22 Sep 2026 · 17:19Z Build v2.1.280 501 read Stable v2.1.267 Latest v2.1.280 Next v2.1.280 Feeds RSS JSON llms.txt Unofficial
Tool description

ExitWorktree, as sent

SDK-CLI Agent SDK, print mode, v2.1.280. 27 model strings share this prompt, byte for byte.

Lines301,923 characters
Moved+0−0 against v2.1.278
Reach27model strings receive this description
Copies1distinct descriptions under this name
Parameters21 of them required Tools in captureall of themevery description on this arm
Plain text · sha256 63e763304c95

The description, rendered

This renders the markdown inside the description, so it isn’t quite the description itself.

The raw view and the plain text are the bytes as they were sent.

Exit a worktree session created by EnterWorktree and return the session to the original working directory.

Scope

This tool ONLY operates on worktrees created by EnterWorktree in this session. It will NOT touch:

  • Worktrees you created manually with git worktree add
  • Worktrees from a previous session (even if created by EnterWorktree then)
  • The directory you're in if EnterWorktree was never called

If called outside an EnterWorktree session, the tool is a no-op: it reports that no worktree session is active and takes no action. Filesystem state is unchanged.

When to Use

  • The user explicitly asks to "exit the worktree", "leave the worktree", "go back", or otherwise end the worktree session
  • Do NOT call this proactively — only when the user asks

Parameters

  • action (required): "keep" or "remove"
    • "keep" — leave the worktree directory and branch intact on disk. Use this if the user wants to come back to the work later, or if there are changes to preserve.
    • "remove" — delete the worktree directory and its branch. Use this for a clean exit when the work is done or abandoned.
  • discard_changes (optional, default false): only meaningful with action: "remove". If the worktree has uncommitted files or commits not on the original branch, the tool will REFUSE to remove it unless this is set to true. If the tool returns an error listing changes, confirm with the user before re-invoking with discard_changes: true.

Behavior

  • Restores the session's working directory to where it was before EnterWorktree
  • Clears CWD-dependent caches (system prompt sections, memory files, plans directory) so the session state reflects the original directory
  • If a tmux session was attached to the worktree: killed on remove, left running on keep (its name is returned so the user can reattach)
  • Once exited, EnterWorktree can be called again to create a fresh worktree

What it accepts

2 parameters The JSON parameter schema sent beside this description, 557 characters of it. Name, type, then whether the client marked it required.
action keep | remove required "keep" leaves the worktree and branch on disk; "remove" deletes both.
discard_changes boolean optional Required true when action is "remove" and the worktree has uncommitted files or unmerged commits. The tool will refuse and list them otherwise.

sha256 426b4289b647 · the schema as the client sent it:

{ "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, "properties": { "action": { "description": "\"keep\" leaves the worktree and branch on disk; \"remove\" deletes both.", "enum": [ "keep", "remove" ], "type": "string" }, "discard_changes": { "description": "Required true when action is \"remove\" and the worktree has uncommitted files or unmerged commits. The tool will refuse and list them otherwise.", "type": "boolean" } }, "required": [ "action" ], "type": "object" }