How to fork a Claude Code or Codex session to try another approach A developer documented how to fork Claude Code and Codex agent sessions so an alternative approach can be tried without polluting or losing the original conversation context. Claude Code offers /branch and the --fork-session flag, while Codex provides /fork, codex fork, and a double-Esc prompt picker, and the writeup recommends giving each fork its own git worktree to avoid two agents editing the same files. The agent has a plan, and it's halfway through. You want to see what the other approach looks like, the one you talked it out of an hour ago. If you ask in the same session, you pollute the context it has built up. If you start a new session, you lose that context. A fork gives you both. It copies the conversation so far into a new session, and the original stays exactly where it was: /branch . You're moved into the copy, and the original can be resumed later. claude --resume