跪拜 Guibai
← Back to the summary

Harness Engineering: The Missing Layer Between Chatbots and Working Agents

🔥🔥 So it's the end of 2026 and you still don't get what Harness is?

Harness Engineering, Prompt Engineering, and Context Engineering are explained differently everywhere.

If there's any difference, trust my version.

If you still think of an AI Agent as "a large model + a prompt", you're likely already standing on the edge of being left behind.

Because what really decides whether AI can do work today isn't whether the model can chat, but whether you've mastered a new engineering method: Harness Engineering (I think this translation fits best, though some call it "drive engineering").

Remember this in one sentence:

AI Agent = LLM + Harness Engineering.
The model decides how smart it is; the Harness decides whether it can reliably get the job done.

image.png

This article doesn't pile up jargon; it explains the relationship between prompt engineering, context engineering, and Harness Engineering once and for all. After reading, you'll understand three things:

First, see the big picture: the three engineering disciplines solve three different problems

In 2026, OpenAI mentioned Harness Engineering in a blog post, and the term quickly spread through the AI world.

But the reality is: many people jump on the bandwagon without even knowing what it actually means. That's absurd, though reasonable in an AI circle where "major news every three days, earth-shattering every five.”

The problem is—concepts can follow trends, but work can't.

Before diving into details, let's lay out the evolution. These three aren't parallel new terms; they're stacked one on top of another:

Stage Engineering Name Core Problem It Solves Typical Methods
Layer 1 Prompt Engineering Model talks without guidance, says nonsense Role setting, constraints, output format
Layer 2 Context Engineering Context can't fit, gets forgotten, gets mixed up Recall, compression, assembly
Layer 3 Harness Engineering Model only chats, doesn't keep working, drifts off Execution layer, memory layer, feedback layer, orchestration layer

Remember this main thread; everything after is just filling in the details.

Prompt Engineering: First, make the model "talk the right way"

1. Strip away the model's shell, inside is just a parameter file

Peel off the shell of a product like ChatGPT, and the large model (LLM) inside is essentially a huge parameter file on disk:

image.png

image.png

image.png

The large model does something simple: based on the current input, it predicts what the next token is likely to be. It's essentially always guessing what you want.

image.png

2. If the instruction is too broad, the answer is too broad

Because it's "guessing," the broader your instruction, the less reliable its guess. For example, if you throw a piece of code at it and only say "add sorting," it'll likely just return how to write the sorting part; you need to add "give me the complete function code, don't change my existing code" to get closer to what you want.

image.png

There are many things that can constrain the output:

Together, these constraints are what we call a prompt.

image.png

3. What problem does it actually solve?

Consciously adjusting and designing prompts so the model reliably outputs content and format in the direction you want—that technical discipline is prompt engineering.

image.png

In one sentence: prompt engineering solves the problem of the large model "talking without guidance, saying nonsense."

Context Engineering: Next, make the model "remember and see accurately"

1. A prompt is only part of the context

It's intuitive to think: the longer and more detailed the prompt, the more the model knows, and the more accurate the answer.

The reverse also holds—if the model's answer is inaccurate, it's probably because it doesn't know enough.

image.png

So people naturally stuff more and more material into the model.

All the information packed together and sent to the model is called context; the prompt is only one part of it.

2. The unescapable limitation: the context window

No matter how strong the model, there's an upper limit to how much context it can process at once; that limit is the context window.

In real applications, after a few conversation turns and a few files read, the window fills up easily. At that point, you have to rely on strategies to compress or discard part of the information, and in the process you inevitably lose key information, breaking the completeness and accuracy of the context.

image.png

These problems are collectively called context corruption, and the symptom is: the model starts forgetting, giving inconsistent answers across turns.

So the question becomes: how to stuff the right content into the limited context at the right time. The set of techniques that dynamically manages context is context engineering.

image.png

The prompt is part of the context, so prompt engineering is essentially also part of context engineering.

3. Three steps for implementation: recall, compression, assembly

Context engineering is usually implemented by external programs, like Coding Agents such as Cursor, Claude Code, and Trae. The details differ across implementations, but generally it boils down to three steps:

① Recall: what information to find

Sources can include external materials, historical chat records, the current code environment, program runtime errors, etc. The goal is to pick out the most relevant content. This involves technologies like RAG and Memory, each of which could be a topic on its own; this article won't expand them.

image.png

② Compression: make the information smaller

When there's a lot of information but a limited window, you have to shrink it. A typical approach is to send the information in batches to the model for summarization, keeping the essence.

image.png

③ Assembly: rearrange by structure

Where and in what order information is placed directly affects the model's understanding and output—for example, content near the end tends to get more attention from the model.

So you need to reassemble the content with a certain structure, making the context that goes into the model more concise and relevant, so the output is more stable and accurate.

image.png

4. Why the same model performs very differently across tools

Different AI tools have different context engineering strategies, so even with the same underlying model, switching tools yields noticeable differences in execution results.

That's one of the root reasons many people "switch AI IDEs and feel the model got dumber."

image.png

Harness Engineering: finally wrapping an "engineering shell" around the model

Agent = LLM + Harness

Everything that isn't part of the large model itself basically falls into the scope of Harness Engineering.

In other words, the real competition ahead isn't just model capability, but how this engineering shell is designed. For existing programmers, this is likely the main battlefield going forward.

1. Models are getting smarter, but they only chat

Prompt engineering solves the problem of talking nonsense; context engineering solves the problem of organizing context. The model is smarter, but it still only chats; it can't actually help you do real work.

To make it work, you need to give the large model a set of external capabilities: Bash, sandbox, file system, MCP, and so on.

So it can operate external tools, read and write code files, execute commands, and run tests like a human. Together these capabilities form the execution layer.

image.png

2. A think-then-act loop: ReAct

String these capabilities into a workflow and wrap an outer loop:

  1. Assemble context via prompt engineering and context engineering, and send it to the large model;
  2. The large model thinks, and external programs execute;
  3. Errors and outputs produced during execution get added back into the context;
  4. Continue reasoning and executing until the task is done.

image.png This loop of thinking and acting is ReAct. And the program that can help you execute tasks through chat is an AI Agent.

3. An Agent's essence is a loop; long loops corrupt

The essence of an Agent is a loop. As long as the loop grows long, the context inevitably expands, and even good context engineering can corrupt:

image.png

4. Memory layer: pin down the core information

The solution isn't complicated: ensure every context given to the model includes a set of reusable core information—project goals, tech stack, requirement background, code style, prohibited actions, etc.

As long as that's always there, the model stays within a framework and reduces drift.

image.png

This core information can be written to its own file and fixed in the code repository:

There's no unified name for these files yet; for now let's call them rule files. When the model is invoked, they're automatically injected into the context as system prompts.

If a rule file gets long, the context can explode again.

A common practice is to split it into several shorter files plus a simple router: read bg.md for background, stack.md for tech stack. Generally only file paths are loaded; full content is loaded only when actually needed.

image.png

Combine rule files with prompt engineering and context engineering, and you get the memory layer.

5. Feedback layer: if something goes wrong, come back and fix it

With the memory layer paired with the execution layer, an Agent can keep writing code and running Linters and unit tests.

Once tests find a problem, test output and error messages are added back into the context, driving the next iteration to fix it automatically. This ability to derive errors from verification results and auto-fix forms the feedback layer.

image.png

6. Orchestration layer: avoid running into endless loops

But a loop alone isn't enough. Without global planning and a clear end goal, an Agent can easily drift or fall into an endless, useless loop.

So you need to break the big task into multiple subtasks with clear execution criteria, and drive the Agent step by step according to the plan.

image.png

This capability of global planning, task decomposition, and full-process control forms the orchestration layer.

image.png

7. The four layers together make up Harness

These four layers together form an engineering shell wrapped around the large model—this is Harness Engineering.

image.png

The stronger the large model, the thinner this shell can be; but no matter how strong the model, this shell can never be absent.

How to actually put Harness into practice?

Once the concept is clear, the key question is: how do I use it in my own project? Let's take Claude Code as an example.

1. The lightest approach: write good rule files

Claude Code already natively supports all four layers of Harness. The lightest approach is to write clearly in CLAUDE.md:

image.png

2. Don't want to hand-write it? Bring in a spec-driven plugin

If you don't want to write rules yourself, you can introduce an extension like spec-kit. It breaks a requirement into multiple stages:

  1. First generate the corresponding constraint files to clarify requirements;
  2. Then create a concrete development plan and decompose tasks;
  3. Finally, do the actual modification and testing.

Each stage can update CLAUDE.md once, ensuring that the context injected at each stage is mostly core information.

image.png

This development style is called Spec Driven Development (SDD), and in essence it's an application of Harness Engineering.

Of course, tools like spec-kit aren't yet strong overall; more comprehensive alternatives will likely appear soon.

3. The role changes: from writing code to writing rules and Skills

With Harness Engineering, the programmer's work in AI Coding is shifting from "directly writing code" to "writing rules and Skills."

image.png

Let's summarize

Only when these three layers stack together do you get an Agent that actually gets work done, not just a model that chats.