Start here
Harness vs Prompt vs Context Engineering: Key Differences
Harness engineering vs prompt engineering vs context engineering: a plain comparison table, one task fixed three ways, and a symptom checklist.
On this page
- Harness engineering vs prompt engineering vs context engineering at a glance
- Prompt, context and harness engineering defined
- One task, improved three ways
- How to tell which layer failed
- Where tools, MCP and skills fit
- Does prompt engineering still matter?
- Common mistakes when you compare the three
- Which should you learn first?
- A connected way to learn all three layers
- Frequently asked questions
- Final thoughts
- Sources and further reading
The short answer
The main difference in harness engineering vs prompt engineering is scope. Prompt engineering shapes the instructions you give an AI model. Context engineering decides what information the model sees at each step. Harness engineering designs the whole system around the model, including its tools, permissions, saved state, stop rules and checks. Each layer contains the one before it, and each one fixes a different kind of failure.
When an agent fails, the natural thing to do is rewrite the prompt. Sometimes that works. But you can spend an hour on better wording when the agent never saw the right file, or when nothing was there to catch the mistake.
This guide will help you work out which layer to fix. I compare the three terms, explain each one in a sentence and take one task through all of them. Near the end there is a table of symptoms, so the next time something breaks you will know where to look first.
Harness engineering vs prompt engineering vs context engineering at a glance
Prompt engineering, context engineering and harness engineering differ in what they control, how far they reach and which failures they can fix. Here they are side by side.
| Question | Prompt engineering | Context engineering | Harness engineering |
|---|---|---|---|
| What it shapes | The instructions and examples | The information in the context window at each step | The environment the agent acts in and how its work is checked |
| Main question | What should the model do? | What does the model need to know now? | What can the agent do, and how do you know it worked? |
| Scope | One message or system prompt | One step or session | The whole run, across steps and sessions |
| Typical artefacts | Task brief, role, examples, output format | Retrieved files, search results, summaries, memory, tool results | Tools, sandbox, permissions, state files, step limits, tests, traces |
| Mostly built with | Writing | Writing plus retrieval and selection code | Code, configuration and workflow rules |
| Failure it fixes | The model misunderstood the task | The model lacked a fact or used an old one | The agent did something unsafe, looped, lost progress or claimed false success |
| Failure it cannot fix | A missing file or a missing test | An unsafe action or an unchecked result | A model that cannot reason through the task |
They nest inside each other. A harness contains the handling of context, and the context contains the prompt. Teams draw the lines in slightly different places, so use the table to work out who owns a failure. It will not help you win an argument about names.
Prompt, context and harness engineering defined
You can define each one in a sentence, and these are the definitions I use here:
- Prompt engineering is the practice of writing the instructions, examples and output format that tell a model what to do.
- Context engineering is the practice of choosing which information goes into the model's context window at each step, and what to leave out.
- Harness engineering is the practice of designing the system around the model, from tools and permissions to saved state, loop rules and completion checks.
Prompt engineering is the oldest of the three. It grew up with the early large language models (LLMs), when most of the work was finding the words and examples that gave you the right answer in one reply.
Context engineering became popular in mid-2025. Simon Willison's post, Context engineering, notes that Shopify's Tobi Lütke and Andrej Karpathy both promoted the term in June of that year. Lütke described it as giving the model all the context it needs to plausibly solve the task. Anthropic later called it "the natural progression of prompt engineering" in Effective context engineering for AI agents. Its guide treats context as a limited budget, because a model remembers less accurately as its window fills up.
Harness engineering arrived in February 2026, after posts from Mitchell Hashimoto, OpenAI and LangChain. You can read the history, and meet the six parts of a harness, in my beginner's guide to harness engineering.
One task, improved three ways
The easiest way to feel the difference is to fix one task at each layer. Suppose you ask a coding agent to add a CSV export to a habit-tracker app. It should include only the habits you completed in the week you have selected.
The agent adds a download button and tells you it is done. You open the file and find every record from the past year, and it turns out that the agent never looked at its own output. Your first thought will be to write a longer prompt. But this one run has three separate gaps, and they belong to three different layers.
The prompt fix: say exactly what you want
The first gap is in the instructions. "Add CSV export to the history page" does not say which records you want, so the agent guessed. A proper brief takes away the guessing:
Add an "Export week" button to the history view.
Export only the selected week's completed habits.
Columns: date, habit_name, completed (true/false).
Keep the existing history filter working.
Done means: changing the selected week changes the exported rows.Now the agent knows what it is aiming for. The brief still cannot tell it how this codebase stores a week, and it cannot make the agent open the file before it celebrates. You could write "ONLY the selected week" five times in capitals, and neither of those gaps would close.
The context fix: show the agent what it needs
The second gap is in what the agent knows about your application. You give it four things, and you can say why each one is there:
src/dates.py, because it defines when a week starts.src/models/habit.py, because it shows how the app stores completions.src/views/history.py, because the new button must respect its filter.- Two sample records from different weeks, so the agent can see the boundary.
You also leave things out, such as the marketing folder and the old migration scripts. Files that do not matter compete for the model's attention. On a longer task, context engineering also means deciding what to keep between steps. A good summary has exact file paths and the checks that are still to run. "Progress is good" will not help anybody tomorrow.
The harness fix: control the action and demand proof
The third gap is in what the agent may do and what it has to prove. You run it on a separate git branch and let it write only in the src/ and tests/ folders. You also add a test that has to pass before it may report that it is finished:
def test_export_only_selected_week(client, two_weeks_of_records):
rows = client.export_csv(week="2026-W10")
assert rows, "export is empty"
assert all(r["date"].startswith("2026-03") for r in rows)
assert all(r["completed"] == "true" for r in rows)This test is simplified, but look at what has changed. Whether the task is complete now depends on the rows in the file, and the agent's summary has no say in it. A retry limit stops it from repeating a failing command, and a progress note and a git commit let a new session carry on if the first one dies halfway. You could not write any of these as a sentence in a prompt, because they live in code and configuration.
How the three layers meet in one step
Let us follow a single step after all three fixes. The harness builds the request and loads your brief, which is the prompt layer. It adds the date helper and the latest test output, which is the context layer. The model answers with a tool call that edits src/views/history.py.
Before anything is written, the harness checks that the path is inside the allowed folders. It then runs the tests and sends the result back as fresh context. If a test fails, the loop goes round again, and if the step limit runs out first, the harness stops and tells you.
Take away any one layer and you can predict what will happen:
- Without the brief, the agent builds the wrong export.
- Without the files, it invents its own date logic.
- Without the check, it reports a confident "done" on a broken file.
How to tell which layer failed
Start from the symptom. This table connects the failures you are most likely to see with the layer that usually owns them and the first thing to try.
| Symptom | Likely layer | First fix to try |
|---|---|---|
| The agent solved a different problem from the one you meant | Prompt | Rewrite the brief with inputs, outputs and a definition of done |
| The output format is wrong or changes between runs | Prompt | Add one example of the exact format |
| The agent invented a function or used an outdated API | Context | Supply the real file or current documentation |
| It ignored a project convention | Context | Add the rule to the project instruction file, such as AGENTS.md |
| Quality drops late in a long session | Context | Summarise and restart with a clean context window |
| It edited files or systems it should not touch | Harness | Enforce a workspace boundary in code, not in the prompt |
| It repeats the same failing command | Harness | Add a retry limit and return the error message to the agent |
| It forgets finished work after a restart | Harness | Save progress to a file and commit after each step |
| It says "done" when the result is wrong | Harness | Require test output or another check before you accept completion |
Change one likely cause and run the same task again. If you change the prompt, the model, the tools and the permissions together, you will never know which of them helped. My guide to why AI agents fail goes deeper into each symptom, and testing AI agents shows how to compare two runs fairly.
Where tools, MCP and skills fit
Tools, Model Context Protocol (MCP) servers and skills work across all three layers. Each one helps with a particular job, and none of them replaces the controls you still have to build.
| Mechanism | What it does | Layer it mostly serves | What it does not do |
|---|---|---|---|
| Tool calling | Lets the model ask for an action, which your code runs and reports back | Harness | Check inputs or enforce permissions by itself |
| MCP | A standard way to connect AI applications to outside data, tools and workflows | Context and harness | Decide who may use a tool or whether a result is correct |
| Agent Skills | Packaged instructions, scripts and references that load when a task needs them | Prompt and context | Create isolation or grant access to a service |
| AGENTS.md | A project file of standing instructions for coding agents | Prompt and context | Stop an agent from breaking a rule it was given |
The Model Context Protocol documentation describes MCP as an open-source standard for connecting AI applications to external systems, and compares it to a USB-C port. A port lets you plug something in. You still need input checks, access limits and a clear idea of what a useful result looks like.
Skills are a lovely example of context engineering in practice. Anthropic's Agent Skills overview explains that only the name and description of each skill load at startup, and the full instructions load when a task matches. The context window stays small until the agent needs the detail. AGENTS.md does something similar for project rules, across many coding agents.
Does prompt engineering still matter?
Yes, it does, and it now lives inside something larger. Look at what LangChain changed when it improved its coding agent in February 2026. The model stayed the same, and the benchmark score still went up.
Some of those changes were prompts, such as instructions to plan, build, verify and fix in a loop. Others were code, such as a step that forced a check before the agent could leave and a detector for repeated edits to one file. The team also changed how much reasoning the model used at each stage.
Clear instructions are still the cheapest improvement you can make, so make it first. Once they are clear, each extra sentence gives you less, and the next gain usually comes from better context or a control in the harness.
Common mistakes when you compare the three
These mistakes come up again and again in discussions of the three terms:
- Treating the terms as a fashion cycle. Each new term adds a layer around the old one. Context engineering contains prompt engineering, and harness engineering contains both.
- Putting every fix in the prompt. "Never touch the database" in a prompt is a request. A blocked path in the tool code is a boundary.
- Treating a bigger context window as a fix. A larger window holds more text, but it does not stop unsafe actions or check results.
- Loading every file in case it helps. Extra files compete for attention and push out the facts the agent needs.
- Changing all three layers at once. You lose the ability to say which change helped.
Which should you learn first?
Learn them in the order they nest, because each one depends on the one inside it:
- Write clear task briefs with a definition of done. You can test the effect in minutes.
- Practise choosing context. List the files and facts a task needs, and say why each one is there.
- Build a small loop with one or two tools, so you see how actions and results flow.
- Add one boundary and one check, such as a workspace limit and a required test.
- Save state and set stop rules once tasks run longer than one session.
You may also come across loop engineering and graph engineering. In my book, I treat them as parts of harness engineering. Loop engineering is about when an agent continues, retries or stops. Graph workflows make each state and approval point visible, which helps when you already know the shape of a task. Anthropic's Building effective agents gives similar advice and suggests a fixed workflow when the steps are predictable.
The harness engineering tutorial takes you through steps 3 to 5 in Python, and the 30-day learning roadmap spreads the whole sequence over four weeks. For more reading, The 20 Must-Read Engineering Articles is one of the PDFs in my free resource pack.
A connected way to learn all three layers
It is easy to study prompts, context and harnesses as if they were three separate subjects. I wrote The Harness Engineering Blueprint because they are not, and I think it is the best book for learning harness engineering if you want to see how they work together. You start with a first prompt, and by the end you have a harness that you can test and trust.
The free companion course lets you build each layer yourself. If you would like to see what else is available, look at my list of harness engineering courses.
Frequently asked questions
1. What is the difference between prompt engineering and context engineering?
Prompt engineering is how you ask, and context engineering is what the model knows when you ask. A prompt might be beautifully written and still fail because the model never saw the file, the search result or the earlier decision it needed. Context engineering makes sure that it does.
2. Is context engineering the new prompt engineering, or only a rebrand?
It is a wider job, so it deserves its own name. The prompt is one of many things in the context window. Once agents began to run for many steps, somebody had to choose the right files, results and memories for each step, and that work had very little to do with wording.
3. Is prompt engineering dead?
No. A clear request with a definition of done is still the first thing to fix when an agent misunderstands you, and anyone who builds a harness spends time writing system prompts and tool descriptions. What has faded is the belief that clever wording can make an agent reliable by itself.
4. Do better prompts still make a big difference with newer models?
They do when they make the task clearer. Newer models need fewer tricks, such as pretending to be an expert, but no model can guess a requirement you kept in your head. Once the request is clear, you will gain more from better context or a check on the result than from another paragraph of instructions.
5. Is harness engineering the same as context engineering?
No, because context engineering is one part of it. Harness engineering also covers what the agent may do, where it runs, how it saves its progress, when it stops and how you know the work is right. You feel the difference on the day an agent takes a dangerous action while knowing everything it needed to know.
6. Will bigger context windows replace harness engineering?
I do not think so. A bigger window lets the model read more, and that is useful. It cannot stop a bad action, save progress for tomorrow or prove that an answer is correct. Anthropic also points out in its context engineering guide that recall gets worse as the window fills, so you will still have to choose with care.
7. Who coined the term context engineering?
Nobody is credited with inventing it. Shopify's Tobi Lütke and Andrej Karpathy both promoted the term in June 2025, and that is when it spread. Anthropic published its own guide to context engineering for agents in September of the same year.
8. Is loop engineering real, or a new name for the agent loop?
Loop engineering is real work, and the name is newer than the agent loop. IBM defines loop engineering as designing the loops that guide agents towards a goal with minimal human help. Machine Learning Mastery's introduction to loop engineering calls it a rallying phrase for research that has built up since 2022. The Harness Engineering Blueprint, which I wrote, treats it as one layer that harness engineering brings together. I answer whether harness is a buzzword separately.
9. What is the difference between agentic engineering and vibe coding?
The difference is whether someone checks the code before people rely on it. Simon Willison defines agentic engineering as developing software with coding agents, and keeps vibe coding for unreviewed, prototype-quality code. In his May 2026 post on vibe coding and agentic engineering, he said the two had started to blur in his own work. He no longer reviews every line. Tests and completion checks in the harness help you verify code that you do not read line by line.
Final thoughts
The next time an agent lets you down, leave the prompt alone for a minute. Look for the symptom in the diagnosis table, fix the layer it points to, and run the same task again. You will often find that the words were fine all along.
If you would like to watch the three layers working in one small program, build the agent in the harness engineering tutorial. Harness engineering vs prompt engineering is much easier to understand once you have seen each layer change the result.
Sources and further reading
- Abhishek Ashtekar, The Harness Engineering Blueprint, Chapters 2 to 7 and 13 to 15.
- The Harness Engineering course, free companion lessons and projects.
- Simon Willison, Context engineering, June 2025.
- Anthropic, Effective context engineering for AI agents, September 2025.
- Vivek Trivedy, LangChain, Improving Deep Agents with harness engineering, February 2026.
- Anthropic, Building effective agents, December 2024.
- Ivan Belcic and Cole Stryker, IBM, What is loop engineering?, July 2026.
- Shittu Olumide, Machine Learning Mastery, An Introduction to Loop Engineering, July 2026.
- Simon Willison, What is agentic engineering?
- Simon Willison, post on vibe coding and agentic engineering, May 2026.
- Model Context Protocol introduction, official documentation.
- Anthropic, Agent Skills overview, Claude documentation.
- AGENTS.md, an open format for guiding coding agents.