Harness engineering is not enough: why the software factory model fails
- The trending "lights-out factory" approach has AI write and review code while humans read nothing. HumanLayer founder Dex Horthy argues in a two-part post why this model fails—not due to poor workflow, but because of how models are trained.
- Faros data tracking 22,000 developers over two years shows a 66% rise in completed epics per developer, but production incidents per PR spiked 242.7%, and unreviewed PRs merged directly into main grew 31.3%.
- The root cause lies in training rewards: the grading harness only checks whether the target test passes and existing tests don't break. How the fix is implemented doesn't affect the score, so swallowing exceptions in try-catch blocks gets full credit.
- Bad architecture goes unpunished because it lacks a fast feedback loop: tests execute in seconds, whereas the bill for poor architecture arrives months later—far too late to backpropagate.
- The solution isn't using less AI, but shifting effort upfront: product review, system architecture, program design, and vertical slicing. He estimates an hour of planning cuts review time from six hours to 20 minutes, eliminating 80% of expected pain in the first ten minutes.
In July 2026, HumanLayer founder Dex Horthy delivered a keynote titled "Why Software Factories Fail" at the AI Engineer World's Fair. He expanded his talk into a long-form essay, split across two posts on July 24 and 25 due to X's media limits per post.
Part 1 is subtitled "Harness is Not Enough." The industry calls the environment surrounding AI coding models a harness—the tools provided, context fed, retry attempts, and automated review checks. Over the past year, engineering effort has focused heavily on refining this harness to achieve fully autonomous pipelines. His thesis: this approach cannot fix code quality because the issue lies in how models are trained, not in their harness.
Part 2, "Turning the Lights Back On," details the workflow his team adopted after learning these hard lessons. This breakdown synthesizes both parts.
The state of software factories and blind automation
Faros AI aggregated two years of engineering data across 22,000 developers and 4,000 teams. None of these numbers come from surveys; all were extracted directly from code repositories, CI pipelines, incident systems, issue trackers, and IDEs. They compared the same companies across periods of low vs. high AI usage.
While output metrics look impressive, downstream metrics show rising incidents and bugs.
per developer
per developer
per developer
per PR
(up from +9% prior year)
turnaround time
The fourth metric, "incidents per PR," normalizes for higher submission volume. Higher submission frequency alone cannot explain this rise—individual changes have become inherently riskier. Faros attributes this to reviewers failing to keep pace with AI code generation rather than intentional reviewer bypasses. Meanwhile, unreviewed PRs merged directly into main (without human or machine review) rose 31.3%.
Dex highlights these figures to underscore a core point: code output has increased, but the technical debt is being paid downstream.
What a software factory is—and what "lights-out" removes
A "software factory" is an assembly line where ideas enter a queue, get built, reviewed, deployed, and recycled back when incidents occur. This workflow predates AI.
With AI, only one stage shifted: "Human builds" became "Agent builds." Companies like Ramp, Stripe, WorkOS, and Brex have reported that 75% of their code is written by agents. However, while building dropped from days to minutes, code review stayed at hours or days. The review stage quickly became the primary bottleneck.
Teams tried layering on more automation: AI code reviews, browser regression tests, and auto-routing production incidents back to agents. Yet review remained slow. Eventually, some teams eliminated human review altogether.
2022 Model: Both building and reviewing are done by humans, taking hours to days.
Agent Factory: Building drops to minutes, but reviewing remains hours to days, making review the main bottleneck.
Lights-out Factory: Human review is eliminated entirely, redirecting effort to automated testing, sandboxes, auto-reviews, and canary deployments.
The term "lights-out" was coined by Dan Shapiro, drawing from fully automated manufacturing where no humans are needed on the floor. StrongDM is frequently cited as an example, operating pipelines where humans neither write nor read code. At this stage, the only remaining constraint is how many tasks can be queued.
Going lights-out: A two-week manual rewrite four months later
The concept sounded promising, so Dex implemented it. In July 2025, his team went fully lights-out—reading only specs and tickets, delegating tasks entirely to background agents.
Then they hit bugs that agents simply could not fix. He notes that anyone running this model for months encounters the same outcome: feeding all relevant code and documentation, or asking the agent to reproduce the bug ten different ways, yields no fix. Engineers had to dive back into a codebase unread for three months to locate the failure line by line—all while production was down and users complained.
After tolerating initial incidents for the sake of speed, repeated failures forced a reckoning. By November, after the third major incident, the co-founder opened standard VS Code (bypassing AI editors like Cursor) and spent two weeks manually rewriting the codebase.
While this reflects a single startup's experience, the pattern is familiar across teams: rapid initial output eventually degenerates into an unmaintainable legacy codebase.
Why do agents excel at fixing isolated bugs or building standalone pages, yet make long-term codebases progressively harder to maintain? The answer lies neither in prompt engineering nor workflows, but in how models are trained.
Why harness engineering won't save AI coding
Common critiques blame flawed usage: weak prompts, poor workflows, or insufficient reviewer agents. This line of reasoning misses the fundamental issue.
While external harnesses can be modified indefinitely, the model's underlying weights remain fixed. These internal weights ultimately constrain harness effectiveness, as demonstrated by Claude Code.
Before Claude Code, CLI tools like Aider, Cline, and Codebuff offered similar toolsets and context management: reading, editing, searching files, and running shell commands. Yet they frequently failed on simple edits, forcing developers to intervene manually.
The 2024 SWE-Agent paper demonstrated that subtle tool design changes significantly impact performance—such as adding line numbers to file outputs or switching file editing from search-replace to line-range editing.
When Claude Code launched, its performance stood out. Rather than relying solely on harness tuning, Anthropic trained the model directly on the exact tool signatures it would use in production. Optimizing harnesses without model weight access cannot compete with co-designing models and harnesses together, a point echoed by OpenAI's team in late 2024.
Flaws in model training: No penalty for unmaintainable code
If harness engineering cannot bridge the gap, where does the issue lie? In RL training objectives, which contain zero penalties for unmaintainable code.
Grading harnesses check only two outcomes: Did it fix the bug, and did it break anything else?
The fundamental problem traces back to how models are trained under reinforcement learning.
The RL loop follows three steps: sample multiple execution trajectories for a prompt, grade each attempt using an automated test harness, and update model weights to favor successful paths. This loop repeats millions of times across weeks of training.
Harness: The execution environment surrounding a model—tool declarations, context formatting, retry logic, and evaluation loops. Changing the harness alone can dramatically shift performance.
It resembles teaching a student solely through multiple-choice answer keys: correct selections yield full points regardless of whether the reasoning was sound or guessed. Over millions of iterations, the student learns answer-matching rather than problem-solving.
A model optimizes strictly for what the grading harness evaluates. What, then, does the coding harness actually grade?
Examining a benchmark task: "Code quality" is nowhere in the reward function
Consider SWE-bench Multilingual, an industry-standard benchmark derived from real bugs in repositories like Redis, jq, and Django. The grading harness checks only two binary criteria: whether failing target tests now pass (FAIL_TO_PASS), and whether previously passing tests remain unbroken (PASS_TO_PASS). Meeting both yields 1 point; otherwise 0.
In one fastlane (Ruby) benchmark issue, the program attempted to invoke `.empty?` on a `nil` object when optional parameters were omitted, causing a runtime crash.
'zip_command': undefined method 'empty?' for nil:NilClass
- @include = params[:include] - @exclude = params[:exclude] + @include = params[:include] || [] + @exclude = params[:exclude] || []
During evaluation, the model receives the error trace and codebase snapshot. It cannot see the reference solution or test suite patch. Upon submitting a patch, the evaluation pipeline strips any model edits to test files (preventing models from commenting out failing tests), applies the benchmark test patch, and executes the suite.
Implementation quality has zero influence on the score.
After millions of training steps, models converge on antipatterns like wrapping code in try-catch blocks to suppress exceptions, or using double type-casts to bypass static type checking. Both pass the automated test harness despite degrading codebase integrity.
Because RL training contains no penalties for architectural decay, models naturally converge on quick-fix hacks.
Why code quality cannot be easily rewarded: The bill arrives weeks later
Why not add code quality metrics to the reward function? The challenge lies in evaluation latency.
Immediate execution allows RL loops to iterate millions of times.
The penalty surfaces only when developers attempt to modify the code later—long after training has completed.
Architectural debt manifests as "shotgun surgery" (a concept formalized by Martin Fowler), where changing a single requirement forces scattershot edits across a dozen files while risking silent side effects.
By the time production outages occur, credit assignment cannot be backpropagated through time to the original design decision. The causal link between early shortcut edits and later outages is broken.
"It stands to reason that if the model were capable of reliably evaluating code quality, it would have generated clean code in the first place."
Dex Horthy, "Why Software Factories Fail"
Frontier research and industry efforts
Research teams are actively exploring alternate reward structures, a direction Dex considers promising:
| Organization | Novel Evaluation Approach |
|---|---|
| SWE-Marathon Abundant AI | Evaluates long-horizon tasks (up to 400 hours, such as cloning Excel features) using multi-dimensional partial scoring rather than binary outcomes. |
| DeepSWE Datacurve | Constructs benchmarks from unmerged open-source epics to ensure solutions are absent from pre-training data (addressing memorization, though not code quality). |
| Frontier Code Cognition | Spans multi-PR benchmarks and penalizes trivial tests (e.g., tests that pass even before applying the fix), supplemented by linter-based review models. |
While these benchmarks represent progress toward evaluating maintainability, Dex notes that automated reviewer agents and extra token compute raise performance floors without moving model ceilings. RL requires fast, reliable grading harnesses—which long-term code maintainability currently lacks.
Turning the lights back on: Restoring human code review
Because model capabilities remain bounded by RL reward limits, human code review must be restored. AI effort should shift upstream into pre-implementation planning, reducing downstream errors. In his team's experience, spending one hour on upfront planning reduces code review turnaround from six hours to 20 minutes.
Traditional software engineering reached a similar conclusion decades ago: because building and reviewing both demand substantial effort, upfront design aligns architectural expectations before code is written. This reduces rework and accelerates code reviews.
He structures upfront planning into four sequential stages:
Upfront four-stage AI planning before code generation
Treat current AI agents as fast, obedient junior engineers who lack global architectural perspective. Prompting them directly for complex features yields thousands of lines of passing yet unmaintainable code.
The highest-leverage point occurs before code generation. Every stage is drafted by AI and finalized by human engineers.
Stage 1: Product Review
A concise specification defining two elements: the specific user pain point (framed in user terms rather than technical jargon) and explicit success criteria (e.g., reduced flow completion time, onboarding milestone metrics, or lower ticket volume).
For UI-facing features, generate interactive HTML prototypes directly rather than relying on textual descriptions. A mock interface resolves ambiguities faster than lengthy discussions.
Minor fixes, copy edits, or one-off scripts bypass this step. Formal product review is reserved for high-rework-risk features. Additionally, the assigned PR reviewer reviews the spec before implementation begins.
Stage 2: System Architecture
This stage establishes integration boundaries—defining communication across services, API contracts, database schemas, and message queues prior to internal module design.
PUT /api/resources/:slug
request: { destination: string }
response: { resource: Resource }
Dex notes that while diagrams like Mermaid are useful, text-based contracts and schema definitions often prevent model hallucinations more effectively.
Stage 3: Program Design
Relying solely on architecture leaves internal module structure to model discretion, often yielding suboptimal code organization.
Before code generation, developers define concrete program shapes: core types, function signatures, file tree diffs, and call stack trees. Dex emphasizes that program design is heavily underrated in AI coding workflows.
Their team utilizes three lightweight pseudo-code artifacts:
entrypoint runCommand + handleCreateResource + ResourceClient.create(input) + POST /resources + renderResult - legacyCreateFlow
src └── resource + ├── resource-client.ts # NEW - wraps API contract calls + ├── resource-client.test.ts # NEW - covers request/response mapping ~ └── resource-route.ts # MODIFIED - wires create action into UI
interface Item {
id: ItemId
parentId: ItemId | null
// ...
}
interface Cursor {
position: ItemId
direction: 'up' | 'down'
// ...
}
resolveTarget(items: Item[], cursor: Cursor) -> ItemId | null
These artifacts allow rapid iteration between developer and model. Unresolved structural details during planning inevitably trigger costly refactoring during code review.
Stage 4: Vertical Slicing
Rather than generating entire features end-to-end across database, API, and UI in a single pass, vertical slicing breaks work into thin, testable end-to-end increments.
AI models naturally favor horizontal layer-by-layer plans (database → service → API → UI).
Horizontal execution prevents intermediate end-to-end testing. Manual verification in the browser or terminal becomes impossible until the final layer is completed.
Vertical slicing establishes working endpoints with mock data first, builds UI views against mock responses, connects real service layers, and finishes with data migrations and edge-case handling.
Frontier models rarely slice work vertically without human intervention. Releasing 1–3 thin slices per iteration allows reviewing 100–200 lines at a time rather than debugging 2,000 lines at once.
Managing code review overhead in the AI era
Even with upfront planning, code review queues remain active. His key insight: "You don't have too many PRs; you have too many low-quality PRs."
Well-structured PRs that conform to team architecture conventions are straightforward to review.
Conversely, PRs requiring 20%+ rework impose significant cognitive load. Unguided AI-generated PRs often require near 50% rework.
"You don't have too many PRs; you have too many low-quality PRs."
Upfront planning reduces code review friction. To determine when full four-stage planning is warranted, he proposes a decision framework based on expected risk.
His team tailors planning depth by task scale: roughly 40% of small tasks use direct single-prompt agents, medium tasks combine product and architecture into a single plan, and full four-stage planning is reserved for major features.
He defines "Expected Pain" as:Expected Pain = Probability of Rework × Severity of Rework
Evaluating three points along this curve: a 2-minute quick prompt carries a ~50% rework probability; 5 hours of detailed spec writing by a senior engineer drops rework probability to ~10%; spending 20 hours writing all code manually eliminates AI leverage entirely.
He notes that minor UI tweaks carry low rework severity, keeping total expected pain minimal even if rework probability is high.
If 10 minutes of initial planning eliminates 80% of expected pain, avoid spending six hours over-specifying it.
Accepting constraints to find true leverage
While fully autonomous software generation remains an attractive vision, current model limitations require structuring workflows around realistic capabilities.
Rather than chasing hypothetical 10x–100x efficiency claims at the expense of code quality, teams can achieve a sustainable 2x–3x throughput increase by adopting structured upfront planning.
He concludes with four key principles:
StrongDM responds to the article
Following Dex's comment regarding sporadic updates on StrongDM's public progress page, StrongDM AI Labs responded on Hacker News.
StrongDM engineer jaytaylor clarified on July 23 that updates occur monthly as milestones are met. They remain optimistic that software engineering challenges will succumb to automated factory pipelines as base models improve. Dex replied requesting a retrospective detailing successes and lessons learned.
AI-generated code degrades over time because of how models are trained
HumanLayer founder Dex Horthy published a two-part essay analyzing why "lights-out software factories" fail. This one-pager summarizes his evidence, mechanics, and proposed workflow.
↓ One-page summary · Includes an animated diagram
Faros AI compared two years of engineering data across 22,000 developers and 4,000 teams within the same companies during low-AI vs. high-AI periods. Upstream output increased, but downstream quality declined.
Incidents per PR normalizes for submission volume, indicating that individual changes became inherently riskier. Meanwhile, unreviewed PRs merged directly into main rose 31.3%. Source: Faros AI telemetry report cited by Dex Horthy.
Attributing code quality failures to weak prompts or missing reviewer agents overlooks fundamental model weight constraints.
Minor tool design changes alter execution results (SWE-Agent 2024)
Reviewer agents and extra token compute catch surface-level errors
Claude Code succeeded because Anthropic trained base weights directly on production tool signatures
OpenAI's team notes: Harness engineering without weight access cannot compete with co-designed models
Reinforcement learning optimizes models strictly according to evaluation criteria within the grading harness.
Incorporating maintainability into rewards remains difficult due to evaluation latency.
Frontier efforts like Abundant AI's SWE-Marathon (long-horizon partial scoring) and Cognition's Frontier Code (penalizing redundant tests) attempt to evaluate maintainability, though practical deployment remains early stage.
Even with upfront planning, code review queues remain active. His key insight: "You don't have too many PRs; you have too many low-quality PRs."
per dev
per PR
Training sets the ceiling.
- × Future maintainability
- × Architectural integrity
- × Shotgun surgery scope
Product Review → System Architecture → Program Design → Vertical Slicing.
Review 1–3 thin slices iteratively.
10x-100x claims unverified
Members can copy or download the full Markdown, and let their AI subscribe and ask.
Found this useful? Leave your email — every new explainer, the moment it's out. Unsubscribe anytime.



