# Run history, checkpoints, diffs and review comments

A design moves through dozens of runs and edits before anyone else sees it. Voltecx keeps each run with what changed, lets you go back to any saved state, tells you exactly what differs between two versions, and keeps a reviewer's notes in the file itself. Everything below is a command, so a script or an assistant can use it as well.

## Run History reads like a commit list

Every simulation is kept with what changed since the run before. **Simulation › Runs** (`runs.list`) lists the runs. You can tag a run to keep it (`runs.tag`, `runs.untag`), remove one (`runs.remove`), drop every untagged one (`runs.clear`), and compare runs signal by signal: mean, RMS, min, max and final value, with the difference from a reference run (`runs.compare`, also **Simulation › Compare Runs**). The last 10 untagged runs and every tagged run stay in memory, up to a fixed count and size, and tagged runs are saved with the circuit in a bundle (below).

*In the next release.* The Run History, also the **Runs** view of the side bar, shows one card per run, newest first. A card's title is the tag you gave the run, or what changed since the run before: `Q2: ron 1.8m→3m`, `added Rstep`, or **First run**. Under the title are the run's number, how long ago it ran and its key results, each with its change from the run before (green ▲, red ▼). Re-runs with no changes fold into one line. Click a title to open the card: a table of every changed value, **Before** and **After**, plus the parts added or removed and any new connections.

- **Show on scope** draws the run dashed over the latest one.
- **Compare** on two cards overlays both and adds a side-by-side table of each signal's results and the difference.
- **Restore** (`runs.restore`) sets the circuit's parameter values, circuit variables and simulation settings back to that run's, in one step that Undo takes back. Parts added or removed since then stay and are listed.
- **Tag**, **Rename**, **Untag** and **Delete** sit on each card.

## Several reference traces

*In the next release.* **Keep as reference** in the scope toolbar keeps the latest run as a reference. You can keep up to 8, each drawn dashed under every later run in its own colour and dash and named in the legend (`v(out) · Ref 1`). A reference is a tagged run, not a copy, so it is saved in a bundle and measured against the latest run like any overlaid run. The **References** list shows, hides, restyles, renames or removes them. Scripts use `scope.references` with `list`, `add`, `show`, `rename`, `style`, `remove` and `clear`.

## Undo history

**Edit › Undo List** opens a tab beside Properties in the right column. It lists every undo step of the circuit, oldest first, with the current one highlighted and the undone ones dimmed. Hover over a step to see what it changed, and click it to jump there in one move; the later steps stay until the next edit. Scripts use `edit.history` (with `step`, what that step changed) and `edit.goToHistory`.

## Checkpoints

A checkpoint is a named snapshot of the circuit. `checkpoint.create {"label": "sent to layout"}` takes one, `checkpoint.list` lists them with what has changed since each, `checkpoint.diff` gives that change in full, and `checkpoint.restore` puts the circuit back as one undoable step. Up to 50 are kept per circuit. The AI assistant takes a checkpoint before each turn, so every turn has a **Restore** button, and each stage of automatic design leaves one behind.

## Compare two versions

`file.diff` says what changed between two versions of a circuit and opens nothing. Each side can be a `.voltecx` file, a file in another supported format, a circuit you have open, circuit or netlist text, or a checkpoint. A checkpoint's label works as a version tag: `{"a": {"checkpoint": "sent to layout"}}` compares the newest checkpoint with that label against the circuit now. The reply lists each change once:

- parts added, removed and renamed (a rename is one change, not a removal and an addition);
- parameters that differ, with their units (`C1.c: 1 µF → 2.2 µF`);
- wiring per net, and nets that were only renamed;
- circuit variables, simulation settings and subsystem definitions.

Each change also comes as one sentence in English and Traditional Chinese. For the results, `bom.diff` compares two `bom.export` replies: lines added and removed, a changed part number, value, quantity, footprint or price per reference designator, and the change in total cost, pieces and board area. `spec.diff` compares two `spec.verify` replies row by row: what now fails, what now passes, what measures differently, and the verdict before and after.

## Review comments in the file

Comments work as in Figma. The **Comment** tool (**Shift+C**) drops a pin with a click or pins an area with a drag, and a box opens beside the pin to type in. Point at a pin to read its first message and the number of replies; click it to open the whole thread on the schematic, reply with **Enter**, resolve it with the check mark or delete it. The **Comments** view of the side bar lists the same threads, numbered as their pins, and also pins a thread to a selected part or net or to a point on a waveform ([how it looks](https://voltecx-web.nguyenvanqui291.workers.dev/docs/manual/14-preferences-and-saving/#review-comments)). The threads are saved in the circuit file, so a colleague reviews by opening the same file, with no account and no server. Every change is one undo step. **Merge Comments from File** brings in the threads and replies from a colleague's copy, and merging the same copy twice adds nothing. Scripts use `comment.add`, `comment.reply`, `comment.resolve`, `comment.reopen`, `comment.delete`, `comment.list` and `comment.merge`.

## The .voltecx file

A circuit file is plain JSON that keeps every number bit for bit, so it works in version control and reads in a text editor. *In the next release:* circuits are saved as `.voltecx`, and files saved earlier as `.pcraft` open as they are. A circuit can also be saved as a bundle (`file.save {"bundle": true}`), one file that adds the last simulation result, the tagged runs and a thumbnail. On opening a bundle, the scope shows the saved result without a new run if the circuit has not changed since. A save that names no form writes a bundle when the circuit has tagged runs, so they are not lost. Runs read from a bundle keep their waveforms but not the circuit they ran on, so **Restore** does not apply to them.

## Signed saves

Each save is signed with a key that belongs to your installation. The status bar shows **Signed**, **Modified after signing** or **Unsigned**, and **File › Protection › Verify Signature** (`file.verify`) shows the key, the licence id and the time. **Trust This Signer** (`signing.trust`) names a colleague's key, so their files read as signed by that name. `signing.status`, `signing.setEnabled` and `signing.untrust` do the rest. A signature shows that a file is unchanged since the holder of that key saved it. It does not show who made it unless you trust their key, and in a bundle only the circuit is signed.

To share a sub-circuit that simulates without showing its inside, see [protected blocks](https://voltecx-web.nguyenvanqui291.workers.dev/features/licences-and-protection).

## From a script

Run the RC example, tag the run, take a checkpoint, change R1, run again, then compare the runs and the circuit with the checkpoint:

```sh
powercraft-cli run \
  --cmd file.openExample   --params '{"name":"rc"}' \
  --cmd simulation.run     --params '{}' \
  --cmd runs.tag           --params '{"id":"r1","tag":"1k"}' \
  --cmd checkpoint.create  --params '{"label":"before R1"}' \
  --cmd circuit.setParam   --params '{"component":"R1","key":"r","value":"2k"}' \
  --cmd simulation.run     --params '{}' \
  --cmd runs.compare       --params '{}' \
  --cmd file.diff          --params '{"a":{"checkpoint":"before R1"}}'
```

The manual covers [the Run History and references](https://voltecx-web.nguyenvanqui291.workers.dev/docs/manual/05-scope/), [comparing versions](https://voltecx-web.nguyenvanqui291.workers.dev/docs/manual/09-import-export/) and [bundles and signed files](https://voltecx-web.nguyenvanqui291.workers.dev/docs/manual/14-preferences-and-saving/). See also [debugging and the scope](https://voltecx-web.nguyenvanqui291.workers.dev/features/debugging-and-scope) and [automation](https://voltecx-web.nguyenvanqui291.workers.dev/features/automation).
