← Blog

Building Bishop

One Expensive Night, and the Junior/Senior Split It Forced

I'd been running long overnight tasks: write out the whole job, hand it to the orchestrator to plan, and let it run while I slept. Twenty-four hours plus, no drama. One night I sent through a task that wasn't even that complex, just a bit ambiguous. And I'd made one error: I never put a limit on the code reviews.

What happened next is the part that cost me. The junior would write the code, the reviewer would look at it, and because of the ambiguity it kept landing on the opposite of what it wanted. Picture it: the code uses a for loop. The reviewer says, no, use a while loop. The junior switches to a while loop. The reviewer comes back and says, well, use a for loop. Round and round it went, all night, and I burned through every token I had on that one task. On the night itself it was database queries, in one of my early plugins, before I had a boilerplate or a WordPress coding standards skill. It wrote a query one way, the checker picked up an error, it fixed it as recommended, and then it was changed again. It must have looped like that all night, giving the same answers. There was no hard out, and there was no one to escalate to.

The next morning there was an API error that wasn't super helpful. I opened my subscription and everything was used up. The 5-hour window had run out, it had moved on to the top-up credits I keep just in case, and it used up everything. That was the expensive night, and it's why the harness works the way it does now.

The junior's code flips between a for loop and a while loop as the reviewer keeps asking for the other one, round and round all night, while the token meter drains to nothing
No limit on code reviews, one ambiguous task, and every token I had.

What I tried first: let the orchestrator choose

After that night I added a senior developer. I worded it so the junior handled the simple tasks and the senior handled the complex ones, and I left the choice to the orchestrator.

It didn't work. The orchestrator always wanted to use the senior, because it felt the senior would get it right first time. That's in its design: it's trying to solve the task as quickly as possible for me. But I was paying for the expensive model on work the cheap one could have done, and the senior was becoming the default instead of the exception.

The hard rule: the senior is only an escalation

So I made it a hard rule. Every task, however easy or hard, goes to the junior developer first. No exceptions. The senior can only be reached by escalation, and the orchestrator can't call it directly.

Every coding round gets a code review. The junior writes the code, the reviewer reads it back. A separate reviewer catches what the writer misses because it's a fresh context. It didn't write the code, so it reads the work the way a stranger would, before I ever see it.

And this time the review has a ceiling, because that's what was missing on the night.

The escalation rule

Now the loop is: the junior codes, the reviewer checks. If there's a problem, it goes back to the junior to fix: that's fix round one. The reviewer checks again, and if the problem's still there it goes back to the junior: fix round two. If it comes back from the reviewer a third time with the same problem still present, the task escalates automatically to the senior developer.

Two failed fix rounds is the tripwire. It's enough to tell the difference between "made a typo" and "doesn't understand the problem." One failure is normal. Two failures on the same critical issue means the junior is spinning, and the right move is a different context with more judgement, not a third try with the same one. It's enforced: the junior can't talk itself past it on the third attempt.

I love rugby, and one thing I've always liked about it is that it doesn't have rules; it has laws, and how they're read depends a lot on the referee. I didn't want my harness to work like that. Two rounds means two rounds, whatever the junior thinks of its own work.

The senior runs the same loop. It gets the task, does its round, the reviewer checks it. If it gets stuck again, the whole task stops and waits for me to give it direction. That's the real safety net: when even the expensive model is blocked, I decide, instead of the machine looping all night again.

The junior / senior escalation loop
Junior codes, reviewer checks, two failed fix rounds go up to the senior, and if the senior is stuck, the task stops and asks me.

The rule I like best

Here's the part of the design I'm fondest of. The orchestrator cannot call the senior developer. It's not in its makeup to do that. Escalation only ever happens through the junior-and-reviewer cycle. The tripwire fires, and then the senior arrives.

That matters more than it sounds. If the orchestrator could pull in the senior whenever it liked, it would. It's built to solve fast, and the senior is the fast answer. Then I'm back to the original problem: the expensive model becomes the default.

The public bishop-harness repo has a similar role it calls Vasquez: the heavier agent that only turns up when the lighter ones can't close the task.

The model economics

The reason this stays affordable is the model assignment. My junior developer runs on a much cheaper model, Sonnet, and does the actual work there. My code reviewer runs on Opus, but not at high effort; it's checking the code, not really thinking hard about it. And the senior developer also runs on Opus, with a bit more effort, and it generally closes the issue in the first round.

The numbers, as I've seen them

I've probably run well over a thousand primary tasks through this system. "Task" here means an orchestrator run, which then breaks down into a lot of sub-tasks: lots of junior dev rounds, lots of code reviews. So the actual volume of work is much higher than a thousand; that's just the count of top-level jobs.

Of those, it escalates from junior to senior maybe... I don't really want to say one out of ten, but it's probably about one to two out of twenty. Which probably makes a little more sense: roughly 5 to 10% of the time. The rest never leaves the junior.

And two rounds of a junior dev cost far less than one round of a senior dev. You can run quite a few junior rounds for the same money as a single senior round. A code review, remember, is just checking the code. It's not really actually thinking.

The senior itself? In all those thousand-odd tasks, I think it's only been twice that the senior couldn't solve it. And even then, if there's something it needs to find out from me, it still asks that question. If it hits something completely blocked, I read through what it's tried, give it a suggestion, and let it go forward. It stops and waits, instead of burning the night.

The principle underneath

If you want to run real long-term tasks, the kind that run for a day or more, you have to think about the little nuances. Things can get caught in a loop, and there has to be a way out. A way to escalate from a lower model to a higher one, on a rule rather than on a hope. That's what made long-term tasks work for me.

Next: Where My Agents Actually Run, on Tuesday 5 January: the harness and its memory on my own Mac, the models over the network, and why local models aren't there yet.

More in this series

bishop-harness on GitHub →