# Versions

> Every change to a Layerz model, by a person or an agent, is a version that can be listed, compared, pinned and restored.

Every write that changes a model records a **version**: its author (a person, or the agent acting for them), a label saying what changed, and the full state of the model. A write that changes nothing records nothing.

## What you can do with versions

- **List** the history of a model, or the changes to one line.
- **Compare** two versions, or a version with the live model: lines added, removed and modified, scenario cells, and optionally the computed values that moved. Comparing values is how an agent proves a refactor is neutral on the numbers.
- **Restore** a version. The live state is saved first, so a restore can itself be undone; a source's settings and mapping rules come back with the version.
- **Pin** a version (a board pack, a closed month) to keep it beyond the plan's history window.

## Revisions and concurrent writes

Each state of a model has a `revision_id`. Two reads that return the same revision saw the same model. Writes are atomic: when two writers change the same model at once, the second one is refused and retries on the new state, so no change is lost silently.

## Before a risky change

A patch or a blueprint can run as a dry run that reports errors, and a patch can preview the numbers it would move. See [Blueprint and patch](/docs/mcp/blueprint-and-patch).
