Skip to content

Creating Worktrees from a Bot

In a Bot’s dedicated chat, which you open in the Bots view, you can specify a workspace name and ask the Bot to create a worktree in that workspace. In the same way, you can also ask it to delete a worktree.

Creating and deleting worktrees by specifying a workspace is not available from a regular worktree chat or from the Super Secretary.

Use it when you are interacting with a Bot in the Bots view and want to prepare a worktree for working on an issue without switching to the Projects view.

  1. In the Bots view, choose a Bot and open its dedicated chat.

  2. Give the workspace name and an issue number or branch name, and ask the Bot to create a worktree.

    Example request:

    Create a worktree for issue #10 in expense-api

  3. A confirmation dialog appears before the worktree is created. Check the details and press “Allow”. When Tool Permission under Agent in Settings is set to “Auto Allow”, the confirmation dialog does not appear.

  4. When creation finishes, the Bot reports the branch and location it created.

  5. When you switch to the Projects view, the new worktree appears under the workspace in the sidebar.

The following image shows the completion report after asking for a worktree in a Bot’s dedicated chat.

Release Coordinator’s dedicated chat open in the Bots view, showing the completion report with the branch feature/issue-10 and the location in response to the request “Create a worktree for issue #10 in expense-api”

  • Specify the workspace by the name shown in the sidebar. The worktree is created only when exactly one workspace matches the name exactly. If none is found or more than one matches, nothing is created and candidates are returned.
  • When you give an issue number (for example, 123 or #123), the worktree is created with the branch feature/issue-<number>. You can also give a branch name (for example, fix/login).
  • If you do not give the workspace name, or an issue number or branch name, the Agent asks for it.
  • The new branch is created from the remote default branch (the branch that origin/HEAD points to) after a fetch.
  • Creating a worktree does not switch the current conversation.

For worktree basics, see Multiple Worktrees.

  1. In a Bot’s dedicated chat, give the workspace name and the worktree’s branch name, and ask the Bot to delete it.

    Example request:

    Delete the feature/issue-10 worktree in expense-api

  2. A confirmation dialog appears before the worktree is deleted. Check the details and press “Allow”. When Tool Permission under Agent in Settings is set to “Auto Allow”, the confirmation dialog does not appear.

Deleting a worktree deletes its folder and branch, and stops the Agent and terminals of that worktree. It is not deleted in the following cases.

  • The main working tree, a folder not managed by git, or the root of the workspace
  • A worktree that is being deleted
  • A worktree whose main Agent is running or starting
  • A worktree with uncommitted changes