### wai-quantum: a debugger, statistical tests, state views and editing by the drawing

What a program does, step by step, with every number the engine's: in the Studio, in editors, from the command line and from agents.

- **The debugger** (`engine::debug`): a program stepped forward and back one gate, measurement or reset at a time on a method where every number is exact for it: the bit-exact state vector when every angle is a dyadic multiple of 2π, else double precision, and under noise the density matrix beside the noiseless state on the same path.
  - Breakpoints by line, a measurement's line found through broadcasts, loops and branches.
  - Probes at any position: the amplitudes with their phases, the probabilities, each qubit's Bloch vector, purity and probability of 1, the reduced density matrix of chosen qubits, and the entanglement across a cut (the entropy of a side of a pure state, or the logarithmic negativity of a small mixed one).
  - Every branch at the measurements in the middle, with its weight (exact fractions by the stabilizer tableau for a noiseless Clifford program) and the distribution of the final measurements on it; a recorded path replayed, and an outcome the state cannot give refused.
  - Deterministic: stepping back runs again from a saved state, so a state seen twice is the same bits, and the exact method's state after the last gate is the exact run's, by its `state_hash`. Refused past 16 qubits, or 8 under noise. Its tests are ground truth: teleportation's four branches a quarter each, a Bell pair's reduced states, the noisy steps against the density matrix's run.
- **Statistical intents** (`engine::stats`, `wai-quantum test`): `{"sampled": …, "test": "chi_squared" | "g_test", "alpha": …, "shots": …}` runs the program for the stated shots and holds the counts to the distribution by the stated test at the stated level, as evidence; the p-value is the same bits on every platform. `test --junit FILE` writes the verdicts as a JUnit report. The exit codes are as they were.
- **The command line:** `wai-quantum debug` prints a position's state or every branch; `wai-quantum dap` serves the debugger over the debug adapter protocol (launch, breakpoints, steps both ways, continue both ways, the probes and the branch tree as variables), driven in `tests/dap.rs` as an editor drives it; `draw --svg`, `--latex` (plain TikZ) and `--describe` (in words).
- **Agents:** the stdio MCP server gains `debug_step` and `debug_branches`, read-only and deterministic, and `draw_circuit` takes a `format`; the agent docs are regenerated from the live lists.
- **Editors:** the extension contributes breakpoints and a debugger whose launch settings are the adapter's own, held to its source by `test/check.mjs`; the Lua and `languages.toml` configurations register it.
- **The Studio:** "Step through", with a slider, the branch tree, each qubit's phase disk with a purity ring and its Bloch sphere in plain SVG, the amplitude and phase table, the reduced state of chosen qubits, and under noise the noisy state against the noiseless one; editing by the drawing (a gate dropped on a wire, dragged or moved and deleted from the keyboard), each an edit the engine makes in the program's text through its syntax tree (`engine::visual`) and recorded as the reader's; the circuit described in the engine's words for a screen reader (`engine::describe`); the drawing saved as SVG or LaTeX (`engine::latex`). The same in the desktop app, natively.
- **CI:** the editors workflow runs the debugger's module tests and the adapter's sessions on Linux and macOS; the wasm workflow's counts are now 16 native and 9 under Node.

