exit_worktree — remove, merge, or abandon a worktree
exit_worktree is the cleanup half of the worktree pair. Each action resolves the worktree differently:
| Action | Effect |
|---|---|
remove | git worktree remove <path>. Branch is kept; tree is deleted. |
merge | Switch to the worktree’s parent branch, fast-forward merge the worktree branch, then remove. |
abandon | remove + git branch -D <name>. Both tree and branch are gone. |
Schema
Section titled “Schema”| Arg | Type | Required | Description |
|---|---|---|---|
worktree_path | string | yes | Filesystem path of the worktree to operate on. |
action | string | yes | remove, merge, or abandon. |
Example invocation
Section titled “Example invocation”{"worktree_path": "/Users/me/dev/chimera-spike-redis-backend", "action": "merge"}from chimera.tools.worktree_tool import ExitWorktreeTool
tool = ExitWorktreeTool()result = tool.execute( {"worktree_path": "/Users/me/dev/chimera-spike-redis-backend", "action": "abandon"}, env=local_env,)Output sample
Section titled “Output sample”Abandoned worktree '/Users/me/dev/chimera-spike-redis-backend' (deleted tree, deleted branch 'spike-redis-backend').mergerefuses to run if the worktree has uncommitted changes; commit (orremoveand accept the loss) first.abandonis destructive. Behind thePermissionslayer it should require explicit approval.