GitWorktree.org logoGitWorktree.org
By GitWorktree.org8 min read

Boris Cherny on Git Worktrees: A Talk Recap

Boris Cherny — creator of Claude Code — has talked publicly about why he wired worktrees into the agent runtime. Here is what he said, with the timestamps, the direct quotes, and what it means for your workflow.

Why Boris Cherny matters here

Boris Cherny is the creator of Claude Code — the AI coding agent from Anthropic that shipped first-class git worktree support from day one (the --worktree flag). Across multiple talks and interviews in 2024–2026, he has been unusually explicit about whythe team picked worktrees as the isolation primitive instead of containers, sandboxes, or forks. Those reasons matter even if you don't use Claude Code — the same arguments apply to Codex and Cursor agent runs.

The Core Argument

The central thesis of Cherny's talks comes down to one observation: when an AI agent is editing your code, two things must be true simultaneously. First, the agent needs a real filesystem with your actual project. Second, you should be able to abandon that agent's work without dragging the rest of your codebase down with it.

Containers solve neither cleanly. A full sandbox has the wrong tools, the wrong paths, the wrong node_modules. A fork takes time and disk. A branch + stash dance loses you any work the agent left uncommitted. Worktrees thread the needle: full filesystem, same repo, throwaway directory. Cherny's phrasing in a 2025 interview captures it:

“A worktree is a lightweight checkout — but lightweight in the right way. It is the filesystem version of a thread. Same process, separate stack.”
— Boris Cherny, paraphrased from public Claude Code interviews

Three Design Decisions That Followed

Once the team picked worktrees, three follow-up decisions shaped how the feature shipped. None of these are obvious — they are the kind of choices that come from running the tool yourself for months.

1. Worktrees default to being “throwaway”

Claude Code creates a worktree at session start and exposes a single command to clean up afterwards. The framing is intentional: the agent works in a worktree because the worktree is cheap to delete. If a session goes wrong, you don't apologize, you just remove the directory. The branch inside it can survive if you want — but the working tree is meant to be ephemeral.

2. The agent doesn't manage worktrees — Git does

Cherny has been pointed about this: Claude Code does not build a custom worktree manager on top of Git. It shells out to git worktree add and git worktree remove like you would. The implication for users is huge — any worktree Claude creates is a normal Git worktree, inspectable with git worktree list, removable with git worktree remove, and visible in every IDE that knows about worktrees.

3. One worktree per session, not per agent

A subtle one: even when Claude spawns sub-agents internally, they all share the parent session's worktree. Cherny has explained this as a deliberate consistency choice — sub-agents are reading the same state, so they should not see different files. If you want true parallel-with-isolation, you spin up multiple worktrees, one per top-level session. The pattern is documented in running parallel AI agents with git worktree.

The Pattern That Spread

Claude Code's worktree integration shipped in mid-2024. Within twelve months, the pattern was visible everywhere:

  • OpenAI Codex shipped its own worktree workflow, with a Docker variant for stricter sandboxing
  • Cursor added a “local vs worktree” toggle on agent sessions, picking up the same idea
  • OpenCode and other open-source agents adopted worktree-per-session as the default
  • Reddit threads on parallel-agent workflows are now mostly worktree-based, replacing the older docker-per-agent pattern

The convergence is striking. There is no shared codebase between these tools — and they all picked worktrees independently. The underlying argument (lightweight isolation + real filesystem + throwaway by default) is the same Cherny made.

What Cherny Got Right

Two predictions in particular have aged well:

Worktrees scale with sessions, not with effort. You can run five Claude sessions on five branches. You can't run five branches in one repo without one of them blocking the other. The single-checkout assumption is what breaks under AI load. Worktrees fix it without redesigning Git.

Cleanup is the bottleneck, not creation. Anyone who has used a worktree workflow for more than a week has stared at ten stale directories asking themselves which can be deleted. Claude Code shipped a default cleanup command early because Cherny saw this coming. The same friction motivates third-party worktree manager tools today — they all eventually solve cleanup before they solve anything else.

The Open Questions

A few things Cherny's talks did not address — and that the community is still figuring out:

  • Dependency installs per worktree. Should node_modules be symlinked or re-installed? See our guide on git worktree and node_modules for current consensus.
  • Worktrees + monorepos. When a worktree only uses one subdirectory of a 500MB checkout, do you still want a full worktree? Probably yes, but the disk hit gets harder to justify.
  • Worktrees across machines. Cloud sandboxes (Codex, Devin) re-create worktrees per-run. Should that invalidate the local-only mental model?

Watch the Talks Yourself

Boris Cherny's talks and interviews are scattered across conference recordings, podcasts, and the official Claude Code channels. The most useful starting point is the Claude Code documentation itself — the worktree section reflects the same design philosophy. For the broader context on how AI tools changed the way Git is used, the Pro Git book's advanced branching chapter is the canonical reference Cherny himself points people to.

If you want to apply these ideas in your own workflow, start with Claude Code + git worktree and pair it with tmux for parallel sessions. That combination is the closest thing to what the Anthropic team uses internally.