BUILD / fork-a-grok-build-session

Build

Fork a Grok Build session

Fork a Grok Build session

/fork branches the current session into a peer that starts from a copy of the conversation. Official: Sessions, Worktrees.

Fork in the TUI

  1. Open the session you want to branch.
  2. Run /fork (optional directive after the command).
  3. Pass --worktree when the fork should run in an isolated git checkout, or --no-worktree to stay in the same tree.
  4. Continue in the new peer session; the original session stays where you left it.

Fork when resuming from the CLI

grok -r <session-id> --fork-session

--fork-session creates a new session id from the resumed history instead of continuing the same id. Combine with -w / --worktree when parallel agents must not overwrite each other’s files.

Worktrees

A worktree fork lives under ~/.grok/worktrees/ and starts from your current HEAD (including uncommitted changes unless you pass --ref). Land changes with ordinary git. Housekeeping: grok worktree list, show, rm, and gc — see Use Grok Build worktrees.

Pitfalls

  • Forking without a worktree when two agents edit the same paths.
  • Expecting /fork to undo file edits the way /rewind does — fork copies conversation context; rewind restores snapshots.