---
title: "ZAF 01 - Claude Code vs Codex - Worktree"
url: "https://zuey.me/articles/zaf-01-claude-code-vs-codex-worktree?lang=en"
locale: en
access: members
full_text: false
published_at: "2026-07-31T02:00:00.000Z"
tags: ["Claude Code", "MCP", "AI Agents", "AI"]
translations:
  vi: "https://zuey.me/articles/zaf-01-claude-code-vs-codex-worktree.md?lang=vi"
  zh: "https://zuey.me/articles/zaf-01-claude-code-vs-codex-worktree.md?lang=zh"
  ko: "https://zuey.me/articles/zaf-01-claude-code-vs-codex-worktree.md?lang=ko"
  ja: "https://zuey.me/articles/zaf-01-claude-code-vs-codex-worktree.md?lang=ja"
---
# ZAF 01 - Claude Code vs Codex - Worktree

> Claude Code and Codex both support worktrees, but where they put the worktree folders breaks the relative paths in CLAUDE.md/AGENTS.md. Here's why, and how I fixed it with the /ak:worktree skill.

![ZAF 01 - Claude Code vs Codex - Worktree](https://media.zuey.me/blog/2026/7c109e12-zaf-01-claude-code-vs-codex-worktree-isometric.png)

Anyone here using worktrees? I only learned about worktrees about a year ago myself, around when Claude Code picked them up.

### What is a worktree?

Roughly speaking, a "worktree" is a copy of some branch in your git repo. Creating a new worktree is like doing `git clone <repo-url>` and then `git checkout <branch>`.

That way you can work in parallel in 2 different folders on 2 different git branches, and when you're done, just open a PR to merge into the shared branch.

> **INFO:** In an era of AI agents running in parallel, worktrees speed up development a lot: each worktree builds 1 feature, so 10 worktrees means 10 features at once! (That's the ideal anyway. In reality there are more bumps along the way, especially at the... merging into the shared branch part 😁)

### Worktrees in Claude Code & Codex

Okay, both Claude Code & Codex support worktrees now, and when you start a new session there's always a "worktree" option. But the two of them set up worktrees a little differently: **where the worktree folders live**.

#### 1. Claude Code

In the terminal you can start Claude Code with `claude -w <name>`. In the Claude desktop app, just tick the "worktree" checkbox and pick the branch to fork from.

By default Claude puts worktree folders with random names right inside the project: `.claude/worktrees/<random-name>/`

These random names are pretty annoying, because when you need to clean up or find something again, the folder name tells you nothing about what that worktree is doing... Also, when I open the project in an IDE (like VSCode) with a bunch of unfinished worktrees, git just lags (partly because my crappy M1 Pro Mac is weak).

#### 2. Codex

In the terminal, open `codex` and use natural language to create a worktree (there's no built-in command/skill), e.g. "create a worktree from branch origin/dev". In the Codex desktop app it works like Claude: tick worktree when starting a new session and you're done.

---

*Phần còn lại dành cho thành viên có quyền đọc toàn bài (Knowledges, Kết hợp, Cộng đồng) — see plans at https://zuey.me/pricing*
