Developers building multi-step workflows for coding agents such as Claude Code, Cursor and Antigravity keep hitting the same problem: long SKILL.md files decay. A new approach, state machines for LLM agents, moves the workflow out of the prompt and into a runtime that enforces each step. It ships in Flux v3, an update to the Flux Player project.
Why giant skills fail
A skill that front-loads 300 lines of instructions, edge cases and formatting rules looks thorough at Turn 1. By Turn 12, tool outputs, file reads and subagent handoffs have filled the context window. The model starts skimming. It rushes past setup, forgets pacing rules, skips validation, or invents a shortcut.
Flux’s author names three recurring failures:
- Attention decay: noise from the early steps buries the rules for Step 6.
- Spoofing and skipping: no mechanism stops an agent from declaring itself finished before a check actually passes.
- No fixed recovery: when output is poor, the agent improvises its next move rather than following a planned rollback.

How Flux v3 works
The skill shrinks to a few lines: run flux start, follow only the active state’s instructions, and advance with flux step. The playbook lives in a cartridge, a cartridge.yaml or cartridge.py file that defines the state machine.
Flux stores the session in .flux/state.json and keeps a history stack. When the agent enters a state, Flux prints only that state’s instructions, tone rules and good and bad examples. A state can also fix a persona, a role boundary and a model tier of opus, sonnet or haiku.

Guardrails with real checks
Moving to the next state requires passing automated checks. These can be shell commands like pytest or a linter, file and regex assertions, JSON or YAML schema validation, required output files, or custom Python validators.
If a check fails, Flux refuses the move and returns a prewritten failure prompt with the errors and attempt count filled in. The agent then retries the same state, steps back by popping the history stack, or, after a retry limit, lands in an earlier recovery state.
In the example given, an IMPLEMENT state with a Staff Engineer persona on the sonnet tier expects src/app.py. It can only move to REVIEW once uv run pytest -q passes and no TODO or FIXME remains in src. It gets three retries, then rolls back to revise the plan.
A graphic novel pipeline as a test
The author stress-tested Flux on an existing multi-volume educational graphic novel pipeline. It had a showrunner, curriculum architect, dialogue screenwriter, panel formatter, OCR pre-screener, two levels of vision QA and an EPUB packager.
With a detailed skill file alone, the Volume 1 script opened on system acronyms. By Page 2 the characters were in a whiteboard lecture with no relationship set up, and definitions were recited when the student character should have asked a question.
Moved into an 18-state cartridge, the pipeline changed in three ways:
- The screenwriter state changes its prompt by volume. Volume 1 must build a three-page Hollywood-style opening before any diagram, while later volumes get a continuity re-entry.
- A reader-proxy gate, run by a Script Doctor state before panels are formatted, checks for friendly analogies, at least three student questions, and no leaked CamelCase keys or insider jargon.
- Cost is tiered by model. Opus 5.5 runs once, for the master showrunner. Sonnet 5.5 covers curriculum, dialogue and likeness QA. Haiku 5.5 handles bash orchestration, pagination and packaging. Any page flagged by vision QA automatically rolls back to the render and OCR stage.
Where it leaves skills
The author’s view is that a skill tells an agent a workflow exists, and a state machine is what keeps it intact. With the rules in a cartridge, the model does one job, clears the gate and moves on, instead of holding 18 steps in mind.
The updated Flux v3 code is available on GitHub under adamjgrant/fluxplayer. Teams running long agent pipelines can test it on one workflow first and compare how often steps get skipped.
Source: State Machines Are Better Than Skills for LLM Agents