source dump of claude code
23
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 32 lines 2.0 kB view raw
1export function getExitWorktreeToolPrompt(): string { 2 return `Exit a worktree session created by EnterWorktree and return the session to the original working directory. 3 4## Scope 5 6This tool ONLY operates on worktrees created by EnterWorktree in this session. It will NOT touch: 7- Worktrees you created manually with \`git worktree add\` 8- Worktrees from a previous session (even if created by EnterWorktree then) 9- The directory you're in if EnterWorktree was never called 10 11If 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. 12 13## When to Use 14 15- The user explicitly asks to "exit the worktree", "leave the worktree", "go back", or otherwise end the worktree session 16- Do NOT call this proactively — only when the user asks 17 18## Parameters 19 20- \`action\` (required): \`"keep"\` or \`"remove"\` 21 - \`"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. 22 - \`"remove"\` — delete the worktree directory and its branch. Use this for a clean exit when the work is done or abandoned. 23- \`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\`. 24 25## Behavior 26 27- Restores the session's working directory to where it was before EnterWorktree 28- Clears CWD-dependent caches (system prompt sections, memory files, plans directory) so the session state reflects the original directory 29- 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) 30- Once exited, EnterWorktree can be called again to create a fresh worktree 31` 32}