Proving the one promise your tests can't reach

AI-generated illustration.
Agents can now write the formal specs and proofs that used to cost a team years, and the most practical way I've found to point them at your own code is a skill in Lauren Tan's pstack plugin. It doesn't replace tests. It covers the promise tests are worst at keeping: that something never happens, whatever order the world does things in.
The idea reached me through a video by The Hype Kevin, "Proofs Are the Biggest Upgrade to Claude Code Yet". It opens with throughput numbers, Boris Cherny's 259 PRs in a month and Lauren Tan's team's 11,000, and then the uncomfortable line: "You merge code you didn't read." That's true of my own software factory. Every change passes three reviewers and the full test suite on the merge with the main branch before it reaches me, and I still don't read most of the lines. This article checks the video's claims against its sources, reads the skill itself, and spends real time on what a proof doesn't promise, which is the part the excitement tends to skip.
One click, two charges
The video's example is a checkout. You ask an agent to add a retry for when the payment call times out. It writes one, the tests pass, and you merge it. Then a customer is charged twice. The first call was slow, not dead. The timer gave up on it and sent the retry, then the first call landed anyway, then the retry landed.
No test caught it because a test walks one path, and this bug lives on a path nobody picked. The video counts them. One click can go six ways at the first step: the provider answers fast or slowly, the call fails, the network drops, the customer clicks again, or they close the tab. If every step had only three outcomes, ten steps would make 59,049 paths and twenty would make about 3.5 billion. Order multiplies that again: ten events can land in 3,628,800 orders and twenty in about 2.4 quintillion. Two customers paying at once shuffle their steps together. Your agent writes tests for the paths it thought of, and the bug is on one it didn't.
The fix is well known. Stripe's API takes an idempotency key so that a retry counts as the same charge. Knowing you needed it before a customer told you is the hard part.
A checker walks the tree, a proof skips it
Formal verification starts from a rule in one sentence: a customer is never charged twice for one purchase. The agent then writes a small model of the checkout, the steps and what each one changes, usually in TLA+. A model checker (TLC, for TLA+) explores every state the model can reach, in every order. That's tractable because many paths end in the same state, and each state only has to be checked once. When it reaches a state that breaks the rule, it stops and hands back the shortest sequence of steps that got there.
A proof goes further. It doesn't explore anything. It shows that the rule holds at the start and that every possible step keeps it holding, so it holds at the end of every path, however long. It's induction, the same move that proves something for every number. A model checker says there's no counterexample within the bounds you gave it. A proof says there's none at any size. Lean, Rocq and Isabelle are the proof assistants that check the second kind of argument.
Why nobody did this before
It was expensive enough that only teams with a lot at stake paid for it. In 2015 AWS reported that TLA+ had found a subtle bug in DynamoDB's replication design whose shortest error trace was 35 high-level steps long. Nobody writes that test by hand. The seL4 microkernel is the classic cost figure. Its team reports that developing the kernel took 2.2 person-years, and proving it correct took about 20.
What changed is who writes the spec. Cherny, who created Claude Code, has used both TLA+ and Lean, and the video quotes him: "I don't know either language well, but Claude is excellent at both." I couldn't open his original post, so take that as quoted. The two larger results from this autumn are better documented.
In October, Anthropic and Theorem reported that Claude had proved there are no crashes "on any input (up to 64 MB) for 239 entry points across 123 different OSS-Fuzz libraries". That took about 180 million lines of Rocq, written over a few weeks, and Claude patched the bugs it found along the way. Anthropic's own caveat belongs next to the headline: "'Formally verified' does not mean 'bug-free.'" The proofs are about RISC-V builds under a model of Linux, and a program that never crashes can still return the wrong answer. A subset of the proofs is public.
In November, Levent Alpöge, a mathematician at Anthropic, released a proof of the Riemann hypothesis as a Lean library of 17 million lines. He says he found it working with Claude between early October and mid-November, and that "Claude far outpaced me near the finish line." A day later the Lean FRO and the Mathlib Initiative certified "both the statement and the proof", after Lean's kernel and several independent checkers accepted it. There's no human-readable paper: Alpöge's draft of one passed 250,000 pages. Stanford's Brian Conrad told the New York Times that releasing a proof its author doesn't fully understand was "frankly completely outrageous". That's the same tension as merging code you didn't read, at a much larger scale. A checker can certify something no person fully understands.
Lauren Tan's skill
Lauren Tan maintains React Compiler and works on Grok Bot at SpaceX AI. I covered her path from watching every agent move to letting agents merge in Climbing the trust curve with coding agents. In her AI Engineer talk, "All Code Is Slop (Except Mine)", she says her team shipped 11,000 pull requests to production in October, and that most of her tokens now go to verification. Formal methods are one layer of that. They use TLA+ to check models of core flows such as notifications across devices, and Lean to prove their virtualisation library doesn't flicker or jitter. She calls it an experiment and one more tool, not a cure-all.
Her skill is create-formal-verification-skill, in pstack. It landed on 18 October, with a companion, maintain-formal-verification-skill, the next day. Neither can be invoked by the model on its own, so you start them yourself. The skill is short enough to read whole, and worth it, because nearly every paragraph is a rule about honesty.
It chooses the target from the code. A good one is "a promise the code makes, where a break harms users and tests rarely reach the case that breaks it", and it takes "the strongest such target in the repo, not the one that is easiest to verify." That last clause matters most. Left alone, an agent will prove something easy.
The question chooses the tool. Whether events can happen in a bad order suits a model checker over a small model, "and TLA+ is the default for that in any language". Whether the code itself behaves for every input suits a verifier that runs on the code; the video's example is Kani for Rust. If nothing runs on your language, the agent tests the real code with generated inputs and says so. A property that has to hold at every size can need a real proof.
Then the line the video quotes, which I'd put on the wall next to Alexis Roberson's from the factory article: "A check that you have never seen fail proves nothing." The skill breaks the code on purpose, by removing a check or reordering a step, and has to watch the property fail before it trusts a pass. When the property fails on the real code, the finding stays a finding: "Do not weaken the property or the model until it passes." The agent has to say what was verified, under which bounds and assumptions, and state the property and the harm in one plain sentence each, so you can judge the result without learning TLA+.
What it leaves behind is a project-local verify skill. It's one command with a pinned tool version, and it records the files and functions each check covers and the commit at which the model last matched them. Before handing off, the agent follows that skill once on a scratch change that breaks the property, and it has to catch the break. The maintain skill reads the record later. It diffs the covered code since the recorded commit and sorts each change: no effect, a model that no longer describes the code, a promise that changed on purpose, or a promise that may be broken. Its first paragraph names the failure it exists for: "That pass is the dangerous case, because it looks like a proof." A third skill, /statechart, turns a TLA+ result into a Mermaid chart of the states a user sees, with the shortest path to each broken rule written out in plain words.
In Claude Code it installs from Cursor's marketplace, and the commands take a pstack: prefix:
/plugin marketplace add cursor/plugins
/plugin install pstack@cursor-plugins
/pstack:create-formal-verification-skill the payment retry. a customer is never charged twice for one purchase.
A real one: two presses, two paid calls
The best evidence is a small open-source project. crashlens has a local web page with an "Ask AI for a fix" button that sends a crash report to a paid model. The rule was one suggestion and one paid call per report. A TLA+ model of the route and the button, with two tabs and up to two presses each, broke it in two steps: press, press. The page marked the button busy while it waited, but busy only blocked the mouse, so pressing Enter on the focused button sent the same report again. The author reproduced it on the real server: two API calls, two suggestions, both requests answered 200.
The numbers in the PR show the method at small scale. Before the fix, TLC explored 267 distinct states and broke the one-call rule in 2 steps and the one-suggestion rule in 4. After it, 23 states, and both rules hold. The check runs in about a second with TLC pinned by hash, so the next agent has no reason to skip it. The whole model is 76 lines, each action names the code it stands for, and the rules read like something a user would sign:
\* Rules a user would agree to.
\* A report gets at most one AI suggestion.
OneSuggestion == ai <= 1
\* Asking again for a report that already has (or is getting) a suggestion
\* does not send it to the API again.
OneApiCall == calls <= 1
The detail I liked most is in the PR's testing section. Before the fix, removing the guard that turns away a report which already has a suggestion broke no test. The model found the bug, and then breaking each guard alone found the missing tests. Formal verification ended up improving the test suite, which is the outcome I'd want.
What a proof doesn't promise
There are two doubts, and the video gives both their due.
The first is the rule. A proof shows the code keeps the rule you wrote, not that you wrote the right rule. Go back to the checkout: with the idempotency key in place, "never charged twice" holds, and there's still a path where the card is charged once, the retry times out, and the order sits pending forever. Nobody wrote a rule about that. Hillel Wayne's account of what TLA+ can check gives the precise version: "Any property TLA+ can check of the system must be a property that is true for every individual behavior." TLA+ can check "every purchase eventually ends paid or refunded", but only if someone thinks to write it.
Worse is a rule that passes because nothing can happen. An open pstack issue has the cleanest example I've seen. In a small payment model, the step where the bank accepts set paid to true and also listed paid as unchanged, a one-word typo. So paid could never become true, and the report listed NeverPaidTwice under "Rules that hold". TLC printed a warning, and the report dropped it. The issue proposes listing every action that never fired. Until that ships, the skill's own rule is the defence: if you never saw it fail, it proved nothing. The video attributes the blunt version to Tan herself: how do you know what it's proving? It could be proving false is true. Nothing can prove the spec is right, and "only you can judge."
The second doubt is the model. TLA+ checks a design, and the code can drift away from it. Wayne again: "correct designs don't automatically translate into correct code." If someone breaks the payment code and leaves the model alone, the check still passes. pstack's answer is the coverage record and the maintain skill. That's the right answer to drift, and it still depends on someone running it.
So my reading is that the review moves. I'd stop reading every line of the checkout and start reading one sentence, the list of what the check leaves out, and the counterexample it showed when the code was broken on purpose. That's far less to read. It's also easier to read carelessly.
Bend 2: put the law in the language
Victor Taelin's Bend 2 removes the separate model. You write laws in a LAWS.bend file beside the code, the agent writes their proofs, and the agent runs the checker before every commit. The README calls it "AGENTS.md backed by proof." Its demo is a game with one law, "winning is impossible". Asked to make the board wrap around, an agent without the law ships a way to win. With the law, the checker rejects the change until the agent adds a wall.
The video ran its own version. In a game where every box is a room you can walk into, they wrote two laws: a room can never end up inside itself, and you can always walk back out. Then they asked Claude to let the player push a box into the room they're standing in. Without the laws, Claude built it, its checks passed, and a room ended up inside itself, as deep as the screen could draw. With the laws, Bend's checker rejected the change. Claude said the request broke a rule it wasn't allowed to change, and offered a version that kept it. The proof grew from about 400 lines to about 900.
Taelin is candid about the limits, and the README's list runs to about thirty lines. The one the video gets slightly wrong matters most. It says the part of Bend that checks proofs is proven. The README says "The checker has no proof and may have bugs; --verdict uses a proven kernel," and "The compiler (not kernel) is 99% AI-written and not yet fully audited." You also have to write the app in Bend, so it can't check your TypeScript or your C#. For now I'd watch it. The idea is right, though: a law that lives in the code can't drift from it.
Where I'd point it first
I haven't run the skill on my factory yet, so this is a plan, not a result. The review finding I quoted in the factory article, where an export handler marked records as sent and committed them before the post-processor could reject the batch, is the shape of bug a model catches: a promise ("an invoice is never marked sent unless the client received it") broken by the order of two steps. Our review caught that one. I'd rather a checker caught the next one.
The costs are real, and the video lists them: the skill is new, it spends tokens, TLA+ needs Java, and it checks one rule at a time. Keep your tests. This is for the one promise they can't reach, and for that promise the trade is a good one. You stop reading every line, and you read one rule very carefully instead.
Sources
- The Hype Kevin, Proofs Are the Biggest Upgrade to Claude Code Yet, YouTube, 22 November 2026
- Lauren Tan, All Code Is Slop (Except Mine), AI Engineer, 14 November 2026
- Lauren Tan, pstack, version 0.15.51: create-formal-verification-skill, maintain-formal-verification-skill and statechart
- cursor/plugins issue #1235, a rule "holds" when the action that could break it can never fire, 14 November 2026
- crashlens PR #7, serve: send a report to "Ask AI" once, merged 26 November 2026
- Victor Taelin and team, Bend 2, README and limitations
- Victor Taelin, Bend: A Linear Proof Language That Matches C Performance and Runs on GPUs, SF Lean Meetup, 26 October 2026
- Anthropic, LLMs are making formal software verification feasible at a much larger scale, 22 October 2026, and Theorem's published proofs
- Lean FRO and Mathlib Initiative, joint statement on the Riemann Hypothesis, 21 November 2026
- Ana Maria Constantin, Anthropic mathematician says he and Claude proved the Riemann hypothesis, TNW, 21 November 2026
- Hillel Wayne, What TLA+ can and can't check, Computer Things, 30 September 2026
- Chris Newcombe et al., How Amazon Web Services Uses Formal Methods, Communications of the ACM, April 2015
- Gerwin Klein et al., Comprehensive Formal Verification of an OS Microkernel, ACM Transactions on Computer Systems, February 2014
- Stripe, Idempotent requests