# Changes

## 0.4.13 - baseline routes checked against the harnesses Kani compiles

`scripts/baseline.py` reads a route to a Kani harness file only through `mod` declarations, `#[path]` attributes and `include!` items outside macros and function bodies. It does not guess from source text whether a macro, an attribute macro or an `include!` that it cannot read builds another route. The check against the harnesses that Kani compiles covers such a route, so `#[path = "proofs.rs"] mod readable;` beside `cfg_if::cfg_if! { if #[cfg(kani)] { mod proofs; } }` fails `record` with the name that Kani gives the harness on the route inside the macro, such as `proofs::a`. When Kani cannot run at `record`, `compare` makes the check. A route inside a function body, an inline module in one included, and one through a `const _` block, are routes that the record does not read. A harness file outside any Cargo package gets no such check.

`scripts/baseline.py` now asks Kani which harnesses it compiles from a recorded Kani harness file, through the Rust checker's discovery. A harness that Kani compiles under a module path that no route the record reads gives, such as through a module that a macro declares, fails `record` and `compare` with the name Kani gives it. `record` stores the recorded harnesses that Kani compiles, and `move` carries them to the new file. `compare` prints `not compiled harness <name>` for one that Kani no longer compiles, including one that a change outside the source switches off, such as a default feature removed from `Cargo.toml`. `compare` needs Kani for a harness file inside a Cargo package; `record` notes when it cannot ask, and `compare` then prints `not checked against Kani at record` for the file, because it cannot see a harness that stopped compiling on a route that the record does not read. A record made with 0.4.12 prints that line for each Kani harness file; record the file again.

`scripts/sync.py`'s fallback now reads each parent of a rename made in a merge under that parent's own old path, and says in a `SYNC none` line when it could not. When the merge's parents hold the source under different old paths, such as a branch that renamed the file again before the merge, each old path gets a walk of its own into the parents that hold it. The walks are read together, newest commit first, as one `git log` reads them, so the sync commit is the latest commit that any of them finds, and a commit that two walks reach under the same paths counts once toward the limit of 100 commits. When git finds the rename against some parents only, such as when the branch grew the file below git's 50% rename similarity, the walk reads the other parents under the old path of the first parent with one. When such a parent does not hold that path, the line adds `it read the parent <parent> of the merge <commit> under <old path>, which that parent does not hold, since git finds no rename to <path> against it`. When git finds no rename to the source against any parent, such as when the merge's resolution grew the file below git's 50% rename similarity, the walk stops following that source, reads on for any other source, and the line adds `it stopped following <path> at the merge <commit>, since none of its parents has <path> and git finds no rename to it`. A source that a merge does not hold, such as one added after it, no longer counts as one that the merge renamed. Before this change, the walk read every parent under the first parent's old path, so it missed a harness commit made under the branch's own old path and did not say when a parent lacked the path it read.

`scripts/sync.py`'s fallback now follows a rename made in a merge commit, such as a `git mv` before committing a merge, back into each of the merge's parents, so it finds a harness commit made under the old name on the merged branch or on the first parent. It follows a source that is in none of the merge's parents into each parent, under the old path that `git diff-tree -M` finds against that parent, and still never counts the merge itself. The `PATH` and `READ` lines now include a path that a merge renamed, so the `READ` range shows a production change made under the old name before the merge. Before this change, `git diff-tree` printed nothing for the merge, so the walk followed no rename and printed a `SYNC none` line that did not say it had stopped at one.

`scripts/sync.py` now adds `it did not follow the rename of <old path> in <commit> into a branch merged after it` to a `SYNC none` line for each rename that the fallback walked back through when a branch merged after the rename has a commit of the old path. The walk follows a rename along the renaming commit's parent only, so it misses a harness commit made under the old name on a branch merged after the rename. Before this change, `SYNC none` said only that no commit qualified, which was wrong when such a branch held one.

`scripts/baseline.py` now follows an `include!` whose path is a `concat!` of strings and `env!("CARGO_MANIFEST_DIR")`, such as `include!(concat!(env!("CARGO_MANIFEST_DIR"), "/sub/items.rs"))`, and takes `env!("CARGO_MANIFEST_DIR")` to be the directory of the nearest `Cargo.toml` above the crate root that reaches the including file, as Cargo sets it. With no `Cargo.toml` there, such an `include!` is not followed. Before this change, a `cfg` added to such an `include!` switched off one copy of the harnesses that the included file declares while `compare` printed `UNCHANGED`. A record that holds a harness file reached through such an `include!` prints `CHANGED` once; record the file again.

`scripts/baseline.py` now follows an `include!("...")` item outside function bodies to the file it names, so a `cfg` on the `include!`, or on the modules around it, is a guard on the routes through the `mod` declarations in that file. As rustc does, those declarations load from the included file's own directory. Before this change, the record did not see that route, so `#[cfg(feature = "slow")]` added to `include!("sub/items.rs");` switched off one copy of the harnesses while `compare` printed `UNCHANGED`. A record that holds a harness file reached through `include!` prints `CHANGED` once; record the file again. It does not follow an `include!` inside a macro or function body, or one whose path it cannot read, such as one under `env!("OUT_DIR")`.

`scripts/baseline.py` now records each route that leads to a Kani harness file from a crate root, with the crate root's path relative to the harness file's directory and the route's guards, such as `routes(lib.rs: unguarded; main.rs: cfg(feature = "slow"))`, so removing, adding or guarding any route, or moving a guard from one route to another, prints `CHANGED`. A crate root counts as a route without a guard, unless it is a `lib.rs` or `main.rs` that Cargo does not name and that another file declares, such as `src/a/main.rs` under `mod main;`. Before this change, the record joined the guards of every route into one string, so deleting `mod proofs;` from `src/lib.rs` while `src/main.rs` kept `#[cfg(feature = "slow")] mod proofs;` printed `UNCHANGED`, though the harnesses then compiled only with the `slow` feature. A harness file that is itself a crate root and that another root also declares, such as a `src/lib.rs` that `src/main.rs` loads with `#[path = "lib.rs"] mod lib;`, now records both routes; before, it recorded no guard. A file with one route keeps its recorded value. A record that holds a file with several routes prints `CHANGED` once; record the file again. A new route, such as a `tests/*.rs` file that declares `mod common;`, also prints `CHANGED` for the harnesses in `common`.

`scripts/baseline.py` now follows a Kani harness file's `mod` declarations from the crate roots, as rustc does, so it records the `cfg` guards on a declaration that `#[path = "..."]` points at the file and on one in a crate root other than `lib.rs` or `main.rs`. The crate roots of a Cargo package include `src/bin/`, `tests/`, `examples/` and `benches/` files and the `.rs` paths that `Cargo.toml` names, such as `[lib] path`. A `#[cfg_attr(<condition>, path = "...")]` on a module is now a guard, so a record that holds one prints `CHANGED` once, with the attribute under `new:`; record the file again. Before this change, the reader looked only where Rust's default module layout puts a declaration, so adding `#[cfg(feature = "slow")]` to `#[path = "checks.rs"] mod proofs;` switched off the harnesses in `checks.rs` while `compare` printed `UNCHANGED`. A harness file that no route the record reads reaches, other than a crate root, now fails the record, such as one that only a `mod` declaration inside a macro such as `cfg_if!`, or in a function body, declares. Before, the record took such a file to have no declaration guards.

`scripts/baseline.py` no longer records a `cfg(...)` inside another attribute as a guard on a Kani harness. A `cfg_attr` counts when its own attribute list, or that of a `cfg_attr` nested in it, applies `cfg(...)`. Before this change, `#[cfg_attr(docsrs, doc(cfg(feature = "x")))]`, which only labels the documentation, was recorded, so editing it printed `CHANGED`. So were the `cfg(z)` inside an attribute such as `#[my(#[cfg(z)] q)]` and a `cfg_attr` whose condition string held `,cfg(`. A record that holds such a guard prints `CHANGED` once, with the guard under `old:`; record the file again.

A `SIGINT` that reaches `setup.sh tla`, `setup.sh rust` or `setup.sh lean` while its readiness check is still importing Python modules now ends the check by the signal with nothing on stderr. `tlc.py`, `kani.py`, `lean.py` and `mutate.py` restore the default `SIGINT` action before their other imports, when run as a script, until `runner.run` installs its handlers. Before this change, such a `SIGINT` printed a `KeyboardInterrupt` traceback.

`setup.sh tla` now prints `usage: setup.sh tla` and exits 2 when it gets an argument after `tla`, as `setup.sh rust` and `setup.sh storage` do for theirs. Before this change, it ignored the argument and ran the readiness check.

`scripts/sync.py` now adds to its `PATH` and `READ` lines each file where a commit since the sync added or removed a covered name as a whole word. It finds those commits with `git log -S` and applies the same rules as its name search. Before this change, a file that held the covered code between the sync and `HEAD`, such as one it moved through, was in neither set, and the `READ` command left out the commits made to the code while it lived there. A file renamed away without a content change counts too, and a changed path with a glob character such as `[id]` matches only itself. The helper still misses a path that held the code only under another name, or a path where each commit since the sync kept the number of times the name appears, such as one that replaced a mention of the name with its definition, and the skill and the helper reference now say so instead of claiming every path.

`scripts/sync.py` now prints a `MISSING` line for a covered name that only documents and other models still mention. Its name search leaves out documents, such as `.md`, `.txt` and `.tex` files and `README`, `CHANGELOG` or `CODEOWNERS` with no extension, and TLA+ and Lean model files, such as `.tla`, `.cfg`, `.lean` and `.mutations`, unless a source path has the same extension. Other files with no extension, such as a `Makefile`, and data files, such as `.json`, `.yml`, `.html` or `.ipynb` files, stay in the `PATH` and `READ` lines, but a name found only in them is `MISSING`. Before this change, a doc or another model that still named a deleted function counted as finding it, so the helper printed no `MISSING` line for the function and added that file to its `PATH` and `READ` lines.

`scripts/sync.py` no longer takes a production edit as the sync commit of a Kani harness that lives in the production file. When the model's header has no usable `Source read at` line and a model file is also a `--source`, the fallback is now the last commit that changed the code of that file's `#[cfg(kani)]` items and none of its other code, whether or not it changed another model file too, and `SYNC none` when there is no such commit. Comments and blank lines do not count as code, and a `#[cfg(kani)]` on a field or an enum variant does not mark a harness. The search reads the last 100 commits of the model files, following the source back through its renames, and its `SYNC none` line says when it reached that limit. Before this change, the fallback was the last commit of the model files, so each production edit moved it forward and the `READ` command left out the production changes that the harness had not been synced with.

The TLA+ template now models what the TLA+ brief asks for. Worker threads claim items under a mutex, build them without it and publish them. The consumer's `next()` waits on a condition variable that admits spurious wakeups, and its `close()` wakes every waiter, joins the workers and frees the items never taken. A build fails for each item in `FailAt`. The template checks item ownership, delivery order, error ordering, no delivery after an error and no leak at close. It also checks that `next()` and `close()` return, and that a consumer that keeps calling `next()` reaches the end or the error. Each action names the variable groups it leaves unchanged, as the brief's "Keep the spec small" section asks. Its matrix covers windows of 1, 2 and 4, 0, 1, 3 and 5 items, and one to three workers. It has reach checks for a full window, a parked worker, a parked consumer and a failure, and its header lists its assumptions. Before this change, the template modelled only the window counters, the same arithmetic that the Lean template proves. The template's matrix explores 50,021 states, and its 14 mutations, which include a `while` written as an `if` and each of the three broadcasts removed, carry `only` lines that keep each one to the runs that show its bug.

`scripts/sync.py` now prints a `MISSING` line for a covered name that Rust files mention only in comments and strings. Such a file stays in the `PATH` and `READ` lines. Before this change, a comment such as `// drain empties the queue` in `src/log.rs` counted as finding `drain` after its definition was deleted. In other languages, such as C, JavaScript or Python, a comment or a string still counts, because their comments and strings differ from Rust's.

Added `scripts/sync.py`, which lists what changed in the code an existing model covers since the model was last synced. It prints the sync commit from the header's `Source read at` line or the model files' last commit, every path the covered code has had since then through renames and moves, each covered name that no longer exists with the commits that removed it, and the `git log -p` command that shows every commit to read. Step 1 of the skill now runs it, where it listed the `git` commands to run by hand.

The skill and the Rust brief now ask for one Kani harness layout: a `#[cfg(kani)] mod proofs` at the end of the production file that defines the function, with the `.mutations` file beside it, as the Kani template has it. Before this change, the skill and the brief's file list asked for the harness in a separate crate, while the template and the brief's mutation section put it in the production file. The mutation runner changes only the file beside the mutations file, so a harness in a separate crate leaves no way to write a mutation of the production code. The skill now gives one agent every Rust target in one production file, so parallel agents still share no file. Before any agent starts, the main thread declares `cfg(kani)` in the crate's `Cargo.toml`, as the template does, so the harness module adds no compiler warning to the user's builds. The template's header comment now sits directly above its `proofs` module, where a production file can hold it.

A Kani harness that an earlier run wrote in a crate of its own now moves into the production file that defines the functions it calls, with its `.mutations` file, unless it copies a production function or calls functions from several files. The Rust brief's new "Moving a harness" section says how: the harnesses move unchanged into `mod proofs` under a `use crate as <name>;` line that keeps each path to the production crate, such as `prod::seed` in a stub, as it was, each `detects` names the new qualified harness name, and each mutation edits the production function instead of the harness. Before this change, such a harness kept its layout, so its mutations could edit only the harness, and the skill gave no way to move it. The agent leaves the old crate in place, so the workspace still builds while it checks the production crate, and the main thread deletes the old harness file, and its crate, workspace entry and CI steps once they hold nothing else, before it reruns the checks. Such a harness gets an agent even when it passes. `baseline.py` has a new `move` command for the main thread: `baseline.py move <record-file> <old file> <production file>` makes `compare` check the old file's recorded harnesses, assumptions, covers and stubs against the production file, and `--module crate proofs` renames harnesses that sat at the old crate's root, such as `first`, to `proofs::first`. It reads only the record, so a move that also adds an assumption or drops a harness still prints CHANGED with that item. The main thread accepts a move only when `git diff` shows the harness lines with nothing but their indentation changed. Before this change, `compare` reported only that the old file was missing and never read the production file.

The TLC pin and its readiness check moved from `scripts/tlc-tools.sh` to `scripts/tlc.py`, as Kani's live in `scripts/kani.py`. `setup.sh tla` now runs `python3 tlc.py ready`, and the matrix and mutation runners check TLC in their own process instead of through a `bash` shell that sources `tlc-tools.sh`, which is removed. `setup.sh tla` now also rejects a malformed `TLC_TIMEOUT` with `UNAVAILABLE` and exit 3, as the matrix and mutation runners do. It also reports a `JAVA` that cannot be executed, such as a script without a `#!` line, as having no runtime. Before this change it printed `READY` for both, and the runners then failed. An unreadable cached JAR is now reported as `cannot read <path>`, and a missing Python 3.9 is reported before a missing Java. The other readiness messages and exit codes are unchanged. Python now computes the cached JAR's SHA256, so `sha256sum` or `shasum` is no longer a prerequisite.

`setup.sh tla` and `setup.sh rust` now stop their readiness check on a `SIGINT`, `SIGTERM` or `SIGHUP` sent to the `setup.sh` process alone, as a supervisor can send it. A signal that arrives while the check runs its probes stops them, prints no `READY` and ends `setup.sh` by the signal. One that arrives during the storage report, after `READY`, ends `setup.sh` by the signal before the `TEMP_DIR` lines. Before this change, `setup.sh` held the signal while the check ran: after a `SIGINT` it went on to print `READY` and exit 0, and after a `SIGTERM` it ended at once while the check and its probe kept running and printed `READY` later. `setup.sh` now hands its process to the Python check, which prints the storage report itself, so `tlc.py ready` and `kani.py ready` now print the `TEMP_DIR` lines too. Run on their own, they now also print `FAIL` and exit 1 after `READY` when `TMPDIR` cannot be used, as `setup.sh` already did. The output and exit codes of `setup.sh tla` and `setup.sh rust` are otherwise unchanged.

The Lean checker and the Lean mutation runner no longer download a toolchain that is not installed. `elan run` installs a missing toolchain even without its install flag, so they now look for the pin in `elan toolchain list` first, under the name elan gives it, and print `UNAVAILABLE <pin> is not ready` with the `setup.sh lean` command when it is not there. A `lean-toolchain` that names the channel `stable`, `beta` or `nightly`, or a repository's `lean-toolchain` release name, now fails in the checker and in `setup.sh lean`, because elan resolves it to a release online. A pin that is an absolute path to a toolchain directory is ready when the directory exists. Before this change, `lean-check.sh` on a project pinned to a toolchain the machine lacked downloaded it, though `references/setup.md` said it reported UNAVAILABLE.

The Lean pin lookup and readiness check moved from `scripts/lean-tools.sh` to `scripts/lean.py`, as TLC's live in `scripts/tlc.py` and Kani's in `scripts/kani.py`. `setup.sh lean` now runs `lean.py ready`, which installs a missing toolchain as before and prints the storage report. Like `setup.sh tla` and `setup.sh rust`, `setup.sh lean` now stops its readiness check on a signal sent to the `setup.sh` process alone. The Lean checker's steps also run in `lean.py`, and `lean-check.sh` only checks for Python and starts it. The mutation runner checks the original Lean model in its own process instead of starting `lean-check.sh`. `lean-tools.sh`, `lean-statements.py` and `lean-layout.py` are removed; `lean.py` records and compares frozen statements, and reads Lake's search path with `lake env printenv LEAN_PATH`. `setup.sh lean` now needs Python 3.9 or later as `python3`, as `lean-check.sh` already did. Before this change, with an older `python3` it printed `READY` and then failed on the storage report. `lean-check.sh` reports an explicit `TMPDIR` that cannot be created or written with the message the other runners print. It now checks for Python 3.9 before its arguments and the project, so with an older `python3` it prints `UNAVAILABLE` and exits 3 where it reported a missing lakefile or a misplaced `--freeze` first. A project path that is a symbolic link to a directory is now checked; before this change the checker found no `.lean` file in it. The checker sorts a project's sources by code point rather than by the shell's locale, so the build and audit order no longer depends on the locale. A `lean-toolchain` file that cannot be read now gives `FAIL cannot read <path>` and exit 1 from both; before this change, they printed the shell's error and an empty line. The other output and exit codes of `setup.sh lean` and `lean-check.sh` are unchanged.

A frozen Lean record now keeps which match helper sits at each place in a declaration's type and value, and in each hygienic constant that the record carries. A record names every match helper alike and lists each helper's content once, so before this change a statement that used helpers A, B and A and an edited one that used A, B and B had the same record. An edit that moved a helper, such as one that changed the shape of a `local notation`'s `match`, could then change a frozen theorem's statement or a frozen definition's value and still pass the frozen check. A record frozen before this change reports each declaration whose type or value uses a `match`, itself or through a hygienic constant that the record carries, as changed, including instances that `deriving DecidableEq` adds; review them and run `--freeze` again. Other records are unchanged. The Lean template's record is frozen again, and the mutation runner compares statements in the same form.

A frozen Lean record now also keeps which of two universe parameters that look alike in it sits at each place in a declaration's type and value. A record writes a universe parameter's name without its macro scopes, so a macro-made `u` and the user's own `u` in one declaration look alike. Before this change, an edit that swapped them, such as `(α : Sort $v) (β : Sort (u + 1))` changed to `(α : Sort u) (β : Sort ($v + 1))` in a macro, changed which arguments the declaration takes and still passed the frozen check. A record frozen before this change reports each declaration with two such parameters as changed; review them and run `--freeze` again. Other records are unchanged, the Lean template's among them. The mutation runner compares statements in the same form.

A frozen Lean record now also keeps which of two constants that look alike in it sits at each place in a declaration's type and value. A record writes a hygienic name without its macro scopes, so two definitions of `a` that macros make, or one that a macro makes and the user's own `a`, look alike. So do the private helpers that `deriving` makes on Lean 4.20 for mutual types whose last name components match, such as `A.T` and `B.T`. Before this change, an edit that put one in place of the other in a frozen definition, such as a macro's `$x + a + $x` changed to `$x + a + a`, changed the definition's value and still passed the frozen check. A record frozen before this change reports each declaration whose type or value uses two such constants, itself or through a hygienic constant that the record carries, as changed; review them and run `--freeze` again. Other records are unchanged, the Lean template's among them. The mutation runner compares statements in the same form, so a mutation that makes the same swap in a theorem's statement now reads as a changed statement and gets no verdict. Before this change, the theorem's failing proof counted it as detected.

The mutation runner now checks a TLA+ model's unmutated spec on every run that its mutations select before it applies the first mutation, as it already did for Lean and Rust models. A model that fails one of those runs stops the runner with `FAIL unmutated model did not pass <Property>` and no verdict lines. Before this change, the runner checked each run the first time a mutation selected it, so it reported a broken model partway through the list, as the error of whichever mutation reached the run first, after earlier mutations had printed their verdicts. A mutation whose `only` line matches no run, or whose reach check has no run, now stops the runner with that mutation's label before TLC checks any run.

The TLC matrix runner now handles `SIGINT`, `SIGTERM` and `SIGHUP` while it checks that TLC is ready, as it does during a run, and ends by the signal. Before this change, a Ctrl-C during that check printed a Python traceback.


The Lean mutation runner now reads the output of its Lean analysis as UTF-8, and `mutate.py` writes its output as UTF-8, as the Lean checker does, so a run under a locale whose encoding is not UTF-8 prints the same verdicts and messages. Before this change, under `LC_ALL=C` with Python's UTF-8 mode off, every Lean mutation run stopped with an `'ascii' codec can't decode` error.

The Lean mutation runner now compares a theorem's, example's or `#guard`'s statement in the form the frozen record uses: match helpers by their content, together with the helper at each place in the statement, hygienic names and universe levels without their numbers, and no binder names. Before this change, it compared Lean's raw types, so a mutation that changed which match helper an unchanged statement shared, such as one that changed the shape of an earlier definition's `match`, read as a changed statement and gave the mutation no verdict, while the frozen record showed the statement unchanged. The Lean checker's audit and the mutation runner's analysis are now one program, `scripts/lean-analysis.lean`, instead of a Lean file that `lean-check.sh` wrote out on each run and a separate `lean-mutations.lean`. Frozen records and the output of a passing `lean-check.sh` run are unchanged. A failed import is now reported against `<audit>` instead of a temporary file's path.


The trace reducer `scripts/tlc-trace.py` is now `scripts/tlc_trace.py`, which the matrix runner imports instead of running in a second Python process. Its command line is unchanged. A TLC log that holds bytes that are not UTF-8 now has its trace reduced with those bytes replaced; before this change, the reducer stopped with a decoding error and the runner printed the log's last 40 lines instead.

The Python runners now hold back `SIGINT`, `SIGTERM` and `SIGHUP` while they stop a checker, and end by the signal once the stop has finished. The stop no longer handles a signal at each of its steps. One effect is visible: a Ctrl-C during a stop, such as the TLC timeout stop, no longer shortens the two seconds that the checker's processes get to exit after `SIGTERM` before `SIGKILL`.

A `SIGINT`, `SIGTERM` or `SIGHUP` that reaches the Python runners while they start a checker, such as TLC, Kani or a Lean build step, now stops that checker and the processes it started. Before this change, such a signal could end the runner while `Popen` waited for the checker to start, or just after, before the runner held the checker, and the checker kept running. The runners now start each checker through `processes.guarded`, which holds a signal until the checker is known and then stops it.

The Lean checker no longer reports a frozen definition as changed when a `match` of the same shape, or a pattern lambda such as `fun (a, b) => ...`, is added above it. Lean shares one match helper among such matches, so the frozen definition's value could switch to the new declaration's helper. A record now names every match helper alike, and the splitter that the `split` tactic uses with one, and carries their content without binder names; match helpers get no record of their own. The arguments passed to a match helper are recorded without binder names too, since Lean 4.20 names the binders of a recursive definition's alternatives after the shared helper. An edit to a frozen definition's own patterns or results still fails its check. A record frozen before this change reports each definition that uses a `match` as changed and each match helper as deleted; review them and run `--freeze` again. The Lean template's record is frozen again.

A signal that reaches the Python runners while they stop a checker no longer cuts the stop short: the stop still finds the checker's processes and sends `SIGKILL` to those that ignore `SIGTERM`, then the runner ends by the signal. This holds for a signal during the stop's `ps` listings too, such as a Ctrl-C during the TLC timeout stop. Before this change, such a signal ended the stop before it found the checker's children, so a child that ignores `SIGTERM` kept running after the checker died.

A frozen Lean record now covers the content of the hygienic constants it refers to, such as a helper that a user's macro defines, including the body of a hygienic `partial def`, and of the hygienic constants those refer to in turn. Proofs stay out of the record, as before. Such a constant has no record of its own, so before this change an edit to it passed the frozen check although the frozen declaration that uses it changed meaning. Hygienic names that Lean extends with a suffix, such as a helper's `match_1`, are now recorded without their numbers too. Records that refer to no hygienic constant are unchanged. On older pins such as Lean 4.20.0, the instances that `deriving` adds refer to hygienic helpers, so a record frozen before this change reports them as changed; review them and run `--freeze` again.

When a signal interrupts the Python runners while they wait for a stopped checker and its processes to exit, as a Ctrl-C during the TLC timeout stop can, the stop still sends `SIGKILL` to the checker and to every process it found that still runs. Before this change, the interrupted stop skipped that step, and the second stop that follows found the checker reaped and returned, so a process that the checker started and that ignores `SIGTERM` kept running after the runner exited.

When the Python runners stop a checker, the `ps` listings of the checker's processes now share one five-second limit, and a `ps` that does not end when the runner kills it at that limit is left behind instead of waited for. Before this change, each listing had its own five-second limit, so a stop could take about four minutes over fifty slow listings, and the runner waited without a limit for a killed `ps` that could not die, such as one in uninterruptible sleep, with the checker suspended all the while.

When the Python runners stop a checker, each `ps` listing of the processes it started now has five seconds to answer, and one stop takes at most fifty listings. When either limit is reached, the runner signals the processes it has found and prints a warning to `stderr` that others may still be running. Before this change, a `ps` that hung kept the checker suspended and the runner waiting, and a process that kept starting others, such as one whose `SIGSTOP` failed, kept the runner listing forever.

The Rust checker and the mutation runner now give the tools that Kani runs, such as `goto-cc`, a `TMPDIR` inside the runner's working directory. Before this change those tools wrote their temporary files straight into `TMPDIR`, and a check stopped partway could leave them there; the runner's cleanup now removes them with its working directory.

The Lean checker now records each frozen declaration's type and value without the numbers that Lean 4.20 gives across the whole module to hygienic names, such as binder names, universe parameters and the helpers that `deriving` adds, and to abstracted proofs named `_proof_` and a number. Before this change, on Lean 4.20.0, adding a declaration or editing a proof above a frozen recursive definition, structure with derived instances or enumeration failed its check with `statement changed`, although the Lean brief allows both edits. User-written names are still recorded. A record frozen before this change can report some of its declarations as changed; review them and run `--freeze` again. The Lean template's record is frozen again.

When the Python runners stop a checker, a process the checker started that is still running two seconds after `SIGTERM`, such as one that ignores `SIGTERM`, now gets `SIGKILL`, as the checker already did. When `ps` fails, so the runner cannot find the processes the checker started, it prints a warning to `stderr` that they may still be running. Before this change, both kinds of process outlived the runner without a word.

The helpers now state and check that they need Python 3.9 or later as `python3`. `setup.sh rust`, `setup.sh storage`, `setup.sh tla`, `tlc-matrix.sh`, `kani-check.sh`, `lean-check.sh` and `mutate.py` print `UNAVAILABLE`, name the version found and exit 3 on an older Python, which before this change failed partway with a `TypeError` or an `AttributeError`. On Python 3.9, Rust mutation runs no longer stop when a crate's subdirectory holds a dangling symbolic link, such as an editor lock file in `src/`; before Python 3.10, `shutil.copytree` skipped such a link only in the top directory. The copy now also keeps a working relative link, such as `src/alias.rs -> lib.rs`, which it dropped before unless the link also resolved from the directory the runner was started in.

The Rust checker now handles `SIGINT`, `SIGTERM` and `SIGHUP` while Kani checks the bundle's version as it does during a check: it stops the driver and the processes the driver started, ignores a second signal while it does, and ends by the signal. Before this change, a `SIGTERM` or `SIGHUP` there left the driver's processes running, a Ctrl-C printed a traceback, and a second Ctrl-C ended the stop early.

`lean-check.sh` now stops its running build on `SIGTERM`, `SIGHUP` or `SIGINT`, with every process the build started, such as Lake and the Lean compiler, before it removes its temporary directory and ends by the same signal. Before this change, a `SIGTERM` sent to the script alone left Lake and Lean running. It runs each build step through `processes.py run`, which stops a command's process tree as the Python runners do.

The Python runners no longer signal the process ID of a checker that exits just as they stop it. Before this change, such a checker was reaped without a signal, and the runner then sent `SIGTERM` and `SIGCONT` to its process ID, which another process could have taken.

The Lean checker no longer records the declarations that Lean generates only when a proof uses them, such as the equation lemmas `f.eq_1` and `f.eq_def`, the induction principle `f.induct`, and the equations of a private definition's matcher. Before this change, a proof edit that stopped using one, such as replacing `simp [init]` with a term, failed with `statement changed` and `new: (deleted)`, although changing proofs is allowed. The record of a recursive definition now includes the body that Lean keeps in an auxiliary declaration: `_f` for structural recursion, `_unary` or `_mutual` for well-founded recursion, and `_unsafe_rec` for the code that runs. Before this change, a frozen `partial def`, recorded with only a placeholder value, could change its body and still pass, and on Lean 4.35.0 the body of a structural, mutual or multi-argument well-founded definition was covered only by its equation lemmas. Records frozen before this change report their generated lemmas as deleted and their recursive definitions as changed; review those definitions and run `--freeze` again. The Lean template's record is frozen again.

The TLA+ matrix runner and mutation runner now enforce a per-run time limit (`TLC_TIMEOUT`, sixty minutes by default, using the same `<n>[s|m|h]` syntax and upfront `UNAVAILABLE` check as `KANI_HARNESS_TIMEOUT`), forward periodic elapsed-time and `Progress(...)` updates to `stderr` during long runs, flush each mutation verdict immediately, and allow `TLC_WORKERS` when checking `reach:` mutations on a modified spec while keeping single-worker witness checks deterministic; the TLA+ brief recommends binding `reach:`-mutated checks to small boundary runs. A timed-out ordinary or mutation run fails with a message naming the limit and `TLC_TIMEOUT` and never counts as a detection or an unreachable state.

Each TLC run now unpacks the TLA+ standard modules into a `java` directory inside its own run directory instead of the JVM's shared temporary directory. Before this change, TLC runs started at the same time, such as those of parallel agents, could delete each other's copy of `Naturals.tla` or `TLC.tla` and fail with `Module-Table lookup failure`, a `NullPointerException` or `source file 'TLC.tla' has apparently been deleted`.

The TLC runner now removes each run directory as soon as its check and trace reduction finish instead of holding every `states` directory until the matrix ends. On a non-ignored `SIGINT`, `SIGTERM` or `SIGHUP`, the Python runners (`tlc.py`, `mutate.py`, `kani.py`) clean up active working directories, stop their child checkers and the processes those started, such as CBMC under Kani, and then end by the same signal, so a shell loop that calls them stops at Ctrl-C. They keep child processes in the caller's process group, so `SIGHUP` and `SIGKILL` sent to the group stop them too. `lean-check.sh` honors `TMPDIR` across platforms and exits promptly on `SIGTERM`, an explicitly configured `TMPDIR` that cannot be created or written fails fast instead of falling back to the system disk, and `setup.sh` plus the runners check free temporary space (`FORMAL_MIN_FREE_GIB`) and report larger writable `EXTERNAL_VOLUME` mounts with a shell-quoted suggested `TMPDIR`.

A Lean mutation that edits the text of a theorem, such as one that replaces only its proof term, now reaches no verdict when that theorem fails. Before this change, such a mutation counted as detected and covered the theorem, even though the model it describes had not changed.

A TLA+ mutation that a property such as `Safe == []Small` detects now counts as detected. TLC checks such a property as the invariant `Small` and reports `Invariant Small is violated`, with or without `by the initial state:`, so before this change the mutation reached no verdict and the runner stopped. The run's configuration holds only the named property, so the violation comes from it. An invariant check still needs TLC to name the invariant itself.

`scripts/baseline.py` now records the `#[cfg(...)]` and `#![cfg(...)]` attributes that can switch each Kani harness off: those on the harness, on its enclosing modules and functions, and at the top of its file, other than `#[cfg(kani)]`, and each `#[cfg_attr(<condition>, cfg(...))]` there. `compare` prints CHANGED when one is added, removed or edited. For a harness file that another file declares, such as `proofs.rs` under `#[cfg(kani)] mod proofs;` in `lib.rs`, it also records those on each out-of-line `mod <name>;` declaration that leads to the file, found by Rust's default module layout, up to the crate root. It does not follow a `#[path = "..."]` attribute, a declaration inside a macro, or a crate root other than `lib.rs` or `main.rs`. Before this change, a `#[cfg(feature = "slow-proofs")]` added above a recorded harness took it out of Kani's discovery while `compare` printed UNCHANGED.

TLA+ baselines now follow the subscript of `[][Next]_vars`, `<<A>>_vars`, `WF_vars(...)` and `SF_vars(...)`, such as `vars`, in `Spec` and in every definition they follow, such as a fairness definition. Before this change, the baseline removed the subscript with the action, so taking a variable out of `vars` could strengthen fairness and turn a failing liveness property into a passing one while the comparison printed `UNCHANGED`. The actions under those forms are still not followed. A record made before this change still compares as before; record the matrix again to cover the subscript.

TLA+ baselines now follow the operators that a function definition names in its domain, such as `Slots` in `Ok[i \in Slots] == ...`. Before this change, the baseline followed only the text after `==`, so an edit to `Slots` could turn a failing invariant into a passing one while the comparison printed `UNCHANGED`. A record made before this change still compares as before; record the matrix again to cover these operators.

The Rust checker and the mutation runner now reject a harness marked `#[kani::should_panic]` when it is among the harnesses they would verify, before they verify any, and name the harness. Naming the other harnesses still checks them. Kani reports the expected panic as a failed check, so before this change the checker printed `FAIL` for a harness that Kani verified, and the mutation runner stopped at the unmutated harness.

Rust mutation runs now skip a dangling symbolic link, such as the `.#lib.rs` lock file that Emacs leaves beside an open file, when they copy the crate. Before this change, the copy stopped the run with a Python traceback after the unmutated harnesses had passed.

The specification baseline now keeps the layout of a TLA+ definition that spans several lines, and a removed comment leaves spaces so that each token keeps its column. Before this change it flattened nested conjunction and disjunction lists, so an edit that regrouped them, which can turn a violated invariant into a passing one, compared as unchanged. When a module has an indented definition outside a `LET` expression, or a column-0 definition inside one, the baseline compares the whole module text, because it cannot tell which definition holds that line. A definition inside a `LET` stays part of the definition that contains it. A TLA+ baseline recorded before this change reports that it needs review; record it again after the review.

A TLA+ mutation now gets credit only when its detector passes on the original spec at the same run settings. An ordinary check must pass there, and a reach check must find its witness. Before this change, a mutation that only added parentheses could get credit for a violation the original model already had, or for a state the original model never reached. The mutation runner checks each selected run on the original once. When the original fails, the mutation gets no verdict. The run stops with a `FAIL` line for that mutation, followed by a line that names the detector the original did not pass.

The TLA+ matrix runner now drops every space and tab between a run's label and its `|`. Before this change it dropped one space, so a label followed by more spaces or a tab printed them in its `PASS` and `FAIL` lines. Spaces inside a label stay.

The Lean mutation runner now runs the Lean checker on the original model, with its frozen statements, before it checks any mutation. Before this change, deleting a frozen public theorem removed it from mutation coverage without a failure, and a malformed `.statements` file could still give a passing summary. The Lean checker, the mutation runner and the baseline helper now read statements records with the same reader.

Rust mutation runs now copy a module directory named `target`, such as `src/target/mod.rs`. Before this change, the copy left out every directory with that name. It still leaves out the target directory that `cargo metadata` reports, and any directory that holds Cargo's `CACHEDIR.TAG` file, such as a `target/` that stayed in the tree after `CARGO_TARGET_DIR` moved the build.

The Lean checker now finds compiled modules through the library paths that Lake reports. A project that set `buildDir` or `leanLibDir` used to build and then fail before the declaration audit. The kernel replay uses the same paths for the project modules that a checked file imports.

The npm package no longer includes the Kani template's Cargo build output when the template was built in the checkout before publishing. A test packs the package offline and compares its file list with the tracked files under `skills/` and the root entry points.

## 0.4.12 - Kani harness time limits checked before any harness runs

Lean mutations now match a failing example or guard to its original occurrence. Previously, inserting a broken example with the same statement as a passing one could count as a detection. A failure in a new check or one whose origin is ambiguous now gives the mutation no verdict.

The Rust checker, the mutation runner and `setup.sh rust` now check `KANI_HARNESS_TIMEOUT` before Kani runs. The setting takes a whole number from 1 to 4294967295 with an optional unit `s`, `m` or `h`, as Kani 0.68.0 reads it, and spaces around the value are ignored. For any other value, including `0`, the helpers print `UNAVAILABLE` and check no harness. Before this change, `0` stopped every harness at once, and a value that Kani rejects failed every harness with a message about a missing result file. The limit cannot be turned off, so set a long one, such as `24h`, instead. A harness that reaches the limit fails with a message that names the limit with its unit, such as `90s` for a value of `90`, and the setting that changes it. The setup guide says that each harness check can take up to the limit, so run the Rust checker and the mutation runner in the background or with a command timeout longer than the total.

## 0.4.11 - Antigravity install, stricter verdicts and a Kani harness time limit

Kani now checks the configured crate and requires a satisfied cover witness for each passing harness. Each Rust mutation starts from a passing harness. Coverage is checked per harness source file, and the checker supports Kani stubs. A missing toolchain version file no longer hides the original compiler error.

TLC mutations use the runs that actually enable their named property. Temporal mutations must violate that property to count as detected. TLA+ baselines now follow local module imports. Review and record older matrix baselines again. Lean now fingerprints opaque definition bodies. Review and re-freeze older statements records that contain an opaque definition.

The plugin now installs in Antigravity with `agy plugin install`. The `.antigravity-plugin/plugin.json` manifest exposes the `setup` and `formal-verify` skills from `skills/` and adds no hooks or MCP servers. Antigravity loads only the first 24,000 bytes of a skill body, which cut off most of the formal-verify reply instructions. The helper reference and the table of evidence meanings moved from `SKILL.md` to `references/helpers.md` and `references/evidence.md`, which the skill tells the agent to read, and a test keeps each skill body within that limit.

When a crate uses a standard library feature that is newer than the toolchain bundled with Kani 0.68.0, Kani discovery fails with E0658. The Rust checker and the mutation runner now add a note to that failure. The note names the bundled toolchain and says to rewrite harness code that uses the feature. When every error is in production code or a dependency, it says to report the target as not checked, because the feature attribute that the compiler suggests would change the production crate. The Rust brief says the same.

The Rust checker and the mutation runner now stop each Kani harness after five minutes, through Kani's own harness timeout, which also stops the CBMC solver. Set `KANI_HARNESS_TIMEOUT` to change the limit, for example to `90s` or `20m`. A harness that reaches the limit fails with a message that names the setting, and a mutation that reaches it gets no verdict, so it never counts as detected. Before this change, a harness whose symbolic inputs reached message-formatting error paths or a wide symbolic division could run with no output until something else stopped it.

The repository now tells Git to check out text files with LF line endings on every platform. A Windows clone with `core.autocrlf=true` used to get CRLF line endings in the Bash helpers.

## 0.4.10 - baselines keep each check's run and each Kani constraint's function

The specification baseline now records the checks that apply to each TLA+ run and the inputs selected by each reach check. Moving check lines below a run or changing which run a reach check selects no longer compares unchanged. Kani assumptions, covers and stubs now retain their qualified owning function, and harness names include their modules, so moving a constraint between functions is reported. The Rust reader supports free functions under inline modules and rejects Kani forms in an owner it cannot identify, including macro definitions and implementation or trait bodies. Baseline records use format 2; create a new record after updating rather than reuse a format 1 record.

## 0.4.9 - a specification baseline, Lean kernel replay and checked witnesses

The specification baseline now preserves whitespace and comment markers inside string literals, so edits to those parts of TLA+ properties and Kani assumptions are reported as changes. Lean kernel replay now selects exact modules and their project imports, leaving out cached objects from deleted, unimported descendants.

The Lean checker now replays every built module, and every project module it imports, through the Lean kernel with the pinned toolchain's `leanchecker`, after its existing checks. A declaration that a command added to the environment without a kernel check used to pass the build and the audit. The replay rejects it, and the checker exits 1 with `leanchecker`'s output. A pin that ships no `leanchecker`, such as Lean 4.20.0, prints `UNAVAILABLE kernel replay` and still passes. The PASS line says whether the replay passed or was unavailable.

The Lean checker now checks hypothesis witnesses. For a public theorem with hypotheses, a `private theorem <Property>.witness` in the same file proves that some values satisfy all of them at once. The checker derives the statement such a witness must prove from the property on every run. It prints the statement when the witness is missing or states something else, and fails only in the second case. Each property gets a WITNESS line, and the PASS line counts witnesses checked, absent and unavailable. The Lean brief no longer accepts an `example` as a witness. The Lean template now proves a witness for each of its two theorems with hypotheses. Its statements are re-frozen to record them, and no existing fingerprint changed. The mutation runner does not count a failing witness as a detection, so a mutation that breaks only a witness reads MISSED, and it does not list a public witness as UNCOVERED.

A new helper, `baseline.py`, records what each existing model specifies before the modelling agents run and names each part that changed afterwards. For a TLA+ matrix it records the matrix lines and the definitions of `Spec`, of the initial state, of the checked and reach operators, and of the operators they reference, but not the actions that `Spec` names under `[][...]_vars`, `WF_` or `SF_`. A column-0 definition whose header it cannot read, such as an infix operator, is recorded whether or not a property references it. For a Lean model it records the `.statements` file, and for a Kani harness file each harness name, assumption (`kani::assume` or `kani::any_where`), cover and stub, including those under `cfg_attr(kani, ...)`. A removed or changed item fails the comparison, and so does an added Kani assumption or stub. A Kani assumption, cover, stub or harness attribute in a form the helper cannot read, such as an import that renames `kani::assume`, fails the record instead of going unrecorded. An added Lean declaration, TLA+ check or run, or Kani cover or harness does not. The skill's main thread now runs this comparison where it used to read `git diff` for those changes, and records an accepted specification correction again with its old and new digests. `git diff` still covers what the record leaves out, such as a theorem newly marked `private` or a removed assertion in a Kani harness. The record keeps cooperative agents to their briefs; it does not stop an agent that edits it, and the skill says so.

Rust mutation runs now preserve the crate's workspace and local path dependencies in their temporary copies. Copying only the harness crate left sibling dependencies and inherited workspace settings behind, so a harness that passed the checker could fail mutation testing before Kani checked its property. The runner uses the bundled Cargo to find the required workspaces and packages, including transitive and optional path dependencies.

Lean mutation coverage now reads declaration identities and source ranges from the pinned Lean frontend. Indented public theorems remain covered, and equal short names in different namespaces remain separate targets. Structure and class projections and instance declarations are not property targets, including local and scoped instances. Wrapped guards and examples remain detectable, and their reported locations refer to the original model. Guard and example failures cannot cover named theorems; errors outside recognized properties are rejected. The runner checks that the original module elaborates before testing mutations.

A Lean mutation that changed a theorem's statement used to count as breaking its proof. Renaming a definition that a statement names makes the statement fail to elaborate, or makes Lean bind the old name as an automatic implicit variable so that only the proof fails. The runner printed DETECTED for both and counted the theorem as covered, although Lean checked no proof of the frozen statement against the mutated code. The runner now compares each failing theorem's elaborated statement with the unmutated model's, and a mutation that changes or adds one reaches no verdict. The comparison ignores binder names, which Lean 4.20 numbers by a counter that edits to earlier commands shift.

`example` and `#guard` commands have no declaration to compare, so a rename that broke one still printed DETECTED and exited 0. The runner now compares an example's elaborated header type and a guard's elaborated term with the unmutated model's, after closing them over section variables, whose internal ids shift when an earlier command changes. A mutation that changes one reaches no verdict. So does a mutation whose replacement adds a check that the unmutated model lacks, which used to count as DETECTED.

Lean mutation results explicitly measure whether existing proofs break; they do not establish that a statement is false or its hypotheses can hold. The skill reports those evidence gaps separately. Existing properties may be corrected and re-frozen when the main thread accepts source-backed specification evidence, even when production code is unchanged; unsupported weakening remains prohibited.

The mutation runner reads and applies every mutation before it runs any tool. A mutation whose replaced text does not occur exactly once in the model used to be found only when its turn came, after every earlier mutation had run its checker; it now stops the run first. A TLA+ or Rust mutation without a `detects` line, and a mutation with two `detects` or two `only` lines, now fail by name instead of reporting a property named by an empty string or keeping the last line. A Lean mutation with an `only` line now fails instead of ignoring it. Because these checks run first, a malformed mutations file fails before a missing tool reports `UNAVAILABLE`.

The mutation runner checks that a Lean project's pinned toolchain is ready once per run, not once per mutation. The check and its remedy now live in `lean-tools.sh`, where `lean-check.sh` reads them too, and a Lean project without a pin reports that directly instead of as an analysis that did not complete.

The Lean checker derives each source's module name once and passes it to the frozen-statement step, which derived it a second time from the same path. When Lake reports a build file outside `.lake/build/lib/lean`, the checker now names it and stops instead of auditing a wrong import.

The TLA+ matrix runner moved from bash into `tlc.py`, and `tlc-matrix.sh` now checks for Python 3 and runs it, as `kani-check.sh` runs `kani.py`. Its output and exit status are unchanged, except that a matrix saved with CRLF line ends now runs, where the bash runner reported its spec as not found. The mutation runner now reads the matrix with the same parser and runs each mutation through the same runner, instead of parsing the matrix a second time and reading verdicts back out of printed lines. So it now finds its spec's section when the `spec` line writes the path another way, such as `./Name.tla`, and it checks TLC once per run instead of once per mutation. Any line the matrix runner rejects now stops the mutation runner wherever it is in the matrix, including an unknown directive, a run before any `spec` line and a check after an empty `spec` line; before, it noticed only a malformed check or reach in its own spec's section. It also reads a matrix whose words are separated by tabs, as the matrix runner always did.

The Lean and Kani templates now ask the adapter to record the source files, line ranges, covered functions and `Source read at <commit>` line in the model's header, as the TLA+ template and all three briefs already did.

## 0.4.8 - pin Lean 4.35.0

The Lean template pins Lean 4.35.0 in place of 4.34.1. The template records the same 34 declarations with the same statement types under both versions. Lean 4.35.0 builds the bodies of three generated `match_1` matchers differently, so their value fingerprints changed, and the template's statements are re-frozen. A project copied from the template keeps its own pin. After its `lean-toolchain` changes, the checker asks for a review and a fresh `--freeze`, as before. The checker still supports pins from Lean 4.20.0.

## 0.4.7 - an optional review of each model's properties

A property can pass every check and still promise less than the code's callers rely on, and until now only the agent that wrote it read it. After writing the target table, the skill asks whether to add an independent review, one agent per target, and skips the question when the request already answers it. A headless run cannot answer, so it gets no review, and its reply says so. A reviewer follows the new review brief. It reads the source and the model's properties, assumptions and fix commits, without the modelling agent's report, and writes the bugs it expects to pass as mutations. The skill appends them to the model's mutations file and runs the mutation runner. It keeps the detected ones and gives a missed one to a new modelling agent. A finding that no mutation can express is reported as an open question. For each model, the reply says whether its properties were reviewed and how the reviewer's mutations fared.

## 0.4.6 - every Lean theorem must be breakable, past fixes become mutations, and agents' results are rechecked

A Lean theorem whose hypotheses can never all hold passes whatever the code does, and the mutation runner never required a Lean theorem to fail. It now reads each Lean model's `.statements` file and prints UNCOVERED for a public theorem that no mutation makes fail, as it already did for TLA+ properties and Kani harnesses. A failing `#guard` does not count for the theorem, and private theorems are proof helpers that need no mutation. A Lean model without a `.statements` file fails before its mutations run. So does a Lean mutation with a `detects` line, which would otherwise count as covering the theorem it names. The template's `invariant_init` named the literal state `⟨0, 0⟩`, so no mutation could break it. The template now transcribes the initial state as `init`, uses it in the reach search and adds a mutation that counts an item as consumed before any claim; its statements are re-frozen. Models copied from earlier templates report `UNCOVERED theorem invariant_init` until they gain such a mutation.

Step 1 lists the commits that fixed a bug in each target's code, and each brief replays them as mutations that restore the behaviour before the fix. A Kani mutation can replay a fix only in the file beside its mutations file. After the agents report, step 3 reruns every matrix, Lean check, Kani check and mutations file in the main thread and takes the verdicts from those runs. It reverts a changed property, theorem statement, statements record or Kani assumption on an existing model, or a theorem newly marked `private`, unless the row's evidence supports the change.

## 0.4.5 - follow renames before retiring a model

The 0.4.4 recheck could propose retiring a model whose code still exists, and could skip the commit that changed a guarantee on purpose. Its search for the covered functions left out each model's files. A Kani harness written inside a production file, as in the bundled template, took the production functions out of the search with it, and a function renamed in place matched nothing. Step 1 now leaves out only model files that hold no production code. When a covered name is found nowhere, it finds the commit that removed the name with `git log -S` and reads all of it, and proposes retiring the model only when that commit deleted the code. The history search read a source file's first and last paths only, so a commit made at an intermediate path was skipped, and a guarantee changed there on purpose kept its old property. Step 1 now follows each source file through every rename since the sync commit and reads the log over all of its paths.

## 0.4.4 - bring existing models back in line with the code

A TLA+ spec or Lean model keeps passing after the code it describes changes, because it never reads the code. When a repository already has models, the formal-verify skill now starts with them. It runs every one, finds where the functions it covers live now, and reads the commits that touched those files since the commit its header records as `Source read at`, so it follows code that moved to another file. It asks whether the model still describes the code and whether any of those commits says the guarantee changed; without that evidence the property stays, and a failure after the update is a bug candidate. Each brief has a section for an existing model: the agent edits the model's files, adds a mutation for each step the update adds, and records the commit it read the source at. When that commit is missing or no longer reachable from `HEAD`, as after a squash merge, the skill uses the last commit that touched the model. It proposes retiring a model whose functions are found nowhere and deletes it, with its CI steps and testing documentation row, when the user agrees. The reply keeps each model's verdict and adds whether it was unchanged or updated, or is proposed for retirement. A request to recheck only the existing models skips the search for new targets.

## 0.4.3 - clear the directory's credential and download-and-run holds

The Claude directory held every version since 0.3.3 for a credential read and a download-and-run command, and 0.3.2 stayed the version it served. Validating the tree one deletion at a time against a throwaway repository named each trigger. The credential rule matched a parameter named for a credential in `opencode.mjs` and in the metadata test, an environment lookup in the Kani helper's `search_path` whose variable name was an argument, and the test driver writing its whole environment to a file. `search_path` now takes the inherited value, which its two callers read by name, so the assembled `PATH` and `PYTHONPATH` are unchanged; the parameters are renamed; the fake kani-driver lives in `tests/fixtures/kani-driver.py` and checks `KANI_HOME` and the loader path against `driver.json` instead of writing its environment. The download-and-run rule matched the name of Lean's evaluation command in the Lean brief, which now says to evaluate `badPairs` at top level as the template does; the command stays in the template and the checker. The CI workflow's curl of the TLC release stays and shows as a warning, which does not hold a version. The 0.3.5 notes blamed the workflow token; it was never the trigger.

## 0.4.2 - OpenCode skips stray folders and rejects incomplete skills

The OpenCode plugin read every folder under `skills/` as a skill, so one folder without a `SKILL.md`, such as a scratch folder in a local checkout, failed the plugin and registered neither skill. It now skips such folders, as Pi does. A `SKILL.md` without a `name` or `description` used to register with that field undefined; the plugin now fails with the file's path and the missing field. A single-quoted `description` lost nothing but kept its quotes; it now reads as YAML does. The two bundled skills register exactly as before.

## 0.4.1 - install from npm

The package is publishable to npm as `agent-formal-verify`, so Pi installs it with `pi install npm:agent-formal-verify` and OpenCode with `opencode plugin add agent-formal-verify`. A `files` allowlist limits the tarball to `opencode.mjs`, `skills/`, the license, the README and the changelog, which drops it from 77 files and 2.86 MB to 34 files and 59 kB; it leaves out the README artwork, tests, CI configuration and the Claude Code and Codex manifests. A Lean build cache under `skills/` stays out. The metadata test pins the allowlist and fails when a new root file is neither shipped nor listed as repository-only. Pushing a `v*` tag runs a workflow that checks the tag against the package version, runs the metadata tests and publishes with npm trusted publishing and provenance; it skips a version that is already on npm. The skills, the OpenCode plugin and the Git installs are unchanged.

## 0.4.0 - install in OpenCode

The repository is now an OpenCode plugin for OpenCode 2.2 and later. `opencode plugin add 'git+https://github.com/michael-denyer/agent-formal-verify.git'` loads `opencode.mjs` through the package's `./server` export. It reads `skills/*/SKILL.md` and registers `setup` and `formal-verify` with their helpers, templates and references in place, and keeps any skill already registered under the same name. It has no dependencies, runs no commands and makes no network requests. The Pi package and the Claude Code and Codex plugins are unchanged.

## 0.3.5 - fetch TLC in CI without a token, and name no MCP package

The CI workflow downloads the pinned TLC JAR with curl and checks it against the pinned SHA256 through the shared helper before anything runs it, instead of fetching it with the GitHub CLI under the workflow's token. The Lean brief no longer links to a Lean language-server MCP package. Neither change cleared a directory hold; 0.4.3 names the triggers.

## 0.3.4 - keep image references out of release-note code

Removed the obsolete icon path from a release-note code span. The Claude directory treats bundled image paths in backticks as possible executable references, even in historical prose. The two README images added in 0.3.3 carried signed C2PA provenance manifests from the image generator; the `caBX` chunk is stripped from both, leaving the pixels unchanged, which cleared the directory's image hold. Metadata tests now reject bundled image and font paths in documentation code, reject provenance and text chunks in bundled PNGs, and guard the plugin's absence of automatic hooks and MCP or LSP servers. The README makes explicit that the plugin configures no servers or hooks and requires no credentials.

## 0.3.3 - fix only what reproduces, and name the property in the PR

The skill fixes only a counter-example that shipped settings can reach, and only with a reproduction unless none is practical. When a unit test for a Lean or Kani counter-example passes on the production code, the agent corrects the model or harness, and the Lean brief permits that re-freeze. A fix PR includes any reproducing test and names the theorem, `#guard`, TLC property or Kani harness that failed. The agent uses a tool the request names and reports what it leaves unchecked.

## 0.3.2 - install in Pi

The repository is now a Pi package. `package.json` points Pi at the existing `skills/` tree, so `pi install git:github.com/michael-denyer/agent-formal-verify` provides the `setup` and `formal-verify` skills with their helpers, templates and references, without a copy. The plugin test checks that the package version, license and skills path agree with the other manifests.

## 0.3.1 - name the Rust commands after the language and the tool

`setup.sh rust` prepares Kani and `scripts/kani-check.sh` runs it. They replace `setup.sh bmc` and `bmc-check.sh`, and the Rust brief moves to `references/rust-brief.md`. As with TLA+ and TLC, the setup command and brief take the language's name and the scripts take the tool's. Rust mutations reject an unknown harness or an `only` line before any mutation runs. A refuted property no longer counts as a detected mutation when Kani also reports a status that the check's category does not use.

## 0.3.0 - check bounded Rust functions with Kani

The Rust checker runs Kani 0.68.0 on actual functions through proof harnesses. It reports each harness's unwind bound and check count, rejects failed checks and unsatisfied cover witnesses, and prints generated concrete playback tests when available. Incomplete verification, insufficient unwinding bounds and unsatisfied covers fail. Rust mutations copy the whole crate and require detection by the named harness; compiler errors and incomplete verification do not count as detection.

Setup verifies a separately installed pinned Kani bundle and invokes its verifier driver directly with the bundled toolchain. Verification and mutations use that same absolute installation, so a relative KANI_HOME or a shadowed Cargo wrapper cannot trigger Kani's automatic setup. The dependency-free bounded-queue template, setup instructions, modelling brief and CI demonstrate the Rust path.

## 0.2.8 - compare models with code and label counter-examples

The Lean template prints boundary and in-range test vectors. The brief requires comparing them with the production function in its native tests before reporting that a proof describes the code, or stating that the comparison was not run. Reports label counter-examples as reproduced, reachable at shipped settings, or model-only. Lean goal and diagnostics tools remain optional.

## 0.2.7 - require reachable boundary states

A TLA+ matrix can require a state with `reach <Operator> | <label>`. The checker searches the first matching run and reports the shortest witness, or fails when no state satisfies the predicate. Reach checks have separate summary counts and can detect mutations with `detects reach:<Operator>`. The templates require a full-window state in TLC and Lean so a property cannot pass by avoiding its boundary.

## 0.2.6 - freeze Lean statements before proving them

`lean-check.sh <project> --freeze [<file.lean> ...]` records each checked source's declaration types and definition values in a `.statements` file beside it. Later checks reject a changed statement, a changed definition or a deleted declaration. Proof changes and added declarations remain allowed. Freeze can record statements whose proofs use `sorry`, but it does not report a proof pass; the final check still rejects unfinished proofs and extra axioms. Fingerprints use SHA256 of structural expressions and belong to the recorded Lean pin. A toolchain change requires review and a fresh freeze.

## 0.2.5 - unavailable tools are not model failures

Helpers now print `UNAVAILABLE` and exit 3 when TLC or Lean cannot run because a prerequisite is missing, unusable or unverified. The remedy stays with that result. Mutation checks preserve the status and stop without a MISSED or SUMMARY line. Model and input errors remain `FAIL` with exit 1; usage errors exit 2. Reports mark an unavailable target as "not checked".

## 0.2.4 - no listing fields in `plugin.json`

The Claude `plugin.json` no longer carries `icon`, `documentationUrl`, `supportUrl`, `privacyPolicyUrl`, or `termsOfServiceUrl`. Claude Code ignores all five at load time. The Claude plugin directory read the icon path as an image the plugin's code could run and held the version for review. The directory icon stays in the repository.

## 0.2.3 - TLC comes from the user, verified by setup

The plugin no longer carries `tla2tools.jar`. Save the JAR from the TLA+ release pinned in `scripts/tlc-tools.sh` as `~/.cache/tla/tla2tools-v1.7.4.jar`, or point `TLC_JAR` at one. `setup.sh tla` verifies the pinned SHA256, names the release and path when the file is missing, and rejects a file that does not match. `TLC_CACHE` chooses another cache directory. No helper downloads anything.

## 0.2.2 - the TLC JAR ships inside the plugin

The plugin bundles the TLC v1.7.4 release JAR at `skills/formal-verify/vendor/tla2tools.jar` with its MIT license. `setup.sh tla` checks that JAR against the pinned SHA256 and no longer downloads anything, so TLA+ setup needs no curl and no network. The `~/.cache/tla` cache and the `TLC_CACHE` setting are gone; `TLC_JAR` still selects another JAR. Lean setup is unchanged.

The plugin has an icon for the Claude plugin directory.

## 0.2.1 - reports for readers new to the tools, and briefs read from a file

The formal-verify skill writes its reply, pull requests and documents for a reader who knows the code and has used neither tool. A report leads with what goes wrong in the code, states each property as what it guarantees, and says what a TLC pass, a Lean proof, a bounded search and a detected mutation each mean.

The modelling requirements moved from `SKILL.md` to `references/tla-brief.md` and `references/lean-brief.md`. An agent's brief names the file to read, where the skill previously had the requirements copied into every brief. `SKILL.md` is about a fifth shorter.

The briefs tell agents to write each fact once: named variable groups for `UNCHANGED`, one operator for a shared guard, one bounded input list per Lean model, and no mutation switches in a model. The skill gives each result one home and rules out a report file per bug and machine-specific paths in committed commands.

## 0.2.0 - one Lean project per repository and a mutation runner

Lean models share one Lake project: each target is a file `lean/Model/<Name>.lean` in its own namespace, where each previously copied the whole template to `lean/<Name>/`. The Lean template moved to `examples/lean-template/Model/BoundedQueue.lean`, and its lakefile builds every file under `Model/`. Existing projects with their own layout still check.

`lean-check.sh` takes file names after the project and then builds and audits only those files, so agents that share a project can each check their own model. It names the cause when two modules declare the same name. Its result lines read `declarations checked, no unfinished proof (sorry), no added axiom`.

Added `mutate.py`. It reads a model's `<Name>.mutations` file, applies each listed bug to a temporary copy, and prints DETECTED or MISSED with what failed. A TLA+ mutation names the one property that must fail; a property that no mutation targets is reported as UNCOVERED. A Lean mutation is reported with the declarations that fail. Specs no longer need a constant or branches for their mutations. Both templates include a mutations file, and the TLA+ template's matrix is now `BoundedQueue.matrix`.

`tlc-matrix.sh` ends with a SUMMARY line that counts the passing runs and totals their distinct states.

## 0.1.11 - Lean checker works from Lean 4.20.0 and ignores leftover modules

`lean-check.sh` takes the modules to audit from `lake query`, so a `.olean` left in the build directory by a deleted source is no longer audited. The audit skips the compiler's auxiliary declarations, which made every model fail on Lean 4.20.0. The checker supports pins from Lean 4.20.0, the first whose Lake builds a module by its source path, and names that minimum when an older pin fails.

## 0.1.10 - sound Lean audit and clearer agent instructions

`lean-check.sh` audits every declaration of every built module with Lean, so a theorem that rests on a declared axiom, `native_decide` or `sorry` fails even when the model has no `#print axioms` line. It builds every `.lean` file in the project by path, so an unimported module is checked and a file that no Lake library owns fails; a default build skipped both. A project with no declarations fails. A long theorem name no longer causes a false failure. The Lean template drops its `#print axioms` lines.

The matrix runner reports the final state count; it previously reported the count from TLC's first progress line on longer runs.

`setup.sh tla` replaces a cached JAR that does not match the pin. `setup.sh lean` prints a `FAIL` line when an installed toolchain does not run.

The formal-verify skill prepares tools after picking targets, tells each agent brief to carry the helper paths, uses one matrix file per spec, and requires mutations for both tools on a copy or reverted. It changes code, commits and opens pull requests only when the user asked for fixes. Tool setup explains how CI obtains the helpers. Both skills run helpers by absolute path with `bash`.

Removed `.codex-plugin/prompts/`, which the Codex plugin manifest never loaded.

## 0.1.9 - verifier fixes and worked TLA+ example

The matrix runner now reduces the trace of an invariant violation or a deadlock; it previously reduced only temporal counter-examples and printed the raw log for the rest. The reducer reads one-variable specs and exits 1 on a log without a trace.

Each matrix run gets its own directory, so a spec no longer resolves modules left by an earlier spec. A missing spec is reported in one line.

The matrix runner fails a `check` line placed before any `spec` line, which it previously dropped while the run still passed, and a `run` line without a `|`, which it previously turned into a constant named after the label.

`lean-check.sh` prints multi-line #eval output whole, no longer counts `error:` text in output as a build error, and fails a theorem that `#print axioms` shows resting on a declared axiom. The Lean template guards its bounded search with `#guard`, so a counter-example fails the build.

Added a TLA+ template beside the Lean one; it replaces `examples/template.matrix`. CI runs both checkers on the examples and on mutated copies.

The tests run under `node --test` and include the metadata checks that `tools/check.mjs` held, so development no longer needs Bun.

## 0.1.8 - validation and simpler metadata

Removed the separate root version file. Validation compares the plugin manifests, marketplace entry and release notes directly.

Added prek hooks shared with CI, including Python and workflow linting. Dependabot proposes weekly updates for lint tools, prek and GitHub Actions.

CI checks local documentation links and heading anchors offline and audits workflow security with zizmor.

## 0.1.7 - simplify contribution guidance

Removed the separate reporting document and contact fields from plugin metadata.

## 0.1.6 - clarify the workflow diagram and method

Moved the diagram subtitle into a README heading and added a short workflow explanation. The introduction credits Boris Cherny's targeted formal-verification method.

## 0.1.5 - workflow graphic and shorter README

Added a workflow diagram and a getting-started example. Moved detailed installation, update and verification guidance into a reference page.

## 0.1.4 - GPLv3 and contributor documentation

The plugin uses GPL-3.0-only. Added contributor guidance, issue forms and a pull request template. The README now explains the verification workflow and updates for Claude Code and Codex. Edited the skills and template comments for clearer prose.

## 0.1.3 - set up all tools once, select them during verification

Setup prepares the complete shared toolset independently of any repository. Formal verification selects tools from its current targets and prepares any missing pinned artifacts before modelling. Repository changes and new Lean pins do not require a manual setup rerun. Lean preparation reuses a working pinned toolchain without calling the installer. CI runners still require a separate preparation step.

## 0.1.2 - clarify global setup scope

Setup resolves the invocation's repository before running helpers from the installed plugin. Global installations share tool caches while selecting tools and respecting Lean pins separately for each repository. Installed helpers and templates remain read-only; model files and build outputs belong in the target repository.

## 0.1.1 - add an agent setup command

`/agent-formal-verify:setup` inspects the repository's thread protocols, sequential invariants and existing models, then prepares TLA+, Lean, or both before verification. Explicit tool arguments are overrides. It reuses existing runtimes, installs missing required prerequisites through the user's package manager when available, and runs the pinned setup helper. Lean setup uses an existing project's pin or the bundled template; setup reports tool readiness without creating a model project or changing the global Lean default.

## 0.1.0 - formal verification with TLA+ and Lean

A standalone plugin for modelling thread protocols with TLA+ and TLC and proving sequential invariants with Lean 4. It includes matrix and proof runners, templates, and explicit tool preparation. Verification checks require prepared tools; they do not install a JDK, elan, TLC, or a Lean toolchain. TLC downloads use unique temporary files and verify the checksum before publishing to the cache.
