Worktrees
Run a chat in your checkout, or give it its own Git worktree so several agents can work in one repository without stepping on each other.
Every chat runs in an environment: the folder its agent reads and writes. There are two kinds.
| Environment | Use it when |
|---|---|
| Local | One chat owns the repository and you want it to edit your current checkout. |
| Worktree | Other chats work in the same repository, you want a separate branch, or you may throw the attempt away. |
A worktree is a second working directory attached to the same Git repository. It shares history with your checkout but has its own files and branch, so two agents can change the same project at once without clobbering each other.
Choosing one
A new chat in a Git project shows a Worktree checkbox next to the branch selector. Tick it and
the chat gets its own worktree on a fresh glade/* branch when you send the first message. The
default for new chats lives in Settings → Git & files.
The Environment panel (the window icon at the top right of a chat) shows where the chat really runs: its working directory, the worktree root, the branch and whether a worktree is still waiting to be created.
Running chats in parallel
Parallel work pays off when ownership is clear.
Works well
- Each chat in its own worktree
- Separate files or subsystems
- A clear objective per chat
- Results you can review one by one
Goes wrong
- Several chats in one checkout
- Agents editing the same files
- Chats that depend on each other’s unstated assumptions
- Everyone trying to “finish the feature”
Cleaning up
Deleting a chat offers to remove its worktree when no other chat uses it. Turn on Delete worktree on archive in Settings → Git & files to remove a finished chat’s clean worktree automatically. Glade keeps a worktree when another chat still uses it or Git finds uncommitted changes, and automatic cleanup keeps the branch so commits stay recoverable.
Settings → Git & files also lists every worktree Glade manages, so you can remove them by hand.
Opening a pull request in a worktree
Opening a pull request from Glade reuses a worktree that is already on that branch. Otherwise it checks the PR out without discarding any uncommitted changes in your checkout.