# forkSession Option

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

**Field:** Artificial Intelligence  
**Category:** Claude Agent SDK  
**Also known as:** forkSession, fork_session, Agent SDK fork, Claude Agent SDK forkSession

## Think of it like

It is like a copy you make to try a new idea.

## Definition

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.

## Common mistake

Thinking a fork protects the files. It copies the chat only; use checkpoints for files.

## Three principles

- **Use with resume.** Then fork.
- **New session ID.** Original kept.
- **Chat only.** Not files.

## Related terms

- [resume Option](https://learn.benibix.com/term/ai/resume-option)
- [continue Option](https://learn.benibix.com/term/ai/continue-option)
- [enableFileCheckpointing Option](https://learn.benibix.com/term/ai/file-checkpointing-option)
- [/fork Command](https://learn.benibix.com/term/ai/fork-command)

## Told apart from

- [forkSession vs enableFileCheckpointing](https://learn.benibix.com/compare/fork-session-option-vs-file-checkpointing-option): 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.

---

Source: https://learn.benibix.com/term/ai/fork-session-option
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-20
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
