Repository navigation
Release 0.2.5 - #27
Merged
Merged
Conversation
… proven verification/ is a Lean 4 project (no dependency beyond Lean) holding models of the rules Clew's safety rests on, the theorems proved about them, and a generator of conformance vectors (lake exe vectors). - Confine: a path check_lexical accepts, resolved against any root, stays under it at every step; its refusals are exactly the documented ones. - Update: what ensure_upgrade accepts is strictly newer than what runs; the version order is a strict total order, so a run of updates only climbs and never installs a version twice; the Display form and the vX.Y.Z tag read back as their version. Each model's vectors (every short input over an alphabet reaching each branch, plus edge cases) are committed, and cargo test runs the real check_lexical, names_a_folder, Version::parse, the derived order and ensure_upgrade on them: the theorems hold of the code as far as the code computes what the model does, and these tests are that link. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
A Lean model of slug, asset_name, parse_digest_list, embedded_digest, parse_sha256 and the accept/refuse decision server_binary and cached_if_valid make, with these theorems: - a slug is a non-empty run of [A-Za-z0-9_-], whatever the remote's uname says and however Unicode lower-casing behaves: no path separator, no dot, nothing a URL reads as syntax; - two different (slug, protocol) pairs never share an asset name, so never share the digest pinned under it; - with a digest list embedded, a binary is deployed only if it hashes to the digest pinned for its own asset, the sidecar has no say, and an asset the list does not name is never deployed; - every pinned digest is 64 hex digits under a non-empty name, and the list the release assembles from its sha256sum lines parses to exactly its entries. cargo test runs the real functions on the model's vectors (slugs, names, digest lists in every documented shape and many malformed ones, sidecars, verify). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
…y per machine A Lean model of what every language-server approval hashes and of the key a remote approval is filed under, with these theorems: - args_part is injective: no two argument lists read alike; - the length-prefixed fields are injective, the command's 32-byte content digest after them included; - command, options-only and leave-to-build fingerprints hash disjoint inputs, so an approval of one is never an approval of another; - the approval key names one user, host, port and project, and a remote key never equals a local one. Proving the last found a hole: a host may hold ':' (IPv6), so u@2001:db8::1:2222 on port 22 and u@2001:db8::1 on port 2222 were given one label, and an approval for one machine covered the other. The label is now made by scope_label, for in-app connections and CLEW_SSH alike: a host holding ':' is bracketed ([2001:db8::1]:2222), and %, /, [, ] and @ are escaped. An ordinary user@host keeps the label it had, so existing approvals still apply; the label also uses the trimmed user and host, as ssh does. The three fingerprints now hash through one length_prefixed encoder, the bytes unchanged (every stored fingerprint still matches). cargo test runs args_part, length_prefixed, project_key and scope_label on the model's vectors; a test pins the IPv6 case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
…exactly A byte-level Lean model of read_frame (Content-Length headers, their caps and refusals), read_json_line (MCP, ACP), read_line_capped (Clew's own protocol) and encode, with these theorems: - a frame encode wrote is read back as exactly its body, whatever follows it, and the stream is left at the next frame; so any number of frames written one after another read back as exactly those messages; - a clean end of stream is no frame, not an error; - a body read is never longer than MAX_FRAME_BYTES, whatever its header claimed, and every frame read consumes input; - a JSON line Clew writes is read back exactly; - the clew protocol's cap is on a line's content: a line of exactly the cap is read, a longer one refused, never read in part. read_json_line's cap is now a parameter of an inner function (the public one passes MAX_FRAME_BYTES), so the vectors reach it. cargo test drives the real async readers over the model's vectors: every sequence of up to four header pieces, line ends and junk, the documented edge cases (case, bare \n, conflicting and over-long lengths, a 33rd header line, an 8 KiB line), encoded streams, and every short line at caps 0-3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
on_words now reads every fact it routes on first (RouteFacts) and lets one pure function, route, decide where the words go: the steps to take, in order, until one acts. Behavior is unchanged; on_words only carries the steps out. The Lean model of route has these theorems, each checked by the Lean kernel on all 1152 combinations of facts: - "Bye, Clew" is always heard first; - a word that stops Clew is never asked of Ask (unless the question waiting offers an answer of its name), nor taken for a yes; - a command waiting for a yes runs only on a yes; - what is said to a question waiting is never asked of Ask; - while an answer is written, a stop word stops it before any command; - every route ends in one step that acts, after at most one Try, and never takes a step whose subject is not there. A test checks the Rust route against the model on all 1152 combinations, so the theorems hold of route itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
- verification/check.sh checks that every proof checks, that each named theorem rests on Lean's three standard axioms alone (Audit.lean: no sorry, no Lean.ofReduceBool), and that the committed test cases are exactly what the models compute today. - CI gains a `verification` job running it, on the Lean release verification/lean-toolchain pins, fetched from GitHub and checked against a pinned SHA-256 (no installer script). - docs/verification.md (and its Chinese mirror, linked from both READMEs) says what is proved, how the proofs reach the Rust code, what they rest on, what is not verified and why, and how to add a rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
…d as ssh reads it The independent review of the Lean work found gaps between what was proved and what the code does. Each is now closed in the model, the code and the tests together. Approval keys (Trust.lean, derived.rs, connect.rs) - A relative remote root (`clew proj` with CLEW_SSH set) could share a key with an absolute one on another port: `2222:/srv/p` on u@h and `/srv/p` on u@h:2222 were both `ssh://u@h:2222:/srv/p`. A relative root is now written `./proj`, and the theorem that a key names one user, host, port and project holds for every root, not only absolute ones. - A path that is not UTF-8 kept its key through to_string_lossy, so `/p/\xff` and `/p/\xfe` were one project. Such a byte is now written as a NUL and two hex digits (no path holds a NUL); UTF-8 paths keep their keys. A local root that cannot be canonicalized is keyed by its absolute path, so a local key never begins `ssh://`. - CLEW_SSH ignored `-l`, `-o User=` and `ssh://` destinations, so alice and bob on one host shared approvals. The user, host and port are now read as OpenSSH reads them (checked against its source): each the first given, in argument order, the URI form included. A port is kept as written, so `-p http` is no longer taken for port 22. Framing: read_line_capped refuses a line that is not UTF-8; the model now does too (Unicode's well-formed table), with byte vectors covering overlong forms, surrogates, code points past U+10FFFF and cut-off sequences — checked against Python's decoder as well as the Rust code. Voice: a stop word is proved never sent to Ask with no exception; when the question waiting has an answer of that name, a new theorem says it is held as that answer. The docs now state the stop-the-answer rule with its two exceptions. Also: vectors for every White_Space code point and its neighbours in the functions that trim or split on whitespace; slug's model lower-cases the whole string, as str::to_lowercase does; the order theorems join the axiom audit (45 theorems, standard axioms only); the build fingerprint test pins the digest worked out apart from the code, which is the one 0.2.4 recorded; docs say "deployed", and name ssh's own configuration as not modelled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
…ision accounted for A new Lean model, Ssh.lean, covers the text Clew hands to another program to parse, where the parse decides what runs: - Shell quoting. `shell_command`, the macOS updater's `quote` and `sh_c` write words a POSIX shell reads back as exactly those words, whatever they hold; `sh -c '<script>'` reads as sh, -c and the script. The model of the shell is itself checked: every vector also goes through the real /bin/sh, which reads it back the same. The remote scripts are tested to read alike in fish and csh too. - ssh's arguments. No field of a saved connection is ever an option to ssh, whatever it holds (a host typed as -oProxyCommand=… is a host), and a machine has one label whether reached as a saved connection or through CLEW_SSH with the same arguments, so approvals through either are filed under one name. The CLEW_SSH reader added last commit is now modelled and tested against the model on 4,393 argument lists. - known_hosts. A field Clew writes a key under holds no pattern syntax and names exactly one host and port. The docs now list every place Clew decides who may do what or what to trust, and how each is checked: proved where a rule can be stated, and otherwise what it rests on (the file system, the url crate, Apple's code signing, a network protocol). They also say why the models are written by hand rather than extracted with Aeneas. Also: clew-core's own tests build clean for Windows with warnings denied (helpers only Unix tests use are marked so); 54 theorems in the axiom audit, all on Lean's standard axioms. The CI verification job was run locally step for step: the pinned download and its SHA-256, then check.sh from a fresh copy with no build cache. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
… headers Two decisions the coverage table still listed as tested only are now proved, in a new model, Guards.lean: - trusted_location decides whether a project's language server may run where it is rather than from Clew's copy of the approved bytes. Its decision is now a pure function, trusted_by, over what it reads (owner, mode bits, kind of the file and each directory above it); the reading is unchanged. Proved: when it says yes, no user but you or root can write the program or replace an entry on the way to it, under the Unix permission rules with every user taken as possibly in the group. - check_headers: the headers it accepts are read back from the request as exactly those headers, one line each, under their own names, however leniently a server splits lines (CR, LF or NUL). No value can start a header of its own. Both are tied to the Rust code by test vectors (7,260 and 123 cases). 56 theorems in the axiom audit, all on Lean's standard axioms. clew-core, clew-protocol and clew-server pass clippy for Windows with warnings denied; the app's own crates cannot be cross-checked here (whisper.cpp needs newer MinGW headers than this machine has). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
The two decisions now live in a new crate, crates/clew-rules, which the app and clew-core call. It has no dependencies, only pure code, written in the part of Rust that Aeneas translates. Charon and Aeneas (pinned release nightly-2026.11.18-1dc8ad3) translate that source into verification/extracted/ClewRules.lean. Equal.lean then proves two things for every input: - route always returns, and returns the model's steps for all 1,152 combinations of facts; - trusted_by always returns (no index out of bounds, no overflow, the loop over directories ends) and says what Guards.trustedBy says. So the theorems about those two models hold of the code that runs, not of a copy of it. Both proofs rest on Lean's standard axioms alone. The new project is kept apart from verification/ because Aeneas's Lean library needs Mathlib. The proofs in verification/ still need only Lean. verification/extracted/check.sh checks that ClewRules.lean is what the tools make of the source today, then runs the proofs and the axiom audit. A change to clew-rules is caught twice. Weakening trusted_by's mask from 0o022 to 0o002 fails the regeneration check, and once regenerated it fails the proof. Both failures were checked here. A new CI job, extracted, runs that check with the pinned release (its SHA-256 is checked) and Mathlib from its build cache. The job is defined but was not run. Locally the whole chain was built from source: Aeneas, about 1,500 Mathlib modules, the translation and the proofs. The docs now explain all of this, in English and Chinese: which rules are proved of the code itself, how to regenerate the translation, and why the other rules stay models checked by test cases. Their code uses what Aeneas does not translate: character iteration over a str, string formatting, closures, char classes, SHA-256 and async I/O. Gates: workspace clippy with warnings denied, fmt, clew-rules docs, clew-core's trust tests, the app's voice-route conformance test, and both Lean checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
…self What read_frame decides from one header line now lives in clew-rules as framing::header. The decision covers four things: - whether the line is ASCII `Name: value` with a token for a name; - whether the header is Content-Length, in any case; - what that length is: digits only, at most 20 of them, fitting a u64; - whether it conflicts with an earlier Content-Length or passes the 64 MiB cap. read_frame calls it and keeps its error messages as they were. Aeneas translates the function, and Equal.lean proves it is the framing model's `header`. For every line and every length read before it, the Rust returns (no index out of bounds, no overflow, every loop ends) and decides what the model decides: the same error, or the same Content-Length. The proof covers the function's eight loops through one generic loop lemma; the digit accumulator's explicit overflow bound is shown to reject exactly the values past u64::MAX. Shaping the code for Aeneas: - each loop is its own function, since Aeneas takes no `return` from a loop that other loops follow; - byte classes are plain comparisons, since its library models no u8::is_ascii_* methods (a module-level clippy expectation says so). Letting a frame of exactly the cap through fails both the regeneration check and the proof; this was checked here, as for trusted_by. The docs (English and Chinese) and Framing.lean's header now say that the per-line decision is proved of the code itself. The loop that reads the lines stays a model checked by test cases. Gates: fmt, workspace clippy with warnings denied, clew-rules docs, clew-core's 38 framing tests (the byte-level conformance vectors included), both Lean checks, and an axiom audit of three theorems, all on Lean's standard axioms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
Until now only clew-core, clew-protocol and clew-server could be linted for Windows from Linux. whisper.cpp would not compile against the MinGW headers here, so the app and the voice crates stopped the check. scripts/clippy-windows.sh now runs clippy for x86_64-pc-windows-gnu over the whole workspace, every target, with warnings denied. No C is built (DOCS_RS, which whisper-rs-sys honours). whisper's bindings are generated for Windows from MinGW's headers, because the bundled ones are Linux's and their struct sizes differ. The first full run found three items the Windows test build never uses: - App::call_site_line, which only a Unix test (symlink refusals) calls; - the Heard and Counted helpers of a Unix-only speech test. Each is now gated as its callers are. The workspace then passes, and Linux clippy and fmt are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
check_headers now checks each header's bytes with two functions in clew-rules: - header_name_ok: not empty, every byte a token byte; - header_value_ok: no CR, LF or NUL. Aeneas translates both. The guard's model in Guards.lean reads characters, while Rust hands over the UTF-8 bytes of a string. Equal.lean bridges the two. On the UTF-8 bytes of any list of characters, as Lean's own List.utf8Encode makes them, both functions return and decide what validHeaderName and the model's value check decide of those characters. The bridge rests on two facts about UTF-8, proved from Lean's definition of String.utf8EncodeChar: - a character below 128 is one byte, itself; - every other character is one or more bytes, each 128 or above. So no multi-byte character is ever read as a token byte, a CR, an LF or a NUL. The ASCII cases are checked over all 128 characters by kernel decision. Dropping the NUL check from header_value_ok fails both the regeneration check and the proof; this was checked here. Four rules are now proved of the code itself, and the docs say so in English and Chinese, along with what the header proof rests on: Rust's guarantee that a str holds the UTF-8 of its characters. Gates: fmt, workspace clippy with warnings denied, clew-rules docs, 56 clew-core tests (the header and framing conformance vectors included), both Lean checks, and an axiom audit of five theorems, all on Lean's standard axioms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
shell_command, sh_c and quote now live in crates/clew-rules as byte-level Rust that Charon and Aeneas translate, and the app calls them on the UTF-8 bytes of its strings. Equal.lean proves the translation returns, with no panic or overflow and every loop ending, and returns the UTF-8 bytes of what Ssh.lean's shellCommand, shC and quote return. Ssh.lean already proves a POSIX shell reads those back as exactly the words given, so that now holds of the code that runs. The one condition is room in memory for the quoted command. The bridge from characters to bytes is new: a character below 128 is its own byte, every other one is bytes of 128 or more, so it is never a quote, a space or a bare byte. extract.sh now fails when Aeneas translates only part of the crate, not just when it falls back to an axiom. The audit lists the three new theorems; all rest on Lean's standard axioms only. Letting a space stand unquoted, or writing the escape with a different byte, makes the proof fail. The Linux test also checks quote, which the macOS installer calls, against the model's vectors and the real /bin/sh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
plain_host_field decides whether a host field may have an ssh key recorded under it. It now lives in crates/clew-rules as byte-level Rust: name bytes, the first `]:`, and a port read the way str::parse::<u16> reads one (an optional `+`, then digits, worth 1 to 65535). connect.rs calls it on the UTF-8 bytes of the field. Equal.lean proves the translation always returns and decides exactly what Ssh.lean's plainHostField decides of the field's characters. Ssh.lean already proves a field it accepts names one host and port and holds none of known_hosts' pattern syntax, so that now holds of the check that runs. There is no room condition: it only reads. The bridge from characters to bytes adds the `]:` split (a character's bytes are never `]` or `:` unless the character is) and the port digits (digitsValue over characters is the same sum over their bytes). Letting a `*` into a host name, or accepting port 0, makes the proof fail. Only Lean's standard axioms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
slug turns the platform a remote's uname reports into the name of the server binary to deploy there, a name joined into a cache path and a download URL. Its check, not empty and every byte in [A-Za-z0-9_-], now lives in crates/clew-rules as slug_ok, and server_dist.rs calls it on the UTF-8 bytes of the lower-cased name. Equal.lean proves the translation returns and accepts exactly the names ServerDist.lean's check accepts. ServerDist.lean already proves an accepted slug can neither climb out of the cache nor change the URL, so that now holds of the check that runs. Letting a `.` into a slug makes the proof fail. Only Lean's standard axioms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
What an approval covers is a SHA-256 of length-prefixed parts, one of them the arguments as `count;len:arg...`. Both encodings now live in crates/clew-rules over bytes (the decimal writer recursive, as the model's decimal is), and trust.rs builds every fingerprint's input with them. The bytes are unchanged: the vectors and the fixed digest of a build fingerprint recorded by 0.2.4 still pass, so no approval already given changes. Equal.lean proves the translations return and write exactly Trust.lean's argsPart and fields for any input that fits in memory. Trust.lean already proves those encodings injective, and the three kinds of fingerprint inputs disjoint, so that now holds of the bytes the code hashes. Writing `=` for the `:` separator, or taking a byte modulo 255, makes the proof fail. Only Lean's standard axioms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
A remote project's approvals are filed under ssh://<label>:<root>, the label user@host:port with %, /, [, ] and @ escaped and an IPv6 host bracketed. scope_label and the remote branch of project_key now build it with clew_rules::approval, over the UTF-8 bytes of their strings; scope_label is split into its user, host and port steps. Equal.lean proves the translation returns and writes the UTF-8 bytes of Trust.lean's scopeLabel and approvalKey. Trust.lean already proves two remotes and two roots share a key only when they are the same, so that now holds of the keys the code writes. The vectors and the approval key tests still pass, so no key already recorded changes. Leaving `@` unescaped, or a relative root without its `./`, makes the proof fail. Only Lean's standard axioms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
The closing paragraph of "The code that runs" now says which rules stay models checked by test cases and what keeps each out of clew-rules: path confinement rests on the standard library's Path and the OS, the version, ssh-argument and digest-list rules trim Unicode whitespace, and framing's reading loop is I/O. The list of what clew-rules uses now includes recursion and optional slices. English and Chinese alike. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
check_lexical, the lexical half of path confinement, now asks clew_rules::confine::check_lexical first, on the UTF-8 bytes of the path. That code, as Charon and Aeneas translate it, is proved in Equal.lean to say what Confine.checkLexical says for every string: the check whose accepted paths never stand outside the root. names_a_folder moves there too and is proved the same way. Its first step is str::trim, so clew_rules::text::trim_bounds reads a string's bytes a character at a time and is proved to find exactly Text.trim, every Unicode White_Space character included. On the way: the byte test agrees with isWhitespace on every character, and UTF-8 is a prefix code (utf8_inj). The standard library's Path reading stays after the proved rule for Windows' backslashes, drives and UNC prefixes; a test shows it refuses nothing more on Unix. Mutating the '..' test or dropping U+3000 from white space makes the proofs fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
Version::parse and ensure_upgrade now call clew_rules::version: parse reads a version from the UTF-8 bytes of its text (trimmed, leading v's dropped, a -/+ suffix ignored, three trimmed numbers), is_newer orders two versions field by field, and upgrade is ensure_upgrade's whole decision. Equal.lean proves, for every string, that they return and decide what Update.parse, Version.lt and ensureUpgrade decide, so what upgrade lets through is strictly newer than the running version (upgrade_newer). The byte parser agrees with the old str reading on all 111,110 strings of up to five pieces over an alphabet that reaches every branch, and letting is_newer accept an equal patch makes the proof fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
SavedConnection::ssh_args now calls clew_rules::ssh::ssh_args on the UTF-8 bytes of its trimmed user, host and identity file. Equal.lean proves that, for any fields and port, it returns and writes the bytes of Ssh.sshArgs, so ssh parses what the code writes as exactly Clew's options and user@host (ssh_reads_as_meant). Charon translates no constant byte strings and Aeneas does not model str::as_bytes, so the fixed option words are built by pushes through a small macro; a test spells them out. The decimal port reuses the fingerprint encoder's proved with_decimal. Dropping the `--` before the destination makes the proof fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
embedded_digest and parse_sha256 now read with
clew_rules::server_dist::{pinned_digest, sidecar_digest}, on the UTF-8
bytes of the list and the .sha256 file. Equal.lean proves, for any text
and asset name, that they return and read exactly what
lookup (parseDigestList list) asset and parseSha256 read: the readings
pinned_only and unlisted_refused speak of. Underneath: str::split_whitespace
a word at a time on bytes, split_once('='), the two-word sha256sum form,
hex and lower-casing, all against their Unicode models.
The HashMap-building parse_digest_list is gone; a test keeps the old str
readings and checks the proved ones agree on ~22,000 generated lists and
sidecars. Letting the list stop splitting at ',' makes the proof fail.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
read_frame, read_json_line and read_line_capped now read a line from the stream and hand it to frame_line, json_line or capped_line in crates/clew-rules, which decide everything about it; what is left in clew-core is a match with one arm per decision. Equal.lean proves each decision, taken as that match takes it, is one turn of the model's loop on the same line (frame_line_is_the_model, json_line_is_the_model, capped_line_is_the_model), with no panic or overflow, on Lean's standard axioms. MAX_HEADER_LINE_BYTES and MAX_HEADER_LINES move to clew-rules. Letting a 33rd header line through, leaving a \r on a JSON line, or refusing a line of exactly the cap each fails the proof. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
The decisions left to tests move into crates/clew-rules and are proved
of the code itself (Aeneas), each against a model with its theorem:
- confine::inside: the canonical path is the canonical root, or the
root, a / and more; never a sibling such as /project-old beside
/project. confine takes a path only if it and Path::starts_with both
accept it (Unix; Windows keeps Path::starts_with alone).
- download::release_asset: an update comes only from the releases' host,
exactly, and under their downloads directory, as the url crate reads
the URL.
- dap::hover_eval_allowed: hovering runs the program's code only with
the adapter's promise or your choice.
- oauth::{endpoint_allowed, fresh, take_stored, answers}: credentials go
only over https or to this machine; a token is used only while more
than the margin is left, with no wrap-round; a refresh token is
presented only when it must be; only the exact state ends a sign-in.
Accepting /pq under /p, a token in its last second, a state matched by
prefix, or a host that begins with github.com each fails the proofs.
Docs list fifteen rules proved of the code, in both languages.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
stage_lsp_command and CommandProbe::into_exec now ask clew_rules::location::launch how an approved command runs, proved of the code itself (Aeneas) against Guards.launch: refused exactly when its fingerprint is not approved (launch_refused_iff), and run in place only when approved, outside the project and private by trusted_by, so that no other user can write it or replace an entry on its path (in_place_is_approved_and_private, from trusted_means_private). Anything else approved runs from Clew's copy of the approved bytes. Running in place on "outside or private" instead of both fails the proof. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
Routing ensure_upgrade through clew_rules::version::upgrade turned the
"not newer" message's named {v} into a positional {}, which the i18n
test reads as {arg1}: not in extern_messages, so the refusal would have
shown untranslated. The argument is named again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
APFS refuses a name that is not UTF-8 (EILSEQ), so the test that trusts such a project failed to create its folders on macOS. There no local project can have such a path; a remote one, whose path is the remote host's bytes, still can. The test now tries the local root where the file system takes the name, and the remote root everywhere. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJhW61edgoVZBStjCVuifR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release 0.2.5: Lean 4 formal verification of Clew's safety rules, proved of the Rust that runs.
What changes
verification/: a Lean 4 project (no dependencies beyond Lean) with models of the rules Clew's safety rests on, the theorems proved about them, and test cases the Rust test suite checks the real code against (verification/check.sh).crates/clew-rules: a new dependency-free crate holding Clew's pure decisions. The app,clew-coreandclew-servercall it.verification/extracted/: Charon and Aeneas translateclew-rulesto Lean (ClewRules.lean), andEqual.leanproves each translated function equal to its model for every input, with no panic, overflow or out-of-bounds index. So the theorems hold of the code that runs.extracted/check.shchecks that the translation is current, the proofs check, and they rest on Lean's three standard axioms only.CLEW_SSHuser and port are now read as OpenSSH reads them.docs/verification.mdanddocs/verification.zh-CN.mdsay what is proved, what each proof rests on, and what is not verified and why.verificationandextractedjobs run both check scripts.Mutation checks: each rule was broken on purpose (a weaker mask, a sibling path, a
statematched by its prefix, a 33rd header line, and others), and the proofs failed every time.Generated by Claude Code