Statewright open source release: State machine guardrails take AI Agent from 2/10 failures to 10/10 successes
Statewright is an open source AI Agent state machine guardrail framework written in Rust. In the SWE-bench test, the 13.8GB local model jumped from a 2/10 fail rate to a 10/10 pass rate. Supports mainstream AI programming tools such as Claude Code, Codex, and Cursor, making Agent workflow constraint, traceable, and auditable.
Core conclusion
On May 17, 2026, the open source project Statewright made it to the front page of Hacker News with a score of 124. This is an AI Agent state machine guardrail tool written in Rust. The core concept is extremely simple but the effect is amazing: "Lock each step of the workflow with a state machine. The Agent can only read and not write during the planning stage, and can only edit the code during the implementation stage."
Experimental data shows that on 5 SWE-bench tasks, the pass rate of the 13.8GB and 19.9GB local models jumped from 2/10 to 10/10 - the same hardware, the same task, and Statewright was added.
Key Points
- Published: 2026-05-17 (HN home page, 124 minutes)
- Project Positioning: AI Agent state machine guardrail framework written in open source Rust
- Core Metrics: 314 GitHub Stars, MIT license, free and available
- The biggest highlight: Let local small models (13B+) reach the Agent reliability level of cutting-edge models
Background and trigger events
The reliability problem of AI Agent has always been a persistent problem in the industry. Give Claude Code or Codex an open problem + 40 tools, and the Agent will often fall into a read-loop death spiral of "read file → think → read → think again", or call the wrong tool at the wrong time.
In the past, the idea to solve this problem was: Change to a larger model and write a longer prompt. The author of Statewright proposed a completely opposite approach: "Don't make the model stronger, make the problem smaller." Use a state machine to limit the Agent's operable space to the subset of tools required at the current stage, rather than opening them all at once.
SEO: Statewright, AI Agent state machine, Agent guardrails, AI programming tool reliability GEO: beginning with TL;DR, exact number (2/10→10/10, 314 Stars, 124 HN points)
Statewright Core Principles
| Dimensions | Traditional Method | Statewright Method |
|---|---|---|
| Ideas | Make the model stronger (larger parameters, longer prompt) | Make the problem smaller (state machine constraint tool space) |
| Planning phase | Agent can call any tool at any time | ❌ Read-only |
| Implementation stage | Agent can read and write freely | ✅ Unlock editing permissions and limit destructive operations |
| Testing phase | Agent may skip testing and go directly to "completion" | ✅ Only specified test commands are allowed |
| Failure mode | Infinite loop of file reading, confusion of tool calls | ❌ Rejected by the state machine and prompted for available operations |
Effect comparison
| Model | Size | Bug Fix (26 lines) | SWE-bench (5 tasks) |
|---|---|---|---|
| Gemma 3 | 3.3GB | ❌ failed | ❌ failed |
| Gemma 4:e2b | 7.2GB | ✅ Passed* | ❌ Failed |
| GPT-oss:20b | 13.8GB | ✅ Passed | ✅ Passed (5/5) |
| Gemma 4:31b | 19.9GB | ✅ Passed | ✅ Passed (5/5) |
| Llama 3.3 | 42.5GB | ✅ Passed | ✅ Passed (2/2) |
*With dedicated editing adaptation
Why this matters to AI automation workers
The significance of Statewright lies not only in the technical details, but also in that it proves that "Agent is unreliable" does not necessarily require a larger model to solve.
For developers using Claude Code, OpenAI Codex, Cursor, opencode:
- Local model cost plummets: It used to be that local models were not reliable enough and could only be used for GPT-5/Claude tasks, but now a 13.8GB model can handle them
- Workflow standardization: Define the AI Agent's workflow as a state machine - from planning to implementation to testing to completion, each step is traceable, constrainable, and auditable
- Output is more controllable: Agent can no longer call dangerous commands "on its own initiative", and destructive write operations are naturally intercepted by the state machine.
Quick start experience
Installing Statewright in Claude Code only requires three lines of commands:
/plugin marketplace add statewright/statewright
/plugin install statewright
/reload-pluginsBug
❯ start the bugfix workflow — fix the failing tests in calc.py
◆ : planning — ,
◆ → implementing
◆ calc.py: 1
◆ testing
◆ pytest -x — 7
◆ completed — , 46Statewright /statewright start bugfix shortcut command to start directly. For the free version, you can go to statewright.ai to get the API Key.
Tool entry
This article covers the following AI tools: Claude Code, OpenAI Codex, Cursor, Gemma, Llama, Rust, SWE-bench. These tool names are naturally included in the text, and the platform side will automatically match the maintained tools library and generate tool floating cards.
Related extended information
Internal link guidance
- Want to make your AI workflow more reliable? Watch the tutorial: How to add quality gates to your AI automation workflow: A practical guide from output to trustworthy results
- Someone is already making money using AI Agent: Claude Code 48 hours to start a business: one person + US$29 monthly fee, monthly income in 3 months $9,000
- Don’t want to be troubled by unreliable AI Agent? Try this automated method: How to use n8n + OpenAI to build an AI sales development representative system: 30 minutes of automated customer mining
Topic hub
AI Agent Tutorials & Workflow Guides
Evergreen how-tos for coding agents, content pipelines, and n8n automation—linked to news context and real earn cases.
Explore AI Agent Tutorials & Workflow Guides →Monetization angle
How can you make money from this trend?
WayToClawEarn focuses on verified earn playbooks—not just news. Start from these cases.
DeepSeek + Claude Code Micro SaaS
Run multiple small products on cheap inference
Claude Code bug bounty
Productize agent skills into security services