Can AI Agents Keep Software Engineering Under Control? A Deep Dive into Harness Engineering
The article analyzes how AI agents can write code yet remain uncontrollable, examines the shortcomings of prompt engineering and simple loops, and proposes Harness Engineering—a structured, constraint‑driven, feedback‑rich environment that turns software development into a stable, closed‑loop control system.
1. An Unexpected Starting Point
Reading OpenAI’s "Harness engineering: leveraging Codex in an agent‑first world" and George’s "Harness Engineering Is Cybernetics" reveals three historical occurrences of the same pattern: James Watt’s centrifugal governor (18th century), the rise of Kubernetes, and OpenAI’s Harness Engineering. Norbert Wiener later named the pattern "cybernetics," a term that also inspired the name Kubernetes.
2. Software Engineering Becomes a Continuous Process
Traditional software engineering follows a static pipeline: Human → Write code → Run system When AI agents intervene, the pipeline changes to:
Human → Describe task → Agent continuously generates code → Run systemThe key shift is not who writes the code but that the system is no longer built once; it evolves continuously. Each step changes the system state, can introduce bias, and creates path dependence, raising the question: How can we keep this ongoing process from becoming uncontrollable?
3. The Limits of Prompt Engineering
Prompt‑to‑model‑to‑output works for simple tasks, but in complex engineering it fails because prompts cannot capture long‑term state, enforce structural constraints, or correct mid‑process drift. This creates an open‑loop system where errors, once produced, are amplified.
4. The Rise of the Loop – Progress with a Critical Flaw
A typical loop looks like:
Task → Agent executes → Result → Feed back as input → AgentWhile loops add iteration and apparent self‑repair, they do not guarantee control. Problems observed include:
Bias accumulation: each generation may introduce tiny errors that are never automatically constrained, eventually steering the system away from its goal.
Architecture drift: repeated agent modifications erode layered structures, introduce temporary code, and duplicate logic, leading to a system that "runs but is unmaintainable."
Local optimisation, global loss of control: agents fix immediate bugs and satisfy current tests but lack mechanisms to ensure global consistency or long‑term stability.
Thus, a loop merely keeps the system running without providing a stabilising mechanism.
5. Harness Engineering – OpenAI’s Engineering Method
OpenAI built a system using a Codex Agent that produced over one million lines of code, with the agent handling almost all development and iteration. They concluded that the problem lies not in the model but in the engineering approach.
5.1 A Key Shift
When an agent fails, the question changes from "Why did the model err?" to "What is missing in the system that makes the error inevitable?"
5.2 Defining Agent‑First
Harness Engineering is defined as constructing an environment where agents can perform software engineering reliably. The environment consists of three pillars:
Context – structured documentation, a single source of truth repository, and clear interfaces.
Constraints – architectural limits, layered restrictions, and automated checks that bound the agent’s action space.
Feedback – tests, CI pipelines, and automatic corrective loops that detect and fix deviations.
These are not a collection of tools but an executable, verifiable, and repeatable engineering structure.
5.3 Solving Specific Agent Issues
For agents that "don’t know what to do," the solution is structured docs, a single‑source repo, and explicit boundaries. For agents that "can do anything," the solution is architectural constraints, layering, and automated checks. For agents that "mistakes are acceptable," the solution is comprehensive testing, CI enforcement, and automatic feedback.
Combined, these mechanisms give the system self‑correction rather than perpetual drift.
6. Harness Engineering as a Control System
In control‑theoretic terms, Harness Engineering acts as the controller in a closed‑loop system:
Goal → LLM (constraints + context) → Agent (execution) → Output (code) → Test/CI/Observation → Feedback → Back to systemThe loop includes a clear goal, a controller (LLM with constraints), an actuator (Agent), measurable output, and feedback that drives correction.
7. Why These Mechanisms Stabilise the System
7.1 Context – Reducing Errors Before They Appear
Without context, agents must guess, introducing uncertainty. Structured context provides explicit boundaries, interfaces, and goals, thereby reducing error generation—similar to design constraints or type systems in traditional engineering.
7.2 Constraints – Limiting the Action Space
Absent constraints, agents can modify any part of the codebase and introduce arbitrary dependencies, leading to an infinite state space. Constraints limit dependencies, call paths, and structural changes, keeping the system within a controllable space.
7.3 Feedback – Continuously Steering Back to the Correct Path
Even with context and constraints, deviations occur. Feedback mechanisms detect these deviations (e.g., test failures, CI rejections) and enforce corrective actions, providing automatic error‑correction capability.
8. Software Engineering in the AI Era as Entropy Control
AI‑driven systems are high‑entropy: each step creates a new state, expanding the state space and increasing inconsistency. Without control mechanisms, the system diverges and eventually fails. Harness Engineering’s context, constraints, and feedback act as entropy‑reducing forces, keeping the system stable, convergent, and maintainable.
9. A Shift in Engineering Cognition
Previously, engineers focused on code correctness and feature completeness. Now the focus shifts to system controllability, behavioural convergence, and preventing runaway paths. In other words, the engineering object moves from "code" to a "behavioural system."
Conclusion
Harness Engineering is not a fleeting tool trend; it marks a deeper transformation where software engineering evolves from building systems to controlling systems. Agents provide capability, loops provide execution, and Harness Engineering supplies the stabilising structure that prevents a continuously generating code system from spiralling out of control.
AI Large-Model Wave and Transformation Guide
Focuses on the latest large-model trends, applications, technical architectures, and related information.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
