How to run Claude Code, Codex, and OpenCode sessions in parallel with Git worktrees (from your phone)
A practical workflow to isolate tasks into worktrees, run Claude Code/Codex/OpenCode sessions in parallel, and review/commit safely from your phone — from one place.
- CLI
- 0.2.17
- Preview ref
- a2c45c8
What makes worktrees useful here isn’t “you can check out two branches.”
It was multi-agent work.
When you run two sessions in the same folder, the failure modes are predictable:
- agents touch the same files
- diffs get tangled
- you lose the thread on what belongs to which task
A simple rule fixes most of it:
one worktree per task
Then, if you want to:
- run one Claude Code session on a refactor
- run a Codex session on tests
- run an OpenCode session on docs
…you can do it in parallel without stepping on yourself.
This guide covers that workflow.
Quick definition: what a worktree is (and why it helps with agents)
Git’s own docs describe a worktree as a way to manage multiple working trees attached to the same repository, letting you check out more than one branch at a time. (Source: https://git-scm.com/docs/git-worktree)
For multi-agent work, the important part is simpler:
- each worktree is an isolated folder
- each agent gets its own folder
So “which agent changed this file?” becomes a directory question, not a detective story.
Common approaches and where they fall apart
- One branch, one folder, run agents sequentially: safe, but slow.
- One folder, multiple agents: fast, but messy.
- Stash/unstash between tasks: workable, but error-prone when you do it often.
Worktrees were the first thing that felt both fast and safe.
A workflow that works
This workflow uses Happier as the control plane. Happier is an open-source app that lets you run and orchestrate Claude Code, Codex and other agents cross-device.
It gives you two things in one place:
- Sessions: launch and monitor Claude Code, Codex and OpenCode sessions across devices
- Files and Git per session: each session is attached to one folder, so its Files and Git tabs show that folder and nothing else
Trade-off: your computer still has to be online.
If you’re new to Happier (what it is, and where to get it)
If you haven’t seen Happier before: it’s an open-source companion app (mobile/web/desktop) that lets you run sessions on a computer you trust, then manage them from your phone.
Get set up:
- GitHub: https://github.com/happier-dev/happier
- Install/download: https://github.com/happier-dev/happier#how-it-works
- Discord: https://discord.gg/W6Pb8KuHfg
The pattern: one worktree per task
Here’s the simplest version:
- create a worktree for task A
- create a worktree for task B
- run one session in each
- review/commit each worktree separately
If you only take one thing from this guide, take that.
Step-by-step
1) Pick the tasks you actually want in parallel
Parallelism is a tool.
Good parallel tasks:
- tests vs docs
- refactor vs small UI tweak
- fix bug vs write migration plan
Bad parallel tasks:
- two agents editing the same core file set
2) Create worktrees
In raw Git, you’d use git worktree add ... to create linked worktrees. (Source: https://git-scm.com/docs/git-worktree)
In practice, what matters is the result:
- two folders, each with its own branch checked out
3) Launch one session per worktree folder
In Happier, start a new Claude Code, Codex or OpenCode session and pick the worktree folder as its working directory. Do the same for the second worktree.
Because a session is tied to its folder, each session’s Git tab is a per-worktree view of diffs, commits and pushes that doesn’t mix changes.
The habit that keeps things clean:
- name the session after the worktree/task
- keep the session scoped (“only touch files in this worktree”)
4) Monitor sessions from one place
Once multiple sessions are running, the goal is not to read every transcript.
It’s to:
- see which sessions are active
- handle approvals
- send one follow-up
Then, when something is done:
- open that session’s Git tab
- review the diff
- commit and push (Git write actions are experimental and off by default, see the Git docs)
5) Review and commit per worktree
Your safety rule:
- never commit cross-worktree changes in one commit
If you do, you’ve lost the benefit of isolation.
Terminal (optional)
Sessions can show a Terminal tab when the embedded terminal is available. It’s experimental per the feature matrix.
Use it for one-off commands (grep, quick status), not as the primary workflow.
FAQ
Why not just use branches without worktrees?
Because switching branches in a single folder forces you into stash/WIP patterns.
Worktrees let you keep work in place.
Do I need one agent per worktree?
Not always.
But if you’re running agents in parallel, one agent per worktree is the easiest way to prevent collisions.
What’s the biggest mistake?
Creating worktrees… and then still running multiple agents in the same folder.
Isolation only works if you actually use it.
What should I name my worktrees and sessions?
Make names self-explanatory on a phone screen.
- worktree:
hotfix-<ticket>/docs-<topic>/tests-<area> - session: match the worktree name, plus the agent (e.g. “hotfix-123 (Codex)”)
How many parallel sessions is “too many”?
It’s not about raw count. It’s about whether you can still review safely.
A good default is 2–3 parallel sessions:
- one doing the main change
- one doing a secondary task (tests/docs)
- optionally one doing a review/check
How do I keep agents from touching the wrong worktree?
Two habits help a lot:
- Put the worktree name in the first message: “You are working in
<worktree-name>only.” - Ask for a checkpoint summary after the first couple steps.
If you’re away from your keyboard, it’s worth being explicit.
What’s the “phone loop” when multiple sessions are running?
A simple loop:
- open Happier
- check which sessions are active
- handle approvals
- send one short follow-up (or “stop and summarize”)
- when a session is done, review its worktree diff and commit
The goal is to stay in control without trying to do deep coding on a phone.
How do I review each agent’s work safely?
Treat each worktree as its own review/commit unit.
- Source control → Changed files → ↓ Review
- commit with a narrow message
- push only when you’re confident
What if two agents need to touch the same file?
At that point, parallelism is less helpful.
Options:
- sequence the work (agent A then agent B)
- split tasks so they touch different parts of the codebase
- or let one agent do the change and the other do review
Is this only useful from a phone?
No — but it’s especially useful from a phone.
Worktrees keep the filesystem tidy.
Happier makes it possible to monitor sessions and review/commit from the same place whether you’re on mobile, desktop, or web.