This carries 0.6.13, which was not published on its own, and 0.6.14. ## 0.6.13 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 is the engine's. Nothing changes the reader's program until they apply a change. engine::critique gives a program's measures before it runs: - gates by kind; one-, two- and three-qubit gates; T gates; gates off the Clifford angles; - depth and two-qubit depth, and whether it is a Clifford circuit; - a fidelity at reference error rates, named as a model. It also gives the program's smells, each with its lines and operations: gates that cancel, rotations that merge or do nothing, idle qubits, and qubits never measured. critique::variants rewrites the program's own text with the smells fixed, all of them to a fixed point and each one alone. Each candidate carries its measures and the equivalence verdict; one the check finds different is never offered. engine::equiv compares two programs up to a global phase: - by tableau for Clifford circuits, at any size; - otherwise on every basis state, to 8 qubits; - otherwise on random product states, to 22 qubits, which is evidence, not proof; - otherwise unchecked, with the reason. qasm::parse_lines gives each operation's line, and draw::layout each gate's operation index. engine::shortcuts lists every exact classical route the engine knows, priced on the program, and names the cheapest for each question: - the stabilizer tableau; - the cut-rank sum; - an exact matrix product state, at a bond bounded by the operator Schmidt ranks of the gates crossing each cut. The bound is held by a test against the true Schmidt ranks of random circuits; - the light cone; - a tensor-network contraction, when asked to be thorough; - the state vector. A cheap route proves a design classically easy; none being cheap proves nothing. On the 70-qubit random graph-state circuit the quick check finds the cut-rank sum (widest cut 30) in under 2 s. The thorough one finds widest cut 29 in about 4 minutes. Quantum Studio gains: - the critique, always on under the diagram, with the smells flagged on it, Show and Fix; - the classical cost, on request; - Alternatives: Improve (the engine's rewrites and the model's, each checked) and Explore (the model's different circuits, each measured and compared), with an atlas and Apply; - Predict first, which sets the reader's expected outcome against the run; - an assistant that asks questions first and speaks only when asked, offering (never sending) a hint when allowed. Its new tools are critique_qasm, check_equivalent and classical_shortcuts. wai-web exports the four engine calls. The desktop app answers them natively. wai-quantum-cli 0.1.1 adds critique, equivalent (exit 0/1/2), improve and shortcuts, with four MCP tools. examples/cutrank_qasm gains probs: the exact 2^n·p of given bit strings, with their linear cross-entropy. ## 0.6.14 A deep circuit on a line, contracted qubit by qubit along time, keeps a boundary of only the bonds between two neighbouring qubits: about half the depth for a controlled-Z brickwork. The contraction search rarely found that tree on its own. - Network::amplitude_split_placed builds the same network as amplitude_split, index for index, with each index's place in the circuit: a qubit and a time. - tensor_places, sweep_orders and sweep_path turn the places into the trees that sweep qubit by qubit, or time by time. - find_path_seeded and find_path_restarts_seeded score such trees beside the trials and polish the best of them all alike. A seed that is not a tree of the network is ignored. - The engine's tensor_network method and the thorough shortcut lens take both sweeps as seeds. On the 70-qubit random graph-state circuit, one amplitude's largest intermediate falls from 2^48 to 2^36, and its multiply-adds from 2^56.1 to 2^48.7, in the thorough lens. With 16 trials and no seeds the search finds 2^59. The pinned plans in tests/bit_identity.rs call find_path itself and are unchanged. The job service answers four design checks: POST /v1/critique, /v1/equivalent, /v1/improve and /v1/shortcuts, with the matching MCP tools. They run in its own process within bounds: - each counts against the client's submissions; - at most two run at once, and one that waits ten seconds is refused with a 503; - equivalence work past 4e9 gate amplitudes, and a thorough search, are refused with a 422 naming the local command. The smoke script checks each one. It now follows a job that outlasts /v1/run's wait, as a client does, instead of failing on a loaded host. wai-quantum-cli 0.1.2 carries the faster contraction. Co-Authored-By: Claude Opus 5.5 <[email protected]>
8 KiB
wai-quantum
The command line of the WAI quantum stack. It runs OpenQASM programs on this machine, planned and run by the same engine as the quantum job service (wai_quantum::engine), so a job gives the same result here as there. It also sends programs to the service, checks and draws them, verifies receipts, and serves its tools to agents over MCP.
Installing it
| Where | How |
|---|---|
| Any platform with Rust | cargo install wai-quantum-cli (installs the wai-quantum binary) |
| macOS or Linux, with Homebrew | brew tap transaction-science/tap https://git.transaction.science/Transaction-Science/homebrew-tap then brew install wai-quantum |
| Windows, with Scoop | scoop bucket add transaction-science https://git.transaction.science/Transaction-Science/scoop-bucket then scoop install wai-quantum |
| Anywhere | a prebuilt archive from the releases tagged wai-quantum-cli-v… |
The prebuilt archives are:
- macOS for Apple silicon and for Intel, with the GPU state vector;
- Linux for x86_64 and arm64, linked statically, so any distribution runs them;
- Windows for x86_64.
Each archive has a .sha256 file beside it (shasum -a 256 -c). A tag wai-quantum-cli-v<version> builds them on the project's own runners (release/, .github/workflows/wai-quantum-cli-release.yml), and writes the Homebrew formula and the Scoop manifest for them.
Running a program
wai-quantum run bell.qasm --shots 1000
wai-quantum run prog.qasm -o "Z0 Z1" -o "0.5 X2" -a 000 -a 111
wai-quantum run prog.qasm --noise depolarizing_2q=0.01 --noise readout=0.02
wai-quantum run prog.qasm --method mps --option max_bond=128
cat prog.qasm | wai-quantum run --json > job.json
A program is OpenQASM 3, or the OpenQASM 2 forms in common use. The reader accepts:
- registers, and a gate applied to a whole register;
- the standard gates;
ctrlandnegctrlmodifiers;- gate definitions;
- measurement and
resetanywhere, andifon measured bits.
It refuses loops, inv and pow, giving the line of each.
--method auto (the default) picks the strongest method the program admits:
| Method | Takes |
|---|---|
| exact | dyadic angles; the state vector, the same bits on every machine |
| statevector | any angle |
| stabilizer | Clifford circuits, to tens of thousands of qubits |
| mps | matrix product states |
| pauli | Pauli dynamics, for expectation values |
| tensor_network | amplitudes |
| cutrank | a Clifford circuit with a layer of rotations |
| density_matrix, trajectories | noise |
wai-quantum methods lists each method's reach in a job's memory here (--memory-gb, default 16).
Each result names:
- its method, and why that method was chosen;
- its accuracy class;
- the counts, expectation values or amplitudes asked for;
- its receipt.
Receipts
Every result is signed over the request and the result in their canonical JSON. The service signs with its key; this tool signs with this user's key:
--key FILE, or$WAI_QUANTUM_KEY, names a file holding the key;- otherwise the key is
$XDG_CONFIG_HOME/wai/quantum-key, or~/.config/wai/quantum-key. It is made from the system's random source on first use and is readable by its owner only.
wai-quantum key prints the key's did:key. --demo-key signs with the published demo key. Its receipts show only that a result is unaltered, not who signed it.
wai-quantum run prog.qasm --json > job.json
wai-quantum verify job.json # VALID, and the signer's did:key
wai-quantum submit prog.qasm --json > svc.json
wai-quantum verify svc.json # the same check on the service's receipt
A receipt shows that this key signed this request and this result, and anyone can rerun the request to compare. It does not say who holds the key.
Checking and drawing
wai-quantum lint prog.qasm # ok, with its shape, or the line of the first problem
wai-quantum plan prog.qasm # the method and why, the memory and work, without running
wai-quantum draw prog.qasm --width 80
q0: ─────H─────●──M0──────
│
q1: ───────────⊕──●───M1──
│
q2: ──Rz(π/4)─────⊕───M2──
Critique, equivalence and improvement
wai-quantum critique prog.qasm # its measures, a modelled fidelity, and its smells with their lines
wai-quantum equivalent a.qasm b.qasm # the same circuit? exit 0 the same, 1 different, 2 unchecked
wai-quantum improve prog.qasm > better.qasm # its smells fixed; what changed, and the check, on standard error
wai-quantum shortcuts prog.qasm # each exact classical route to simulating it, and its cost here
The critique's figures are computed, not estimated: gates by kind, two-qubit gates, depth and two-qubit depth, the T count, and whether the program is a Clifford circuit. Its fidelity is a model at reference error rates, and says so. Its smells are gates that cancel, rotations that merge or do nothing, idle qubits, and qubits acted on but never measured.
equivalent compares two programs up to a global phase. Clifford circuits are compared by their tableaus at any size, and others on every basis state up to 8 qubits. Between 8 and 22 qubits it compares them on random product states, which is evidence, not proof. Beyond that it answers unchecked, with the reason. improve rewrites only statements alone on their lines, and prints a rewrite only when the check does not find it different.
shortcuts lists every exact classical route the engine knows for simulating the program, each with its memory and operations, and names the cheapest. The routes:
- the stabilizer tableau, for Clifford circuits;
- the cut-rank sum, for a Clifford circuit followed by one layer of one-qubit gates;
- an exact matrix product state, at a bond bounded across each cut by the operator Schmidt ranks of the gates that cross it;
- the light cone of a one-qubit expectation value;
- a tensor-network contraction, with
--thorough, which also searches longer for a cut-rank order; - the state vector.
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.
The service
wai-quantum submit sends a job to https://wai.transaction.science/quantum-jobs, or to --service URL (also read from $WAI_QUANTUM_SERVICE). It waits for a long job to finish, then prints the result just as run does.
For agents
wai-quantum mcp is a Model Context Protocol server on standard input and output. Its tools are:
run_quantum_circuitplan_quantum_circuitlint_qasmcritique_qasmcheck_equivalentimprove_qasmclassical_shortcutsdraw_circuitverify_quantum_resultlist_methods
Runs happen on this machine and are signed with this user's key; nothing is sent anywhere. In an MCP client's configuration:
{ "mcpServers": { "wai-quantum": { "command": "wai-quantum", "args": ["mcp"] } } }
The research tools
wai-quantum lab … holds the research tools:
- algorithms from the catalogue, OpenQASM and QIR export, and receipts over them;
- error correction at circuit level;
- qLDPC memory;
- fault-tolerant resource estimates and architectures;
- DMRG, TDVP and molecules;
- neural quantum states;
- Gaussian boson sampling;
- optimisation;
- the compute fabric;
- information and transport.
wai-quantum lab help lists them. wai-quantum verify also checks the receipts they sign.
Builds
- Default:
submit, over HTTPS. --features metal: the single-precision state vector on the GPU (--method statevector_single), on macOS.--no-default-features --target wasm32-wasip2: a WASI component withoutsubmit. It gives the same output under any WASI runtime.
wai-quantum completions zsh (or bash, fish, elvish, PowerShell) prints shell completion.