Skip to content
BENIBIX Learn

forkSession vs enableFileCheckpointing

People think forking a session also copies the files, and it does not. forkSession copies the chat into a new session with its own ID. That lets you try a second idea. A file the fork edits is changed for real, for each session in that folder. File checkpoints are what back files up, so the edits can be rolled back.

AI🧩 Claude Agent SDK

forkSession Option

The option that starts a copy of an old session, with a new ID. The first one stays as it was.

forkSession is the Agent SDK option that, used with resume, starts a new session from a copy of the old one. In Python it is fork_session. The copy gets its own session ID, and the original stays as it was. It branches the chat, not the files. Edits the fork makes on disk are real and shared with any session in that folder.

Example
Leo wants to try two fixes from the same point. He forks the session twice and lets each branch try one.
Why it matters
You can try a risky path without losing the chat you had.
Full entry
AI🧩 Claude Agent SDK

enableFileCheckpointing Option

The option that lets you put files back the way they were.

enableFileCheckpointing is the Agent SDK option that backs up files before the agent changes them, so you can roll them back. It covers the Write, Edit and NotebookEdit tools, not shell commands. Each prompt is a checkpoint, named by its message ID. Pass that ID to rewindFiles to put the files back. The chat stays as it is.

Example
Mia's agent rewrote a module badly. She calls rewindFiles with the ID of the prompt before it, and the old files come back.
Why it matters
Agents make wrong edits, and an undo for files makes it safe to let them try.
Full entry

In one line

forkSession Option
The option that starts a copy of an old session, with a new ID. The first one stays as it was.
enableFileCheckpointing Option
The option that lets you put files back the way they were.