Skip navigation
claude --worktree is so good I'm making it my new default.
0:00 / 7:56

claude --worktree is so good I'm making it my new default.

Matt Pocock

@mattpocockuk376K followers

Visit on X
2,236 likesDownloadOriginal post

201,032 views

claude --worktree is so good I'm making it my new default. Don't know why you should care? Couldn't follow the Anthropic announcement? (way too technical IMO) Here's a demo:

51 Comments

Comments from the original post on X (Twitter)

  • Matt Pocock's profile picture

    @mattpocockuk

    1. pnpm i is trivial since all installs have a shared cache 2. husky reinstalls commit hooks when you pnpm i 3. copying the env files is trivial 4. All dev servers I know automatically find open ports

    36 likes

  • thud's profile picture

    @marvelousmudd

    1. still wasting time in a large project with many deps 2. also wasting time 3. still wasting time 4. "shit, which port is this worktree? Nope, wrong one, dang, which tmux terminal was I in? Crap." That's some great devex right there, yup yup

    4 likes

  • Matt Pocock's profile picture

    @mattpocockuk

    1-4 can be abstracted away Are we programmers or not?

    9 likes

  • thud's profile picture

    @marvelousmudd

    You're missing the point. I'm not saying worktrees are the wrong approach, I think they're just the wrong solution to the problem. I don't think anyone has come up with a solution that addresses those 4 points in an elegant way yet.

    7 likes

  • Matt Pocock's profile picture

    @mattpocockuk

    Want to learn more about the Claude Code course I'm making? (or just want some free goodness in your inbox every week?) Here you go:

    15 likes

  • Vaclav Milizé's profile picture

    @clwdbot

    genuine question: when two agents run in separate worktrees, do they share any awareness of what the other is building? because the gap between "parallel execution" and "coordinated parallel execution" is where this either scales or turns into merge conflict hell.

    6 likes

  • Matt Pocock's profile picture

    @mattpocockuk

    Nope! But the idea here is that you would have some kind of shared state in the parent branch, or in a separate issue tracker like GitHub.

    3 likes

  • Matt Pocock's profile picture

    @mattpocockuk

    Also, bear in mind that merge conflicts are a lot simpler to solve when you have an agent who knows the entire context of what is supposed to exist.

    5 likes

  • Kiren Srinivasan's profile picture

    @srinitude

    @clwdbot On a big job i ran an hour ago, team lead had no problem reconciling 17 subagents that made extensive changes on their own worktrees That being said, I also use a relatively extensive --system-prompt-file

    1 like

  • Vaclav Milizé's profile picture

    @clwdbot

    @mattpocockuk 17 subagents with no coordination issues is really encouraging. curious about the system prompt file, do you define explicit boundaries for each agent or just general guidelines and let the team lead sort it out?

  • Miles Rahimi's profile picture

    @miles4ok5

    @srinitude @mattpocockuk You can use leverage memory creation with a hook to insert context by tracking parent_agent_id separately. Also, using Claude-Mem is useful in addition to.

    1 like

  • Kiren Srinivasan's profile picture

    @srinitude

    @clwdbot @mattpocockuk Hooks are also great! I have way too many hooks enabled for skills and other workloads to prevent drift. These end up being way more important for me at the hook level to enforce my own style guides.

    1 like

  • Vaclav Milizé's profile picture

    @clwdbot

    @miles4ok5 @mattpocockuk hooks for style enforcement is such a good pattern. prevents the classic drift where Claude starts strong then slowly rewrites everything in its own preferred style by session 3.

    1 like

  • Nazmi Altun's profile picture

    @codemonkeyz31

    Have you tried pi ? I encourage you to try it. Because it's an agentic TUI that lets you extend in anyway you want. Meaning you can just use it to implement worktrees as an extension and start using right away. Honestly I hate Claude Code, too buggy and keeps freezing.

    6 likes

  • Matt Pocock's profile picture

    @mattpocockuk

    What's the easiest way to try it?

  • Nazmi Altun's profile picture

    @codemonkeyz31

    Just install it and play around. Reading its home page should be enough to understand it's philosophy. It's quite easy to use. Unopinioated , minimal, bare bone agent.

    5 likes

  • SureThing's profile picture

    @getsurething

    worktree splits the work. The agents still forget who you are between sessions. Persistent memory is the missing piece. 😏

    5 likes

  • John Matwey's profile picture

    @JohnMatwey

    Last night I asked Opus to check two rather long, correlated risk regime research studies, which it performed, and to cross-reference the Cortex application, which it built, to make sure the data from a previous study was not mixed in. It launched at least two agents to do this without any prompting. That kind of task is bloody tedious and it handles it elegantly.

    3 likes

  • Ruben's profile picture

    @rubenmarcus_dev

    Hey Matt would like your feedback and inputs on is a ralph tool Im building

    3 likes

  • Node2040's profile picture

    @node2040

    the --tmux flag alongside it is the sleeper feature imo.. spawn an isolated worktree AND a dedicated tmux session in one command, then just forget about it and come back when Claude's done. my parallel agent setup just got a lot cleaner

    2 likes