### wai-quantum 0.6.13 and wai-quantum-cli 0.1.1: the engine critiques a design, checks two circuits are the same, offers alternatives, and prices its classical shortcuts

The engine is the microscope and the judge, a local model is a muse that waits to be asked, and the reader is the author. Every figure below is computed by the engine. Nothing changes the reader's program until they apply a change.

- **`engine::critique`** gives a program's measures and its smells before it runs.
  - The measures: gates by kind; one-, two- and three-qubit gates; T gates; gates off the Clifford angles; depth and two-qubit depth; and the measured qubits.
  - It says whether the program is a Clifford circuit.
  - It gives a fidelity at reference error rates (`REFERENCE_RATES`), named as a model of a device and not a run.
  - The smells, each with its lines and its operations: gates that cancel; rotations that merge; rotations that do nothing; qubits nothing uses; and qubits acted on but never measured.
  - In a program that measures in the middle, a measurement, a reset or a condition is a barrier, and no smell spans one.
- **`critique::variants`** rewrites the program in its own text with its smells fixed.
  - It offers every fix, to a fixed point, since one fix can bring two gates together. It also offers each first-round fix alone, and each distinct program once.
  - A fix touches only a statement alone on its line. A merge keeps the program's own expressions, as `rz(pi/4 + pi/8)`, and its comment.
  - Each candidate carries its measures and the equivalence check's verdict against the program. A candidate the check finds different is never offered.
- **`engine::equiv`** says whether two programs are the same circuit up to a global phase, and how it knows:
  - Clifford circuits by their tableaus, at any number of qubits;
  - otherwise on every basis state, up to 8 qubits and within a work budget;
  - otherwise on three random product states, up to 22 qubits, which is evidence and not proof;
  - otherwise unchecked, with the reason.

  A difference names the input it was found on. Programs that measure in the middle are not compared. Programs of different widths, or that write different qubits to the bits, differ by shape.
- **`qasm::parse_lines`** gives each operation's source line: a broadcast's gates and a definition's expansion share the call's line. **`draw::layout`** gives each gate the index of its operation (`op`), so a diagram can mark the operations a smell names.
- **In the browser:** `wai-web` exports `engine_critique`, `engine_equivalent` and `engine_variants`, tested native and under wasm.
- **Quantum Studio, in the browser and on the desktop:**
  - **The critique, always on.** Under the diagram it shows the measures, each with its change since the last run, a Clifford badge and the modelled fidelity. The smells are listed with their lines. Their gates are flagged on the diagram, and each gate's tooltip names its smell. Show selects the lines and marks the gates. Fix applies the engine's rewrite, and the note says how the result was checked the same circuit; Undo brings the lines back.
  - **Alternatives.** Improve offers the same circuit, cheaper: the engine's rewrites, and the model's when one is connected, each checked against the draft. A rewrite the check finds different is listed as not offered, with the reason. Explore asks the model for different circuits toward an aim the reader names. The engine reads, measures and compares each one, and gives how many lines it changes. An atlas plots the draft and each alternative by two-qubit gates and depth. Apply puts one in the editor.
  - **Predict first** (off by default). Before a run, the reader names the outcome they expect most often and its share of the shots. The run's counts are set against it, and a tally of how close their predictions come is kept on this device.
  - **The assistant asks questions first, and speaks only when asked.** The reader chooses how it helps: it asks questions first (the default), suggests changes, or writes programs. They also choose when it speaks: only when asked (the default), or with a hint offered, never sent, after a problem the engine has reported for a while or two refused runs in a row. New quick asks are "Ask me a question" and "Hint". New tools are `critique_qasm` and `check_equivalent`. For Alternatives it is called once per request, without tools and outside the conversation, and only proposes.
  - The desktop app answers `critique`, `equivalent` and `variants` natively.
- **`wai-quantum-cli` 0.1.1:**
  - `wai-quantum critique` gives the measures and smells.
  - `wai-quantum equivalent a.qasm b.qasm` exits 0 for the same circuit, 1 for different and 2 for unchecked.
  - `wai-quantum improve` prints the improved program, and what changed and how it was checked on standard error.
  - `wai-quantum shortcuts prog.qasm [--thorough] [--json]` prices each exact classical route.
  - The MCP server adds `critique_qasm`, `check_equivalent`, `improve_qasm` and `classical_shortcuts`.
- **`engine::shortcuts`** lists every exact classical route the engine knows for simulating a program, with its cost on that program:
  - **the stabilizer tableau**, for Clifford circuits, at any width;
  - **the cut-rank sum**, for a Clifford circuit followed by one layer of one-qubit gates. Its cost is a table of 2^cut entries along the best order found, and includes running the bulk's tableau and reducing it to graph form;
  - **an exact matrix product state** along the qubits' own order. Its bond is bounded across each cut by the product of the operator Schmidt ranks of the gates that cross it, each computed from the gate's matrix, and never by more than the smaller side's dimension. The bound is rigorous: a test holds it against the true Schmidt rank at every cut of random circuits of every two- and three-qubit gate;
  - **the light cone** of a one-qubit expectation value;
  - **a tensor-network contraction** of one amplitude of a seeded random output, by the engine's tree search (when asked to be thorough);
  - **the state vector**.

  Each route gives its memory, the log2 of its operations to a first answer, and a time at a reference rate of 10¹⁰ operations a second, which is a reference and not a measurement. The cheapest route is named for counts, amplitudes, expectation values and one-qubit expectation values. A summary leads with "classically easy at any width" for a Clifford circuit.

  A cheap route proves a design classically easy. None being cheap proves nothing about hardness: other methods, approximate ones above all, may cost far less, and the result says so.
- **On the 70-qubit random graph-state circuit** (CZ-depth 70, a closing layer of face-basis rotations), the quick check finds the cut-rank sum in under 2 s on one workstation. Its widest cut is 30 bits along a quick order search, at about 2^35 operations a sample. The matrix product state's bound is 2^35 at the middle cut, and the light cone of every qubit is all 70.
- **The lens in the browser and on the desktop:** `wai-web` exports `engine_shortcuts`, tested native and in wasm. The desktop app answers `shortcuts` off the window's thread.
- **The lens in Quantum Studio:**
  - Under the critique, "Classical cost" prices each route and names the cheapest. "Thorough" adds the contraction search.
  - A check is marked stale once the program changes.
  - The assistant gains the tool `classical_shortcuts`.

