> ## Documentation Index
> Fetch the complete documentation index at: https://docs.buildbetter.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Versions & Forking

> How iteration history works — browsing past versions, sharing version-scoped links, and forking from any point to explore variations

Every chat turn in a prototype saves a new version. The history is immutable — you can always step back to any iteration, share that exact state, or fork it into a new prototype to explore a different direction without touching the current path.

## How Versions Are Created

A new version is created whenever:

* A user message produces an agent response (the most common case)
* A prototype is forked from another version
* A prototype is created from extension capture (v0 = base)

Each version stores:

* **Patch operations** — the changes the agent applied (modify / insert / remove)
* **Chat history** — the full message array
* **Thumbnail** — 480×300 JPEG of the canvas at that moment

The base version (v0) is the original capture (or empty HTML for blank canvases). All later versions replay the patch log from v0 to reconstruct their state, so the history is deterministic.

## The Iterations Strip

When more than one version exists, the strip appears at the bottom of the canvas.

* Header shows total version count and a **"Viewing older"** badge if you're not on the latest
* Thumbnails are scrollable; each labeled `v0`, `v1`, etc.
* Tooltip on hover shows the full timestamp
* Click any thumbnail to view that version

When you click an older version:

* The canvas re-renders that state
* The composer disables with the placeholder **"Return to the latest version to keep editing"**
* A **"Back to latest →"** button appears at the end of the strip

This prevents accidentally branching the version tree — to start a new line of edits from an older state, **fork** instead.

## Sharing a Version-Scoped Link

Hover any thumbnail and click the **link icon** to copy a URL with `?version=<id>` appended. Recipients open the link and see that exact iteration, regardless of what the latest has become since.

This is the right share format for review — your stakeholders see the version you meant, not whatever the prototype has drifted to.

## Forking a Version

Hover any thumbnail and click the **fork icon**. This:

1. Creates a brand-new prototype
2. Seeds it with the chosen version's full state (patches and chat history)
3. Opens the new prototype in a new tab

Use forks to:

* Explore a variation without affecting the current path
* Snapshot a working state before a risky change
* Hand a colleague a starting point for parallel iteration

Forks are independent — once created, edits to the fork don't affect the original, and vice versa.

## How Forks Differ from Clones

Two ways to start a new prototype from an existing one:

|              | Fork                              | Clone (from list page)                                     |
| ------------ | --------------------------------- | ---------------------------------------------------------- |
| Source       | A specific version                | The base version (v0) only                                 |
| Chat history | Copied from source                | Empty                                                      |
| Use case     | Branch off a particular iteration | Start fresh from the same capture                          |
| Where        | Iterations strip in the editor    | **New prototype → From existing capture** on `/prototypes` |

Forking carries the agent's context and edit history forward, so the agent in the fork understands what's already been changed. Cloning gives you a fresh agent slate — same starting page, no history.

## Sharing the Whole Prototype

The **Share menu** (upload icon in the chat header) has two options:

* **Copy as prompt** — see [Handoff Export](./handoff). Only enabled when viewing the latest version.
* **Copy link** — copies the current URL. Includes `?version=<id>` if you're viewing an older version, or just `/prototype/:id` if you're on the latest.

## Returning to the Latest

If you've been browsing older versions:

* Click any version's thumbnail in the strip and then **"Back to latest →"** at the end
* Or click the latest thumbnail directly
* The composer re-enables and you can continue iterating

<Tip>
  Use forks generously. They're cheap and they protect a working iteration from being clobbered by a follow-up prompt that didn't pan out. The Iterations strip becomes more useful when you have many versions to choose from.
</Tip>
