I Stopped Prompting and Wrote Twelve Lines by Hand
When your prompt gets longer than the code it asks for, stop prompting. Write the core yourself and let the agent attack it with tests.
"Payout batch rejected. 14 bookings. Can you look before tomorrow morning?"
Sofia sent this on Sunday at 21:40. Sofia is one of our founders and she also does finance, because at a startup with eleven people somebody has to. Under the message was a screenshot from our payment provider. Red banner, short text: the sum of transfers is higher than the captured amount.
We run a booking platform for independent trainers and small studios. A customer pays for a class, and the money is split three ways: the studio, the trainer, and our platform fee. On the first of every month we send the payouts. Tomorrow was the first. Some trainers really wait for this money to pay their rent.
The 14 bookings had one thing in common. Each split was one cent too big.
Rule number four broke rule number two
I knew the bug before I opened the file. Every part was rounded on its own, with HALF_UP. Three parts of 33.33%, 33.33% and 33.34% from a 10 euro class, and suddenly you pay out 1,001 cents from 1,000. Classic. I wrote this kind of bug myself, maybe fifteen years ago, in PHP, for a webshop.
So I opened the agent and wrote: "The payout split in PayoutSplitter can produce a sum bigger than the total because every part is rounded separately. Fix it so the parts always add up to the total."
It was fast. The new version rounded down every part and put the leftover cents on the platform fee. Sum correct, tests green.
Then I remembered the trainer contracts. I messaged Sofia. She answered in two minutes, still awake: "No party gets more than one cent away from their exact share. And if there is a leftover cent, it goes to whoever has the biggest fraction. Ties go to us. It's in the contract, page 4."
I gave the agent these rules. The next version respected the one cent limit, but now it gave the leftover to the biggest share, not the biggest fraction. I explained the difference. The next version fixed that, and broke the tie rule. I explained the tie rule again, with an example. The next version handled ties, and also added a RoundingStrategy interface, a factory, and a new config property payout.rounding.mode, "for flexibility".
It was 23:10. I looked at my prompt history. My last message was 40 lines of English, with three examples in a table, and words like "fraction part after flooring, compared as BigDecimal, descending".
That's when it hit me. I was writing a specification in a language that has no compiler.
When my prompt got longer than the code it asked for, I was not delegating anymore. I was writing code in a worse language.
Twelve lines and a cold coffee
I want to be fair to the agent. Every single version was reasonable code. The problem was not that it is stupid. The problem was that the rule lived in my head and in a PDF on page 4, and I fed it to the agent one sentence at a time. Each new sentence moved the solution, and the old sentences got less weight.
Some things are hard to type and easy to explain. This one was the opposite. Easy to type, hard to explain without becoming the code itself.
So I closed the chat, made a coffee I forgot to drink, and wrote it by hand. It is the largest remainder method, nothing new. Fifteen minutes:
// Largest remainder: floor every share, then hand out the leftover
// cents to the biggest fractions. Ties go to the platform.
fun splitCents(total: Long, shares: List<Share>): Map<Party, Long> {
if (total < 0) return splitCents(-total, shares).mapValues { -it.value } // added later, see below
val exact = shares.map { it.party to BigDecimal(total).multiply(it.percent).divide(HUNDRED, 6, HALF_EVEN) }
val result = exact.associate { (p, v) -> p to v.setScale(0, FLOOR).toLong() }.toMutableMap()
var left = total.minus(result.values.sum())
exact.sortedWith(compareByDescending<Pair<Party, BigDecimal>> { it.second.remainder(ONE) }
.thenBy { it.first != Party.PLATFORM })
.forEach { (p, _) -> if (left > 0) { result[p] = result.getValue(p) + 1; left = left.dec() } }
return result
}Then I gave the keyboard back. But for a different job.
I did not ask the agent to write the function. I asked it to attack my function:
Here is splitCents. Do not change it.
Write property tests with Kotest. For any total and any shares that add up to 100%:
1. The parts add up exactly to the total.
2. No part is more than one cent away from its exact share.
3. Same input gives same output.
Think about which totals are dangerous and include them.
If a test fails, show me the input. Do not fix the code.This is where the agent was really good. Before writing the tests, it asked me one question: "Does the refund flow call this function too? If yes, the total can be negative."
I had not thought about refunds at all. They do call it. And with a negative total, FLOOR rounds away from zero, the leftover becomes positive, and the sorting by fraction goes wrong. The test it wrote failed after two seconds with a total of minus 1,000 cents and a sum of minus 999.
My bug. In my twelve careful lines. The agent found it with one good question and a random generator. I added the first line you see above, the test went green, and I felt both stupid and relieved, which is a normal feeling in this job.
"Can we make payouts agentic?"
On Monday morning I explained the incident in our standup. Jonas, our new product guy, listened carefully and then asked: "Could we make payouts agentic? Like, the AI checks every split before it goes out?"
A year ago I would have sighed inside. Now I think it was a good instinct with the wrong tool. He wanted a safety check. He just named it with the word he hears every day.
So I told him: money needs the same answer every time, at 3 in the night, for every booking. A model is great for fuzzy questions. A sum is not fuzzy. But his idea of a check before the batch was right, and we did not have one. So we built it, without any AI inside: before the batch goes to the provider, it verifies for every booking that the parts sum to the captured amount. If one fails, the whole batch stops and Sofia gets a message with the booking ID.
Jonas said: "So it's agentic, but boring." I said yes, the best kind.
The payouts went out at 14:00 instead of 9:00. Two trainers asked Sofia why it was late. Nobody got paid one cent too much or too little. I went home early.
When I put the keyboard back in my hands
- Watch the prompt length. If your prompt is getting longer than the code it should produce, stop. You are already writing the code, only without a compiler.
- Count the "almost" rounds. If each answer fixes the newest rule and breaks an older one, the agent is not the bottleneck. The specification is. Write it as code or as tests yourself.
- Hand-write the core, delegate the attack. For small, exact logic like money, dates or permissions, I write the function and let the agent write property tests against it. It is much better at imagining weird inputs than at guessing my rules.
- Tell the agent "do not fix it". When it writes tests for your code, a failing test should come back to you with the input. Otherwise it quietly bends the code to the test.
- Translate buzzwords into the need behind them. "Make it agentic" meant "I want a safety check". Build the need, not the word.
I still don't have a clear rule for when to switch. Fifty minutes was too long, I know that. Maybe the honest signal is the moment I start writing BigDecimal in English.
When do you stop prompting and just type it yourself?

If this was useful
Telc German B1 Exam Success Kit (20/80 Rule)
The 20% of German that keeps showing up in the telc B1 exam. Learn it first and walk in already knowing what to expect. €7.99