Worktrees
Every session works in its own git worktree: a separate checkout of the repo on its own branch. Agents never share a working tree, so two agents can change the same repo at once. Your main checkout stays yours.

When you start work, heed makes the worktree before the agent starts:
- heed fetches the repo's base branch from
origin. A failed fetch does not stop the start. - heed runs
git worktree add -b <branch>fromorigin/<base>, or from the local base branch when the repo has noorigin. - heed runs the repo's approved setup commands in the new pane.
- The agent starts when every setup command passed.

- Worktrees go under
~/code/wt/<repo>/<name>. Setrootunder[worktrees]to move them. A host has its ownworktree_root. - The folder name is the branch name with
/replaced by-. - The branch name comes from the prompt. See Branch names.
- A cross-repo session gets a worktree in each repo, on the same branch name.
- You can import worktrees made outside heed as sessions.
A worktree belongs to one session. Closing the session keeps the worktree and its branch. Deleting the session removes the worktree and its local branch.
Removing a worktree saves its unpushed commits and uncommitted changes first, as refs/heed/archive/<branch> in the
repo. Cleanup never removes a worktree that has any. A pinned session's worktree is never removed.
