Definition
A worktree task is one piece of coding work done on its own branch in a separate git worktree, so one or more AI coding agents can work on it without touching your main checkout or each other's changes.
Also called: task, branch task, agent task on a branch.
Running several AI agents on one repository works best when each job has its own git worktree: a separate folder on its own branch, sharing the repository's history. The job then has a clear life: start it in a fresh worktree, let one or more agents work (a Claude chat writes the fix, a Codex chat reviews it), open a PR, merge, and remove the worktree.
- Claude Code starts one with
claude --worktree <name>(under.claude/worktrees/), and a subagent withisolation: worktreegets a temporary one. - Codex's app can start a thread in a new worktree, often on a detached HEAD until you create a branch.
git worktree removedeletes the folder when the work is done; the branch and its commits stay.
Because the chats working on one task can be in different apps, and even in the cloud, it's easy to lose track of which chats, branch and PR belong together.
In Pairbar
Pairbar's Tasks view groups chats into tasks: every chat, from Claude and Codex, local or cloud, on the same branch of a repository or in the same worktree folder is one task, whatever branch it reports. Each task shows its PR and checks and sits under Needs you, Working, Ready to review or Done. Suggestions open a plan first: a fix or review plan may add a worktree of the branch (git worktree add), and Mark done and archive removes the worktree only if you tick it, never with uncommitted changes and never deleting the branch. The composer's Worktree chip starts a chat in a new one. See Tasks.
Frequently asked questions
- Is a worktree task the same as a branch?
- Nearly: the task is the work, the branch holds its commits, and the worktree is the folder where agents do it. Pairbar treats chats on the same branch or in the same worktree as one task.
- Can Claude and Codex work on the same worktree task?
- Yes. For example, Claude writes a change and Codex reviews it on the same branch. Pairbar shows both chats under one task.
- What happens to the worktree when the task is done?
- Remove it with
git worktree remove. The branch and commits stay, so the worktree can be added back later.
Related
- GlossaryGit worktreeAn extra working folder attached to the same Git repository, with its own branch and files but shared history.
- Use caseTrack every branch and pull request across your Claude Code and Codex chatsThe Tasks view groups chats from both apps and the cloud by branch or worktree, with PR checks, lifecycle sections and suggestions you approve or decline.
- Use caseStart a Claude Code or Codex chat on a new branch in its own git worktreePairbar's composer starts a chat in any repo, on any branch or in a new worktree, with model, effort, mode, agent and local or cloud set up front.
- DocsTasksChats grouped by the branch or worktree they work on, across Claude, Codex and the cloud: needs you, working, ready to review, done, with each task's PR and checks