Every Step the Agent Takes Is Right, but the Whole Is Still Wrong
Addy Osmani spent 41 minutes laying out a process for getting agents to write code that doesn't fall apart, and all 24 skills are open source. But what really trips up most people is the layer outside the process: loops manage a node, graphs manage between nodes. Most people build only the former, then keep tuning parameters.
Addy Osmani is now at Anthropic; before that, Google. The salary range cited in the tweet is $600,000 to $1.2 million, not because he can write code, but because he knows how to get AI agents to write code that doesn't fall apart.
He released a 41-minute workshop that breaks the process of building this system from scratch into five steps.
- Sharpen the idea. Throw in a rough notion; the agent interviews you in turn and finally gives you three directions.
- Write the spec. Success criteria, tech stack, and unresolved questions are all locked down before the first line of code is written.
- Break it into small tasks. Each task has acceptance criteria plus a list of files it is allowed to change.
- Test first. Red to green, one block at a time; anything already working must not be broken.
- Validate and review. The agent opens the app in a browser itself, checks security, and then simplifies the code it just wrote.
He open-sourced all 24 skills; the repository is approaching 100,000 stars. Inside Google, this practice is called agentic engineering. The tweet says 95% of people will spend weeks hand-rolling this.
The process itself isn't new. What is new is that each step has been cut into units an agent can execute and a program can judge.
The article in the quote below is more worth reading. The author, Hanako, writes about the layer outside the process that nobody draws.
The Whole Point of a Loop Is the Thing That Can Fail
At its cleanest, a loop has only four things: produce, check, fix, repeat until green.
The check is everything.
If nothing can judge the work as failed while you are out of the room, all you have is a scheduler.
That sounds obvious, but almost no one writes the check first. People build the workflow first, then hang a review on the end; the so-called review is letting another model look at the output. Two optimists nod at each other.
Checks must be written in a form a program can evaluate:
- Green: the test suite exits with code 0
- Green: every conclusion carries a source line number
- Green: the diff touches only the files listed in the plan
- Not a check: the output looks good
- Not a check: the model says it is confident
- Not a check: there were no errors
The last one is the easiest to fool yourself with. No errors does not mean correct. Build a loop using that as your check, and you get a system that confidently repeats the same mistake until the budget runs out, with clean logs the whole way.
Where Loops Can't Reach
A loop can only improve one unit of work. That is its entire job, and it does it well.
It cannot decide which units exist, what order they go in, or which two of the five steps don't need to wait for each other at all.
So you get a very good agent running the wrong three steps, in the wrong order, one at a time. Every step is right, and the result is still slow and the wrong shape. Tuning the loop cannot fix this, because the failure isn't inside any unit.
That's when people start blaming the model. That's also when the layer above starts paying off.
The Graph Is the Shape
The graph describes: what is running, what runs at the same time, what is waiting, what doesn't run at all, and where results go back to.
There are only two things. A node is a unit of work, a bounded piece of work, one input in and one output out. An edge is a dependency: this node's output feeds that node's input.
All unnecessary waiting comes from the same mistake: treating 'and then' as an edge.
'Summarize this file, then check the weather.' The weather does not consume the summary. These are two independent nodes strung together by a linear script, and the only reason they're strung together is the order in which you typed them.
Use this to check every arrow in your existing pipeline: does the next step actually read the previous step's output? If you can't say which variable crosses over, there is no edge there, and the waiting is pure waste. Most chains have two or three arrows like this; finding them is usually the biggest speedup available.
Four Kinds of Nodes, One of Which Isn't a Model
Splitter, worker, code node, gate. That's the whole vocabulary.
The splitter comes first and cuts up the work. The decisions it makes carry more weight than those of any other node, because if you split along the wrong dimension, everything downstream is wasted. Split a repository by folder, and four workers will review the same three files. Split it by impact surface, and each worker sees things the others can't.
A worker gets one piece of work, one perspective, its own context. That last part is often skipped. Give four auditors a shared window, and they will converge: the first writes down a finding, the next three read it, and four reports circle the same issue. You pay for four and buy one opinion plus three echoes.
The code node is the one most often forgotten. Merge, sort, deduplicate, compare before and after export. None of these are reasoning. Each has exactly one correct answer; each is only a few lines of code. Sending them through a model means adding cost, latency, and variance to a step that had no variance to begin with.
The test is hard-edged: if you can describe the transformation without using the words judge, decide, evaluate, or summarize, it's code.
A graph where every edge is an agent is paying rent on its own wiring.
One Sentence Settles the Loop-vs-Graph Debate
Loops live inside nodes; graphs live between nodes.
Inside a unit: produce, check, fix, repeat until green.
Between units: split, fan out, merge, gate, send back. The actions in that second list cannot be expressed from inside a single unit at all.
So you don't have to choose. A graph with no loops inside its nodes will produce unverified things in parallel, which is worse than serial, because there is more of it. A loop with no graph around it is a nice step in a queue that nobody designed.
Two Back Edges, and Everyone Skips the Second
A graph with no way back is a pipeline. It produces a result and forgets it. Next week it starts from the same place with the same blind spots.
A graph that works has two back edges, doing different jobs.
The correction edge is short. A gate sends a unit back to the step that produced it, fixing the current round.
The learning edge is long. Accepted results go back to the splitter and become a constraint, fixing every round after that.
Almost everyone builds the first and skips the second. The symptom is easy to recognize: the system is fast but never gets smarter.
The learning edge does not carry outputs; it carries constraints inferred from outputs. For example, 'the utils slice has been migrated, all green on the first try' leads to 'the adapter preserves keyword arguments as-is,' and that constraint lands in the task brief the splitter gives every subsequent slice. Note the landing point: not the worker's instructions, but the task brief that decides how the work gets split.
A confirmed cause becomes a rule, and the next break starts where this one ended.
Return Units, Not Batches
This is the most expensive mistake on the return path.
Four slices are migrated, and one test fails. The whole batch is sent back, and the three correct ones are rewritten. Their new versions are different, not better, because there was nothing wrong with the originals. Now you have to revalidate four slices, and any of those three could fail this time for unrelated reasons.
You have turned one failure into four uncertain outcomes and paid for the privilege. Do this twice in one round, and it will never converge. From the outside it looks like the model keeps failing, when in fact the return path is destroying correct work.
When sending something back, include four things: which unit, the verdict, the reason, the evidence, and the scope.
The scope line matters more than it looks. Without it, the unit sent back grows: the agent opens the file, notices two nearby issues, fixes those too, and your one-slice correction becomes an unreviewed four-file diff.
Cap attempts at three. If a unit still doesn't pass after three fixes, the problem is in the plan that produced it, and the loop cannot see the plan.
Gates Open on Cost, Not Confidence
The usual approach is to build a confidence score, set a threshold, and let anything above it through. Wrong variable.
Confidence is the weakest input in this decision, for a simple reason: it is the one thing the model can influence.
The strong variable is 'what happens if this is wrong.' Sort by the cost of undoing an error:
- Reversible and local. Copy changes, a test, an isolated function with coverage. A bad merge costs one rollback. These can open first.
- Reversible but broad. Shared utilities, schema additions, things a dozen callers will touch. Let these through based on deterministic checks plus a clean trace.
- Hard to roll back. Data migrations, deletions, anything that writes to production data or moves money. These do not open, regardless of score.
The third category is not about setting the threshold very high; it is about that lane not being open. The difference is that thresholds get adjusted, while a closed lane does not.
Once a gate opens, read the evidence in order: deterministic results, this round's trace, this node's historical rollback rate, and only then the model's own evaluation.
Put the Human at One Point
Take something you do repeatedly and draw the splitter, the lanes, the merge, one gate, and one back edge.
Build the gate first. Once something can fail loudly, everything else is easier. A graph without a gate is just a faster way to produce unverified results.
Then draw the lanes. Put the learning edge last, because you cannot infer constraints before you have accepted any results.
Put the human in one place: the step with the biggest consequences and the least reversibility. Approve merges, choose which fixes go live. Do not read things in the middle, do not confirm step by step. A human in the middle of the graph is the slowest node in the graph, and the whole graph will run only as fast as one person reading.
Three rules hold the whole practice together. Measure the paths, not just where the answer lands. A judgment that does not change what runs next is just a report. Any failure that is not turned into a permanent constraint will be encountered again.
Most people will keep tuning that one loop and call it a system.
发布时间: 2026-11-29 15:29