Why Coding Agents Excel at the Harness, Not the Model
This article examines why coding agents differ so sharply in real development tasks, arguing that the decisive factor is the engineering layer built around the model rather than the model itself. It defines Harness Engineering, explains why model capability alone is insufficient, and walks through a layered architecture, a dual-loop execution engine with multiple recovery paths, context engineering, and tool-calling with verification. It closes with practical guidance for building similar capabilities in your own systems.
While the industry is still debating whether model parameters are large enough, an accidental source code leak has put the real engineering complexity of AI coding agents on display. According to public discussion, a widely praised coding agent exposed a large number of mapping files due to a configuration oversight during release, and then attracted intense attention within days. What the community actually cared about was not the code itself, but a more fundamental question: why do similar products perform so differently on real development tasks?
Many beginners assume the answer is “a stronger base model.” But after reading through the engineering implementation, it becomes clear that model capability is only a necessary condition. What determines stability and usability is the entire set of constraints, scheduling, and verification mechanisms built around the model. Setting aside specific product attributes, this article breaks down from a general technical perspective why coding agents are “strong in engineering.”
1. The Core Thesis: From a Smarter Model to Better Reins
What Harness Engineering Means
Harness Engineering can be understood as “control-layer engineering”: building a deterministic control system around the model that constrains uncertain generation behavior onto tracks that are verifiable, rollback-able, and recoverable. One comment repeatedly cited from the leaked implementation roughly says: what we need is not a smarter model, but better reins. This points to the key tension at the current stage—the model has planning and coding abilities, but lacks a consistent understanding of the real engineering environment.
Why the Model Alone Is Not Enough
A real repository contains a large number of implicit conventions: directory structure, dependency versions, test commands, code style, and historical decisions. This information cannot all fit into the context window, so the model can only “guess.” One wrong guess cascades and amplifies errors in subsequent steps. The value of the harness layer is to turn guessing into querying: fetch exactly the information needed through tools, and固化 the result into the execution trace.
Three Principles of the Design Philosophy
- Determinism first: use conventional code for flow control, permission checks, and result判定, rather than leaving them to the model’s free play.
- Observability first: leave a trace for every action, every tool return, and every failure reason, making it easy to locate and replay.
- Small-step verification first: cut large tasks into independently verifiable segments, avoiding the generation of massive changes that are hard to review all at once.
2. Layered Architecture: Confining Complexity to Modules
Separating the Interaction Layer from the Orchestration Layer
The interaction layer handles sessions, input parsing, permission confirmation, and result presentation; the orchestration layer handles task decomposition, state progression, and exception handling. Once separated, the interface form can be replaced while the core execution logic stays stable, which is also the prerequisite for an engineering system to evolve over the long term.
Plugin-based Capability Layer
Capabilities such as file read/write, command execution, retrieval, and test running are abstracted into a unified tool interface. Each tool declares its input schema, side-effect level, and required permissions, and the orchestration layer decides whether to allow the call and whether human confirmation is needed. The tool description itself is a form of prompt engineering: the more precise the description, the lower the probability that the model picks the wrong tool.
A Closed Loop for Data Flow
A typical chain is: collect context → decide action → call tool → verify result → update memory. The key to the closed loop is that “verification” cannot be omitted. An agent without verification is just a text generator; only with verification does it carry engineering meaning.
3. Execution Engine: Dual-Layer State Machine and Recovery Paths
Separation of Concerns in the Two Loops
The outer loop manages the task lifecycle: planning, execution, and wrap-up; the inner loop manages single-step reasoning and tool calls. The outer loop cares about “is it done,” while the inner loop cares about “how to do this step.” Mixing them leads to state explosion and makes targeted recovery difficult.
The Meaning of Multiple Recovery Paths
Mature implementations usually preset multiple recovery strategies: retry after a tool error, switch approach when the result does not match expectations, compress when context exceeds limits, degrade when permission is denied, and skip with annotation when an external dependency is unavailable. The value of recovery paths is to turn “failure” into a “branch that can continue,” rather than terminating directly.
Illustrative pseudocode:
while not outer.done():step = planner.next_step(state)for attempt in recovery_paths(step):result = tool_registry.invoke(step, attempt)if verifier.accept(result):state.commit(result)breakelse:state.mark_blocked(step.reason)
Completeness of Termination Conditions
Termination cannot judge only “task completed”; it must also cover: reaching the step limit, exhausting the budget, repeated ineffective actions, unresolvable dependency conflicts, and the need for human intervention. The more complete the termination conditions, the less likely the system is to spin idle.
4. Context Engineering: The Invisible Battlefield That Decides Success
Retrieval on Demand Rather Than Full Feeding
Stuffing the entire repository into the context is neither economical nor accurate. A more reliable approach is to build a searchable code index, locate relevant fragments by symbol, call relationships, and change history, and inject only the necessary content into the current step.
Layered Compression and Summarization
In long tasks, context expands rapidly. A common strategy is to produce structured summaries of completed steps, keeping conclusions, the list of modified files, and open questions, while discarding redundant reasoning text, thus maintaining continuity within a limited budget.
The Dual-Layer Structure of Memory
Short-term memory stores the current task trace, while long-term memory stores project conventions and historical preferences. Both need clear write and invalidation rules; otherwise, stale information will continuously mislead subsequent decisions.
5. Tool Calling and the Verification Loop
Tool Description as Contract
The input schema, return structure, and side-effect description together form a contract. A clear contract allows the model to orchestrate correctly; a vague contract causes errors to erupt in clusters after multiple steps.
Verification Should Be Multi-Layered
Static checks, unit tests, build results, and diff review form multi-layer verification. A failure at any layer should trigger targeted repair, not a full restart.
Permissions and Security Boundaries
Write operations, delete operations, and external access should be authorized in tiers, and high-risk actions require explicit confirmation. Security boundaries are not the enemy of experience, but the prerequisite that allows automation to dare to run in a real repository.
6. Engineering Takeaways
To build similar capabilities in your own system, you can prioritize four things: a unified tool interface and permission model; a searchable code context; a dual-loop with multiple recovery paths; and making verification a mandatory step. Combined with container platforms to isolate the execution environment, logging services to leave traces, and monitoring and alerting to track anomalies, the system’s stability will improve significantly.
The conclusion is clear: the gap between coding agents lies mainly not in the model, but in the reins. Giving uncertainty to the model and certainty to engineering is the reusable practical path at the current stage.
