Alex Tričković

One-piece flow for AI coding agents

More than ten years ago I watched a video by Ron Pereira of Gemba Academy. He runs a lean manufacturing simulation with 10 envelopes and times two ways of preparing them for mail.

Batching vs. one-piece flow

First he works in batches, the way mass production does. He folds all 10 letters, stuffs all 10 envelopes, seals all 10, and then stamps them. That takes 3 minutes and 42 seconds.

Then he switches to one-piece flow. He takes one envelope through every step before he starts the next one. He finishes the first envelope after about 17 seconds, and all 10 take 2 minutes and 56 seconds.

Batching cost him 46 extra seconds. He spent them putting a pile down, picking it back up, and switching between steps. That’s with only 10 envelopes. With 20 or 30, the gap grows.

The bigger cost is late feedback

Suppose the letters are folded the wrong way and you only notice when you stamp the first envelope. In a batch, all 10 letters are already folded and stuffed, so you have to open every envelope and start over. With one-piece flow you notice after 17 seconds, when only one envelope needs fixing.

One-piece flow tells you early whether your approach works. That matters more than the 46 seconds.

Tracer bullets in software

Software has the same trade-off. Andrew Hunt and David Thomas describe it in The Pragmatic Programmer and call it tracer bullets. You build a thin slice of a feature that runs end to end through every layer of the system, and you get feedback right away.

The batch approach is to design all the database tables, then build all the API endpoints, then write the UI. A tracer bullet is one small slice that touches the database, the API and the UI together. If the schema is wrong, you find out when the first screen tries to show the data, before you build more endpoints on top of it. You also have a working piece of the feature to show from the start.

Getting a coding agent to work in slices

A coding agent will work in slices if the prompt asks it to. I put the instruction in the skill or slash command that starts implementation work, such as /implement, /build or /execute. The agent then follows it on every feature, and I don’t have to repeat it.

This is the instruction:

### Tracer Bullets

When implementing a feature, build a small vertical implementation slice first.
It should include all the implementation layers. Run the feedback loop iteration,
and then continue from there. This concept is explained in The Pragmatic
Programmer book. Tracer bullets are thin end-to-end slices of a feature
connecting all system layers.

The feedback loop is whatever the agent can run to check its work, like the tests, the type checker or a browser. The first slice plays the role of the first envelope. If the agent’s approach is wrong, you find out after one slice instead of after it has built every layer.