Skip to content
All writing

8 min readai, workflow, opinion

From Vibe Coding to Software Factory

A year ago the question was whether AI can write code. Now it's a different question: how do you get AI to write code without you sitting next to it?

In Context Engineering vs Vibe Coding I wrote about the spectrum between describing a vibe and giving the agent a precise, structured environment. That article ended at one developer and one agent in one terminal. This one is about the next step: turning agents into a system that takes a task in and puts a reviewed pull request out. People call it a software factory.

I spent the last few weeks building one as a side project, called codetiller. This is what I learned, including the parts that didn't work.


The Five Levels

Dan Shapiro described five levels of AI coding, modeled on self-driving cars:

LevelNameWhat the human does
0Spicy autocompleteWrites code, AI suggests lines
1Coding internReviews every snippet AI writes
2Junior developerPair programs, reviews every line
3DeveloperFull-time reviewer of AI-generated code
4Engineering teamWrites specs, reviews outcomes, not lines
5Dark factoryNobody writes or reviews code

Vibe coding lives at levels 2–3. You're in the loop on every step, you react to output, you steer. Most teams I talk to are there.

A software factory is level 4. The human writes the intent and judges the result. The agents do the work in between, and nobody watches them type.

Level 5 exists too. StrongDM publicly runs with the rule that humans don't write or review code. I don't think most teams should aim there. Level 4 is hard enough.


What Changes When You Leave the Terminal

When I vibe code, I am the safety system. I see every command the agent runs. If it does something stupid, I stop it. If the result is wrong, I notice because I'm looking at it.

Take me out of the loop and three things break immediately:

  1. Nobody checks the result. The agent says "done". Is it?
  2. Nobody watches what the agent does. It has a shell, a network and maybe your credentials.
  3. Nobody knows if a change made things better. You tweak the prompt or swap the model. Did success go up or did you just get lucky?

A software factory is the answer to these three questions. Everything else is plumbing.

The shape I ended up with is CI/CD for work done by agents:

  1. A task comes from the tracker (a GitHub issue)
  2. A human enqueues it. No auto-spawning agents on every new issue.
  3. Preflight: a read-only pass estimates the scope and can suggest splitting the task
  4. The agent works in a sandbox as an untrusted worker
  5. Verification runs the checks the agent can't touch
  6. The result is a draft PR
  7. A human reviews it. A comment on the PR resumes the same task.

Lesson 1: Treat the Agent as Untrusted

This was the most uncomfortable finding.

I wrote a set of probes (tiller audit) that run inside the agent's container and try to get out. My first version of the sandbox failed badly:

  • The network was open, and the model API key sat in the agent's environment. Any shell command could send the key and the repository anywhere.
  • The factory's own API was reachable from the container. An agent could create tasks and read other runs' transcripts.
  • Even with the network closed, the model API itself is a way out: it can fetch URLs and connect to remote tools on the provider's servers.
  • The UI rendered images from agent output. An image URL can carry data, and the reviewer's browser sends it.

None of this needs a malicious model. It needs one prompt injection in an issue, a dependency README or a web page the agent reads.

The fix was a model gateway: the agent's container has no route out except to the gateway. The gateway forwards only the model calls, swaps in the real key (the agent holds a placeholder) and refuses everything else. All 19 probes pass now, and agents still finish tasks just as before.

If your agents run unattended, assume they will eventually do what an attacker tells them. Give them nothing worth stealing.


Lesson 2: Verification Is the Real Bottleneck

Writing code is now cheap. Knowing whether the code is right is not.

An agent that is told "make the tests pass" will sometimes make the tests pass by changing the tests. Not out of malice. It's the shortest path to "done". So the factory has to check things the agent can't influence:

  • run checks from the original branch, not from the agent's workspace
  • flag removed tests and changed check files
  • run a second reader on the diff

The metric I care about most is not "tasks completed". It's human interventions per completed task. A factory that produces ten PRs you have to rewrite is worse than no factory.


Lesson 3: Measure, Because Your Gut Is Wrong

Before building the factory, I built a benchmark. Take real fixed issues from a repo's history, hide the maintainers' tests, let the agent try, and check the hidden tests. I used two open source TypeScript libraries, hono and zod.

Then I tried to make the agent better. The idea was a "self-improving" loop: collect failed runs, have a model distill lessons from them, put the lessons into a skill file.

On the training tasks, success went from 67 % to 92 %. It looked like a breakthrough.

On held-out tasks the agent had never seen: no improvement. The model had simply written down the answers to the training tasks as "principles". My leak guard didn't catch it, because the answers were rules, not unique identifiers.

Then it got more humbling. When I measured rerun noise (the same config run twice), I found that with 2 repeats on 47 tasks, any difference under about 7 percentage points is noise. Every skill effect I had reported earlier was smaller than that. The only effect that held up was model choice: Opus beat Sonnet by 8.5 pp, at 2.5× the cost per solved task.

What did hold up were the cheaper metrics: time, cost, turns. One file with plain operational facts about the repo (how to install, which command runs which tests) cut wall time by 65 % without changing success at all.

The lessons:

  • Always keep a holdout. Without it I would have "proven" my thesis on the training set.
  • Know your noise floor before you claim an effect.
  • Context helps the agent work faster and cheaper more reliably than it helps it succeed more often.

This is the same perception gap I wrote about last time, one level up. Developers feel 20 % faster and measure 19 % slower. Factory builders feel their prompt tweak worked. Measure it.


Lesson 4: Humans Stay in the Loop, Just Somewhere Else

Level 4 doesn't remove the human. It moves them:

  • Before the run: decide which tasks go to agents at all, approve a split when preflight says a task is too big
  • After the run: review the draft PR, comment to resume
  • Around the runs: own the configuration, the skills and the checks

I made one rule early: improvements to the agent's skills only land as pull requests a human reviews, with the benchmark as a gate. Auto-learned skills overfit, as Lesson 3 shows. A skill change is a code change and gets the same treatment.

Preflight also taught me something about limits. My first per-repo limit was "at most 10 files per task". It blocked tasks the agent would have solved, and splitting them cost 2.5× more and needed six human decisions. A limit that's too strict just moves work back to people.


Where This Leaves Vibe Coding

Vibe coding isn't going away. I still vibe code prototypes, this website included. It's the fastest way to explore an idea when you don't know what you want yet.

But it doesn't scale to a team or a backlog. Once the task is clear and the cost of a mistake is real, the work moves from "me and an agent in a terminal" to "a system with a sandbox, checks and a review step".

The skills shift too. Less typing prompts, more:

  • writing specs and acceptance criteria an agent can't misread
  • designing checks that can't be gamed
  • running experiments with a holdout and a noise floor
  • thinking about the agent as an untrusted process

That is regular engineering. It's just pointed at a new kind of worker.


codetiller

codetiller is the factory I built while writing this. It sits between your tracker and coding agents: issue in, verified draft PR out, with a human enqueuing and reviewing. It runs on a single Docker host or on Kubernetes, and the configuration lives in your repository (.factory/factory.yaml). Today it runs Claude Code. Codex and OpenCode are on the list.

It's open source under Apache-2.0 and self-hosted. If you're building something similar, or you want to try it on your repo, get in touch.