promptdojo_

The loop with a meter — budget caps, stop reasons, and the trace — step 4 of 8

A seven-step plan with three reruns in it, a ten-step cap, and a $0.30 budget. Walk the loop and predict every line, including the stop line.

Keep a running total, and remember the cost check is spent + cost > cap — strictly greater — evaluated before the spend. The boundary case matters: what happens on the step where spend would land exactly on $0.30?

And remember the else from the last read: it runs only if the loop never hits break. A run that breaks prints no plan-complete line.