{
  "id": "249ed2ca9ece1bb478dab8692b6c3969f276611c205fc5a397da0bf74f449c4b",
  "label": "estimate-tool-ExitWorktree",
  "generatedAt": "2026-06-09T00:30:01.941Z",
  "url": "https://api.anthropic.com/v1/messages/count_tokens?beta=true",
  "headers": {
    "anthropic-beta": "claude-code-20250219,context-1m-2025-08-07,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,mid-conversation-system-2026-04-07,advisor-tool-2026-03-01,effort-2025-11-24,token-counting-2024-11-01",
    "anthropic-version": "2023-06-01",
    "content-type": "application/json",
    "x-api-key": "<redacted>"
  },
  "body": {
    "model": "claude-opus-4-8",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "<system-reminder>\nAs you answer the user's questions, you can use the following context:\n# currentDate\nToday's date is 2026-06-08.\n\n      IMPORTANT: this context may or may not be relevant to your tasks. You should not respond to this context unless it is highly relevant to your task.\n</system-reminder>\n\n"
          },
          {
            "type": "text",
            "text": "say hi",
            "cache_control": {
              "type": "ephemeral"
            }
          },
          {
            "type": "text",
            "text": "{\"description\":\"Exit a worktree session created by EnterWorktree and return the session to the original working directory.\\n\\n## Scope\\n\\nThis tool ONLY operates on worktrees created by EnterWorktree in this session. It will NOT touch:\\n- Worktrees you created manually with `git worktree add`\\n- Worktrees from a previous session (even if created by EnterWorktree then)\\n- The directory you're in if EnterWorktree was never called\\n\\nIf 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.\\n\\n## When to Use\\n\\n- The user explicitly asks to \\\"exit the worktree\\\", \\\"leave the worktree\\\", \\\"go back\\\", or otherwise end the worktree session\\n- Do NOT call this proactively — only when the user asks\\n\\n## Parameters\\n\\n- `action` (required): `\\\"keep\\\"` or `\\\"remove\\\"`\\n  - `\\\"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.\\n  - `\\\"remove\\\"` — delete the worktree directory and its branch. Use this for a clean exit when the work is done or abandoned.\\n- `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`.\\n\\n## Behavior\\n\\n- Restores the session's working directory to where it was before EnterWorktree\\n- Clears CWD-dependent caches (system prompt sections, memory files, plans directory) so the session state reflects the original directory\\n- 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)\\n- Once exited, EnterWorktree can be called again to create a fresh worktree\\n\",\"input_schema\":{\"$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\"},\"name\":\"ExitWorktree\"}"
          }
        ]
      },
      {
        "role": "system",
        "content": "The following skills are available for use with the Skill tool:\n\n- deep-research: \n- update-config: \n- keybindings-help: \n- verify: \n- code-review: \n- simplify: \n- fewer-permission-prompts: \n- loop: \n- claude-api: \n- run: \n- init: \n- review: \n- security-review: "
      }
    ],
    "thinking": {
      "type": "adaptive"
    },
    "output_config": {
      "effort": "high"
    },
    "system": [
      {
        "type": "text",
        "text": "x-anthropic-billing-header: cc_version=2.1.168.c27; cc_entrypoint=sdk-ts; cch=e5b75;"
      },
      {
        "type": "text",
        "text": "You are a Claude agent, built on Anthropic's Claude Agent SDK.",
        "cache_control": {
          "type": "ephemeral"
        }
      }
    ]
  },
  "bodyCanonicalSha256": "7b8ea25fed4fb24a9d6dea85ea662c9730c493a52f3d290d2d500fde29d33c57"
}
