Worktrees are not working as expected

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Worktrees get ignored by agent when triying to ask to copy some work from non worktree folder/original folder

Steps to Reproduce

  1. start working on a worktree using agent window
  2. ask it to copy some changes from current window
  3. Cursor will behave weirdly by moving the agent to current window and out of worktree created
  4. thus current work gets hampered
  5. although it shows in agent work is being done in worktree but still we can see clearly that cursor has shifted the agent and work to current window which is using orginal folder not the worktree folder at all

Expected Behavior

Agent should be working inside the worktree only and should never shift to current window at all

Operating System

MacOS

Current Cursor Version (Menu β†’ About Cursor β†’ Copy)

Version: 2.3.35
VSCode Version: 1.105.1
Commit: cf8353edc265f5e46b798bfb276861d0bf3bf120
Date: 2026-01-13T07:39:18.564Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 25.2.0

For AI issues: which model did you use?

opus4.5-high

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report. This looks like a known issue with worktrees, where the agent loses the worktree context and switches back to the main directory.

A few similar reports from the last few days:

The team is working on fixes for worktree functionality. To help with debugging, can you share:

  1. The Request ID for a specific case where the agent switched directories (chat context menu β†’ Copy Request ID)
  2. The exact prompt text that triggered the switch
  3. Did you use file mentions (the @ symbol) to reference files from the main directory?

Item 3 is especially interesting. There’s a known bug where file mentions in worktrees can cause edits to be applied to files in the main branch instead of the worktree.

Hi, I answered with the Request Id 6 hours ago, strangely my response has disapeared.

Find below to data you have required :

Request Id : e4d25486-8f95-43bf-877c-060b1037bb01

Prompt in Ask Mode : change the folder name to widgets and carefully review every place where components keyword is used and if it should be changed as well.

then Prompt in Agent Mode - Auto : Apply these changes

No use of @

1 Like