Worktrees.json does not work - nightly

1.8.0 pre 12 patch 1 windows 10


none of these commands were run during worktree creation

1 Like

hi @liquefy do you have any related output in your logs (Bottom pane > Output) or in Console (Developer Tools)?


in git output, lmk if i should check anything else
also do you know if i configure mcp.json in my project folder and then use worktrees, if the mcp works in the worktree agent as well? not sure how it is handled at all

@liquefy Console in Developer Tools has most output about it.

there is no mention of git/worktrees in console when i filter by it, there are warning and errors, likely irrelevant

The errors and warnings would likely help

i opened cursor, cleared console log to get rid of logs that are caused by something other than worktrees, crated new chat with worktree on and there are no errors or warning in the console

1 Like

I have shared the details with the team. Thank you for the report!

@liquefy did you have any version where this was working? Likely it isn’t yet in the version you have.

@liquefy it’s likely that you have Worktrees enabled but you’re not on a version where .cursor/worktrees.json is already respected as this was only added to Nightly ~24 hours ago.

@condor @David_Gomes
Version: 1.8.0-pre.12.patch.2 (user setup)
VSCode Version: 1.99.3
Commit: a19821b5ee800a93209eb65ab5c7a79c0d5dc710
Date: 2025-10-03T00:26:43.675Z
Electron: 34.5.8
Chromium: 132.0.6834.210
Node.js: 20.19.1
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.19045

i got this version just now, still does not work

also how do i transfer changes from the worktree to my main project folder?
also when i run gci env:* | sort-object name in the worktree folder i dont see the ROOT_WORKTREE_PATH variable

  • If .cursor/worktrees.json is not running for you on the absolute latest nightly, then the only explanation I can think of is that perhaps you’re not opening Cursor on the root of your project (where .cursor/ would be)?

  • There is an “Apply” button that shows up when the agent makes changes, and that’s how we expect people to move the changes from a worktree to their main project folder.

  • We only inject ROOT_WORKTREE_PATH to the setup script as it is running immediately upon creation of a worktree, we don’t inject that variable anywhere else.

i have tried just now, got latest version:

Version: 1.8.0-pre.14.patch.0 (user setup)
VSCode Version: 1.99.3
Commit: 999f5d69859bc8f95d43a5e1ea2ac840f4f126d0
Date: 2025-10-04T08:10:14.199Z
Electron: 34.5.8
Chromium: 132.0.6834.210
Node.js: 20.19.1
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.19045

tried both in main cursor chat and agent window:
worktrees.json did not run
when i click keep all changes, it did not move them into the main project folder

i check the button for worktrees, told agent to create new file, it did in the worktree folder, i checked, i also checked that file that should have been created via worktrees.json was not created in the worktree folder. then i click keep changes and it did not move them into main project folder.

i can send any debug info or get in touch for more in-depth analysis, anything you might need, because this feature would be awesome for me
image
found this error in dev tools… maybe spawn does not work on windows??

Oh! Thank you so much for the screenshot with logs, that’s gotta be it, we’ll take a look at Windows support.

2 Likes

Version: 1.8.0-pre.14.patch.0 (user setup)
VSCode Version: 1.99.3
Commit: 999f5d69859bc8f95d43a5e1ea2ac840f4f126d0
Date: 2025-10-04T08:10:14.199Z
Electron: 34.5.8
Chromium: 132.0.6834.210
Node.js: 20.19.1
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.26100

Hi, I’m also using Dev Containers extension, not sure if relevant.

When I try to execute an agent command in a worktree, it runs the commands in worktrees.json in the root worktree (primary workspace) instead of in the new worktree. As a test, my worktrees.json file is:

{
  "setup-worktree": [
    "echo \"Worktree path: <$ROOT_WORKTREE_PATH>\" > env_path.md",
    "touch test.md"
  ]
}

Result:

Both env_path.md and test.md appear in the root worktree, and I would have expected them to appear in the new worktree.
$ROOT_WORKTREE_PATH is printed into env_path.md (and the path appears correct).

I know I’m using a feature that isn’t even really released yet, but I thought I’d provide feedback.

Thanks,
James

relevant thread: Worktrees.json does not work - nightly

Thanks @liquefy, I saw your thread there and it inspired me to open this one, because this seems to describe a slightly different problem from what I can tell!

1 Like

any update on windows support?

@liquefy our last Nightly build has Windows support. You can put the script inside setup-worktree-windows in .cursor/worktrees.json, e.g.:

{
  "setup-worktree-windows": ["npm install"]
}