### wai-quantum: a program's history, attributed, and the Studio's Versions

- **The history** (`engine::versions`): every version of a program, in a chain.
  - Each version names its parents: none for the first, one for a change, two for a merge.
  - Each names who made it: the person, the assistant (a model), an outside agent, the engine, or where the program came from.
  - Each names how it was made: an edit, a proposal reviewed change by change, or a merge.
  - A version's digest covers its parents' digests, its source, who made it and how, and the recording host's key seals it. `History::verify` checks every digest and seal, and that each review gives its version's source.
- **A proposal reviewed change by change** (`changes`, `apply`, `History::propose`):
  - the changes are a line-level diff, a longest common subsequence by Myers' algorithm;
  - only the changes accepted reach the program;
  - the version keeps the whole proposal and which changes were taken, so the rejected ones stay readable.
- **Whose hand** (`History::blame`, `authorship`, `gate_hands`):
  - a line keeps its author until someone changes it;
  - a model's or an agent's line that the person then edits is in both hands (`assistant_then_person`, `agent_then_person`);
  - an edit back to an earlier program (an undo) keeps that program's authors, and a merge keeps each line's author from either side;
  - the gates follow their lines, so a generator's are counted at given inputs, each by the line in the loop that makes it.
- **On the receipt:** `History::attest` gives a version's digest and the gates and lines in each hand. A job's request carries it as `history`, so the receipt binds it and a changed count fails the signature. `History::check_job` recomputes the account from the history, and checks that the job ran that version's program.
- **The command line:**
  - `wai-quantum history start | commit | changes | propose | merge | log | blame | verify`, with the history in a file beside the program;
  - `run --history` and `submit --history`;
  - `verify --history`.
- **For agents:** `wai-quantum mcp` adds `history_commit`, `history_changes`, `history_blame` and `history_log`. An agent's edit is recorded as an outside agent's, under the name its client gave in `initialize`, whatever it says of itself.
- **The Studio's Versions pane:**
  - **Recording:** what the reader types is recorded as theirs once they pause. Every proposal (the assistant's program, an alternative, a generator from the Workbench) is offered change by change, and the editor waits until the reader chooses.
  - **Lines of work:** drawn in lanes. An older version opened and edited starts a line of its own, and "Bring in" merges another line change by change.
  - **"Who wrote it"** marks each line in the gutter and each gate on the diagram.
  - **On the receipt:** a run's receipt binds the account, and the result shows it, recomputed here. The versions are kept in the browser and download as `program.qasm` and `program.history.json` for the command line.
  - **Hosts:** `window.quantumStudio.propose` lets an embedding page offer a program as someone's proposal. The page and the desktop app call the engine through one `history` binding.
- **Fixes in the Studio:**
  - a run is shown as running before the history's account is made, so a quick check after it does not read the last result;
  - the draft is kept as the page goes, not only after a redraw's pause.

