codex_cleanup_worktree
Remove a managed Git worktree after its branch is verified and merged or discarded. Use it to clean up task workspaces safely, with options to force removal or delete the branch.
Instructions
Remove a managed Git worktree created with use_worktree=true after Gemini has verified and merged (or discarded) its branch.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"task_id": "<task_id>"
},
"name": "codex_cleanup_worktree"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | Force removal even with uncommitted changes or unmerged branch. | |
| task_id | Yes | The task_id whose managed worktree should be removed. | |
| delete_branch | No | Also delete the codex/<task_id> branch. |