---
title: "Testing and quality control, revisited"
date: "2026-11"
category: "AI Engineering"
tags: ["AI Engineering"]
description: "I still think quality control can't be one person fighting alone, and building feedback from the real production environment matters a lot..."
source: "https://enriquemark.com/en/posts/testing-and-quality-control-revisited/"
---

I still think quality control can't be one person fighting alone, and building feedback from the real production environment matters a lot. There is one and only one standard for whether a system is stable: does it run in production, with the expected business behavior, stably over the long term? If it can't, that means there's a hole in the quality-control process, room to improve. Ideally humans should step in to some degree, but since the design goal is an automated development process that maximizes efficiency, any step that needs a human becomes a **bottleneck** here. The core goal of quality control is to **build trust**: to make sure output of acceptable quality comes out even without a human stepping in.

I divide my current development process into these stages:

**Stage 1: Understanding the business.** This is the step before development where requirements get aligned with the PM, and it's about understanding the business. It looks like it has nothing to do with development, but if we're talking about a fully automated process, then **getting the agent to understand the business correctly** has to be part of quality control. Given how **fuzzy** understanding is, you need a method here, and DDD is one usable scaffold. Since this is agent development, we can skip the communication problems DDD tries to solve, like the gap in understanding between the PM and engineers. The core problem I'm trying to solve is the agent's understanding drifting.
The most useful part here is DDD's strategic design: carve the business into domains, build a model of each domain, settle on a ubiquitous language, and mark out the bounded contexts that apply within a given domain. Then bring in detailed spec files, use cases, even records of conversations with the PM, and do the modeling above from real business text.
Also, because understanding the business is a fuzzy concept, it's hard to make it deterministic. The one core benchmark for whether this stage is working is the rework rate. If business-related rework is too high, this stage has a problem and the design needs rethinking. If instead things run stably over the long term and the problems are all logic issues outside the business, then it's the later stages that need optimizing.

**Stage 2: Development.** Once the business is settled, development can start. Given the agents' context windows, division of labor is the best choice at this stage. You can see from Poteto's development flow that she also uses a pattern of a main orchestrator, sub-bots doing development, and multiple bots collaborating. Since I haven't brought in a multi-agent structure like bots, and instead set things up on Claude Code's existing architecture, a lot of places need changing. Besides that, I think a reminder is in order: not everyone can copy Poteto's model. Her 2,500 PRs in a month burned 1.5T tokens. Playing like that depends entirely on an inexhaustible token supply, running flat out 24 hours a day on servers. An ordinary company burning tokens like that would have gone bankrupt long ago. You could say that for us ordinary developers, the focus is always a usable trust architecture under limited token usage. That's the top constraint.
Structurally, I think its arrangement is worth learning from. A main orchestrator hooked into the outer loop (that is, sitting where it can get outside context) is in overall charge, and the work is split across four processes: orchestration, development, review, testing. The main orchestrator doesn't direct the development agents itself. It first cuts the big task into subtasks with clear boundaries, then delegates a parallel **task orchestrator** to each subtask, and only deals with them. Each task orchestrator cuts further: within its own task domain it splits the work into actual development chunks and delegates development agents to do the coding.
Note that a development agent doesn't write code first. Following BDD, it writes tests first, locking the business settled in stage 1 into the tests, then records how the tests are running at this stage as a snapshot. The key at this stage is building an "automated signal feedback process," so that as many errors as possible get stopped by this stage's tests and less time is needed from humans.
Once development is done, there still needs to be review: two adversarial agents, as independent as possible and stripped of distracting context, going after the tests and the implementation separately. If you can, use models from different vendors here, so you lean on one model's habits as little as possible.

**Stage 3: Verification.** After development comes verification, and verification here means more than testing. The most important part is verifying the business process. In stage 1 we built a business process for the agents to understand, but it isn't necessarily correct. Many bugs caused by the program itself can be fixed in stage 2's iteration loop, but problems with understanding the business can't. The only thing that can verify this part is the final result of execution, and that **needs a human to confirm**. It's one of the few moments that call for human attention.
Bring in real production data and user behavior, then watch whether the program responds the way you expected. The human's main job here is to make the call. Judging what counts as correct is still hard for current AI. Or, to put it another way, today's agents still can't grasp "tacit knowledge," especially the background in complex production environments that's hard to write down or put into words. Sometimes a piece of code is correct "logically," the tests pass, and it still doesn't fit the business. Making judgments in that kind of murky ambiguity is exactly the human engineer's responsibility. Also, the feedback humans give should be recorded and organized into persistent business context, which becomes reference material for the automated process later on. That's how stage 1 gets filled in.
This background system keeps growing, and over the iterations it should cut the moments where humans have to step in as far as possible. Once there's a clear feedback signal, go back to stage 2 and keep improving, then come back to stage 3 again.

If you can fully build a loop running from the outer loop to the inner loop, you get issue in, result out, and quality can be pretty well guaranteed. Of course, this doesn't come free. My usage isn't as big as Poteto's, but running the whole setup still eats a lot of tokens. That's simply the price of quality. So at this point I need to bring in the next important concept, **observability**.

Observability is very important. For a complex system, if you can't even see its internal data, you have no way to optimize it. We talked about cost above, so of course you need to know what each stage costs, and start optimizing from the biggest part. For example, the main orchestrator agent can use the best model, but the agents actually doing the work don't need the best too. In my experience, haiku 5.5 or deepseek 4.1 flash are both good choices, and the latter saves a lot of cost.

After switching, you need comparison tests: under the same conditions, did changing the model lower quality, especially in how well it follows those constraints? But since a lot of our process is highly deterministic (problematic operations get blocked by hooks outright), the key becomes whether it can finish the task the way the agent in charge laid it out. In my own comparison tests, switching to cheaper models didn't cause a noticeable drop in quality, but cost really did fall by more than half. Under the same weekly limit, I can finish more tasks than before. And even then, cost still has room to fall. For example, compacting context at the right time, cutting extra intermediate artifacts (switching e2e browser operations from MCP to scripted execution), and so on.

All in all, good output depends on iterating on the process, and even what's above is only part of what I've worked out so far. Maybe as models get stronger, some of it will turn into a "bitter lesson" and get dropped. But there's one signpost I think is right: keep a close eye on big labs like OpenAI and Anthropic, read their blogs, and pick up the newest practices. Still, always remember our own resource constraints. Some methods don't need to be copied wholesale; after all, we don't have their unlimited tokens. A good engineer has to make trade-offs and judgment calls, and the same goes for the process.

---

**Translation note.** I wrote this in Chinese. This English version is an LLM translation, so the wording is not mine even though the thinking is. Original: [再谈测试与质量控制](</zh-hant/posts/testing-and-quality-control-revisited/>).
