AI engineering is like gardening

Written by Bob, my BusyYaks agent · open source. Thanks, Bob :)

Agents are not magic. It’s math. So are plants.

A plant grows well in a steady environment, from healthy parent plants. Any disease spreads quickly. Agents work the same way. They copy the code they find. Give them good code and they grow more of it. Let one bad pattern in and it spreads, unless something stops it.

That matters the moment you scale agents up to build faster. The problem is not a weak model producing slop. The problem is the environment, and the code that is already there.

So the job changes. Less writing code, more gardening: keep the soil clean, build the frames the growth follows, pull the weeds early. I tried this on my own site. The checks found bugs I had shipped. Then one of my own checks turned out to be broken.

Weeds spread

Before agents, a workaround was one bad line. Now it is a seed. The next agent finds it, copies it, and next week it is everywhere. Deprecated APIs, old tech debt, the quick fix nobody undid: all of it spreads the same way. An agent can’t tell a precedent from a mistake. To it, both are just code that exists.

So keep the codebase clean enough to copy. Not because clean code is pretty. Because it is now the seed bank for every change that lands.

Two garden beds, read left to right. Without a check: one weed, the workaround, lands among the seedlings; the next agent copies it and its seeds spread; by the right end the weeds are the pattern and the plants have wilted. With a check: the same weed is lifted out with its whole root, which the lint message names, and a low trellis runs on along a row of healthy plants: the fix becomes the pattern. One workaround, two gardens the next agent copies whatever is there without a check a workaround lands the next agent copies it it is the pattern with a check the same workaround lint fails: it names the root cause the fix is the pattern each correction can move a mistake from the top bed to the bottom one
The same mistake, with and without a deterministic check in the way.
Two garden beds, read left to right. Without a check: one weed, the workaround, lands among the seedlings; the next agent copies it and its seeds spread; by the right end the weeds are the pattern and the plants have wilted. With a check: the same weed is lifted out with its whole root, which the lint message names, and a low trellis runs on along a row of healthy plants: the fix becomes the pattern. One workaround, two gardens the next agent copies whatever is there without a check a workaround lands the next agent copies it it is the pattern with a check the same workaround lint fails: it names the root cause the fix is the pattern
The same mistake, with and without a check in the way.

Pour concrete, don’t put up signs

Not every fix holds the same. Some are concrete: the plant can’t grow through them. Some are signs: a note asking it nicely. Spend most of the effort on concrete.

Think of it as an upside-down pyramid. The deterministic layers are wide at the top. Prose sits at the narrow bottom, because prose needs judgment, and judgment is exactly what a copying agent doesn’t have.

Four garden beds stacked widest first, one per layer of effort. The widest is code and API design, drawn as a bed with concrete footings and a stone path that roots cannot cross. Next is lint, types and tests, drawn as a trellis of stakes and wires that every stem is tied to. Then verification, drawn as a watering can, a hand lens over a leaf and a soil probe. The narrowest is prose such as AGENTS.md, rules and skills, drawn as small plant labels on sticks. The first two are deterministic, verification checks intent, prose needs judgment. Where the effort goes: widest first deterministic at the top · judgment at the bottom 1 · Code and API design an API that can't be misused · imports that can't cross 2 · Lint, types, tests errors that name the root cause 3 · Verification run it · model-check it · prove it 4 · Prose AGENTS.md · rules · skills
Effort per layer. A correction belongs in the widest layer that can hold it.
Four garden beds stacked widest first, one per layer of effort. The widest is code and API design, drawn as a bed with concrete footings and a stone path that roots cannot cross. Next is lint, types and tests, drawn as a trellis of stakes and wires that every stem is tied to. Then verification, drawn as a watering can, a hand lens over a leaf and a soil probe. The narrowest is prose such as AGENTS.md, rules and skills, drawn as small plant labels on sticks. The first two are deterministic, verification checks intent, prose needs judgment. Where the effort goes: widest first deterministic at the top · judgment at the bottom 1 · Code and API design an API that can't be misused imports that can't cross 2 · Lint, types, tests errors that name the root cause 3 · Verification run it · model-check it prove it 4 · Prose AGENTS.md · rules skills
Effort per layer. A correction belongs in the widest layer that can hold it.

Small examples work best:

One rule on top: a new check gets fixed everywhere in the same change. A baseline file of “known offenders” is a weed with a permit.

Comments are where the weeds hide

Agents leave comments that justify the shortcut: why this quick fix is fine, just this once. That comment is a disease in disguise. Nothing enforces it, it goes stale, and it tells the next agent the shortcut is allowed. Ban most comments. Write lint errors that tell the agent to fix the root cause instead.

Rules can get sick too. Agents over-rotate: one small correction turns into a rule forever. Prune them.

I tried it on this site

My site had the same disease. Articles kept coming back with the same corrections, and every time the fix was one more sentence in an instruction file. So I read 19 recent cards on my board, mostly articles, and wrote down every correction I made and every finding the QA agents raised. About 60 kinds.

Every one a script could catch became a check. They run in CI on every push: a lint over the Markdown, and a rendered audit of every article page at 1280 and 390 px. What needs judgment went into a writing skill, each rule pointing to the card it came from.

countwhat the checks found
277lint hits on the first run, before tuning (JRuby versions read as IP addresses, and the like)
33real findings after tuning: blank lines inside figures, a repeated sentence, a leftover draft marker
1a figure whose labels were never painted, live on the site
3pages that scrolled sideways on a phone or a laptop
88/125pages whose figure labels render under 10 px

The 33 findings, the broken figure and the 3 pages are fixed. The 88 small-label pages are a project of their own. That check goes on with the PR that fixes the last of them. Not before, and not with an exemption list.

Check the weed killer

Then a QA agent planted seven violations on purpose, to see if the checks fire. Six were caught. The seventh slipped through: a “Related” link whose text didn’t match the article it pointed to. The check worked mid-file but not at the end of a file, because I had written \Z for end-of-input, and JavaScript regular expressions don’t have it. A real mismatch of exactly that kind was already live.

A check that never fails looks the same as a check that works. The fix was one regular expression. The lesson: plant weeds. Every check gets a test that breaks the rule on purpose and expects a failure.

Review becomes reading proof

The other half is looking at the plant, not the seed packet. Let agents run the code and show it, then review what they bring back instead of the diff. Model checks of user flows, proofs of small algorithms, property-based UI tests: all of it fits here.

None of this is new. It used to be too expensive to write and keep up. Agents made it cheap. On my site it looks like this: simulators with a checkable answer ship a selfTest() against ground truth (the event-loop simulator runs 32 cases against a real browser Worker), and cards reach me with a QA verdict and screenshots at both widths.

Where the metaphor breaks

A garden grows without you. A codebase rots without you, and with agents it rots faster. What stays human is taste: what not to build, which correction deserves a check, and when a rule is wrong for everyone and should change instead of being worked around.

Fix the soil first: the code, the checks, the verification. If your loop grows slop, automating it grows more slop, faster. Then build the factory on top. That part is in How I reached 100 quality PRs a day with an agents kanban.

Questions? Let's Chat :)

essays