Forking & Snapshots
Learn how to fork an agent conversation from any message — branching into a new session or a new task with a git snapshot of the worktree at that point.
Verun takes a git snapshot of your worktree at the end of every agent turn. This means you can go back to any point in a conversation and fork from there — without losing your current work.
When to Fork
- The agent went down the wrong path and you want to try a different approach from an earlier message.
- You want to explore two solutions from the same starting point simultaneously.
- You want to hand off work to a different agent or model from a mid-point in the session.
How to Fork
Hover any assistant message in the session chat to reveal the fork buttons:
Fork in this task
Creates a new session in the same task, rewinding the conversation to the selected message. The worktree stays at its current state (your latest code). Use this to retry a different approach without losing the worktree.
Fork to new task
Creates a new task with a new worktree and a new branch. You choose what state the worktree starts in:
- Snapshot — the worktree is restored to exactly how it was at the forked message. Files the agent had written up to that point are present; changes after it are not. This is a true counterfactual.
- Current — the new task's worktree starts from the task's current code, not the historical snapshot.
Original Task
├── Turn 1 — snapshot A
├── Turn 2 — snapshot B ← fork here
│ ├── Fork in task → new session, worktree stays current
│ └── Fork to task → new task, worktree = snapshot B (or current)
├── Turn 3 — snapshot C
└── Turn 4 — snapshot D (current)How Snapshots Work
At the end of every assistant turn, Verun creates a lightweight git snapshot using commit-tree against a temporary index. Snapshots are stored under refs/verun/snapshots/ so they survive git gc. No commits are added to your working branch — snapshots are invisible to normal git operations.
Fork vs. New Task
| Fork | New Task | |
|---|---|---|
| Starting point | Any past turn | HEAD of base branch |
| Conversation history | Copied up to fork point | Empty |
| Worktree state | Snapshot or current | Clean checkout |
| Use case | Retry or branch existing work | Start something new |