Agentic Engineering / Rung 1
Prompt Engineering for Agentic Coding
The instruction is the smallest unit of an agent run, and the only part still standing at turn 40. Objectives, constraints, worked examples, acceptance criteria, output contracts and escape hatches, written to survive compaction and sub-agents.
What This Rung Owns
Prompt engineering is the rung where you decide what the agent is being asked to do. Not what it knows. Not what it runs on. The instruction itself.
That distinction used to be academic. In a chat window the instruction, the context and the harness were one thing. You typed a paragraph, a model answered, you corrected it. In an agentic run they come apart. One instruction gets re-read across forty tool calls, survives a compaction event that deletes the conversation it was written into, and is handed verbatim to sub-agents that never saw your original message. Often it is the only artifact in the system that says what done looks like.
A prompt that only works because you were sitting there to correct it is not a prompt. It is a conversation. This page is about the other kind: the instruction you can commit to a repository, hand to a machine you are not watching, and audit afterwards.
Out of scope on purpose, because each has its own rung. What the agent is allowed to see is context engineering. Which agent, model, tools and permissions execute it is harness engineering. Turning single turns into act, observe and correct cycles is loop engineering. Confusing the three is the most expensive mistake in the stack, so there is a triage table further down.
Why a Chat Prompt Fails a Forty-Turn Run
Underspecification is survivable in chat. You leave something out, the model guesses, you correct it on the next line, and the cost is fifteen seconds. That correction loop does far more work than most people credit it for.
Take the loop away and the numbers move. Laban and colleagues at Microsoft Research and Salesforce Research ran over 200,000 simulated conversations in which a fully specified instruction was instead revealed piece by piece across turns. Performance fell by an average of 39% across six generation tasks, and the decomposition matters: only a small share was lost capability, the bulk was unreliability. Models commit to an assumption early, build a full solution on it, then keep leaning on it. Their phrasing is that when a model takes a wrong turn, it gets lost and does not recover.
An agent run is that experiment with nobody in the room. The wrong turn happens at turn three and thirty-seven tool calls get built on top of it. Prompt quality in agentic work is closer to a load-bearing wall than a nice-to-have.
The prompt outlives its conversation. Long runs cross context windows. Anthropic’s prompting documentation tells you to say so in the instruction: warn the model that its context will be compacted, tell it to save progress and state before the window refreshes, and tell it not to wrap up early because it senses the budget running out. That guidance has no analogue in chat, because chat never gets that far. Write it, or the model quietly starts closing down at the worst possible moment.
The prompt is inherited. A sub-agent receives the slice you wrote, not the conversation you had. Anything that lived in an earlier message, a pasted screenshot or a verbal clarification is simply absent. If a constraint matters to the worker, it has to be in the worker’s instruction.
Nobody says stop. OpenAI’s GPT-5 prompting guide is direct about this: state the stop conditions of the agentic task, mark which actions are safe and which are not, and define when, if ever, it is acceptable to hand back to the user. Without that you get one of two failure shapes. Either the agent halts on the first ambiguity and waits for a human who is asleep, or it keeps going long past the point where it should have asked.
So the rule is: write for turn 40, not turn 1. Every constraint that still matters at the end belongs in the instruction, not in a follow-up you intend to type. Anything too large to carry in the instruction goes to disk, and the instruction says where. That handoff is where this rung ends and context engineering begins.
The Six Parts of a Durable Agent Prompt
This is not a template to fill in for its own sake. Each section exists because a specific failure happens when it is missing, and you can watch that failure in a transcript. If you can only keep three, keep the objective, the acceptance criteria and the escape hatch.
A Prompt Is a Spec, Not a Wish
Here is a real shape of task from our own work. A JSON dataset of ASIC error codes needs a severity field on every record. The chat-shaped version of that instruction is one line.
Add a severity field to the error codes data.
Handed to a capable agent with write access, that line has a lot of plausible readings. Add the field to the schema, or the records, or both. Reformat the file while you are in there. Helpfully invent severities where the answer is not obvious. Write a migration script because that seems tidier. Every one of those is defensible, none is what was wanted, and you find out when you read the diff.
The spec-shaped version lives in a file, has a name, and is versioned with the data it operates on.
$ cat prompts/normalize-error-codes.md
# Objective
Every record in data/error-codes.json ends up with a severity field.
# Constraints
- Do not change any existing id, code or title value.
- Do not add or remove records. Same count in, same count out.
- Edit data/error-codes.json only. No schema change, no loader change,
no migration script.
- Do not reformat the file. Preserve key order and two-space indent.
- If a record cannot be classified from evidence already in this repo,
set severity to unknown. Never guess a severity.
# Worked example
in { code: E01, title: Fan speed too low }
out { code: E01, title: Fan speed too low, severity: warning }
Allowed values, and nothing else: info, warning, critical, unknown.
# Acceptance criteria
- npm run validate:error-codes exits 0.
- jq 'length' data/error-codes.json prints the same number it printed
before you started. Capture both.
- git diff --stat touches exactly one file.
- Every record has a severity key.
Write a general rule from the evidence. Do not special-case records to
make the validator pass, and do not edit the validator.
# Output contract
Reply with the raw validator output, then one final line, exactly:
RECORDS n CHANGED n UNKNOWN n FILES n
# Escape hatch
Stop and report instead of improvising if any of these are true:
- validate:error-codes does not exist or does not run.
- data/error-codes.json is not valid JSON before you touch it.
- more than a quarter of records would land on unknown.
In those cases change nothing and say what you found.
Nothing in that file is decoration. The count constraint exists because agents lose records when they rewrite files. The format constraint exists because a reformat buries a three-line change in a three-thousand-line diff and destroys your ability to review it. The unknown value exists so that the honest answer is available. Without it, the only way to satisfy the objective is to invent data, and a well-behaved model will invent data rather than fail an instruction you gave it.
The line about not special-casing records comes from documented behaviour, not a hunch. Anthropic’s prompting guidance warns that models can focus too heavily on making tests pass at the expense of a general solution, and recommends stating outright that tests verify correctness rather than define it, with permission to report that a test is wrong instead of working around it. Acceptance criteria therefore come in pairs: the check, and the ban on gaming the check.
The last third of the file is what separates a prompt from a wish. A wish says what you want. A spec says how the machine will know it succeeded, what it hands back, and what it does when reality does not match the assumption.
Criteria, Contracts and the Right to Refuse
Acceptance Criteria
Write them as commands, not adjectives. Clean code is not a criterion. npm run lint exits 0 is. The bar is whether the agent can settle the question alone at three in the morning.
Include one criterion the agent cannot satisfy by editing the checker, and one that measures scope rather than correctness. A diff stat is an excellent scope criterion because it catches the commonest form of agent overreach: a correct fix wrapped in nine unrequested improvements.
Output Contracts
Decide what the next thing downstream needs, then make the reply that. Anthropic’s state-management guidance splits it cleanly: structured formats such as JSON for structured state like test results and task status, freeform text for progress notes. Mix them and neither is reliable.
Specify the final line exactly, in a form a script can match. When a run is one node in a larger graph, the output contract is the wire protocol between agents, and an unparseable reply is a broken build.
Escape Hatches
OpenAI’s GPT-5 guide calls these escape hatches and treats them as a tuning control for how eager an agent should be. Anthropic’s advice runs parallel: give the model explicit permission to express uncertainty rather than guess, because that lowers hallucination.
Name the refusal in advance and it becomes a legitimate outcome instead of a failure to paper over. We hold ourselves to the same rule in DCENT_ADE, where the catalog execution layer refuses to claim a Git merge it did not perform. An agent that reports honestly beats one that always reports success.
Pair the escape hatch with a persistence clause or you overcorrect. An agent told only when to stop will stop constantly. Together the two clauses define a band: keep working through ordinary friction, halt on these named conditions. Anthropic publishes sample wording for the destructive half of that band, covering force pushes, hard resets, deleting branches and anything visible to other people.
Is It Actually a Prompt Problem?
When a run goes wrong the reflex is to rewrite the prompt. Often the prompt was fine and something around it was broken, so you end up with a worse prompt and the same bug. Symptoms sort more cleanly than expected.
| What you saw | Layer | Where the fix lives |
|---|---|---|
| Confidently did the wrong task | Prompt | Objective is ambiguous, or two constraints contradict. One sentence, one outcome. |
| Right task, wrong file or stale version | Context | It never saw the file, or saw an old copy. Context engineering. |
| Right plan, no way to execute it | Harness | Missing tool, denied permission, wrong model, no isolation. Harness engineering. |
| Stopped halfway and asked what next | Prompt | No stop condition and no persistence clause. Define the band. |
| Looped, editing the same file forever | Loop | No termination test and no evidence step. Loop engineering. |
| Passed the test, broke the feature | Prompt | Acceptance criteria were gameable. Add the no-special-casing clause. |
| Quality collapsed after thirty minutes | Context | Window filled, or compaction dropped what mattered. |
| Two agents overwrote each other | Graph | Fan-out with no claims and no join. Graph engineering. |
| Claimed work it did not do | Prompt | No escape hatch, so reporting failure was not an available move. |
The cheapest diagnostic is a fresh session. Re-run the identical instruction with clean context and the relevant files handed over deliberately. If it now succeeds, the instruction was never the problem and you were watching context rot. If it fails the same way in a clean room, the instruction is the problem. That one test settles most arguments, and it is the same isolation principle RALPH loops exploit deliberately by restarting every iteration from scratch.
Prompt Libraries Are Project Assets
The moment a prompt works twice it stops being a message and becomes a tool. Tools live in the repository, beside the code they operate on, with a name and a history. The industry converged on this faster than almost anything else in agentic development.
Claude Code project commands are files in .claude/commands/ that ship with the clone, so a teammate who pulls gets your improved prompt the way they get your improved function. Anthropic has since folded that idea into the Agent Skills format, where a skill is a directory with a SKILL.md and progressive disclosure keeps only each skill’s name and description in context until one matches, at which point the body loads. AGENTS.md standardised the repository-level instruction file itself: an open Markdown format with no required fields, read from the nearest file in the directory tree, now stewarded by the Agentic AI Foundation under the Linux Foundation and used by more than sixty thousand open-source projects. GitHub’s Spec Kit pushes hardest, making the specification the reviewable artifact and driving work through a fixed sequence of specify, plan, tasks and implement.
If prompts are code, test them like code. promptfoo is MIT-licensed, runs locally, keeps its configuration as YAML in the repository and can gate a pull request on assertions, which turns a prompt edit into a reviewable before-and-after instead of a vibe. A prompt change is a behaviour change. Treat an unreviewed one the way you would treat an unreviewed schema migration.
Four rules keep a library alive. One file per job, named for the job. The acceptance command lives inside the prompt, so instruction and test cannot drift apart. Prompts get diffed rather than silently mutated, because a prompt with no history cannot be bisected when behaviour changes. Dead prompts get deleted, since a library nobody trusts is worse than none.
How DCENT_ADE Handles It
DCENT_ADE is a local-first agentic development environment, and its answer to prompt libraries matches its answer to everything else: keep it in the workspace, on your disk, under your rules. Workspace-scoped memory is native-scoped local Markdown with bounded read, write, append, list and search, and it rejects unsafe roots, path traversal, oversized documents and stale writes. Instructions stored that way are files. They clone, diff, review and revert like files, and ordinary local work is zero-telemetry.
Mission Control makes the same point structurally. The roles are Coordinator, Scouts, Builders and Reviewers, and a role is an instruction. The review packet a Reviewer receives is an output contract in the most literal sense: a defined artifact in a defined shape, so a critic with fresh context can judge it without having watched the work. Claims and worktree isolation stop two Builders stepping on each other, and MergeGate with human co-signing keeps the last word with a person.
It is also how DCENT_ADE itself gets built, through the adversarial builder-and-critic method on the gauntlet loops rung. The lesson relevant here is that a critic can only reject against a written bar. No acceptance criteria, no gauntlet.
Three Ways a Prompt Rots
Contradiction. OpenAI’s guide singles this out as a real failure mode, not a style issue. Conflicting directives burn reasoning while the model tries to reconcile rules that cannot both hold, and the fix is an explicit hierarchy, not softer wording. Contradictions accumulate quietly: every incident adds a line, nobody removes one, and eventually rule four forbids what rule eleven requires.
Wrong altitude. Anthropic describes a Goldilocks zone between hardcoded brittle logic that tries to script exact agentic behaviour and vague high-level guidance that gives no concrete signal. Specific enough to guide, flexible enough to work as heuristics. In practice, constrain outcomes and boundaries rather than keystrokes. Say which files are off limits, not which order to open them in.
Bloat. Long is not thorough. The published advice points one way: the minimal set of information that fully outlines your expected behaviour, kept informative yet tight. Cutting a prompt is a legitimate fix, and a section that has never changed an outcome is costing window for nothing. Move reference material out of the instruction and let the agent fetch it on demand, which is the whole argument of context engineering.
Almost none of this is ours. The vocabulary and most of the technique come from people who published their work: Anthropic’s prompting documentation and Claude Code, OpenAI’s Codex and its GPT-5 prompting guide, the AGENTS.md contributors now organised under the Linux Foundation, GitHub’s Spec Kit team, the promptfoo maintainers, the researchers who measured multi-turn degradation instead of asserting it, and a large open-source agent community running these experiments in public across open-weight and closed models alike. We build in that lineage and would rather say so.
Next Rung Up
A perfect instruction handed to an agent that cannot see the right files is still a failed run. The next rung is context engineering, which decides what the agent knows when it reads what you wrote. After that, harness engineering for which agent, model, tools and permissions execute it, and loop engineering for turning one instruction into a cycle that corrects itself. The full map is on the agentic engineering hub.
DCENT_ADE is free, open and as-is. No paid tier, no gatekeeping, no feature held back for a licence. If you run it commercially or it earns its keep in your shop, a voluntary subscription or donation is expected and never enforced. That lives at d-central.tech/fund.
Related products, repair, and setup paths
- how D-Central diagnoses ASIC repairs
- ASIC troubleshooting library
- ASIC manuals and repair guides
- replacement hashboards
- ASIC control boards
- ASIC power supplies
- S19 family replacement hashboard
- C52 replacement control board
- APW12 S19 power supply
- compare specs in the ASIC miner database
- compare ASIC miner specs
- ASIC miner database
- ASIC repair services
- Antminer S19 specs and profitability
- buy a tested Antminer S19
- Antminer S19 maintenance guide
- Antminer S19 repair service
- Antminer S21 specs
- Bitmain Antminer S21
- Antminer S21 maintenance guide
- BM1370BC S21 Pro chip
Last reviewed August 13, 2026.
