Agentic coding rewards one habit above the rest: treat a bad agent result as a defect in the brief first and a defect in the code second. This post is about the loop that habit creates, and why it keeps working as the number of agents grows while fixing by hand does not. The brief format itself is in writing briefs AI coding agents can’t misread, and the checks that find defects are in agents report success while shipping defects. Both are context; this post covers what happens next.
What is the re-brief loop?
The re-brief loop is failure, diagnosis, re-brief, verify. Each step has one owner and one output.
| Step | Owner | Output |
|---|---|---|
| Failure | A check (test, grep, build, QA report) | A named defect with evidence |
| Diagnosis | The orchestrator | The sentence in the brief that was missing, wrong or unexplained |
| Re-brief | The orchestrator | A short brief: defect, exact fix, no redesign |
| Rework | The agent | A commit that fixes the defect |
| Verify | The orchestrator | The same check, now passing, run by you |
The loop is short on purpose. The diagnosis step is the only one that requires judgement, and it is the one a hand fix skips. Skipping it is why hand fixes do not scale: every defect is repaired once and the brief that produced it is reused as is.
Why does fixing it yourself not scale?
It does not scale because the cost lands on the scarcest resource and the cause survives. There are three separate problems.
The orchestrator becomes the typist. The point of delegation is that the orchestrator makes decisions and the delegate does the typing. One workstream costs the orchestrator about 600 output tokens for the brief, 400 input tokens for the report and 300 for a verification grep, against tens of thousands of tokens to do the work directly (estimates recorded in the delegation playbook, not a controlled measurement). Every hand fix converts a 600-token delegation back into a direct edit. A fleet of ten agents with one hand fix each is ten pieces of typing the design was meant to avoid.
The cause stays in the brief. If an agent hardcoded a fixture into shared code, the brief probably did not say why that is wrong, and the next agent working from the same template will do it again. Repairing the code teaches nothing to the process.
Ownership blurs. The agent owned the file, you edited it, and now the commit history does not show whether the agent’s version was reviewed or replaced. When something breaks later, nobody can say which version was meant.
There is a quieter cost. Hand-fixing defects hides the pattern. The playbook’s review table lists failure modes that repeat across agents: tests rewritten to pass, fixtures in shared code, unbounded loops, domain data deleted as cleanup, UI with no backing route. Repetition is the signal that the brief or the check is missing something. A reviewer who quietly fixes each instance never sees the repetition.
How do you diagnose a failed run?
Ask what the agent needed to know to get it right, and whether the brief said it. Almost every failure falls into one of five brief defects:
| Brief defect | What the agent did | Re-brief fix |
|---|---|---|
| Silent | Re-investigated or invented a parallel implementation | Add the file and symbol to ground truth: “mirror src/x/repository.ts” |
| Ambiguous | Chose a plausible reading that was not the intended one | Make the decision in the brief and name the alternative you rejected |
| Rule without a reason | Rewrote the rule because it looked arbitrary | Attach the reason: “cleanup must not throw, because it runs before the job is marked complete” |
| No stop condition | Guessed and shipped | Add the escalation triggers and say what stop means |
| No checkable output | Reported success with nothing to verify | Name a string the real output must contain |
Some failures are not brief defects. If the brief was explicit and the agent ignored it, the missing piece is a check that would have caught it: a grep for the forbidden pattern, a test that fails without the fix, a sentinel line in the output. The re-brief still happens, and the check is added to the standing checklist.
Two special cases are worth recognizing quickly. An agent that stalled on a background build and timed out with uncommitted work needs a continuation brief that says review the existing changes, do not start over, verify, commit. And an agent that edited a file it did not own needs the same ownership rule restated with the consequence (merge conflicts), not just the rule.
What does a good re-brief look like?
A good re-brief is short, names each defect by what the agent did and why that is wrong, states the exact fix, and forbids redesign. The template from the playbook:
GOAL: Fix defects in the code YOU just wrote in <file>. Do NOT redesign it.
DEFECT 1: <name>. <what you did> <why it's wrong, concretely>
FIX: <exactly what to do instead>
Each part does a job.
- “The code YOU just wrote.” It restores ownership. The agent made the change and the agent repairs it.
- “Do NOT redesign it.” Without this line a fast model treats a defect report as an invitation to rewrite. The scope of the repair is the defect.
- “What you did, why it’s wrong.” The reason is what lets the agent generalize to other places in the file where the same mistake sits. “Fix line 40” fixes line 40.
- “Exactly what to do instead.” This is the judgement call, made by you in a sentence or two. If you cannot state the fix, you do not yet understand the defect, and you should look before sending anything.
The same fix-wave logic works at scale. In the playbook’s pipeline, a fix agent gets the shared fix rules, a list of finding IDs and its owned files. The shared rules state that the lead has already made every judgement call, and that where a QA report’s suggested fix differs from the brief, the brief wins. That second sentence matters: QA reports are written by agents, and an agent’s suggested fix is a claim, not an instruction.
How is this different from reviewing the output?
Reviewing finds the defect; re-briefing decides what to do with it. The two are consecutive steps with different skills. Review is mostly mechanical: run the checks, read the hunks the greps flagged, compare against the base commit. Re-briefing is judgement: figure out which sentence in the brief let the failure through, and what the agent needs to hear.
Keeping them separate also keeps the review honest. If the reviewer is also the person who will fix by hand, there is pressure to find fewer defects. If the reviewer’s output is a defect list that becomes a re-brief, every defect is worth naming precisely, because the name is what the agent reads.
What does the loop look like at fleet scale?
At scale the loop becomes the wave pipeline: build, independent QA, triage, fix, re-QA, verify. The playbook’s record of one large build shows why the fix step must be a re-brief and not hand edits. Independent auditors found 49 issues, 5 of them P0 and 18 P1, across 7 areas of an app whose builders had all reported success (from the playbook’s wave-pipeline record). Fixing 49 issues by hand is a week of typing and review. Triaging them into fix briefs partitioned by file ownership turns them into a handful of parallel runs.
The triage rules that make it work:
- Read the audit reports’ summary tables, not every finding in full. The reports already carry file and line pointers and reproductions.
- Decide every fix yourself, so the fix brief contains decisions, not options.
- Group finding IDs by file ownership so two fix agents never edit the same file.
- Require a test per fix that fails without the fix. A test that passes either way proves nothing.
- Send fresh agents to re-test the same findings against the rebuilt app, because the fixer grading its own fix is the same instrument problem as a builder grading its own build.
The full pipeline is in build, QA and fix waves.
When should you fix it yourself anyway?
Fix by hand when the edit is small and the cost of a second miss is high. The playbook’s exception list is short: a production SQL patch, a one-line invariant, and work where the agent has shown it does not understand the requirement.
A few cases deserve their own mention:
- Auth, billing and tenant boundaries. These are reviewed by hand whatever the tests say. One example from the review notes: an app-store reinstall callback signed the visitor into an existing account by the store’s email alone, with no password or session check, found only in hand review of the auth diff. If the fix is a small precise edit to such a path, make it yourself and write the reason into the commit.
- Merge conflicts. The lead resolves them, and the lead makes mistakes there too: a dropped flag in a settings registry, two dropped closing braces in a stylesheet. These are not agent defects, so there is nothing to re-brief. They do need a build and a look at the page afterward.
- Defects in the brief’s own premise. If the ground truth was wrong, there is no agent mistake to correct. Fix the premise and brief the next agent correctly.
The default stays the other way around: if the defect is in the agent’s own work and the fix is mechanical, it goes back.
What if the cheap model keeps failing?
Re-brief again before escalating to a larger model. The delegation policy is that a brief which seems to need the frontier model to execute is underspecified, and the fix is to make the missing decision, not to move the work. A fast model that fails a well-specified brief is a signal to re-brief with what went wrong.
The numbers support patience. On the measured code brief, the fast engine took about 5½ minutes and passed 20 of 20 hidden tests, and the metered engine took 2 to 2½ minutes with the same result (from the model delegation comparison). A round trip is measured in minutes, so a second pass costs less than the orchestrator’s time to read the failing diff.
Escalate to a stronger engine when the same defect survives two re-briefs that both named it precisely. At that point the failure is likely capability, not specification, and the task may need the judgement tier. That is a routing decision, not a reason to start typing.
How do you make the habit stick?
Make re-briefing cheaper than fixing. Three things help.
Keep a lead notes block. The shared rules file has a section for facts learned from reviewing earlier waves, such as “route handlers need the second argument in this framework version” or “this test needs a specific environment variable”. Every later agent gets it for free. A defect found once becomes a rule for all.
Keep a standing grep list. Each defect with a mechanical signature becomes a line in the review script: a search for fixture names in shared code, a diff filter for skipped or weakened tests, a search for unbounded loops. The failure that cost a re-brief once costs one grep afterward.
Write down the diagnosis. One line per defect: what the brief lacked. After a wave, the list shows which brief sections fail most, and that is where to invest. If “no stop condition” shows up five times, the escalation section needs to be in the shared rules, not the per-agent brief.
Which response should you use?
| Situation | Response | Reason |
|---|---|---|
| Agent’s own code has a mechanical defect | Re-brief | Fix the code and the brief together |
| Same defect appears in several agents | Fix the shared rules, then re-brief | The cause is the template |
| Production SQL patch or one-line invariant | Fix by hand | Small, high-risk, high-judgement |
| Auth, billing or tenant diff is wrong | Hand-review, then fix or re-brief with the exact change | Authority questions need a person |
| Defect survives two precise re-briefs | Route to a stronger engine | Likely capability, not specification |
| Brief premise was wrong | Fix the premise, brief the next agent | Nothing for the agent to correct |
Which should you choose? Re-brief by default. Fix by hand only for the short list of small, high-risk edits, and write down why. If you are editing an agent’s file because it is faster, you are paying a cost the loop would have avoided.
What broke and what we changed
Defects were hand-fixed and came back. The same mistakes recurred across agents because only the code changed, not the brief. The change: every defect gets a one-line diagnosis, and mechanical ones become a standing grep or a rule with a reason in the shared file.
A QA report’s suggested fix contradicted the brief. Two agents reading one finding picked different repairs. The fix-wave rules now say the lead has made every judgement call, and where a report differs from the brief, the brief wins.
A re-brief invited a rewrite. Without a scope line, a defect report became a redesign. Every re-brief now opens with “fix defects in the code you just wrote; do not redesign it”.
A fix was graded by the agent that wrote it. The fixer reported green on its own fix. Fresh re-QA agents now re-test the same findings against the rebuilt app, and the lead runs typecheck, tests and the build itself.
A stalled agent was treated as finished. Work sat uncommitted after a timeout. The remedy is a continuation brief: review the existing changes, do not start over, verify, commit.
Related
Frequently asked questions
What is the re-brief loop in agentic coding?
It is a three-step cycle. An agent's output fails a check, you diagnose which part of the brief allowed the failure, and you send the agent back with a short brief that names the defect, states the fix and forbids a redesign. The code is changed by the agent; the cause is changed by you.
Why not just fix the agent's mistake by hand?
Because a hand fix removes one defect and leaves the cause. The next agent given the same brief repeats the mistake, and the orchestrator spends time on typing that a delegate would do for a fraction of the cost. It also moves ownership of the code to you without a record of why it changed.
When is it right to fix it yourself?
For small, high-judgement or high-risk edits: a production SQL patch, a one-line invariant, or work where the agent has shown it does not understand the requirement. In those cases the cost of a second miss is higher than the cost of typing.
How do you know the brief caused the failure?
Ask what the agent would have needed to know to get it right, and check whether the brief said it. If the brief was silent, ambiguous or gave a rule without a reason, the failure is a brief defect. If the brief was explicit and the agent ignored it, the check that should have caught it was missing.
Does re-briefing work on a fast, cheap model?
Yes, and it matters more there. A fast model is confidently wrong in a way that reads like a correct answer, so the brief must make correctness checkable. A fast model failing a well-specified brief is a signal to re-brief with what went wrong, not to escalate to a larger model.
