[BUG] Jumping out of worktree and making changes

Resolved 💬 6 comments Opened Feb 28, 2026 by loekj Closed Apr 6, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When crunching in a worktree that was created by Claude, it suddenly jumped out of the worktree and started making changes there...
Very dangerous behavior to existing code on the main repo where I was working on a separate branch.
Sometimes Claude has to cd into a different folder to do things, but it should know to always land back into the worktree.

<img width="1479" height="741" alt="Image" src="https://github.com/user-attachments/assets/e91dca72-5f80-41b6-99a8-a70426d5ec5a" />
<img width="1505" height="642" alt="Image" src="https://github.com/user-attachments/assets/c00c2c14-7851-44a4-9eb2-6d56ef13d053" />

What Should Happen?

It should stay inside the worktree.

Error Messages/Logs

Steps to Reproduce

Not possible. It's Claude's decisioning. Probabilistic. You can try by instructing it do do some action that requires changing dirs but no guarantee.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.63

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗