Harness Notes

Forking

Updated 2026-11-22,

On this page

Branching a session into a copy you can take somewhere else, and going back to an earlier point. Subagents that start from your conversation are on the Subagents page.

Worktrees: create, set up, integrate and clean up isolated checkouts

QuestionCursor Agentchecked at 2026.10.12-d47ca18
Fork a session

Type /fork (aliases /branch and /duplicate) in an interactive session. It copies the current chat into a new session, switches you into the copy, and prints agent --resume <id> so you can get back to the original. There is no --fork flag or agent fork subcommand.

/fork is refused while the agent is still working or before the chat has any messages.

Fork or rewind from an earlier point

Partly

/fork always copies the whole chat; the CLI has no fork-from-message option. /rewind (aliases /undo, /restore) opens a turn timeline and moves the current chat back to an earlier message, either restoring files and conversation or the conversation only. To branch from an earlier point, run /fork and then /rewind inside the copy.

/rewind is on by default since v2026.06.22 and can be turned off with the rewind key in cli-config.json or in /config.

The Cursor editor can fork from a specific message, copying the chat through that message and dropping later ones.

What the fork keeps

The fork gets the full conversation history, including subagent and summary data. In CLI 2026.10.12 it also keeps the mode (agent, plan or ask), the last-used model, the Run Everything and approval settings, and the current plan file. It runs in the same working directory, and you can change model or mode afterwards with /model or Shift+Tab.

Flags such as --model or --force can't be passed to /fork itself.

File changes and worktrees

Partly

Forking does not copy or isolate files: the original and the fork edit the same working tree. /rewind can undo file changes, offering Restore files and conversation or Restore conversation for a chosen turn. For separate files, start a session with -w/--worktree [name], which runs it in its own git worktree under ~/.cursor/worktrees/<repo>/<name>.

Rewinding files in a fork also changes them for the original chat, because both share the same directory.

Rewind file history is stored locally and isn't a replacement for git.

Where a fork came from

Partly

The fork is named after the original with (forked) appended, and /fork prints the original chat's ID. Both chats appear as separate entries in agent ls / /resume. In CLI 2026.10.12 no parent link is stored, so there is no branch tree or switcher; you switch with /resume or agent --resume <chatId>.

Fork from the SDK or API

Not supported

No. Headless mode (agent -p) can continue a chat with --resume <chatId>, but it has no fork option. The ACP server (agent acp) supports session/new, session/load and session listing, but not forking.

agent create-chat makes a new empty chat and returns its ID. It does not copy an existing one.

Notes and sources

Cursor Agent, 6 sources
Fork a session, 1
Fork or rewind from an earlier point, 2
What the fork keeps, 1
File changes and worktrees, 3
Where a fork came from, 2
Fork from the SDK or API, 2