Lost edits / work - IDE agent worktree and canonical (project)path diverge

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

During AI coding sessions, agent edits are sometimes written to a Cursor worktree path instead of the canonical project path that the user is actively using in file browser, git, and terminal workflows.

This causes silent divergence between two trees:

  • Canonical repo path (user’s expected source of truth)
  • Cursor worktree path (where some agent edits are actually applied)

Result: expected edits appear “missing” in the canonical repo, while unrelated/large diffs appear when manually syncing trees. This is especially risky for production migration work.

Steps to Reproduce

  1. Open a canonical project folder in Cursor (example: /Users/xxxx/Dev/code/xyz).
  2. Start an agent session and perform multiple code edits.
  3. Continue normal workflow from canonical repo using terminal/git/file browser.
  4. At some point, observe that agent-edited files exist/changed under a Cursor worktree path instead (example: /Users/xxx/.cursor/worktrees/...) and not in canonical path.
  5. Compare both trees (git rev-parse, git status, diff -qr) and observe divergence.

Observed in incident:

  • Canonical HEAD and worktree HEAD are different.
  • Worktree contains edits/untracked files not present in canonical tree.
  • Canonical contains files/state not present in worktree.

NOTE:

  • I am not using git worktrees explicitly, or doing anything complicated with multi-agents. My workflow is single edit line on a few local scripts in single project.
  • This seems to happen when using Agent / Auto mode, not 100% certain but have been using this most recently when has happened a few times
  • Repo is hard as it happens silently and only becomes apparent when running script reveals expected functions are lost. Sometimes when testing different functions this doesn’t become apparent for hours. It may related to pauses in work or silent agent changes but hard to say.

Expected Behavior

  • Agent should write only to the currently active canonical workspace root unless explicitly approved otherwise.
  • If Cursor changes effective write root (for example to a worktree), Cursor should require explicit confirmation before writes.
  • Write root should be prominently visible at all times during agent operations.
  • Cursor should not rely on implicit/manual syncing after writes have already diverged.

Basically I should be able to trust basic edit functions

Operating System

MacOS

Version Information

Version: 2.5.26 (Universal)
VSCode Version: 1.105.1
Commit: 7d96c2a03bb088ad367615e9da1a3fe20fbbc6a0
Date: 2026-02-26T04:57:56.825Z
Build Type: Stable
Release Track: Default
Electron: 39.4.0
Chromium: 142.0.7444.265
Node.js: 22.22.0
V8: 14.2.231.22-electron.0
OS: Darwin arm64 24.6.0

Additional Information

This bug effectively makes Cursor unusable for me. I’ve had critical projects delayed due to having to scramble to unpick lost edits etc. I can’t understand how it can be so unstable, or why the Cursor team are pushing more complexity into the IDE when things like this happen.

I will move to using Claude CLI out of preference as never had this experience there.

Does this stop you from using Cursor

Yes - Cursor is unusable

As follow up to this what I notice is when starting a new agent you see the local/worktree/cloud path selection under the panel

However once you start interacting the agent/mode goes to bottom and the path selection disappears

If you set to a worktree state then you get the tree icon shown (vs nothing for local)

I’ve never enabled or used worktree, I’ve always used agent(s) on the default local but somehow Cursor toggled the setting to worktree silently and chaos follows

Hey, thanks for the detailed report. This is a known issue, worktree can turn on silently without any clear user action.

You found the key spot, the Local/Worktree/Cloud dropdown at the bottom of the chat. The main workaround right now is to check before each new agent session that it’s set to “Local”, not “Worktree”. If you’re already working, watch the branch icon to the right of the model picker. If it’s there, worktree is active.

A couple things to know:

  • In an already started chat, the dropdown disappears (like you noticed), but the worktree icon stays visible. If there’s no icon, you’re in Local.
  • If worktree already turned on, it’s best to start a new chat and explicitly pick “Local”.
  • Similar reports: here and here

The team is aware of the issue, and your report helps with prioritization. Unfortunately, there’s no way to fully disable worktrees yet, but it’s a frequently requested feature.

Let me know if you have any other questions.

Hello

Thanks for the reply. The other reports are interesting as there seems to be some speculation this happens when you go into Plan mode (explicitly or Agent prompted). I can’t say for certain but that is a possibility when it happened to me.

What I can say to team is this effectively makes Cursor unusable. Coding with AI agents already has a certain element of risk given how quickly it can change / create code. If you add this randomness it is so unstable that it approaches useless or destructive in anything close to production use.