A working folder inside a Git checkout gets a git half in its pill in the environment row: which branch, what changed, and the few Git actions a chat needs.
Which folders
Folder
Git half
Main project folder
Yes, for a real project. Not the default home-folder project: that repository is OpenProgram's storage.
Each additional working folder
Yes
Outside a Git checkout
None
Two folders in one checkout
One git half: project first, then list order (git-chip-registry.ts). Separate worktrees have separate roots and keep their own.
The pill
Segment
Content
Folder (left)
Icon, name; on a working folder a ✕ on hover or keyboard focus. Opens the project menu.
Git (right)
Solar git-branch, the branch's last path segment (claude/foo shows foo; short commit id when detached), uncommitted +N −N
Divider
Full-height hairline with no width, so both hover fills meet; fades on hover or open
Diff badge
Green and red halves, as on the file-change card. Untracked text files count as added. Only binary changes: neutral "N files", grey level-3 dot, never "+0 −0". Clean: branch alone.
Repository name, tagged worktree on a linked worktree
Changes
"N uncommitted files +N −N" opens Review in its Unstaged scope; inert before the first message. Ahead/behind upstream when non-zero.
Branch
Filter and local branches, newest commit first, up to 50. Tags: current; worktree, which a click opens. A new name offers "Create branch" or "… in a new worktree"; Enter does the same.
Pull request
See below
Where a branch click goes
Folder
Result
Clean
git switch in place
Uncommitted changes
Opens in a new worktree and moves this slot there; the section header says so
Slot cannot move
Always switches in place
Moving a slot to a worktree
Created at <repo>-worktrees/<branch>, beside the repository, so the source folder's files stay put. No separate worktree list.
Slot
Result
Working folder
Replaced in the folder list
Main folder, unsent draft
The draft's project re-points to the worktree (registered as a project)
Main folder, started
Fixed: the worktree joins as an additional folder, and the menu says so
Pull request
State
Row
Open PR
"View pull request #N", in the system browser
None
"Create pull request": git push -u origin HEAD, gh pr create --fill against the default branch, opens it
Disabled
With the reason: no gh, no origin, detached HEAD, or on the default branch. The backend also refuses no commits ahead.
Uncommitted changes
"Commit & open PR with the agent…" places an instruction in the composer, unsent
Errors
Case
Card
Any error
At the bottom of the menu, which stays open: plain title, git output behind a "Show git output" text button
Switch would overwrite changes
Names the files and offers Open in a worktree or Carry the changes over
Carry
Runs stash (untracked included), switch, pop
Pop conflicts
The switch stands and the changes stay in the latest stash, which the card says
Not offered
Force-switch or discard
Freshness
Nothing polls. A pill reads on mount and folder change, when its menu opens (the only read that lists branches and looks up the PR), when a turn ends, on window focus, on project change, and after a mutation on the same checkout (op:git-changed).
Backend
openprogram/state/worktree/folder_git.py holds the logic; ws_actions/folder_git.py moves it off the event loop. Every reply echoes path.
Action
Reply
Does
git_folder_status
git_folder_status
status --porcelain=v2 --branch, diff --numstat HEAD, worktree list, default branch, origin, gh; with include_branches, include_pr: branches, gh pr view
git_switch_branch
git_switch_branch_result
git switch [-c] <branch>; with carry, stash around it. Refusal: code (overwrite with files, or stash_conflict), detail
git_create_worktree
git_worktree_created
git worktree add [-b]
git_create_pr
git_pr_created
Push, gh pr create --fill, returns the URL or the open PR
GIT_OPTIONAL_LOCKS=0 keeps status from contending with the user's git. GIT_TERMINAL_PROMPT=0 makes a push needing credentials fail, not hang.
Implementation status
Implemented, except: base-branch choice and draft PRs; pull, push and fetch controls; ahead/behind against the default branch when there is no upstream.