How do I run Claude Code and Codex side by side?
Run Claude Code and Codex side by side
Install both CLIs, start claude and codex in two terminal panes in one folder, keep shared rules in AGENTS.md, and give each agent its own git worktree when both edit. Here is each step by hand, then the same in Trek.
Install both
Claude Code, on macOS, Linux or WSL:
curl -fsSL https://claude.ai/install.sh | bash
Codex, on macOS or Linux:
curl -fsSL https://chatgpt.com/codex/install.sh | sh
On Windows, both have a PowerShell installer, irm https://claude.ai/install.ps1 | iex for Claude Code and powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex" for Codex. Both are also on npm and Homebrew. Run claude and codex once each to sign in.
Two terminals
Split your terminal window in two. In Windows Terminal, Alt+Shift++ splits it side by side. In tmux, Ctrl-b % does. Start claude in one pane and codex in the other, in the same project folder.
Each agent keeps its own login, history and settings. Neither knows the other is there. To see which one is waiting for an answer, you look at each pane. To have each agent notify you when it waits, see how to know when a coding agent is waiting for approval.
Share one AGENTS.md between Claude Code and Codex
Codex reads AGENTS.md. Claude Code reads CLAUDE.md, and since version 2.1.277 it also reads AGENTS.md when the project has no CLAUDE.md or CLAUDE.local.md. So write your rules once, in AGENTS.md.
If you also need a CLAUDE.md for rules only Claude should follow, start it with an import line. Claude Code then reads both, and never reads AGENTS.md twice.
@AGENTS.md
## Claude Code
Use plan mode for changes under src/billing/.
Give each agent its own git worktree
If both agents change code at the same time, put each in its own git worktree. Then neither runs tests on the other’s half-made change. The worktree guide has the commands and the things that break, such as missing .env files and two dev servers on one port.
Have Codex review Claude Code’s plan
A second agent reads the plan without the first one’s assumptions. Have one write a plan, then ask the other to review it before any code changes. Both CLIs take a prompt on the command line and read piped input, so the plan can go straight from a file to the other agent.
cat PLAN.md | codex exec "Review this plan from another agent. List risks and missing steps."
cat PLAN.md | claude -p "Review this plan from another agent. List risks and missing steps."
codex exec runs read-only unless you pass --sandbox workspace-write. To review code that is already written, codex review --uncommitted reads your staged, unstaged and untracked changes.
If you work in Claude Code, OpenAI’s Codex plugin for Claude Code lets you use Codex from inside it, for code reviews or to hand Codex a task. Add its marketplace and install it from Claude Code’s prompt.
/plugin marketplace add openai/codex-plugin-cc
/plugin install codex@openai-codex
Then run /reload-plugins and /codex:setup, which tells you whether Codex is ready. /codex:review runs a read-only Codex review of your uncommitted changes, or of your branch against a base such as main. /codex:rescue hands Codex a task, such as investigating a bug or trying a fix. The plugin needs Node.js 18.18 or later, and its usage counts against your Codex limits.
With Trek
Trek runs the claude and codex you installed, signed in as they already are. Each thread has its own agent and model, so Claude Code works in one thread and Codex in another, in one window.
- Press ⌘\, or Ctrl+\ on Windows and Linux, to open a second thread beside the one you’re in. Each pane has its own agent, composer and scroll position.
- Pick New worktree from the composer’s Local chip, and each thread works on a branch of its own, with your
.envcopied in. - When either agent waits for an approval, its thread goes to the Inbox, above your projects in the sidebar, with what it wants to run. Both agents use the same approval card.
- For a review, use Consult in the composer. The thread’s agent asks the other for advice before it acts, the other only reads, and the answer comes back into the same thread.
- To move a conversation from one agent to the other, pick a model of the other agent. Your next message moves the thread and carries a recap: the conversation, the open to-do list, the changes made so far and where the work stands. You can read it before it goes.

More on agents that ask other agents and the Inbox.
Questions
Does Claude Code read AGENTS.md?
Yes, from v2.1.277, in place of CLAUDE.md when a project has none. To have it read both, set Project instructions to claude-md-and-agents-md in /config.
Does Codex read CLAUDE.md?
Not by default. Codex reads AGENTS.md. You can add other file names to project_doc_fallback_filenames in its config.
Do I need two subscriptions?
You need a sign-in for each. Claude Code needs Pro, Max, Ultra, Team, Enterprise, a Console account or a cloud provider such as Amazon Bedrock. Codex works on any ChatGPT plan, Free included, or an API key.
Can Trek install Claude Code for me?
Yes. When no agent is ready, the new-thread screen offers to install Claude Code and sign you in, without a terminal. If Claude Code or Codex is installed but signed out, it offers to sign you in to that one, Claude Code first.
Sources
- Set up Claude Code
- How Claude remembers your project (CLAUDE.md and AGENTS.md)
- Run Claude Code programmatically
- Codex CLI
- AGENTS.md in Codex
- Non-interactive mode, Codex
- Command line reference, Codex
- What a handover carries (crates/trek-core/src/handover.rs)
- Codex plugin for Claude Code
- Pricing, Codex docs
- Installing an agent from the new-thread screen (crates/trek-app/src/workspace/setup.rs)
- Panes, Windows Terminal docs