Field Notes · · AI

The state graph is the product

← Field Notes

Every time I see a system prompt that contains if statements, I know what’s about to happen.

The prompt will drift. Someone will edit it to fix one edge case and break three others. Six months later nobody remembers why a particular clause is there or whether it’s still needed. The system becomes a pile of accumulated patches with no underlying structure.

Logic belongs in code. Language belongs in prompts.

The state graph is the skeleton of a well-built AI system. It defines every possible state, every valid transition, every hard stop. The LLM fills in the language — how to phrase something, how to acknowledge uncertainty, how to ask a clarifying question. But the LLM doesn’t decide what state to be in. The graph does.

When you build this way, the system is inspectable. You can trace exactly why the system did what it did. You can test it. You can change it without guessing what else might break.

That’s what it means for a system to have a spec.