Worktree application not consistent

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

if /worktree is used to start changes on a worktree, and you continue chat, even if you never have told the agent to apply worktree changes/ never have used /apply-worktree skill, the agent will start making changes to main repo instead of worktree

Steps to Reproduce

  • start an agent request and prepend with /worktree
  • initially request is made on worktree
  • ask a follow-up request
  • follow-up request application is sometimes made to main repo/branch and not worktree

Expected Behavior

Behavior should be consistent. All changes should be restricted to worktree until you explicitly ask for changes to be brought over to main repo.
This worked in Cursor 2 reliably because application of worktrees was handled directly from ui.
Request: bring back worktrees as a first class citizen again to have reliable, consistent workflow

Operating System

MacOS

Version Information

Version: 3.1.15 (Universal)
VSCode Version: 1.105.1
Commit: 3a67af7b780e0bfc8d32aefa96b8ff1cb8817f80
Date: 2026-04-15T01:46:06.515Z
Layout: editor
Build Type: Stable
Release Track: Default
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Darwin arm64 24.6.0

Does this stop you from using Cursor

No - Cursor works, but with this issue

Thanks for reporting this. This is a known issue with how the agent maintains worktree context across follow-up messages. When you use /worktree, the agent’s binding to that worktree path isn’t structurally enforced, so on subsequent turns it can lose that context and start making changes in the main repo.

A similar report was confirmed by our team recently, and worktree support is being actively rebuilt to address exactly this class of problem. The goal is to have persistent, deterministic worktree binding rather than relying on the model to remember the path.

For now, the workaround is to explicitly remind the agent in follow-up messages to stay in the worktree. Not ideal, but it helps reduce the drift.

1 Like