I was gatekeeping this methodology because I thought I was crazy, and I was waiting to fully flesh out the details. Then I started seeing articles heading in the same direction, so it's time to post it.

I call it the deterministic flywheel. Deterministic means the same input gives the same output, every time. The short version: use AI to move away from AI.

The honeymoon, then the problems

This is what I see with clients. The first month with AI is a honeymoon. The demo works, a task that took a day takes minutes, and it feels like the model can do anything.

Usually, about six months later, the CFO has a conversation with the CTO. The bill for tokens, the units a model charges by, grows with every new use. The same input can get a different answer the second time. A failure often can't be reproduced, so it's hard to fix, and there's often no test with one right answer. Many teams end up checking the model's work by hand, which is the work it was supposed to take away.

That conversation is usually where teams start moving toward what this post describes.

Harnesses, scaffolding and decision models

A lot of people are talking about harnesses, scaffolding and decision models right now. A harness, or scaffolding, is the code around a model: it feeds the model, checks what comes back and decides what happens next. A decision model is a model asked one narrow question, with code checking the answer.

It's the same move under different names: more code around the model, and less for the model to decide. It's where things have been going for a while, slowly.

The flywheel

This is the framework I've been using across clients and projects for the past year, and thinking about for a couple of years before that.

  • Answer once. Script anything asked twice. If a result will be needed again on a new input, it gets a script, not another conversation with a model.
  • One script per job. If a script exists, run it. Don't write a second one.
  • Check independently. Every run writes its output, and a separate check confirms it against the input. A check that reruns the code that made the result can't catch that code's mistakes. A model reviewing its own work tends to agree with itself, for the same reason.
  • Grade the failure and keep going. A miss is recorded at the smallest scope that's true, and everything else keeps running. Nothing is dropped without being counted.
  • Queue the misses. Every failure goes into one repair queue, ranked by what's at stake.
  • The AI is the engineer, not a step in the pipeline. It reads each failure and writes the fix as code, with a test. It never writes the output itself. A second, fresh agent reviews the fix, and a person approves what goes in.
  • Once is a note. Twice is a rule. A new pattern seen once is written down. Seen on a second input, it earns a rule.
  • Never break what already passed. Every change has to reproduce every result that passed before it.
  • Score it cold. Each new batch is scored before anything learns from it, so the numbers can't flatter the system.

You're done when a batch of new inputs, run with no code change, adds nothing to the queue.

Using AI to move away from AI

Every turn of the wheel moves work from the model into code, and the AI does the moving: it works as the software engineer. When the code meets a case it can't handle, it writes the case down as a failure instead of guessing. The AI reads that failure and writes the fix as code, with a test. The tests, every earlier result and a second, fresh agent check the fix, and a person approves it. The next time the same case comes in, code handles it. Over time, fewer cases reach the model, and the ones that do are genuinely new.

The deterministic flywheel: each turn moves one more case from the model into code

That's the waterfall in Deterministic by default: an exact rule first, then a fuzzy match (close, not exact), then the rules you've learned, and the model last, for whatever falls through. The flywheel is how the waterfall fills up.

The goal is a system that gets cheaper and more predictable the longer it runs, instead of more expensive and harder to trust. AI does the work only AI can do, at the edges, and a little less of it over time.

Tell us about your business →