Worktrees and branches
Every thread works in a folder: the project folder itself, or a Git worktree of it on a branch of its own. This page covers choosing between them, how worktrees and their branches are made, and what happens to them afterwards.
Choose where a thread works
Under the prompt box of a new thread is the place it will work. Its menu, Work in, has these choices:
- Local checkout
Works in the project folder, on its current branch.
- New worktree
Works in a separate copy on a new branch, so threads don't overlap.
- Existing worktree
Works beside another thread, on its branch. It lists the worktrees other threads of the project already have.
Beside it is the branch. In Local checkout it shows the branch the project folder is on, and choosing another switches the folder to it. Uncommitted changes come along. In New worktree it sets the branch the worktree starts from.
Once the thread has started, the same spot reads Local checkout or Worktree, and the window can't change it. The agent can still move a thread from the local checkout into a new worktree, which happens when its turn ends.
To set which one new threads begin with, open Settings, choose Threads, and change Work in under New threads. You can still choose per thread.
What a new worktree is
A worktree is an ordinary Git worktree: a second checkout of the same repository, sharing its history, with its own files and its own branch. Solanum makes one when you send the first message.
- Folder
~/.solanum/worktrees, in a folder named for the repository.- Branch
A new one, starting with
solanum/. Once the thread has a title, the branch is renamed after it.- Starts from
The branch you picked, or else where the project folder is.
The branch the worktree started from is remembered, and the thread's pull request goes to it.
These are in Settings, on the Threads page under Worktrees:
- Start from origin
Creates the worktree from the latest matching branch on origin instead of your local branch.
- Worktrees folder
Where new worktrees go. Worktrees made already stay where they are.
- Branch prefix
What a new worktree's branch starts with, such as
feat/. Empty gives branches no prefix.
Set up a new worktree
A new worktree has only what's committed. Files Git ignores, such as .env, and installed dependencies aren't there. Choose Worktree setup… in the Work in menu to say what a new worktree needs:
- Files to copy
One path per line, from the project folder.
*matches any name. Files the worktree already has stay as they are.- Setup script
Runs in your shell, in the worktree's project folder, such as
pnpm install.- Settle script
Runs in the worktree as its thread settles, to free what builds left there, such as
cargo clean.
Solanum copies the files, then runs the setup script in the thread's terminal. The thread says Setting up the worktree meanwhile, and your first message waits, marked Queued · sends after setup. The agent starts once the script succeeds. Skip starts it without waiting.
Every workspace with the project shares this setup. A repository can also declare it for everyone who clones it, in solanum.json.
Share a worktree
To have a second thread work in a worktree that exists, right-click the first thread in the sidebar and choose New thread in this worktree, or pick it under Existing worktree. The new thread works beside the other on the same branch, with no new checkout and no setup. Only the thread that made the worktree names its branch.
Remove a worktree
Settling or archiving a thread keeps its worktree. Once every thread that used it is settled or archived, Solanum says the worktree is still on disk and offers Remove worktree. Removing it deletes the folder only. Commits stay on the branch, and sending the thread a message checks the branch out again.
After a thread's pull request merges, the thread offers Clean up, which removes the worktree and its branch.
Deleting a thread removes its worktree folder with it, and warns you first if files there have uncommitted changes.
Clean up many at once
The Worktrees page in Settings lists every worktree with the space it takes, and marks those whose pull request merged, those no thread uses, and those with uncommitted changes. Select merged and unused picks the first two kinds, and Remove deletes what's selected.
To have it done for you, set Remove idle worktrees on the Threads page. A worktree then goes once every thread in it has been settled or archived for as long as you choose, provided nothing in it is uncommitted. It is set to Never to begin with.