Prompt, Context, Harness and Loop Engineering
Since frontier large language models arrived, a branch of engineering has grown around a single idea: improving AI systems without changing the model. Unlike fine-tuning or reinforcement learning, these techniques are non-destructive. The weights stay untouched and only the interaction changes. What began as prompt engineering has since spread into four layers I think of as prompt, context, harness, and loop engineering: asking the right question, supplying the right information, setting the boundaries, and designing the feedback cycle.
Prompt engineering is the practice of designing the instruction that steers a model. Give it a role, state the output you want, and place critical information near the beginning or the end, because models measurably lose material buried in the middle of a long context. For harder tasks, few-shot prompting lets a model infer the expected pattern from examples rather than from ambiguous instructions, and chain-of-thought prompting draws out the intermediate reasoning. Asking a model to critique its own answer before finalising it, as in Self-Refine, helps again. A good prompt is not a complex one; it is the one that stays accurate across many inputs.
Context engineering concerns what the model receives, not how it is asked. It matters most in retrieval-augmented generation, where retrieval quality caps answer quality and irrelevant context actively increases hallucination. A well-written prompt still fails on incomplete or poorly chosen context. The same applies to agents: each should see only what its role requires, not the entire workflow state. Anthropic frames this as treating the context window as a finite resource to be curated. The goal is the right information, to the right component, at the right time.
Harness engineering defines what an agent is allowed to do: its tools, its permissions, its limits. A coding agent may need to edit files, run tests, and debug, but it should not delete files or make irreversible changes without approval. The aim is not to hobble it, but to give it the right tools and nothing more. Toolformer showed that models can learn to call APIs on their own; the Model Context Protocol has since standardised how those tools are exposed. A good harness states both what an agent can do and what it must never do, keeping humans on the critical path.
Loop engineering designs the cycle itself: when an agent plans, acts, evaluates, retries, or escalates to a person. ReAct interleaves reasoning with tool calls; Reflexion feeds failures back as verbal signal so the next attempt improves. Anthropic’s survey of production agents argues that most working systems come from composable patterns rather than elaborate frameworks. Where harness engineering says what an agent can do, loop engineering says how it should operate over time, scaling reliably while involving humans only where judgment adds value.
Each layer manages a different resource. Prompt and context engineering govern what a model knows, harness engineering governs what it can do, and loop engineering governs how it behaves over time. I believe the next frontier is interaction engineering: how humans and agents, and agents with one another, actually collaborate. Every industry has its own workflows, so there may be no universal pattern, only personalised ones.