Agents don’t clean up after themselves
We spend most of our time on the checks that decide what leaves the factory. The other half is keeping the factory floor clean, and we do not have the answers yet.
A lot of what we are building in our factory right now is verification: the checks that make sure the software leaving the factory meets the standard we hold it to. Tests on every change, end-to-end runs against a real stack, review agents with narrow briefs, and a gate that sends back whatever fails. It is the part of the factory we lead with, and it is the part the whole industry is talking about. The other side of a factory is the floor, and I think people underestimate how much work it takes to keep it clean.
We have gotten used to giving agents the ability to work on our behalf, and like us, they do not always clean up after themselves. Push enough work through a factory and it gets dirty over time. We learned that because we push a lot through ours: 825 pull requests merged across 26 repositories in the 30 days to 4 November 2026.
I do not have concrete answers yet, only what we have run into and the questions we are working through.
What a kitchen teaches you
I used to work in restaurants, and the amount of time we spent cleaning up after ourselves was enormous, at the end of every night and after every order. Kitchens call it clean as you go: you wipe down your station when a ticket goes out, so the next one starts on a clean surface. At close you break everything down, so the next shift walks into a kitchen that works.
Keeping that work surface well maintained is how the food keeps going out. Let a station go during a rush and every order after it is slower, for you and for whoever is working next to you.
Software factories need the same habit, and the industry has not built it yet. Right now we are all focused on building the factory, which is exciting work. Maintaining it gets far less thought.
How the floor gets dirty
Every agent that works for us leaves something behind: temp files, scratch directories, git worktrees, and so on.
The mess would be easier to manage if it were consistent, and it is not. Each agent makes its own choices: where it puts its temp files, where it makes a scratch directory, where its worktrees go. We use different agents for so many jobs that the list of places to look goes on and on.
Our agents also run on different platforms, with different levels of access. So no single rule holds across the whole factory for where things go and when they get cleaned up.
None of it fails a check. The checks look at what leaves the factory: the change, the build, the release. A scratch directory an agent left behind is not in the pull request, so the gate never sees it. It stays on the floor, and the next agent works around it.
A dirty floor also cuts against what we mean by a lights-on factory, where a person can walk the floor at any time and see what is happening and why. That is harder to do when the floor is covered in things nobody remembers making.
Where the cleaning should live
I can see two places to put it, and each one costs something.
One is a separate agent whose job is the floor, one that walks the machines on a schedule and clears what was left. That keeps cleanup out of every other agent’s work. It also arrives after the fact, without knowing what any of those files were for, so it has to work out for itself what is safe to remove.
Another is to build cleanup into the skills, so every agent has clean-up steps at the end of every task, the way a cook wipes the station after every order. The agent that made the mess knows what it made. But those steps cost tokens on every run of every agent, and the token economics have to balance.
A kitchen does both: clean as you go during service, and a full close at the end of the night. We do not know yet whether a factory should copy that, or what the close looks like when the cooks are agents from different vendors on different platforms.
Factory balance
Factory balance is how much of the factory’s effort goes into making things, how much into checking them, and how much into keeping the place clean enough to keep making them. We have a lot of unanswered questions about it. The ones on our list:
- Does cleanup belong to a separate agent, to every skill, or to both?
- How much of the token budget should go to cleaning up rather than building?
- How do we get agents that each made their own choices to agree on where temp files, scratch directories and worktrees go?
- How does cleanup work on a machine where an agent has less access than the one that made the mess?
We are not going to stop pushing work through the factory, so we need protocols for maintaining it, the way every kitchen has a close. If you run a factory of your own and have found something that works, we would like to hear about it.