Key points
- A first factory is a rules file, a queue file, and one workflow for each phase.
- The verify stage runs the software and answers pass or needs work, with evidence.
- Each mistake becomes a written rule, so the same failure is less likely to repeat.
How do you build a software factory?
To build a software factory, write the standing rules in a file, keep the queue of work in a second file, and give each phase one agent workflow. Add a stage where a different agent runs the result, and let one agent commit. Then add a rule each time something goes wrong.
A software factory does not have to start as a platform. One operator's factory started as a rules file, a queue kept in one file, and a coding agent that runs workflows in a loop. The rules file had 347 lines when the operator wrote about it. The rest of its factory process grew from mistakes that became rules.
The steps below build the smallest factory that checks its own work. Whether to run your own software factory at all is a separate question.
What do you need before you start?
A small factory needs 4 things:
- A coding agent that can start other agents. Claude Code is one example. Its documentation describes a dynamic workflow as a script that orchestrates many subagents at once.
- Tests that run from one command. Each stage calls the same command, so the result does not depend on which agent ran it.
- A place where agents can run commands. A sandbox limits what an unattended agent can reach.
- A command that starts the product. The verify stage cannot use software that it cannot start.
How do you build a software factory step by step?
Here is an illustrative example. Acme Co. sells furniture online. A developer at Acme sets up a factory for the store and gives it a first request, "Let customers edit their delivery address during checkout."
1. Write the rules in a file
Put the standing rules in the file that the coding agent reads at the start of each session, e.g. AGENTS.md. A rule in that file binds each later agent. A rule said once in a chat is gone when the session ends. Acme starts with four rules:
- Run `npm test` before reporting a phase as done.
- Builders never commit. Only the commit agent commits.
- The verify agent starts the store and uses it.
- The verify agent never passes work by reading the code.
2. Keep the queue in one file
Write each pending task as one line in a file in the repository, e.g. docs/BACKLOG.md. A queue in a file survives a restart, and each agent can read it. Acme's queue starts with the address request.
3. Give each phase one workflow
Write one script that runs the stages in a fixed order. A different agent works at each stage, and each agent has one job. Instructions that a stage repeats can live in agent skills.
4. Make the verify stage run the software
The verify stage is the check stage of this factory. The verify agent starts the product, uses the change, and tries one thing that the builders did not report trying. It answers on a form with two answers, pass or needs work, and it attaches evidence. The page on the check stage covers its rules.
At Acme, the verify agent changes the delivery address during checkout and opens the cart. The address saved, but the cart emptied. The form says needs work, and the fix stage receives the finding. An agent hook can refuse a "done" report until the form exists.
5. Let one agent commit
Give the right to commit to one agent at the end of the phase. In the same operator's post, a builder once ran git add -A and picked up another agent's unfinished work, and that mistake became this rule. Agents that work side by side also need separate working copies, which the page on parallel coding agents explains.
6. Keep the queue moving
Run the coordinating agent in a loop that starts the next phase when one ends. The page on background coding agents covers agents that work while nobody watches. Add an alert for a queue that stops, because a stopped queue makes no noise.
7. Audit the codebase with a second agent
Every few days, have a different coding agent score the codebase at a fixed commit, and put its findings in the queue. Passing tests do not show a codebase that is getting worse, which is how technical debt grows unseen.
This example is simplified. A real factory would add a release step and extra checks where a mistake costs the most, e.g. payments.
What are common mistakes?
A first factory can make five mistakes:
- Letting the builders check their own work. In 35 of 51 recent phases of one operator's factory, the build step reported the work done and the verify step still found a problem.
- Passing work by reading it. A verify agent that reads the diff repeats the builders' reasoning. It has to run the software.
- Keeping rules in the chat. A rule that is not in the rules file does not reach the next agent.
- Reading silence as a pass. A verify agent that crashes has not passed the change. Count the crash as needs work.
- Starting with infrastructure. A small factory needs the stage that runs the product first. Add shared infrastructure when a limit appears, e.g. agents that wait for a free environment.
How do you check that it worked?
Give the factory a change with a known flaw, and watch where it stops. At Acme, the address request is that change, because the first build empties the cart. A working factory shows three signals:
- The verify stage reports needs work. The report includes evidence, e.g. a screenshot of the empty cart.
- The queue moves without a prompt. The next phase starts when the first one ends.
- The rules file grows. Each mistake adds one line, and the same mistake is less likely to return.
A written definition of done tells each stage what a finished phase has to show.
How does RunStory help with building a software factory?
The verify stage has to start the product and use it, which takes more than running the tests. RunStory independently runs the software against your change and returns evidence to the coding agent. After your agent makes the change, RunStory repeats the failing workflow to check that the problem is resolved. The guide to unattended agents shows that check inside a loop.
The operator cited on this page runs the factory that builds RunStory. Your team keeps the final release decision.
FAQs
How long does it take to build a software factory?
The time to build a software factory depends on what it starts with. A factory that begins as a rules file, a queue file, and one workflow needs no platform work. The slower part is the rules, which grow each time something goes wrong.
Do you need a platform team to build a software factory?
A platform team is not needed to build a first software factory. One operator's factory began as a rules file, a queue file, and a coding agent that runs workflows in a loop. Shared infrastructure can wait until a limit appears.
What goes in a software factory's rules file?
A software factory's rules file holds the standing rules that each agent has to follow. Typical rules name the test command, say which stage may commit, and say what the verify stage may not do. Each mistake adds a rule.
How do you keep a factory's codebase from getting worse?
A factory can watch for a codebase that is getting worse by auditing it on a schedule. A different coding agent scores the code at a fixed commit, and its findings go into the queue as ordinary tasks. Passing tests do not show the decline.
When should a small factory add more infrastructure?
A small factory should add infrastructure when a specific limit appears. One example is agents that wait for a free environment. Until then, the rules file, the queue file, and one workflow are enough to run it.