Level 5: You Run the Software Factory
PLLevel 5 of the autonomy ladder is the software factory: a six-station pipeline (Intent · Harness · Loop · Graph · Verification · Release) where agents pull work from a queue, build and verify changes, and open pull requests without human-written code. A loop earns unattended factory operation only when an independent oracle outside the agent’s reach decides done.
Your Level 4 runs already complete overnight, review latency has become the slowest leg of delivery, and leadership asks whether routine changes like dependency bumps can run continuously from a queue. This guide equips tech leads, platform engineers, and CTOs to decide which loops qualify, build the first loop safely, and map all six stations across Claude Code, Codex, and Cursor.
How close production teams actually are to a dark factory
Section titled “How close production teams actually are to a dark factory”Dan Shapiro (The Five Levels, 23 January 2026) describes Level 5 as “a black box that turns specs into software” and places only a handful of tiny teams there (Simon Willison’s February 2026 write-up highlights StrongDM’s AI division using external holdout scenarios).
The best-documented scaled production factory—Stripe’s Minions—keeps humans in the merge loop. Stripe reported over 1,300 merged pull requests per week containing zero human-written code (19 February 2026), operating against over three million pre-existing tests and strictly capped at two rounds of CI before escalating to a human (9 February 2026). The verification layer existed years before the agents.
Skipping that layer carries steep production penalties: Faros AI’s telemetry across 22,000 developers (April 2026) measured task throughput rising 33.7% while incidents per pull request surged 242.7%, median review time jumped 441.5%, and unreviewed merges climbed 31.3%. Treat Level 5 strictly as a property of individual high-oracle loops.
The six stations of a software factory
Section titled “The six stations of a software factory”Each station owns one explicit decision and emits auditable evidence:
| Station | Decision owned | Mandatory evidence | Failure when missing |
|---|---|---|---|
| Intent | What the agent knows before starting | Versioned spec, acceptance criteria, stop condition | Plausible code solving the wrong problem |
| Harness | What the agent may run and access | Versioned sandbox, hooks, and least-privilege policy | Runs succeed only because permissions are overly broad |
| Loop | When execution halts | Machine-checkable stop condition and hard retry bound | Infinite thrashing or premature verbal victory |
| Graph | Who does what across agents | Written topology (planner, workers, judge) + worktree isolation | Concurrent agents overwriting files or shared state |
| Verification | What proves correctness | Independent deterministic checks + advisory review findings | Green builds on tests rewritten by the agent |
| Release | How changes ship and roll back | PR evidence bundle, named merger, canary/auto-rollback | Merges nobody can audit or revert cleanly |
Audit all six stations locally in any repository with npx @wondelai/harness-audit (harness audit guide). Deep factory design lives in software factories.
The four-question autonomy ledger: which loops may run unattended
Section titled “The four-question autonomy ledger: which loops may run unattended”A loop must cleanly pass all four tests before leaving live supervision:
- Named oracle: does an exact command exiting 0 decide done?
- Oracle independence: is that oracle impossible for the agent to weaken in the same diff?
- Fast feedback: does a wrong change surface in minutes rather than weeks?
- Contained blast radius: is a mistake small and reversible by a single revert?
| Loop class | Oracle | Agent-editable? | Time to surface | Blast radius | Verdict |
|---|---|---|---|---|---|
| Patch/minor dependency updates | Full CI + contract suite | No (tests & CI locked) | Minutes | Single revertable PR | Factory loop (evidence merge) |
| Lint rules & typed codemods | Linter + type checker | No (configs locked) | Minutes | Mechanical, reversible | Factory loop (evidence merge) |
| Flaky-test quarantine | CI re-run telemetry | Yes if inside repo | Days | Masks real regressions | Supervised |
| Feature work from a spec | Spec acceptance tests | Yes if in same diff | Days–weeks | Product behavior | Supervised L4 evidence review |
| Auth, money, schemas, migrations | Partial at best | Varies | Weeks | Irreversible | Always human code review |
Standing up your first factory loop in six steps
Section titled “Standing up your first factory loop in six steps”Start with patch and minor dependency updates because its deterministic oracle already exists:
- Commit the intent file (e.g.,
.factory/dep-bump.md) under version control so prompt changes undergo standard code review. - Move the oracle out of reach. Protect
tests/,.github/, lint configs, and type configs viaCODEOWNERSwith required code-owner reviews, pin required workflows to the default branch, and fail any factory branch touching protected paths (protecting the oracle). - Split execution from publishing. Run the agent inside a disposable sandbox with zero write credentials (
persist-credentials: false, only the model key). Export changes as a patch artifact; a separate, non-agent job with narrowly scoped GitHub permissions applies the patch and opens the pull request. - Run headless with hard bounds. Enforce least-privilege tool allowlists, spend limits, and at most two automated fix rounds (mirroring Stripe’s two-round CI cap).
- Merge from an evidence bundle. Include the intent reference, exact command exit codes, automated review findings, and dependency changelog.
- Hold steady for four weeks. Track revert rate, incidents per PR, and review wait before onboarding a second loop class.
Mapping the six stations across Claude Code, Codex, and Cursor
Section titled “Mapping the six stations across Claude Code, Codex, and Cursor”Exact CLI flags, cloud triggers, and enterprise billing evolve quickly—check vendor documentation on the day you wire a pipeline (Claude Code docs, OpenAI Codex docs, Cursor docs):
| Station | Claude Code | Codex | Cursor |
|---|---|---|---|
| Intent | CLAUDE.md / AGENTS.md, Agent Skills (SKILL.md), Plan mode | AGENTS.md hierarchy, Agent Skills, Plan mode | .cursor/rules/*.mdc, AGENTS.md, Agent Skills, Plan Mode |
| Harness | Lifecycle hooks (PreToolUse, PostToolUse, Stop), managed hooks, OS sandbox, least-privilege allowlists | sandbox_mode (read-only, workspace-write, danger-full-access) vs approval_policy (on-request, never, granular; legacy untrusted retired), requirements.toml | Hooks, run modes, isolated Cloud Agent VMs, enterprise admin policies |
| Loop | Headless runs, goal loops, Stop hooks (stop_hook_active), scheduled routines | Non-interactive execution, cloud environments, scheduled automations | Cloud/Background Agents, scheduled & event-driven Automations |
| Graph | Subagents (.claude/agents/), git worktrees, script-driven orchestration | Subagents, managed git worktrees, cloud tasks | Subagents, isolated worktrees, Agents Window |
| Verification | Automated code review (REVIEW.md, /code-review), security review | Codex code review (AGENTS.md review rules), security review | Bugbot (.cursor/BUGBOT.md), security review |
| Release | CI/CD actions & headless integrations | CI action & GitHub/GitLab PR review | GitHub Actions, webhooks, PR routing & approval |
Never place broad permission-bypass flags in any factory loop outside a disposable, network-restricted container; a loop requiring unrestricted access exposes a broken harness.
Proving factory quality without reading every diff
Section titled “Proving factory quality without reading every diff”- Deterministic checks decide; review agents advise. Types, tests, linters, and migration checks gate merges; AI reviewers surface findings rather than acting as sole gates.
- Weekly random sampling audit. One named loop owner inspects a small random sample of merged factory PRs end to end every week. Any defect missed by gates returns the loop to supervised mode until a new check covers the gap.
- Four loop-level metrics: revert rate, incidents per PR, review wait, and share merged without human approval.
Where a software factory rots first, and how to recover
Section titled “Where a software factory rots first, and how to recover”- Factory output outruns human review. Review queues swell while throughput looks healthy (the Faros pattern). Recovery: cap open factory PRs per loop, pause intake at the cap, and review evidence bundles instead of raw diffs.
- The oracle drifts into agent write reach. Green runs quietly modify tests or lint configs. Recovery: revert, enforce
CODEOWNERSon test and CI paths, and add a fail-closed CI path check. - Unattended jobs inherit yesterday’s permissions. Stale allowlists run at 3 a.m. Recovery: version every permission policy in code review, enforce org limits via managed settings or
requirements.toml, and audit quarterly. - Untrusted external text reaches tool-enabled agents. Issue descriptions, external PR comments, webhooks, and scraped HTML are prompt-injection vectors. Recovery: isolate untrusted parsing inside read-only, zero-secret steps and hand write steps to separate constrained jobs (agent threat model).
- Nobody owns the seams across stations. Six owners with no end-to-end accountable lead ship green broken software. Recovery: assign one named loop owner empowered to pause automation without a committee.
Next steps
Section titled “Next steps”Did this guide help you?
One tap, no sign-in.
What will you do with it?
How did it read?
What got in the way? Pick any that apply
Your role?
Thanks. I read every answer. Michał Jaskólski
Did this guide help?
One tap each. Close whenever you like.
no sign-in
Frequently asked questions
What is Level 5 on the autonomy ladder?
Level 5 is the software factory: a six-station pipeline where agents pull queued work, implement and verify changes, and ship pull requests without human-written code. Dan Shapiro calls it the dark software factory; in real engineering organizations it is adopted one bounded loop at a time rather than company-wide.
What are the six stations of a software factory?
Intent (what the agent knows before starting), Harness (what it may execute and reach), Loop (how and when it stops), Graph (how multiple agents coordinate without colliding), Verification (what counts as independent proof), and Release (how work ships and rolls back safely).
Which loops may run unattended in a software factory?
Only loops passing all four questions of the autonomy ledger: a named machine-checkable oracle decides done, the agent cannot edit that oracle, a wrong change surfaces in minutes rather than weeks, and the blast radius is small and reversible.
Does any organization run a software factory in production?
Stripe reported on 19 February 2026 that over 1,300 merged pull requests per week are produced end to end by its Minions agents against more than three million pre-existing tests—capped at two CI rounds and still reviewed by humans before merge.
Primary sources & references
- Dan Shapiro — The Five Levels of AI Coding (January 2026) https://www.danshapiro.com/blog/2026/01/the-five-levels-from-spicy-autocomplete-to-the-software-factory/
- Stripe — Minions Part 2 (19 February 2026) https://stripe.dev/blog/minions-stripes-one-shot-end-to-end-coding-agents-part-2
- Faros AI — AI Engineering Report 2026 (April 2026) https://www.faros.ai/blog/ai-acceleration-whiplash-takeaways