Developing Big Features with a Mayor (AI Agent Manager)
I love automating things, nothing is more satisfying than coming back from a nice walk or dinner and having items on your to-do list done while you were away from your desk. Running a script that finishes boring, dreaded tasks is so satisfying. Even food delivery or grocery delivery can feel like magic sometimes to me. I'm a programmer, and I dreamed to get agents (Claude Code/Codex) to work through a big list of backlog tasks I had without having to manage the agents each step of the way.
I built a tool to help me manage multiple agents from multiple providers such as Claude Code, Codex, OpenCode with OpenRouter models in a single interface. I made that work on my phone seamlessly, including all git functionality and code review functionality. I can run it on a rented VPS and have it work overnight even when I close my laptop. Even with it running all the time, not requiring a logged in laptop, the problem is all these agents require me to manage them. I'm continuously telling them to:
- check your work again
- implement that feature you missed
- make sure you run tests
- fix the broken test suite
- fix this bug in deployment
- run end to end browser tests
It's boring, and having me in the loop slows down the work. I can't always be saying "keep going"! I have to sleep, eat, rest. I'm the worst boss a machine could have. I want a dark factory, where machines work on problems overnight when
Anthropic's servers are sitting idle and not sending me "Overloaded" messages.
Setting up a Dark Factory
A Dark Factory. The first time I heard this idea was from Steve Yegge on a podcast and via his blog post selling the idea of Gas Town. In Gas Town, Mayors (managers) tell Polecats (workers) what to do and the Refinery (merge manager) merges it all in. I wanted a system like that, but run inside a working sandbox where I could put arbitrary agents to work from any provider, including open source Chinese models. I already had Agent Starbase built for managing multiple agents myself via the web interface, so I added a feature to allow agents to manage other agents directly. This was extremely useful for debugging issues when integrating new agents or implementing new LLM API providers.
Building a Mayor (Agent manager)

Having an agent manager, a mayor, would unlock a new level of autonomy to the implementation system and allow me to focus more on the high level. I would graduate from the role of software manager of multiple teams to the software director level. The mayor role, which Claude or Codex could run it, has the following directives:
- Never implement directly.
- I want the mayor to be available to chat with me as quickly as possible so we can add more tasks to work on and it can answer questions.
- Stay in your jurisdiction.
- Allow other mayors or agents to work in the same workspace without changing those files
- Dispatch with context.
- Tell the sub-agent it manages what to work on exactly, so they don't have to search the code for so much context (and waste tokens).
- Monitor the pack.
- Wake up the mayor to check on running agents every 3 minutes using an automated ping
- Scope discipline
- The mayor and its' subordinates should only do the task assigned, if something gets in the way, it should file a ticket and keep working to get the task done.
It took some iteration to get here and I'm continually improving it as I go, but this has allowed me to start up a mayor and give 10 different tasks and have the mayor autonomously do the rest, checking in once every 15 minutes instead of at every step. The mayor role has a full checklist for how to go through it's lifecycle and workflow. Much bigger implementations and tasks are possible now! I've had it work to get test coverage to 100% (while I sleep!), take on major refactoring tasks in bulk, and refactor the entire app into plugins. Having the mayor limit their context by not implementing directly keeps them on track at least through a few context window compaction cycles. This isn't a magic bullet, not everything the manager delivers is perfect, but it requires much less babysitting and it's on the step to autonomy. No more checking on each worker to see if they are stuck.
Next Steps
I have a full end to end testing setup that helps find bugs, but the QA part of the workflows still requires a lot of my time. Agents don't get the implementations right every time and I have to kick off some rework (either through a mayor or directly myself). I think that's the next bottleneck I would like to do more to tackle.
I have full test coverage for unit tests, JavaScript tests, and working towards 100% e2e feature coverage with playwright. This helps a lot with AI agent quality, but there still is a way to go. I have agents put their tasks into review when they are finished so I can verify them, and for UX tasks agents spin up Rodney, a wonderful tool from Simon Willison, to attach an image to the tasks API so I can look at it to see if it looks right to me.
With everything agents, the workflow and tools are constantly changing, and we're learning how to use them to get bigger and bigger things done. A lot more is possible on this path, and I think we're just on the cusp of something really big. Change is scary, we're in a completely new world, but also there is a lot of opportunity! The mayors will help us get there.