As I keep working through the prompt catalog, one thing becomes clearer: improving prompts one sentence at a time is not enough. Good outputs do not come only from wording. They also come from the information placed in front of the model, the tools and output contracts around it, and the way failures are inspected and rerun.
For this series, I am extending PCH with Loop: PCHL.
| Layer | Question | Artifact |
|---|---|---|
| Prompt | What are we asking the model to do? | Role, goal, instruction |
| Context | What should the model see? | Material, state, memory, constraints |
| Harness | How do we execute and hold the output? | Tools, schema, validation, logs |
| Loop | How do we run it again? | Evaluation, revision, retry, learning |
PCHL is my working frame for this catalog. The direction, though, matches current AI engineering practice. OpenAI and Anthropic both emphasize success criteria and evaluation in prompt work. Anthropic and LangChain treat context engineering as the broader problem of deciding what information belongs in each model call. LangChain’s agent documentation describes an agent as a model calling tools in a loop, with the surrounding structure acting as a harness.
Prompt Engineering: Define the Sentence’s Job
Prompt engineering still matters. Role, goal, output format, and examples remain foundational. But modern prompt engineering is less about finding magic words and more about designing instructions that consistently meet requirements.
At the prompt layer, I look for four things.
| Element | Question |
|---|---|
| Role | From what perspective should the model answer? |
| Goal | What counts as success for this call? |
| Work unit | Is this generation, analysis, transformation, or evaluation? |
| Output contract | What shape should the answer take? |
This layer can improve one-shot work substantially. But long-running work, research, coding, and agentic tasks quickly need more.
Context Engineering: Design the Model’s World
Context engineering shifts the question from “How should I write the prompt?” to “What is the model actually seeing?” Anthropic frames context as the tokens included when sampling from a model and treats the engineering problem as optimizing their utility. LangChain expands the material: runtime context, state, long-term stores, tools, and response formats can all be part of context design.
That changes the questions.
| Older question | Better question |
|---|---|
| Which prompt is best? | What information belongs in this call? |
| Should I add more detail? | What should be removed so the model can focus? |
| Should I include memory? | Which memory is relevant now? |
| Should I paste all the material? | Should I summarize, retrieve, compress, or isolate it? |
Context engineering is not the art of adding more information. It is the art of selecting, removing, and shaping the information the model can use.
Harness Engineering: Build the Workbench
Harness engineering is not yet a universally formalized field name. But LangChain’s agent documentation uses harness to describe the structure around the loop: model, prompt, tools, and middleware. I find the term useful.
If the prompt is the request, the harness is the workbench.
| Harness element | What it does |
|---|---|
| Input contract | Defines what is required before work begins |
| Tools | Search, calculation, file access, code execution, and other actions |
| Output schema | Defines the structure of the result |
| Validator | Checks format, evidence, omissions, and safety conditions |
| Log | Makes the run reproducible and debuggable |
Without a harness, a prompt depends on human handling each time. With a harness, the same prompt can behave more like a small system.
Loop Engineering: Make the Output Become the Next Input
Loop engineering is the term I want to use in this series for the repeated structure around AI work. If an agent observes, judges, acts, and observes again, then the loop itself needs design.
A useful loop usually has five stages.
- Define the goal.
- Select the current context.
- Let the model produce an artifact.
- Let the harness validate it.
- Use the result to update the next context.
Without that structure, AI work becomes “ask again until it looks good.” With a loop, we can see why we are asking again, what changed, and when to stop.
Creativity Also Comes From Loops
PCHL is useful for creative prompting too. Creativity does not only come from unlimited freedom. It often comes from good constraints, surprising context, and repeatable variation rules.
For example:
1 | Prompt: |
This is not simply “be creative.” It combines viewpoint, context, constraint, and a regeneration rule.
Sources Read
- OpenAI Prompt Engineering Guide
- Anthropic Prompt Engineering Overview
- Anthropic: Effective Context Engineering for AI Agents
- LangChain: Context Engineering in Agents
- LangChain: Agents
- Anthropic: Writing Effective Tools for Agents
- DSPy
The direction is clear enough: prompts are still the entry point, but real work depends on context, harnesses, and loops. The prompt catalog should become less like a list of sentences and more like a PCHL operating board.
댓글
GitHub 계정으로 의견을 남길 수 있습니다. 댓글은 GitHub Discussions에 저장됩니다.