How to create and remove worktrees¶
Problem¶
You want an agent to work in an isolated checkout of a repository, without touching your main working copy.
Prerequisites¶
- A running API (see the tutorial).
- At least one repository registered in Agentic.
Steps¶
- Open Repositories in the sidebar. Use Browse to pick folders on the machine; select several at once if you want. Git repositories are marked in the picker.
- Optionally create a Repository group under Settings → Repository groups to name a set of related repositories. Pointing a task at a group tells the agent which checkouts may hold information relevant to the task.
- Associate the task with one or more repositories using the
repositories:chips on its header, or with a repository group. - Open the task's Worktrees panel and create a worktree.
Agentic runs
git worktree addand creates the checkout underAGENTIC_WORKTREE_ROOT(~/.agentic/worktreesby default). - To open the checkout in your editor, set an Editor URL template in Settings, then use the Open in editor button on the worktree.
A local VS Code template is
vscode://file{path}.
Remove a worktree¶
Remove the worktree from the task's Worktrees panel when the work is done. The Inbox also suggests removing a worktree left behind by a closed task, so leftovers surface without a manual sweep.
Verification¶
The task's Worktrees panel lists the checkout, and the path exists on disk until you remove it.
Related¶
- Run an agent against a task uses the worktree as the working directory.
- CLI reference for
agentic worktree createandagentic repository.