TL;DR
You make an AI coding agent check its own work by taking the checking out of the agent’s hands. Give it a fixed process with gates it cannot skip, a pass or fail check it must run, proof captured before and after the change, and a reviewer that never saw the build. A better prompt asks; a process enforces.
That is what an AI software factory is: a set of steps the agent runs the same way every time, with outputs a separate checker can compare against a contract. We publish one, the Software Factory, free and MIT licensed, for Claude Code, with Codex and Cursor support in progress. This post covers the problem, the method, each of the factory’s ten steps, how to install it, what stays human, and when to bring in engineers.
A free add-on, shown by the author
Before your AI builds your MVP, watch this.
A free add-on that makes your AI coding tool plan, test and get checked before you see the code.

Free and MIT licensed. Claude Code, Codex, Cursor.Free and MIT licensed. Works in Claude Code, Codex and Cursor.
Why AI-written code runs but goes unchecked
An agent is very good at producing code that runs. Running is not the same as correct, and nothing in a typical session forces the difference to be tested before the agent reports success.
The best large-scale evidence so far is Debt Behind the AI Boom (Liu, Widyasari, Zhao, Irsan, Chen and Lo, submitted to arXiv on 30 March 2026). The authors built a dataset of 302.6k verified AI-authored commits from more than 6,000 GitHub repositories, covering five widely used AI coding assistants. They ran static analysis before and after each commit to attribute which issues the AI introduced, then tracked each issue to the latest version of the repository. They found 484,366 distinct issues. Between 7.5% and 14.8% of each assistant’s commits introduced at least one issue, code smells made up 89.3% of all issues, and 22.7% of the tracked AI-introduced issues still survived at the latest version of the repository.
That last number is the one that matters for a founder. Roughly one in five problems an agent introduced was never caught by anyone afterwards. They did not break the build. They became the codebase. MVP technical debt covers which shortcuts you can afford to carry; the point here is that an agent left alone does not tell you which ones it took.
Anthropic says much the same about its own tool. Its Claude Code best practices page lists, as one of the common ways a session goes wrong, that Claude reports it is done when it is not quite, usually because it had no way to check its own work.
Why a better prompt does not fix it
The instinct is to write a stronger instruction: “always run the tests”, “never say done without proof”, in capitals, in CLAUDE.md. It helps. It does not guarantee anything.
Anthropic’s own documentation draws the line clearly. It splits every instruction into two kinds. Non-deterministic instructions are ones the model reads and then decides what to do with: your prompt, CLAUDE.md, a skill. Deterministic ones are configured and the harness executes them every time: hooks, deny rules, managed settings, tests, CI, branch protection, a person who approves the merge. The same page notes that however strongly you word a line, whether the model follows it on a given turn is still the model’s call, and that if you keep adding emphasis to a line and it still gets missed, the line belongs in a hook.
So the question is not “what do I say to the agent”. It is “what does the agent have to pass before the work counts”. There are four levels, from weakest to strongest:
| Method | Who decides it is done | What it catches | What it misses |
|---|---|---|---|
A prompt or CLAUDE.md line (“run the tests”) |
The agent | Most things, most of the time | The turn where it decides not to, or reports a summary instead of output |
| A pass or fail check it must run (tests, typecheck, build exit code) | The check | Anything the check covers | Anything the check does not cover: the wrong feature, a broken journey, untested paths |
| A Stop hook that runs when the agent tries to end its turn | The harness | Ending the turn with the check failing | Work that passes the check and is still wrong |
| A fixed process with gates, proof and a fresh reviewer | A separate checker, then a separate reviewer, then you | Skipped steps, missing proof, findings a builder argues itself out of | Product judgement, and anything nobody wrote down as a criterion |
The fourth row is the one this post is about. Each level includes the ones above it. A process does not replace tests; it makes sure the tests were run, on the right commit, and that the output was read by something other than the code’s author.
How many Claude Code plugins check the agent’s work?
MVP Development counted it. On 17 November 2026 we read Anthropic’s official Claude Code plugin marketplace repository, anthropics/claude-plugins-official at commit fd30cee. Its catalogue lists 317 plugins; 55 of them are hosted inside that repository, and those 55 are the ones we checked. For each, we read its hooks/hooks.json, its .claude-plugin/plugin.json, and the frontmatter of every skill, agent and command file (188 files) for a hook that fires on Stop, the event Claude Code raises when the agent tries to end its turn.
8 of the 55 ship any hook file. 4 of the 55 register a Stop hook. 1 of the 55, security-guidance, uses that Stop hook to review the agent’s changes (an LLM review of the git diff). Of the other three, ralph-loop uses Stop to feed the same task back to the agent until it is complete, hookify runs rules the user writes, and code-modernization uses it for usage counts. Many more plugins offer review as a command you run (code-review and pr-review-toolkit among them), which is useful, but it is something you remember to call, not something the agent has to pass.
To re-run it: download .claude-plugin/marketplace.json from that repository, keep the plugins whose source is a local path, and search each one’s hook files and markdown frontmatter for Stop. The 262 plugins hosted in other repositories were not checked, so this says nothing about them.
What does an AI software factory do differently?
A factory turns “check your work” from a request into a sequence. The agent cannot reach a pull request without going through analysis, a recorded decision, a plan with a proof list, Before captures, a build loop, verification and review, and a separate checker reads each stage’s output against a written contract.
Three ideas carry most of the weight:
- The method is reloaded, not remembered. Long sessions get their context compacted, and the instructions from an hour ago can fall out. Each step loads its own skill fresh and writes its result to a run file in the project, so the next step reads the record, not the agent’s memory of it.
- Proof is captured, not described. “All tests pass” is a sentence. A Before screenshot or command output taken before the first edit, and an After taken from the finished commit, is evidence a person can compare in thirty seconds.
- Whoever built it does not judge it. The gate checker and the PR reviewer start fresh. They get the contracts, the outputs and the code, never the builder’s reasoning, so they cannot be talked into agreeing with it. Anthropic’s docs make the same point about running a review in a subagent that never saw your conversation.
The Software Factory, step by step
Disclosure: we build and maintain this. The Software Factory is free and MIT licensed. It is a set of skills plus small hook scripts, it runs inside your coding agent, and it has no runtime of its own. Each step below is a separate skill; the descriptions come from those skill files.
0 Ticket. Every run starts from a ticket in your tracker (with none set, it recommends GitHub Issues in a private repository), searched first so work is not duplicated. The ticket holds the definition of done as labelled criteria, and every explicit ask in your request becomes one of them. No tracker reachable: it writes the ticket to a local file and says so.
1 Analyze. Analysis only, no code. The agent reads the actual code, not a diff or a filename, explains what the feature does and what success means, lists every caller and consumer with paths, and draws the flow as an ASCII chart with the change marked on it. Verified facts and hypotheses are kept apart, and a missing “why” is recorded as a finding.
2 Recommend. Three real alternatives in one table, judged on correctness, simplicity, performance, fit to the goal, coupling and cost, and exactly one pick with its reasons. Choices that belong to you (product, naming, anything you reserved) are presented as a recommendation and the run waits for your answer on that point.
2b Challenge. A separate round that tells the agent its pick is not the best it could do and makes it redo the comparison: a missed option, a wrong cell, an underrated cost. The pick stays only if it survives.
3 Plan. The files about to change and a self-critique of that set, phases ordered so the smallest usable journey comes first, a numbered todo list that becomes the ticket’s checklist, a proof list (one id per changed view, journey or command) and a test map. Then Gate A: a fresh, read-only checker compares steps 0 to 3 with each skill’s output contract. No source file is edited before Gate A passes.
4 Before proof. For every id on the proof list, a Before capture (a screenshot, a command’s output, an API response) saved from the base commit before the first edit. A new screen’s Before says “did not exist”. This is the step most agent workflows skip, and it is the one that makes the After meaningful.
5 Build. One todo at a time, each through the same loop: read the context, analyze where the change lands and who consumes it, apply it, then analyze the applied change (correct, no circular dependency, nothing extra, root cause handled, and the user journey used for real before ticking). Any issue found sends it back to analysis. Only the tests mapped to the changed files run here.
6 Verify. On the finished commit, in parallel: review agents, one per lens (compliance always; security, performance, journey and change-guard when they apply), a UI check, a last manual pass through every requested journey capturing the After proof with the same ids, and the full test suite run once on the final head. Fixes go back through the build loop. Then Gate B. No pull request before it passes.
7 Draft PR. A draft pull request, linked to its ticket both ways, with one heading per outcome and its Before and After pair, plus a verification section that maps each criterion to its change, its proof and any gap. Checks that were not run are labelled unverified, not left out.
8 Review. A fresh agent that did not build it reviews the PR on its exact pushed head: analysis, three alternative approaches, an audit of the run’s own blocks and gates, and every review lens, ending in a verdict and a comment on the PR. Then Gate C, which also needs a passing full-suite record for that commit. The run closes and asks you to verify and merge.
Two modes. Fast (the default) runs all ten steps without stopping, except for choices only you can make. Safe also stops after the plan for your OK and runs every review lens at verify.
How does it keep the agent on track?
Four mechanisms do the enforcing. Each has a limit, stated here.
- Stop hooks. In Claude Code, two prompt-type Stop hooks are armed only during a run, right before each step’s block. When the agent ends a turn, a small model reads the last message and sends it on to the next step if a step number is new, or back to run a missing checker if a gate line is not backed. The README is direct about the limit: a small model judges the line, and an agent could still fool it. In scripted tests on Haiku and Sonnet a looping agent stopped below the turn limit, which the README calls very likely, not certain. Claude Code also caps a Stop hook at eight consecutive continuations, per its hooks reference.
- The run guard.
run-guard.sh checkreads.factory/run.mdand Git and prints the next step. It never reads the conversation, so it cannot be argued with. - Loops that end. After three failed rounds at a gate with no open critical finding, the gate passes by cap and the leftovers go to a follow-ups ticket instead of looping forever.
- What it sends. Nothing to the factory’s author and no telemetry. The update check asks GitHub’s public API for the latest release, and
FACTORY_NO_UPDATE_CHECK=1turns it off. Tickets and pull requests go to the repository you choose. Files stay on your machine, in.factory/inside the project.
None of this makes the agent infallible. It makes skipping a step visible, and it makes “it works” arrive with the evidence attached.
How to install the Software Factory
In Claude Code, inside your project:
/plugin marketplace add https://github.com/seifsg/ai-software-factory.git
/plugin install safe-factory@ai-software-factory
/safe-factory
Then ask for an outcome, for example /safe-factory Build a small habit tracker web app, or safe: fix the crash when the login form is empty for Safe mode. You need Git, the GitHub CLI signed in (gh auth login) for tickets and draft PRs, and on Windows, Git Bash for the hooks.
The same plugin installs in Codex (codex plugin marketplace add with the repository URL, then codex plugin add safe-factory@ai-software-factory, then trust its hooks) and in Cursor (/plugin marketplace add with the same URL). Be clear about status: on the day of writing, the repository’s README marks Claude Code as live, Codex full delivery as pending, and Cursor as not yet run live. Use Claude Code if you want the path that has been run end to end. The full install options are in the repository; the factory is also offered on our pricing page.
What stays human?
The factory is built so the agent does the work and a person makes the calls that carry risk.
| The agent does | You decide |
|---|---|
| Tickets, analysis, options, the plan | Anything you reserved: product choices, naming, scope changes |
| Before and After proof, the build, tests | Whether the proof shows what you wanted |
| Review by fresh agents, gate checks | Ready for review, merge, release, deploy |
| Draft pull requests, follow-up tickets | Spending money, notifying anyone, anything outside the project folder |
Pull requests stay in draft. The factory never merges, releases or deploys on its own. That is a deliberate limit, not a missing feature: a review by an agent is still an agent’s opinion, and the merge is where a person accepts responsibility for the change.
It also does not know what you did not write down. If the ticket’s criteria are wrong, the factory will build the wrong thing carefully and prove it. The first five minutes of a run, reading the ticket and the analysis, are the cheapest place to catch that.
When do you bring in engineers?
A factory makes an agent’s work checkable. It does not make every decision the agent faces a good one. Bring in an engineer when:
- The review keeps flagging the same thing and the fix keeps moving it. That is usually a design problem, not a code problem, and an agent tends to patch the symptom it is shown.
- The change touches what other things depend on: the data model, authentication, payments, anything with stored data. The factory marks these as needing your yes; deciding well needs someone who can see the whole system. Vibe coding security lists the structural holes AI-built apps get wrong most often.
- You are about to put real customers on it. A reviewed PR is not a launch. Production-ready MVP covers what has to be true before then.
- You cannot read the proof. If a Before and After pair or a review finding means nothing to you, the process is working and you are the bottleneck. MVP for non-technical founders covers how to work with technical help without becoming a translator.
If you built the first version with an app builder and are deciding what to do next, vibe coding an MVP covers where those tools stop.
How MVP Development helps
We build the Software Factory and publish it so founders can use it on their own, with their own agent. When the agent’s output needs engineers behind it, for example a core that has to be designed rather than generated, or a build that has to ship to real users, that is what rapid MVP development is for. If you are not sure yet whether you need a build or a second opinion on the one you have, MVP consulting is the shorter conversation.
Frequently Asked Questions
How do I make Claude Code test its own code?
Give it a check that returns pass or fail (a test command, a typecheck, a build) and put the command in CLAUDE.md. To enforce it, add a Stop hook, which Claude Code runs whenever the agent tries to end its turn and which can send it back to work while the check fails. To also cover planning, proof and review, use a fixed process such as the Software Factory, where each stage has a written contract and a fresh checker reads the outputs.
What is an AI software factory?
A fixed sequence of steps a coding agent runs the same way on every task, from ticket to reviewed pull request, with outputs that a separate checker compares against a contract. The point is that verification happens because the process requires it, not because the agent remembered. The Software Factory is a free, MIT-licensed one with ten steps and three gates.
Can an AI code review agent replace a human reviewer?
No. A fresh review agent catches things the builder argued itself out of, and it is fast, but it is still a model’s opinion and it cannot know what you did not write down. Use it so the human reviewer starts from findings and proof instead of a raw diff. The merge stays with a person.
Is a Stop hook enough to make an AI agent check its work?
It is enough to stop the agent ending its turn while a check fails, which is a big step up from a prompt. It is not enough to catch work that passes the check and is still wrong, or a step that was never done. That needs criteria written before the build, proof captured before and after, and a reviewer that did not build it.
Does the Software Factory work with Codex and Cursor?
It installs in both. On the day of writing, the repository’s README marks Claude Code as live, Codex full delivery as pending, and Cursor as not yet run live, so Claude Code is the tested path. Check the repository’s README for the current status before relying on either.
Does the Software Factory send my code anywhere?
Not to its author: it has no telemetry. Files stay on your machine in the project’s .factory/ folder. It talks to GitHub’s public API to check for a newer release (turn that off with FACTORY_NO_UPDATE_CHECK=1), and tickets, branches and pull requests go to the repository and tracker you choose. In Claude Code the Stop hook’s small model is Claude Code’s own background model, under your Claude terms.
What does a good AI coding agent workflow look like?
Ticket with criteria, analysis of the real code, a recorded choice between alternatives, a plan with a proof list, Before captures, a build in small checked steps, verification with the full suite once on the final commit, a draft pull request with Before and After pairs, and a review by an agent that did not build it. A person merges. Each of those steps exists because skipping it is where AI-written problems survive.




