frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: Statewright – Visual state machines that make AI agents reliable

https://github.com/statewright/statewright
22•azurewraith•5h ago
Agentic problem solving in its current state is very brittle. I fell in love with it, but it creates as many problems as it solves.

I'm Ben Cochran, I spent 20+ years in the trenches with full-stack Engineering, DevOps, high performance computing & ML with stints at NVIDIA, AMD and various other organizations most recently as a Distinguished Engineer.

For agents to work reliably you either need massive parameter counts or massive context windows to keep the solution spaces workable. Most people are brute forcing reliability with bigger models and longer prompts.

What if I made the problem smaller instead of making the model bigger?

I took a different approach by using smaller models: models in the 13-20B parameter range and set them to task solving real SWE-bench problems. I constrained the tool and solution spaces using formal state machines. Each state in the machine defines which tools the model can access, how many iterations it gets and what transitions are valid. A planning state gets read-only tools. An implementation state gets edit tools (scoped to prevent mega edits) and write friendly bash tools. The testing state gets bash but only for testing commands. The model cannot physically skip steps or use the wrong tool at the wrong time. It is enforced via protocol, not via prompts.

The results were more promising than I would have expected. Across multiple model families irrespective of age (qwen-coder, gpt-oss, gemma4) and the improvements were consistent above the 13B parameter inflection point. Below that, models can navigate the state machine but can't retain enough context to produce accurate edits. More on the research bit: https://statewright.ai/research

Surprisingly this yielded improvements in frontier models as well. Haiku and Sonnet start to punch above their weight and Opus solves more reliably with fewer tokens and death spirals. Fine tuning did not yield these kinds of functional improvements for me. The takeaway it seems is that context window utilization matters more than raw context size - a tightly scoped working context at each step outperforms a model given carte blanche over everything. Constraining LLMs which are non-idempotent by using deterministic code is a pattern that nobody is currently talking about.

So, I built Statewright. Its core is a Rust engine that evaluates state machine definitions: states, transitions, guards and tool restrictions. Its orchestration doesn't use an LLM, just enforces the state machine. On top of that is a plugin layer that integrates with Claude Code (and soon Codex, Cursor and others) via MCP. When you activate a workflow, hooks enforce the guardrails per state automatically. The model sees 5 tools available instead of dozens, gets clear instructions for the current phase and transitions when conditions are met. Importantly it tells the model when it's attempting to do something that isn't in scope, incorrect or when it needs to try something else after getting stuck.

You can use your agent via MCP to build a state machine for you to solve a problem in your current context. The visual editor at statewright.ai lets you tweak these workflows in a graph view... You can clearly see the failure paths, the retry loops and the approval gates. State machines aren't DAGs; they loop and retry, which is what agentic work actually needs.

Statewright is currently live with a free tier, try it out in Claude Code by running the following:

/plugin marketplace add statewright/statewright

/plugin install statewright

/reload-plugins

Then "start the bugfix workflow" or /statewright start bugfix. You'll need to paste your API key when prompted. The latest versions of Claude may complain -- paste the API key again and say you really mean it, Claude is just being cautious here.

Feedback is welcome on the workflow editor, the plugin experience, and tell me what workflows you'd want to build first. Agents are suggestions, states are laws.

Comments

giancarlostoro•1h ago
Interesting, I built a ticketing system similar to Beads which has yielded more predictable results with Claude and other models, and I'm currently building a custom harness, I'm able to use offline models though my GPU ram bandwidth is much lower, but I'm also planning on doing something similar to what you've built, namely the editing tools and what not, I hate how long it takes for Claude to look for files, it feels wasteful. I'm still astounded that everyone else has figured out ways to speed up harnesses, but Claude Code is still slow like a slug. I don't even care if I am waiting on the LLM in terms of slowness, but running local tools slowly bothers the living crap out of me, stop using grep, RIPGREP IS FASTER!

In any case, I'll have to check out Statewright after work ;)

azurewraith•6m ago
I feel you on how sluggish Claude Code can be, you just never know what those pulsing prompts are doing in the background...

Given Statewright plugs into Claude Code, there is a little added overhead while managing the state machine logic, but for complicated workflows if it saves you a few debug loops, mass edit reversions or death spirals I think the case can be pretty solid for including it

password4321•1h ago
Does it make sense to ship an MCP code mode API? I'm surprised you're recommending MCP as-is when concerned about context usage optimization. I don't have a lot of hands-on experience either way yet so I'm curious what's best and/or most popular... I understand MCP is less effort and still affordable at VC-subsidised prices.
azurewraith•56m ago
for the integration piece that ties into Claude Code and other places where AI is used most frequently? yes I think it does... we're not fighting context in Opus/Sonnet as much as we are in smaller models and we're only adding about 6 tools here which is a smaller footprint than other MCP exposures. Smaller models have a more direct/tight interface that doesn't bloat the tool space in my experimentation (using the core directly)
davidkpiano•1h ago
Pretty cool. Looks like stately.ai but catered towards agentic state machine workflows. Really interesting!
azurewraith•44m ago
Stately is pretty neat, I hadn't come across it yet... kind of like a state machine langflow or Node-RED.

I see constant posts on Reddit/HN about the ways that AI is amazing and at the same time is fudging it (literally). Nobody can make reliability guarantees on something that's non-deterministic and non-idempotent. Nobody's AI workflow suite of tools can claim this. Prompting gets you closer to the mark but still non-deterministic. Breaking down the problem into chunks with valid transition criterion so that even tiny models can step through them I believe gets us closer to where we want to be semantically

Show HN: Needle: We Distilled Gemini Tool Calling into a 26M Model

https://github.com/cactus-compute/needle
48•HenryNdubuaku•1h ago•8 comments

Show HN: Agentic interface for mainframes and COBOL

https://www.hypercubic.ai/hopper
27•sai18•2h ago•8 comments

Show HN: Gigacatalyst – Extend your SaaS with an embedded AI builder

22•namanyayg•3h ago•8 comments

Show HN: Statewright – Visual state machines that make AI agents reliable

https://github.com/statewright/statewright
22•azurewraith•5h ago•6 comments

Show HN: Cook a Django project well, the agent-skill take on cookiecutter

https://github.com/RobustaRush/seedkit
2•kmmbvnr_•1h ago•0 comments

Show HN: OpenClaw OS – OSS Claude Cowork Built on Top of OpenClaw

https://github.com/thesysdev/openclaw-os
2•zahlekhan•1h ago•0 comments

Show HN: TikTok but for scientific papers

https://andreaturchet.github.io/website/index.html
172•ciwrl•1d ago•68 comments

Show HN: A modern Music Player Daemon based on Rockbox firmware

https://github.com/tsirysndr/rockbox-zig
111•tsiry•3d ago•24 comments

Show HN: One-shot NAT traversal library

https://warpgate.io/
3•Uptrenda•2h ago•0 comments

Show HN: Profine - Profile and rewrite your PyTorch training loop on real GPUs

https://github.com/ProfineAI/profine-cli
3•aisinghal•2h ago•0 comments

Show HN: OpenGravity – A zero-install, BYOK vanilla JS clone of Antigravity

https://github.com/ab-613/opengravity
100•ab613•23h ago•30 comments

Show HN: Grunden – Frontier AI inference hosted in Sweden, OpenAI-compatible

https://grunden.ai
4•fsrc•4h ago•1 comments

Show HN: E2a – Open-source email gateway for AI agents

https://github.com/Mnexa-AI/e2a
43•mnexa•23h ago•3 comments

Show HN: Doomscroll the Goverment's UFO Files as One Gigantic Microfilm

https://hypergrid.systems/war.gov-ufo-viewer/microfilm2?page=2
15•keepamovin•15h ago•7 comments

Show HN: Formal Verification with Lean

https://www.daniellowengrub.com/blog/2026/04/30/lean
3•lowdanie•6h ago•0 comments

Show HN: Is Github Online?

https://isgithub.online/
5•vednig•6h ago•2 comments

Show HN: How Scaleway brought the first RISC-V servers to the cloud

https://www.scaleway.com/en/blog/risc-v-servers-in-the-cloud/
4•enthusaist•7h ago•0 comments

Show HN: Music visualizers that react to audio in real time

https://vizz.fm/app/
6•lowtecky•7h ago•2 comments

Show HN: I mage GhosttyFX, a JavaFX terminal view that uses libghostty

https://github.com/vlaaad/ghosttyfx/
3•vlaaad•8h ago•1 comments

Show HN: An index of indie web/blog indexes

https://theindex.fyi
145•rocketpastsix•2d ago•40 comments

Show HN: I made a Clojure-like language in Go, boots in 7ms

https://github.com/nooga/let-go
270•marcingas•3d ago•83 comments

Show HN: Countries where you can leave your MacBook at a random coffee shop

https://vouchatlas.com
71•canergl•2d ago•87 comments

Show HN: Rust but Lisp

https://github.com/ThatXliner/rust-but-lisp
207•thatxliner•2d ago•72 comments

Show HN: adamsreview – better multi-agent PR reviews for Claude Code

https://github.com/adamjgmiller/adamsreview
81•adamthegoalie•1d ago•50 comments

Show HN: Safe-install – safer NPM installs with trusted build dependencies

https://www.npmjs.com/package/@gkiely/safe-install
17•gkiely•19h ago•3 comments

Show HN: Java/Spring Boot Idempotency Library

https://github.com/josipmusa/idempotency4j
2•anaq42•11h ago•1 comments

Show HN: Building a web server in assembly to give my life (a lack of) meaning

https://github.com/imtomt/ymawky
422•imtomt•2d ago•223 comments

Show HN: I built a fair-price checker App for home repairs using BLS wage data

https://apps.apple.com/us/app/quotebuster/id6765996986
4•manojtrek•12h ago•0 comments

Show HN: TRUST – Coding Rust like it's 1989

https://github.com/wojtczyk/trust
170•wojtczyk•5d ago•87 comments

Show HN: Tessera – Turn coding agent sessions into structured work

https://github.com/horang-labs/tessera
4•horanglabs•14h ago•0 comments