Free tools Windows power users keep installed
One-click scans. No signup required.
If polishing a prompt is no longer improving an AI workflow, the next fix may be somewhere else: the information the model receives, the software that validates its response, or the process that repeats work toward a goal. Jason Yang’s four-layer framework—prompt, context, harness, and loop—is a practical way to locate that work, not an official industry taxonomy or a requirement to build four separate components.
What are the four layers?
Yang’s framework describes four places engineers can improve work around a model. The boundaries overlap: for example, supplying information and connecting tools can be closely related in a real system. Treat the layers as diagnostic lenses rather than fixed boxes.
As an Amazon Associate I earn from qualifying purchases.
| Layer | What changes | Example in a pull-request review |
|---|---|---|
| Prompt | The direct request to the model | Ask it to find bugs before security and performance issues, skip style nitpicks, and return line numbers with suggested fixes. |
| Context | Information supplied beyond the direct request | Provide project conventions, relevant code, examples, and reference material. |
| Harness | Software that manages an individual model interaction | Assemble inputs, connect tools, require structured output, validate it, and check reported lines against the changed diff. |
| Loop | A repeated task-level process with state, feedback, and stopping conditions | Review the change, apply a fix, run tests, revert a failing fix, and stop at a defined limit or success condition. |
Yang summarizes the framing this way: “I find it useful to think of AI engineering as four layers: prompt, context, harness, and loop.” The example is a conceptual walkthrough with illustrative pseudocode, not a tested implementation or evidence that automated review is reliably safe. The article reports no measured outcome showing that the framework improves results.
How do you tell what needs improvement?
Start with the failure you can observe. These diagnoses are useful starting points, not exclusive categories: a real problem can involve more than one layer.
#1 Best Overall
- The model misunderstands the task: clarify the prompt. State what to prioritize, what to ignore, and what the answer should contain.
- The answer sounds plausible but misses project-specific details: examine context. The model cannot follow conventions or account for code it has not been given or cannot retrieve.
- The response is malformed or makes checkable false claims: add harness-level validation. A request for a format does not guarantee that format, and an instruction to cite changed lines does not prove that the cited lines are in the diff.
- A person must keep starting the next step: consider a loop, if the task has a clear goal and safe, verifiable steps. Define when to continue, stop, or ask a person to intervene.
Yang’s point is that better prompt wording cannot make up for missing project information, enforce runtime checks, or automate a multi-step process on its own.
How does the pull-request example grow across the layers?
1. Ask for a focused review
At the prompt layer, tell the model to inspect the diff for bugs first, then security issues, then performance problems; skip style-only comments; and include line numbers and suggested fixes. This shapes the request but does not supply the project’s conventions or verify whether a cited line exists in the change.
Rank #2
2. Provide project knowledge
At the context layer, add relevant conventions, related code, examples, and reference documents. That gives the model material needed to judge the change in its project setting. Context can also involve retrieved information. Yang distinguishes the information itself from the harness that connects tools and manages their calls, while acknowledging that the boundary can blur.
Recommended Free Tools
3. Validate one model interaction
At the harness layer, software can assemble the request, connect tools, ask for structured output, validate the result, and retry when a response fails a check. For example, code can verify that every reported file and line belongs to the changed diff. Such a check can catch a location error; it does not establish that the review found every defect or that its judgment is correct.
Rank #3
The unit of retry matters: a harness retry is another attempt to get one valid model response. It is not the same as repeating the whole review-and-fix task.
4. Repeat toward a bounded outcome
At the loop layer, the system carries feedback and state across a larger sequence: review, apply a proposed fix, run tests, and decide whether to continue. Yang’s example recommends checking the test baseline before attributing a later failure to an AI-made fix, reverting the specific failing fix commit, setting a maximum iteration count, and defining a success condition. If the process cannot resolve a case safely, it should stop or escalate rather than continue indefinitely.
Rank #4
The example keeps final pull-request approval with a person. A loop is only one part of an agent-style system: tool use, state management, and permission control also matter.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWhat should a safe loop check before continuing?
For the review-and-fix scenario, Yang’s operational cautions suggest making the following conditions explicit:
- Known starting point: run the tests before automated changes so later failures can be compared with the baseline.
- Actionable feedback: carry relevant test and review results into the next iteration rather than restarting without state.
- Bounded attempts: set a maximum number of iterations and a task-level success condition.
- Recoverable changes: revert the specific fix commit when it causes a failure.
- Human control: escalate unresolved cases and leave pull-request approval to a person.
These are design cautions in Yang’s example, not a guarantee that an automated code-review process is safe. The pseudocode is illustrative.
What changes when you move up a layer?
The practical shift is from changing what the model is asked to do, to controlling what it knows, how one call is handled, and whether a larger task can proceed reliably. Pick the layer that matches the failure; do not add a loop when the prompt is merely unclear, or keep revising wording when the model lacks necessary information.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →

