Skip to content
I started a loop by accident, and now my backlog works itself down
← back to feed·~/blog/dispatch-loop.mdx

I started a loop by accident, and now my backlog works itself down

Dispatch is a skill in Prism, my Lightroom-like raw photo editor. A skill is a file of instructions an AI agent reads before it starts a task. This one reads the project's GitHub board, picks the issues that can start right now, and launches one AI agent per area of the code, each in its own git worktree so they don't step on each other. Then it stays with them until each one has merged.

Since this week it doesn't stop there. When a pull request merges, it launches the next issue in that area by itself. In one session that was 18 merges. Over the week, 36 pull requests went into Prism.

The agents write their own manual

I directed it, and an AI agent wrote the skill. My thought was that AI must be the best at writing skills, since they're the ones using them. Must be much better than me, at least.

Mostly that held up. It fixes its own mistakes once it hits them. And sometimes, after a session, I tell it to look through what happened and ask if there's anything we can improve on the skill. Those answers go straight back into the file. I wrote about the same idea for blog posts in Claude grills me, I bring the story.

gotcha

It doesn't always get it right the first time. One update blamed GitHub's secondary rate limit for board calls being refused, because gh api rate_limit said 3397 of 5000 points were left. The refused call's own headers said 4961 of 5000 used. The very next commit is titled "the rate-limit explanation #366 shipped was a guess, and wrong".

18 merges I didn't ask for one by one

Loop mode was more of an accident than anything. I ran a loop command without telling it what to do, it picked up dispatch, and it kept going. It turned out really useful.

It keeps launching the next issue without me. With all the backlog tasks, I can just walk away while it works on it. The skill now has a section for exactly that: confirm the merge, clean up the finished agent's worktree, pick the next ready card in the same area, launch it. It only reports merges to me, not every step in between. Promoting a card out of the backlog is still my call.

.claude/skills/dispatch/SKILL.md
1## 9. Loop mode
2
3When the author says to keep going ("go", "keep it running"), each merge
4launches the next issue in that area instead of ending the session:
5
61. Confirm the merge through REST, not the board
72. Close out that agent per step 8
83. Pick the next issue in the same area
94. Claim it, cut the worktree, launch (steps 4-6)
105. Report to the author merges only

What one long session put back into the skill

Things break whether I'm watching or not. The difference is that the fix ends up in the skill afterwards. After the 18-merge session, the agent wrote these into it:

  • Poll CI over REST. gh pr checks spends GitHub's GraphQL budget, 5000 points an hour shared by every agent and the board scripts. Three agents polling it drained the hour once.
  • Wake on silence too. A mutation sweep (break the code on purpose, check that a test catches it) sat 22 minutes on a dead SSH connection. Its monitor only waited for verdicts, and none could come. Now it also fires after 8 minutes with no new log line.
  • Don't report every win. Agents ended their turn on each caught mutation, and every ended turn is a message up the chain. That was about 40 pings in one session.
  • A usage limit isn't the end. When an agent hits its limit, its work is saved. The skill now says to check for stranded changes and dead processes, then resume that same agent instead of starting a new one.

Until the board is empty

85 issues are still open. The plan is to let it run until the backlog is empty, improve the skill when it needs it, and see what happens.