Codex Desktop App: Projects, Worktrees, Threads, and Cleanup

If Codex desktop app terminology feels fuzzy, this mental model is the one that stays consistent:

What Worktree Mode Means in the App

In Codex app terms, Worktree mode means your thread runs in a different checkout than your main Local checkout for that repo.

That separation prevents common collisions:

This is why permanent worktrees are useful for longer efforts: they give you a stable, separate workspace without constant context switching.

When to Create a New Project vs Reuse One

Use this rule of thumb:

If your work will continue over many sessions in the same repo and you want hard isolation, create a permanent worktree project.

How to Create a Permanent Worktree Project

In the sidebar:

  1. Find the project.
  2. Open the three-dot (...) menu.
  3. Choose the permanent worktree option.

Codex creates a new project backed by a permanent worktree. You can run multiple threads from that project, and Codex does not auto-delete it.

Auto-Cleanup: When It Happens

Codex cleanup is lifecycle-based, not a fixed nightly schedule.

By default, Codex keeps your most recent 15 Codex-managed worktrees and can remove older ones to stay under that limit.

Codex-managed worktrees are eligible for automatic deletion when:

Codex tries to preserve important worktrees and avoids auto-deleting a managed worktree if:

Before a managed worktree is deleted, Codex stores a snapshot so restore is possible when reopening.

How to Configure Cleanup

In Codex desktop app:

  1. Open Settings (Cmd+,).
  2. Find worktree cleanup/retention controls.
  3. Change the managed-worktree retention limit, or disable automatic deletion if you prefer manual cleanup.

If you never want a checkout auto-deleted, use a permanent worktree.

Practical Cleanup Workflow

For old items:

  1. Archive stale threads.
  2. Remove no-longer-needed projects from the sidebar.
  3. Keep only active long-running efforts as permanent worktrees.

This keeps the sidebar and disk usage under control without losing active context.

Sources


This article is open source. Found an error? Have a different perspective? Open an issue or submit a PR — we welcome contributions from the community.

View on GitHub