Find All Implicit State Machines

Ask the agent to name every state machine nobody wrote down. Bugs live in the transitions that have no owner.

The prompt

"find all of the implicit state machines in my app" (Steve Ruiz)

Jamon Holmgren ran it on a game codebase with a longer version: spread subagents across every script in parallel, judge which findings need more thought, and come back with a list (title, one-line description, key files) plus a document with the details. Source: X/@jamonholmgren, 2026-10-31, screenshot reviewed

Why it works

Most systems are full of state machines that were never designed as state machines: a status field, a cursor, a retry counter, a flag set in one handler and cleared in another. Each value an item passes through is a state, and each place that changes it is a transition. When nobody writes the machine down, nobody checks that every transition has an owner, that every state can be left, or that two writers cannot race.

The prompt gives the agent a category with a precise test. "Find all" sets the stopping condition: the search ends when every candidate is on the list. "Implicit" points it at the code that matters, the machines hidden in fields and flags. The output is a list a human can scan in a minute.

David Khourshid's advice is shorter: learn state machines and the actor model. Source: X/@DavidKPiano, 2026-07-18

When to use it

  • Before refactoring a module that has grown flags and status fields.
  • When a bug report says something "got stuck" or happened twice.
  • On any pipeline whose health check reports last-run times instead of queue sizes.
  • On game logic, onboarding flows, payment and job queues.

Skip it on pure data transforms and simple request handlers; there is no lifecycle to find.

Which skill runs it

state-machine-dfa runs it. Its section "Finding Implicit State Machines" turns the prompt into steps: list every field whose value changes over an item's life, write the from-event-to-executor table, mark transitions with no executor, count each state from raw records, and look for states created by defaults or bulk stamps. Source: skills/engineering/state-machine-dfa/SKILL.md

The worked example is Wiki State Machines. Run on this wiki, the prompt found that every pipeline had the same shape (capture, judge, write, publish) and that the judgment step had no executor, so its queues grew while the health checks stayed green. It is also how this bookmark category came to exist.

The same shape elsewhere

"Find all X" works whenever X has a clear test. Noah Shinn's personal-agent version asks for every unwanted subscription, missed refund, unsubmitted expense and expiring credit. Source: X/@noahrshinn, 2026-10-12 For code, see Sweep for One Named Defect.

Loops, graphs and dataflow

David Khourshid's "State machines in 2 minutes" argues the field keeps rediscovering old patterns (first loops, then graphs) instead of naming them. One distinction matters when you hunt for machines: a dataflow graph such as an n8n workflow passes data between nodes, while a state machine is about being in a state. Something that looks like a state machine may be dataflow. Source: X/@DavidKPiano thread, 2026-07-20


Timeline