Run Claude Code, Codex, Gemini CLI and other agents side by side
On this page
One worktree per agentOne instruction file for every CLIRun them in tmuxWhere the CLIs differHow Codeman handles itGive each agent its own git worktree, keep the project instructions in one AGENTS.md that every CLI reads, and run each CLI in its own tmux window or pane. The CLIs then differ only in how they log in, where they keep state and how they tell you they are waiting, and those differences are what trip up side-by-side setups.
One worktree per agent
Two agents editing the same checkout will overwrite each other's work. A git worktree gives each one its own checkout on its own branch, sharing the same repository:
cd ~/src/myapp
git worktree add ~/src/myapp-claude -b try/claude
git worktree add ~/src/myapp-codex -b try/codex
git worktree add ~/src/myapp-gemini -b try/gemini
When they finish, compare the approaches with ordinary git (git diff try/claude try/codex) and remove the worktrees you do not keep with git worktree remove.
One instruction file for every CLI
Each CLI has its own default file for project instructions, but all three can share one AGENTS.md:
| CLI | Reads by default | To share AGENTS.md |
|---|---|---|
| Claude Code | CLAUDE.md; reads AGENTS.md when there is no CLAUDE.md (v2.1.277 and later) |
Put @AGENTS.md at the top of CLAUDE.md |
| Codex | AGENTS.override.md and AGENTS.md, from ~/.codex and from the Git root down to the working directory |
Nothing to do |
| Gemini CLI | GEMINI.md |
Set "context": { "fileName": ["AGENTS.md", "GEMINI.md"] } in its settings.json |
Sources: Anthropic's memory docs, OpenAI's AGENTS.md guide and Gemini CLI's GEMINI.md docs. With the Claude Code import, anything Claude-specific goes below the @AGENTS.md line.
Run them in tmux
One window per agent, each started in its own worktree:
tmux new-session -d -s trio -n claude -c ~/src/myapp-claude claude
tmux new-window -t trio -n codex -c ~/src/myapp-codex codex
tmux new-window -t trio -n gemini -c ~/src/myapp-gemini gemini
tmux attach -t trio
Ctrl-b n and Ctrl-b p move between them. For a literal side-by-side view, split a window instead: tmux split-window -h -c ~/src/myapp-codex codex puts Codex in a pane beside the current one. Detach with Ctrl-b d and all three keep running.
Where the CLIs differ
Logins and state. Every CLI authenticates on its own and keeps its state in its own place: Claude Code in ~/.claude and ~/.claude.json, Codex in ~/.codex (or $CODEX_HOME), and Gemini CLI and Google's Antigravity (agy) under ~/.gemini. Log each one in once, by hand, before scripting anything. According to Codeman's docs, Gemini CLI has been enterprise-only since Google's June 2026 consumer cutover, with Antigravity as the consumer successor.
Permission modes. There is no common flag. Claude Code uses --dangerously-skip-permissions and refuses it when running as root. Grok Build's equivalent is --always-approve. Pi has no permission prompts at all. DeepSeek Harness takes its permission mode from the DSH_PERMISSION_MODE environment variable, and OMP keeps its approval mode in its own config. Read each CLI's docs before running it unattended.
Knowing when each one is waiting. Claude Code exposes hooks (Notification, Stop and others) that can alert you when it finishes or needs input; see Get notified when Claude Code finishes. Other CLIs have their own mechanisms or none, so a mixed setup usually ends up with one alert path per CLI, or with watching the screens.
Instruction and config files. Covered above. The practical rule: shared facts about the project go in AGENTS.md, CLI-specific behaviour goes in that CLI's own file.
How Codeman handles it
Codeman runs nine agent CLIs plus a plain shell as run modes: Claude Code, OpenCode, Codex, Gemini CLI, Antigravity, Pi, Grok Build, DeepSeek Harness and OMP. Each session runs one CLI in its own tmux session and appears as a tab in a browser dashboard.
- Per-session choice. The arrow next to the Run button picks the CLI for the next session, so one project can have a Claude tab, a Codex tab and a shell tab open at once. The optional Split view shows two sessions next to each other on desktop, and the counter beside Run starts several sessions of any CLI in one click.
- Discovery.
codeman doctorlists which CLIs the server can actually see. Binaries resolve from the server's environment, andpi,grok,ompanddshare identity-checked, since unrelated programs share those names. - Logins stay yours. Codeman never collects or stores CLI credentials; log each CLI in once by hand.
- Per-CLI environment variables. Per-session environment overrides are limited to each CLI's own prefixes (
CLAUDE_CODE_*,CODEX_*,GEMINI_*,GROK_*and so on); anything outside that allowlist is rejected. - Waiting detection per CLI. Claude sessions report through Claude Code hooks, confirmed against the screen. Codex declares its own prompt glyph and working line, so it gets the same screen check. DeepSeek Harness reports idle, working and blocked itself. The rest fall back to output stabilization, which is coarser.
- Claude-only extras. Some features depend on Claude Code's hooks or output, such as usage-limit auto-resume and the live subagent windows. The Approvals Inbox covers Claude and DeepSeek Harness. The full matrix is in Agent CLIs.
Codeman does not create worktrees. Create them with git as above and add each one with Add Case → Link Existing. Any run mode also works inside a per-project container; see Docker Cases.