Four million developers use Codex every week, and most have no idea what's happening under the hood. OpenAI has built a system where artificial coders work in parallel inside your codebase — and none of them crash into each other. It sounds impossible. It isn't. But it requires you to understand a Git feature that has been gathering dust for over a decade.


What exactly are git worktrees?

Most developers know one workflow: clone a repo, check out a branch, make changes, push. One repo, one working directory, one branch at a time.

Git worktrees break that pattern. The command git worktree add -b feat ../repo.feat creates a brand new working directory — with its own branch, its own file copy, and its own build process — all connected to the same underlying Git object database.

The result: you can have main, feat/login, and fix/crash open simultaneously, in separate folders, without switching branches even once.

This is not a Codex invention. It is standard Git, available since version 2.5 (2015). It is just that almost nobody used it — until AI agents came along and needed exactly this.


> "Git worktrees have existed for over ten years. It took AI agents to make the feature relevant to everyday developers."


OpenAI Codex Spawns Parallel Coders in Isolated Git Workspaces: What Are Worktrees and Why Should You Care? - Bilde 1

How Codex uses worktrees

OpenAI Codex — launched for macOS in February 2026 and for Windows on March 4, 2026 — is not just code completion. It is an agent command center where you can spin up multiple AI coders on different tasks simultaneously.

When you start a new Codex task, the system spins up a new agent inside its own isolated git worktree. The agent gets its own branch (typically named codex/), its own test suite, and its own build process.

Changes the agent makes exist only in that worktree. No other agents can see them. No race conditions. No situations where agent A overwrites agent B's half-finished changes.

When the agent is done, the result is presented to you. You review it, you approve it, and you merge it into main — on your own terms.


KEYFIGURE

NumberWhat it means
4 million+Weekly Codex users (May 2026)
1.2 million+Git commits scanned by Codex Security
792Critical vulnerabilities found and flagged
77.3%Codex score on Terminal-Bench 2.0


Tools built on the worktree principle

Comparison: worktree tools for AI agents

ToolTypeSupportsPurpose
Git worktrees (built-in)CLIAll toolsCore function
Worktrunk (max-sixty)CLIAI agents generallyWorktree management, most used as of May 2026
Superset (superset.sh)Desktop appClaude Code, Codex, OpenCode10+ parallel agents visually
Claude CodeCLI/AgentGit nativelyBuilt-in /worktree command
Pydantic AI HarnessOrchestration frameworkCustom agentsPlanner/Worker/Judge roles in isolated worktrees

Worktrunk is, as of May 2026, the most widely used CLI for git worktree management specifically designed for AI agent workflows, according to GitHub statistics cited by kingy.ai.

Superset goes one step further: an open-source desktop app where you can view and control ten or more parallel coding agents in real time — each in its own worktree.

Pydantic AI Harness implements an "agent fleet" pattern with clearly defined roles: a Planner agent that breaks down work, Worker agents that execute it in isolated worktrees, and a Judge agent that evaluates results.


Codex beyond worktrees

Worktrees are the core, but Codex has more:

  • Skills Library: Reusable instruction modules — for example "read a Figma file and generate React components" or "run CI analysis and fix errors"
  • Automations: Scheduled background tasks that run without you being present
  • Codex Security: AI-driven application security that has scanned over 1.2 million commits and uncovered 792 critical and 10,561 high-risk vulnerabilities, according to Fluxio.dev (March 2026)

All of this is included in ChatGPT Plus ($20/month), Pro ($200/month), and Business/Enterprise plans.


HIGHLIGHT

Worktrees are not magic — they are isolation. The principle is simple: each agent lives in its own bubble. Failures stay local. Success is merged in a controlled way. This is the same philosophy that Docker containers and virtual machines are built on — just for code branches.


The pitfalls you need to know

Worktrees solve a lot, but not everything. Here is what can go wrong:

Merge conflicts still exist. If two agents change the same lines in the same files, you still have to handle the conflict at merge time. Worktrees delay the problem, they do not solve it.

Branch naming becomes critical. Conventions like codex/ and cc/ are not optional niceties — they are infrastructure. Without them, you lose oversight quickly.

Stale branches are a real danger. On March 25, 2026, a developer team documented an incident where 20 parallel Codex agents built on an outdated version of the main branch. The result: 80 test failures across all agents. The lesson: always verify that the worktree is synchronized with main before starting an agent.

Disk space adds up. Each worktree is a full copy of the working files. In large monorepos, this becomes noticeable.


> "20 parallel agents built on a stale branch — 80 tests failed at once. Worktrees provide isolation, but not automatic synchronization."


TIMELINE: From Git feature to AI infrastructure

  • 2015 — Git 2.5 introduces git worktree as an official feature
  • February 2026 — OpenAI Codex launches for macOS with a built-in worktree-based parallel agent architecture
  • March 4, 2026 — Codex launches for Windows
  • March 25, 2026 — A well-documented "stale branch" incident involving 20 parallel agents becomes a textbook example of the synchronization trap
  • May 2026 — Codex surpasses 4 million weekly users; Worktrunk named most-used worktree CLI for AI agents

BOTTOM LINE

Git worktrees are not new technology — but they are the right technology for AI agent parallelization. OpenAI Codex has made it a first-class concept: one task, one agent, one isolated working directory. Failures do not spread. Work does not collide. And when everything is ready, you merge with full control.

Want to use this to its full potential? Learn the git worktree command. Set branch conventions. Sync against main before starting agents. And consider Worktrunk or Superset if you want to orchestrate more than three or four agents simultaneously.

The real news is not that Codex is smart. It is that an 11-year-old Git trick has finally had its moment.


Verified against 8 open primary sources.