September 23, 2026
Race conditions can be found with a formal model: Opus 5.5 prepared 16 PRs for Agent SDK
On September 22, Boris Cherny verified Claude Agent SDK in Lean with Opus 5.5 and got 16 PRs fixing bugs and race conditions. A few short prompts helped the model formally describe how the SDK works and find issues in concurrent execution.

Boris Cherny
@bcherny
I used Opus 5.5 and Lean to formally verify Claude Agent SDK. A few short prompts produced 16 PRs fixing various bugs and race conditions. Video attached. It works well with TLA+ too. I sometimes combine Lean and TLA+ to find issues in data flows, concurrent execution, and state management. I don't know either language well, but Claude handles both excellently. This approach is very useful: it helps formally describe your code and find bugs a human would most likely miss. Will formal verification be the future of programming? Or at least of bug hunting?
· 1.1M views
The official Claude Agent SDK example has the agent find and fix bugs in a repository. Now Cherny first verified the SDK's design in Lean, then got fixes for the issues found.
The project setup. Claude Agent SDK is installed via npm or pip and reads the key from the `ANTHROPIC_API_KEY` variable. Lean is recommended to be installed through the VS Code extension. TLA+ can be added to find bugs in data flows, concurrent execution, and state management.
TLA+ complements Lean when searching for bugs in data flows, concurrent execution, and state.
Source

