DEV Community

Cover image for A software factory that improves itself
Sambalicious
Sambalicious

Posted on

A software factory that improves itself

I built what I call a software factory: a set of agents that act like a small startup, run by an orchestrator that delegates and does not do the work itself. There is a product manager, a spec writer, an architect, a designer, a backend engineer and a frontend engineer, QA, DevOps, security, a code reviewer, a copywriter and an SEO specialist. Four more run only when I ask for them: a growth agent, a data analyst, a penetration tester and a release manager.

Each agent is a written brief: what it needs, what it must produce, how it hands off. Because they are plain files, they are not tied to one AI tool.

Behind them sit skills: instructions and scripts for a framework, a design system, a testing tool, or a way of writing. Some I wrote. Some I took from people whose work I trust, poteto and Matt Pocock among them.

In practice the same few do most of the work: a browser that drives a real page, a dispatcher that starts a worker, the command that sets a night's run going, a writing pass that strips machine-sounding prose, a review that cannot be the author's, a triage that decides whether a report deserves a run at all, and a retro that audits the factory's own files.

Someone will say that a shelf of skills is a context window waiting to fill up. It is, if you load them all. Nothing here does. An agent's file names the skills it may use, and a skill is opened when the task calls for it: a reference book, not a briefing. A run is one feature per session, resumed from a short digest rather than the whole transcript.

The agent roster, printed and marked up

Figure 1. The roster. Twelve agents by default, four on request — and the orchestrator, which is not on the list because it only delegates.

My main lesson is that the model is not the factory, and neither is the roster. The factory is everything around them: who may decide, who may write, who must check, and when to stop.

Contract first, then parallel work

A run starts with product requirements. Spec, architecture and design follow in parallel. Then the API contract is published, and only then do the builders start: backend, frontend, infrastructure, threat modelling and test writing run side by side, all working from the same contract.

After that come the gates: QA, a design review for interface changes, a security review and a fresh code review. QA and design review run at the same time; security and code review follow them. A run ends as verified or with a list of blockers, and neither result merges anything.

Merging has a sequence of its own. A worker opens its work as a draft pull request. The lead reads the diff and the checks and marks it ready; nothing is reviewed while it is a draft. Then Opus reviews it, and a CI job merges only when every required check passed on that exact commit, that review found nothing high or medium, the diff is at most 400 lines, and it touches no money, auth, database, config, CI, dependency or deploy file. Everything else keeps its findings and waits for me. The run ends at a verdict; the merge belongs to the project.

A blocker does not end the run. It is recorded with what it blocks and which agent it came from. The controller assigns the causal owner, invalidates the work that depended on it, and lets independent branches continue. A repaired branch is checked by someone other than the agent that wrote the fix.

One run: parallel work either side of a published contract

Figure 2. One run. Parallel work either side of a published contract, then gates run by agents that did none of the work. QA and design review run together; a blocker goes to its causal owner and the dependent work is rebuilt.

Rules that stop confident mistakes

Agents fill gaps with plausible guesses, so the rules are blunt. An agent that needs a field the contract does not define must stop and say so. An agent without its inputs does not start. Specs are passed whole, never summarised. Nobody verifies their own work, and after three rounds of repairs the run stops for a human.

The right model for the job

Agents map to tiers instead of model names. A mid-tier model (Claude Sonnet) leads and makes decisions. A stronger one (Claude Opus) handles the places where a miss is expensive or silent: the API contract, the design consult before it, security review and code review. A cheaper model (DeepSeek V4.1 Flash) writes the code and tests.

The tiers are a budget decision, not a claim that the cheap model is better. They also buy a second opinion: a different model on the check is less likely to share the blind spot of the one that wrote the work. Even with unlimited budget and no rate limits, I would keep that difference.

Work climbs that ladder only on evidence. The cheap worker gets one rewrite. If that fails, the lead fixes it, and the strongest model is called only if the lead's fix fails too. Before any worker touched implementation, it had to pass a small benchmark, including a task it was supposed to refuse.

The model ladder, printed as a policy sheet

Figure 3. The ladder. Agents map to tiers, and a step up is only ever earned.

The cheap tier has also corrected the tier above it. In one run, the lead wrote a brief that contradicted the API contract. The worker noticed and stopped. Followed as written, it would have shown every shop the wrong plan.

Failures became rules, then code

Much of the system exists because something went wrong.

A QA agent once stalled one minute into an overnight run. Nothing checked on it, and eight hours produced nothing. Unattended runs now need a check-in every 30 minutes, and a stalled agent is replaced or its task is parked.

A model was once chosen out of habit although the written policy named another. A rule in a document was clearly not enough.

A day of high-effort review sessions produced 666,000 thinking tokens, against 6,000 the day before. Medium effort is now the default, and high effort needs a written reason.

Writing a rule is one thing. An agent following it is another: it may never load the file, may read it and drift anyway, and will not remember it next week. So I stopped asking whether a rule was clear and started asking what refuses to continue when it is broken.

That became the pattern: when a rule matters, give it something that runs. A controller limits how many tasks and repair rounds a run can use. A gate refuses a pull request unless the latest commit passed review. Hooks block expensive models from doing routine implementation. Each sits at a different point — the hook at the tool call, the gate at the pull request, the controller at dispatch — so none of them depends on an agent remembering.

Most of the rules above came from a mistake I noticed. The retro skill catches the ones I did not: it turns a hard mistake into something that catches it next time. It reads the transcript and the run's own artifacts rather than the agent's account of them, and proposes the change that would have stopped it — a pointer an agent could not find, a check that exists but was never wired, a rule that should be a script. Most severe first, each with the line or command it came from, and it prefers a check to a sentence. Nothing is applied until I choose.

When I take one, it lands in the same files the next retro will read, so the instructions get corrected by the runs they produced.

Three incidents, the rule each one produced, and the check that now catches it

Figure 4. Three incidents, the rule each one produced, and the check that now catches it.

What it does not do

This is not a machine that ships software by itself. The controller records what agents report; it cannot prove a test ran. I often cannot get a reliable figure for what a feature cost. The process gets skipped too, usually by me, usually on a change I decided was small enough not to need it.

What it does give me is a process I can inspect. Every decision has an owner, every check is separate from the work it checks, and every failure has somewhere to go besides my memory.

Code is cheap now.

Writing a feature costs less than agreeing on what it should do, so the effort moved. It did not move to review. A person or a model reading a diff can tell you it looks right, and that is the weakest evidence in the building. What costs something is proof: that the test ran, that it tested the thing, that the failure it guards against is one that would really happen. I have not solved that. Everything above is a set of gates around the gap, not the gap itself.

Proving it on a real project

Since then I have added a verification skill that lives in the project. Anthropic says Claude writes about 90 percent of Claude Code's own code, and that most changes are reviewed by Claude before a person looks. If that is where this goes, the definition of done cannot sit in a prompt; it has to live beside the code.

The project is Jella, social commerce for ready-stock stores in Nigeria. It sells a shop's stock on the channels the shop already uses — its own WhatsApp number and, for the pilot, an Instagram account — and it carries the back office with it: a CRM, order management and stock management in the same place. Orders are taken against an allocation the owner sets aside, payments are recorded for the owner to confirm, and the owner steps in only when something needs a human.

I built it with this factory in under two weeks. The pilot is built end to end. It runs on test doubles today; what holds the launch is connecting the real services and clearing regulatory approval. There is a waitlist at usejella.com.

In Jella's repo the verification starts the owner app on a throwaway database with its own ports and reads the result back from the API. The skill proves one changed journey at a time. The browser suite behind it drives every screen of the owner app — today, catalogue and a product, invoices in three states, review cases, conversations, customers, held orders, settings, sign-up and the setup steps — at sizes from a small phone to a wide laptop, including the awkward half-window.

The journeys live in the repo as feature files, with the commit each was last driven against recorded in one map. What comes out is evidence, not a verdict: the state before, the action, the state after, and the commit that produced them. A toast is not evidence. The skill says it plainly: it replaces no test, no review and no release gate, and it covers the owner app and the backend — not the console, not real WhatsApp, not the payment providers, not the reply models. Verification gets its own article.

If you are building your own, start with three things: one written contract that nobody may invent around, a reviewer that did not write the code, and a hard limit on retries.

The rules, the roles and one worked feature are public: github.com/Sambalicious/software-factory-article.

Top comments (0)