Cmd. /worktree
Run new or forked sessions in isolated Git checkouts, enabled by default from 0.156.0
Written and reviewed by Eric Han · Co-founder & CTO, reopt
Key takeaways
- Run new or forked sessions in isolated Git checkouts, enabled by default from 0.156.0
- Starting with
/worktreeorcodex --worktreeruns work in a separate checkout; from 0.162.0 Codex can create and list managed worktrees itself.
Purpose
Run new or forked sessions in isolated Git checkouts, enabled by default from 0.156.0
/worktreeAvailability
| Field | Value |
|---|---|
| Input surface | Running CLI prompt |
| Kind | Built-in |
| Status | Current reference |
| Aliases | — |
| Documented minimum | Not specified |
| Reviewed against | 2026-10-23 · Codex CLI 0.163.0 |
| Release evidence | v0.156.0 |
Added as an experimental feature in 0.154.0 and enabled by default from 0.156.0. Requires a Git repository; the agent command center can also create worktree sessions.
Examples
/worktree/worktree and CLI --worktree provide worktree sessions, added as experimental in 0.154.0 and enabled by default from 0.156.0. Start new work or a fork in a separate checkout, then browse and resume that session.
codex --worktreeCheck the branch and checkout path when entering isolated work. In 0.155.0 the agents view shows worktree ownership and asks for confirmation before deleting clean managed worktrees. Archiving a conversation and deleting its worktree are separate operations. From 0.156.0 the agent command center filters tasks by status and creates worktree sessions directly.
0.162.0 adds tools that let Codex create and list managed Git worktrees from trusted local projects when the worktrees feature is enabled. According to the pull-request description, the tools are create_worktree, get_worktree_creation_status, and list_worktrees, and a worktree is created asynchronously and attached to the requesting task. Without a ref, it starts from the repository's remote default branch. The task's working directory and uncommitted changes in the source checkout stay in place, and creation is rejected in ephemeral side conversations and untrusted projects.
See thread lifecycle for the wider workflow.
Effects and persistence
Starts or forks work in a separate Git worktree. Check the new checkout's path and branch.
Cautions
Added as an experimental feature in 0.154.0 and enabled by default from 0.156.0. Requires a Git repository; the agent command center can also create worktree sessions.
Official sources
Complete command list · Verification scope · History for this command