[KongchangAI]
· 3 min read· 1,825 words

AI Software Factory: How to Orchestrate a Team of Autonomous Coding Agents

AI Software Factory: How to Orchestrate a Team of Autonomous Coding Agents

AI programming isn't about a faster version of yourself—it's a team that needs managing; factory-style orchestration is the way forward.

The article argues that treating AI as a "faster version of yourself" is the root of developers' current predicament. Benchmarks show frontier models score only 14.8% in unsupervised continuous iteration, severely degrading codebases—bad code is more expensive than ever. The way out is a "software factory" model: a spec agent writes the spec, a build agent writes code, multiple sub-agents review independently, failures loop back, and humans only do final merge approval. This demands stronger fundamentals—a ubiquitous language file, deep module design, and TDD as a speed limit—plus micro-VM sandboxes, default-deny network access, and out-of-container key injection. Tiered model scheduling, Git WorkTree parallelism, and in-repo Markdown boards control cost and coordinate the team.

From Code Reviewer to Factory Commander

Watching AI spit out hundreds of lines of code in one go, with no idea how it works—and even less idea how to fix it when it breaks—is the real predicament many developers face today. The root of the problem is that we mistakenly treat AI as a "faster version of ourselves," when it actually behaves more like a team that needs to be managed. This article, based on an in-depth analysis from a YouTube tech channel, maps out the full path from the "slop code crisis" to "software factory orchestration."

The Slop Code Crisis: The Illusion of Specs-to-Code

The speed of AI-generated code tricks us into thinking code is cheap

There's a data point every person relying on AI to write code should pay attention to: on the Slop Code Bench benchmark, one frontier model scored just 14.8%. The key insight researchers uncovered is that when you don't give the complete problem definition upfront, but instead let the model iterate step by step and keep adding features (which is exactly the norm in real software development), an unsupervised model will severely degrade codebase quality over time.

One line from the original hits the nail on the head: "Code isn't cheap. Bad code is the most expensive it's ever been." Blindly relying on AI output without any architectural oversight is essentially technical debt by another name. We once thought that AI generating code in seconds meant code had become cheap—but a tangled, incomprehensible codebase completely blocks you from exploiting AI's speed. If AI can't even read the messy code it just built, productivity drops to zero.

AI-generated code has several typical problems: it assumes your intent without asking about requirements, like an overeager new hire; it's extremely verbose, circling around and burning tokens; it confidently delivers code that doesn't even compile; it dumps a large, untested chunk of code on you all at once; and it creates masses of fragmented shallow modules, forcing you to stuff the entire system's logic into an exhausted brain.

Specs-to-Code refers to an idealized development paradigm: humans first write a complete, precise specification (spec), and AI can then directly generate all the code from it. The term gained popularity in AI programming discussions in 2023–2024, often promoted as "the endgame of software engineering." But in practice it faces a fundamental challenge: real requirements are often vague and gradually clarified, and it's very hard for humans to write a zero-ambiguity spec before starting work; meanwhile, LLMs don't flag missing information as an error—they "fill in the blanks" themselves, causing deviations to accumulate across iterations. This is the deep reason why models score poorly on benchmarks—the problem isn't model capability, but that the premise of a "one-shot perfect spec" simply doesn't hold. As a result, the industry is gradually shifting toward a factory-style process where specification and implementation evolve alternately, with automated review as a backstop.

The Rise of the Software Factory: An Automated Closed Loop

Humans only step in at the final merge approval stage

The software factory is not an entirely new concept. Back in 1968, Bob Beamer of GE proposed the original idea; reusable frameworks emerged in the 2000s; and in the 2010s, CI/CD pipelines automated testing and release. Today's agent factory is the next step in this evolutionary line—automating the "cognitive grunt work" between traditional stages.

The automation loop of a modern factory looks like this: a feature request comes in → the spec agent writes the spec → the build agent writes the code → sub-agents for security, UX, UI, quality, and others review independently → if any one fails, it goes back to the build agent → only when everything passes does it escalate to a human for merge approval. You review a polished finished product, not micromanage things on the assembly line.

Slop Code Bench is a class of benchmarks for evaluating the quality of AI-generated code, deliberately designed to mirror real development: rather than having the model answer isolated algorithm problems correctly in one shot, it simulates multi-round iteration with continuously added features, and examines the maintainability of the codebase over long-term evolution. The word "slop" comes from the AI community and refers to low-quality, redundant generated content that looks plausible but doesn't hold up under scrutiny. The key conclusion this benchmark reveals is that there's a huge gap between a model's performance on single-turn tasks and its performance in continuous iteration scenarios—the latter is closer to engineering reality. So when citing such scores, pay attention to the test conditions and timeliness—models iterate quickly and specific numbers change rapidly, but the structural problem it reveals—"unsupervised iteration leads to quality degradation"—is stable.

The Fundamentals Matter Even More

A counterintuitive conclusion: AI won't replace software engineering fundamentals—it makes them far more important.

Ubiquitous Language: Put a simple Markdown file in the repo listing the project's core terms. Force AI to reference it when planning and writing code, and AI is compelled to communicate using your precise vocabulary, eliminating room for guesswork. This is an antidote to AI's verbosity and tangents.

Deep Module Design: AI naturally gravitates toward creating a chaotic web of shallow modules that expose too much complexity and quickly lose context. Force the architecture toward deep modules—hiding complexity behind minimal interfaces—and you design the clean interfaces, tactically delegating the dirty implementation to AI. It's like giving it a sandbox with clear boundaries.

Test-Driven Development (TDD): TDD is essentially the speed limit for AI. When AI "can't see as far as the headlights shine," it builds too much without verification. TDD guarantees a tight feedback loop: write a test → watch it fail → write just enough code → watch it pass. Small steps, verified, rollback-able.

Deep Module is a core concept from the classic software design book A Philosophy of Software Design, contrasted with "shallow modules": a deep module has a minimal interface and encapsulates a large amount of internal complexity; a shallow module has a complex interface where each method does only a little, leaking complexity to the caller. The criterion is the ratio of "interface complexity" to "complexity the implementation can hide." This distinction is especially critical for AI collaboration: shallow modules force AI to consume a lot of context while reading code yet still struggle to grasp the overall logic, frequently losing the global view. Enforcing deep module design amounts to using a small number of carefully designed interfaces to delineate the sandbox boundaries for AI, letting it implement freely within those boundaries without complexity spilling out.

Secure Isolation: Give Agents a Disposable Sandbox

Security must be solved before giving autonomous agents free rein

If we want agents to run tests and iterate on code autonomously, how do we prevent them from wiping the database or leaking API keys? The answer is a fully isolated runtime environment. Never run agents directly on a bare-metal OS. Use tools like Docker Sandboxes to spin up lightweight micro-VMs in seconds—even if an AI hallucination tries to delete everything, the only thing destroyed is temporary content inside the sandbox, and your personal files remain untouched.

Network access inside the sandbox must also be strictly limited: deny all external traffic by default, allowing only necessary dev tools and trusted registries—that's enough for the agent to get work done while blocking malicious NPM packages hallucinated by AI. For API keys, use secure key injection: when a network request leaves the sandbox, a proxy outside the container intercepts it and injects credentials. The AI container never knows your real GitHub token; malicious code that prints environment variables only sees useless fake tokens.

Orchestrating the Agent Team: Division of Labor and Cost Control

Use interrogative prompts to have AI ask 50 questions first to align on goals

With fundamentals solid and the environment secure, you can then optimize the entire factory pipeline. Practical approaches mentioned in the original include: spend 20 minutes on intensive planning before starting, using "interrogate me" prompts to have AI ask you up to 50 questions until both sides share the same vision; equip agents with headless browsers so they can actually inspect the UI; and use Git WorkTree to let multiple agents develop different features in parallel without large-scale merge conflicts.

The technology for managing all this is surprisingly simple: no complex external database needed—transparent Markdown files in the repo can track to-dos, monitor status, and handle handoffs between agents.

Be smart about scheduling: use the strongest frontier model as the brain for architectural logic, mid-tier models for building the frontend, specialized models for complex database structures, and cheap, efficient models for routine reviews. The original's analogy is apt—don't use a bazooka to swat a fly; this saves a lot of cost.

Git WorkTree allows multiple independent working directories to be checked out simultaneously from the same repository, each on a different branch, all sharing the same Git object store. Compared to copying the entire repository, WorkTree saves disk space and keeps commit history consistent, making it especially suitable for multiple agents developing non-interfering feature branches in parallel. Its value in multi-agent orchestration lies in this: parallel agents each work in their own independent WorkTree, avoiding the races and conflicts caused by files in the same working directory being rewritten simultaneously; during merging, things converge through the usual PR and code review process. Combined with a Markdown task board in the repo, you can achieve the factory rhythm of "multiple agents working simultaneously, with humans closing the loop centrally" at extremely low tooling cost.

Conclusion

AI hasn't replaced your job—it has promoted you. You now manage an infinitely scalable, extremely fast team of developers, but they desperately need your strategic guidance, rigorous fundamentals, and a secure runtime environment. Only one question remains: what are you going to build with this new team?

Note: The benchmark scores and model names in this article come from the original video; readers can verify their timeliness themselves.

One-line Summary

AI programming isn't about a faster version of yourself—it's a team that needs managing, and factory-style orchestration is the way forward.

Paragraph Summary

The article points out that treating AI as a "faster version of yourself" is the root of developers' current predicament. Benchmarks show that in unsupervised continuous iteration scenarios, frontier models score only 14.8% and severely degrade codebases over time—making bad code more expensive than ever. The way out is to shift to a "software factory" model: a spec agent writes the spec, a build agent writes the code, multiple sub-agents review independently, failures loop back, and humans only do the final merge approval. This model demands more rigorous fundamentals—a ubiquitous language file to eliminate ambiguity, deep module design to constrain AI's complexity, and TDD as a speed limit—plus secure isolation through micro-VM sandboxes, default-deny external network access, and out-of-container key injection. Finally, cost and team coordination are controlled through tiered model scheduling, Git WorkTree parallel development, and in-repo Markdown boards.

#AI software factory#autonomous coding agents#agent orchestration#deep modules#test-driven development#micro-VM sandbox#Slop Code Bench
Share:

Related articles