wai-quantum: the person's rules for proposals, checked change by change #494

Merged
dcharlot merged 2 commits from wai/quantum-locks-r2 into main 2026-10-26 13:40:52 -04:00
Owner

Feature 7 of the co-design report: region-scoped edits with locks and keep/avoid marks. A proposal from a model, an outside agent or an engine rewrite must keep the person's rules, and the engine checks it change by change. A change that breaks a rule is named with the rule and cannot be taken.

Supersedes #487: its two commits on current main (after #492's zstd and avx2 fixes), pushed once. #487 ran green except for checks every pull request was failing then: the repository check (four new zstd advisories) and the avx2 leg on the linux label's new framework runner.

Two commits:

  • the rules, below;
  • wai-quantum mcp: an agent is told at initialize to record its changes with history_commit and keep the person's rules.

The rules: engine::locks

  • Held blocks are marked in the program itself, between // @lock and // @unlock, so they travel with it to a model, an agent and a file.
  • The other rules:
    • gates: the only gates a change may add;
    • qubits: the qubit declarations held;
    • avoid_gates and avoid_text: what no change may add;
    • region: the lines a rewrite must keep to.
  • check names each change (versions::changes) and the rules it breaks.
    • Only what a change adds is judged, so a gate the program already used is never a proposal's breach.
    • A generator's gates are read at its inputs. A proposal that does not read cannot pass a gate rule.
  • brief states the rules for a model, held_ops gives the held gates for the diagram, and call is the JSON dispatch for hosts.
  • versions::Review keeps the blocked changes (History::propose_with). A change both blocked and accepted is refused there and by History::verify. A review with nothing blocked has the digest it had before.

The command line and MCP

  • Commands:
    • wai-quantum locks check prog.qasm theirs.qasm exits 1 if any change breaks a rule;
    • wai-quantum locks brief prog.qasm prints the rules as a model is told them;
    • the rules sit beside the program as prog.locks.json.
  • History:
    • history changes names each change's breaches;
    • history propose refuses a blocked change, and --accept all takes the allowed ones;
    • history log shows how many were blocked.
  • MCP: history_commit refuses an agent's edit that breaks a rule, with the rule. history_changes shows each change's breaches and the rules as sentences.

The Studio: Rules for proposals

  • "Hold the selected lines" marks them in the program. They are shaded in the editor, and their gates are marked on the diagram.
  • Other rules: the gates allowed, "Hold the qubit declarations", and gates and text to avoid.
  • "Keep the next proposal to the selected lines": a region, let go once that proposal is decided.
  • The review shows a breaking change with its rule, its box disabled, and the version records it as blocked. This covers every proposal: the assistant's, an alternative, a fix, a generator from the Workbench.
  • Alternatives leaves out a candidate whose every change breaks a rule, with the reason.
  • The model is told the rules with every request: ask, Improve and Explore.

A fix found on the way

versions::call's blame, and locks::check, reported an unreadable program in a field called error. A page's worker treats any answer with error as a failed call. So an unreadable draft lost its lines' authors, and a proposal that did not read never reached the review. The field is now unread.

Checked on the build host

  • wai-quantum (--features full, engine::): 89 tests pass, including the rules' and the blocked-review tests. Clippy reports nothing in locks.rs or versions.rs.
  • Re-checked on this branch: after replaying onto main, the engine (89), wai-web (9) and the CLI (13) pass, the advisory gate is clean, and the Studio's browser test passes every check.
  • wai-quantum-cli: 13 tests pass, including the MCP refusals: an edit in a held block, and one adding a gate the rules do not allow. Clippy with -D warnings is clean.
  • The built binary, end to end:
    • locks brief;
    • locks check on three changes, two breaking a rule, which exits 1;
    • history changes with the breaches;
    • history propose --accept 0, refused;
    • --accept all, which takes 1 of 3 with 2 blocked;
    • history verify.
  • wai-web (quantum_engine::): 9 of 9 tests pass, including the rules in the page. wai-web-wasm.yml now counts 9.
  • The desktop app: clippy is clean.
  • The Studio in Chrome: every check passes, 97 in all.
    • Holding a line marks it, shades it and marks its gate.
    • A proposal of three changes shows the gate-set breach and the held-block breach with their rules, and only the third can be taken. The version records 1 of 3 taken, 2 blocked.
    • A region blocks a change outside it and is then let go.
    • The model's requests carry the rules.
  • Public names: scripts/check-public-names.sh is clean.

🤖 Generated with Claude Code

Feature 7 of the co-design report: region-scoped edits with locks and keep/avoid marks. A proposal from a model, an outside agent or an engine rewrite must keep the person's rules, and the engine checks it change by change. A change that breaks a rule is named with the rule and cannot be taken. Supersedes #487: its two commits on current main (after #492's zstd and avx2 fixes), pushed once. #487 ran green except for checks every pull request was failing then: the repository check (four new zstd advisories) and the avx2 leg on the `linux` label's new framework runner. Two commits: - the rules, below; - `wai-quantum mcp`: an agent is told at `initialize` to record its changes with `history_commit` and keep the person's rules. ## The rules: `engine::locks` - **Held blocks** are marked in the program itself, between `// @lock` and `// @unlock`, so they travel with it to a model, an agent and a file. - **The other rules:** - `gates`: the only gates a change may add; - `qubits`: the qubit declarations held; - `avoid_gates` and `avoid_text`: what no change may add; - `region`: the lines a rewrite must keep to. - **`check`** names each change (`versions::changes`) and the rules it breaks. - Only what a change adds is judged, so a gate the program already used is never a proposal's breach. - A generator's gates are read at its inputs. A proposal that does not read cannot pass a gate rule. - **`brief`** states the rules for a model, `held_ops` gives the held gates for the diagram, and `call` is the JSON dispatch for hosts. - **`versions::Review` keeps the blocked changes** (`History::propose_with`). A change both blocked and accepted is refused there and by `History::verify`. A review with nothing blocked has the digest it had before. ## The command line and MCP - **Commands:** - `wai-quantum locks check prog.qasm theirs.qasm` exits 1 if any change breaks a rule; - `wai-quantum locks brief prog.qasm` prints the rules as a model is told them; - the rules sit beside the program as `prog.locks.json`. - **History:** - `history changes` names each change's breaches; - `history propose` refuses a blocked change, and `--accept all` takes the allowed ones; - `history log` shows how many were blocked. - **MCP:** `history_commit` refuses an agent's edit that breaks a rule, with the rule. `history_changes` shows each change's breaches and the rules as sentences. ## The Studio: Rules for proposals - **"Hold the selected lines"** marks them in the program. They are shaded in the editor, and their gates are marked on the diagram. - **Other rules:** the gates allowed, "Hold the qubit declarations", and gates and text to avoid. - **"Keep the next proposal to the selected lines"**: a region, let go once that proposal is decided. - **The review** shows a breaking change with its rule, its box disabled, and the version records it as blocked. This covers every proposal: the assistant's, an alternative, a fix, a generator from the Workbench. - **Alternatives** leaves out a candidate whose every change breaks a rule, with the reason. - **The model** is told the rules with every request: `ask`, Improve and Explore. ## A fix found on the way `versions::call`'s `blame`, and `locks::check`, reported an unreadable program in a field called `error`. A page's worker treats any answer with `error` as a failed call. So an unreadable draft lost its lines' authors, and a proposal that did not read never reached the review. The field is now `unread`. ## Checked on the build host - **wai-quantum** (`--features full`, `engine::`): 89 tests pass, including the rules' and the blocked-review tests. Clippy reports nothing in `locks.rs` or `versions.rs`. - **Re-checked on this branch:** after replaying onto main, the engine (89), wai-web (9) and the CLI (13) pass, the advisory gate is clean, and the Studio's browser test passes every check. - **wai-quantum-cli:** 13 tests pass, including the MCP refusals: an edit in a held block, and one adding a gate the rules do not allow. Clippy with `-D warnings` is clean. - **The built binary, end to end:** - `locks brief`; - `locks check` on three changes, two breaking a rule, which exits 1; - `history changes` with the breaches; - `history propose --accept 0`, refused; - `--accept all`, which takes 1 of 3 with 2 blocked; - `history verify`. - **wai-web** (`quantum_engine::`): 9 of 9 tests pass, including the rules in the page. `wai-web-wasm.yml` now counts 9. - **The desktop app:** clippy is clean. - **The Studio in Chrome:** every check passes, 97 in all. - Holding a line marks it, shades it and marks its gate. - A proposal of three changes shows the gate-set breach and the held-block breach with their rules, and only the third can be taken. The version records 1 of 3 taken, 2 blocked. - A region blocks a change outside it and is then let go. - The model's requests carry the rules. - **Public names:** `scripts/check-public-names.sh` is clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Feature 7 of the co-design report: region-scoped edits with locks and
keep/avoid marks.

- engine::locks:
  - held blocks marked in the program between // @lock and // @unlock;
  - the gates a change may add, the qubit declarations held, gates and
    text to avoid, and the region a rewrite must keep to;
  - check names each change of a proposal and the rules it breaks. Only
    what a change adds is judged, and a generator's gates are read at its
    inputs;
  - brief states the rules for a model; held_ops gives the held gates;
    call is the JSON dispatch for hosts.
- versions: a review keeps the changes the rules blocked (propose_with),
  and a change both blocked and accepted is refused there and by verify.
  A review with nothing blocked has the digest it had before.
- The command line: locks check | brief, prog.locks.json beside the
  program. history changes names the breaches; history propose refuses
  a blocked change, and --accept all takes the allowed ones.
- MCP: history_commit refuses an agent's edit that breaks a rule, with
  the rule; history_changes shows the breaches and the rules.
- The Studio's Rules:
  - hold the selected lines (shaded in the editor, gates marked on the
    diagram), the gates allowed, the qubit declarations, what to avoid,
    and a region for the next proposal;
  - in the review a breaking change is shown with its rule and cannot be
    taken, and the version records it as blocked;
  - Alternatives leaves out a candidate whose every change breaks a rule,
    and the model is told the rules with every request.
- Bindings: engine_locks in the page, locks in the desktop app.
- versions::call's blame and locks::check name an unreadable program
  `unread`, not `error`, which a page's worker read as a failed call.
- CI: wai-web's native engine tests count 9.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
wai-quantum mcp: an agent is told at initialize to record its changes and keep the person's rules
All checks were successful
wai-quantum OpenCL member / member · OpenCL GPU (macos) (pull_request) Successful in 22s
wai-quantum CPU vector units / member · vector unit, rvv 1024-bit (riscv64, emulated) (pull_request) Successful in 15s
wai-quantum CPU vector units / member · vector unit, sve 128-bit (aarch64, emulated) (pull_request) Successful in 22s
wai-quantum CPU vector units / member · vector unit, rvv 128-bit (riscv64, emulated) (pull_request) Successful in 10s
wai-quantum CPU vector units / member · vector unit, sve 2048-bit (aarch64, emulated) (pull_request) Successful in 10s
wai-quantum service / service · macos (pull_request) Successful in 46s
wai-quantum CPU vector units / member · vector unit, avx2 (x86_64 silicon) (pull_request) Successful in 13s
wai-quantum matrix-extension member / member · matrix extension absent (macos) (pull_request) Successful in 12s
wai-quantum CPU vector units / member · vector unit, sve 512-bit (aarch64, emulated) (pull_request) Successful in 9s
wai-quantum studio and desktop / studio · browser (pull_request) Successful in 2m52s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 17m14s
wai-quantum WebGPU member / member · software Vulkan (linux) (pull_request) Successful in 1m54s
wai-quantum studio and desktop / desktop app · macos (pull_request) Successful in 2m35s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 18m13s
wai-quantum tensor-engine member / member · tensor engine, the kernel toolchain's simulator (linux) (pull_request) Successful in 4m54s
wai-quantum portable tensor program / tensor program · Metal and the arm64 CPU (macos) (pull_request) Successful in 17s
wai-quantum CPU vector units / member · vector unit absent (macos) (pull_request) Successful in 15s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 10m46s
wai-quantum WebGPU member / shader checks · browser build · wasip2 inertness · MSRV (pull_request) Successful in 3m4s
wai-quantum WebGPU member / member · browser WebGPU (macos) (pull_request) Successful in 1m46s
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Successful in 2m33s
wai-web reach builds / wai-web reach builds · the package of record, every output as recorded (pull_request) Successful in 2m55s
wai-quantum neural-processor member / member · neural processor (macos) (pull_request) Successful in 8m27s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 4m40s
WAI mbt2018_mean integer decode (regenerated vectors) / regenerate mbt2018_mean integer vectors → Rust decode, required (pull_request) Successful in 5m18s
wai-web reach builds / wai-web reach builds · this tree's wai-web, every rung on its engine line (pull_request) Successful in 4m44s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 19m48s
wai-quantum signal processor / processor and member · signal processor, emulated (pull_request) Successful in 13m44s
wai-quantum WebGPU member / member · discrete GPU, Vulkan (jetson-hub) (pull_request) Successful in 26m18s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 46m33s
ea24034ba8
The server's instructions now say to record a change with history_commit
(kept as the agent's, its lines and gates shown as its own), and that held
blocks and NAME.locks.json bind every change, history_changes showing what
a change would break before it is made. The MCP test checks the
instructions say so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Transaction-Science/open-standards!494
No description provided.