# One agent or six: my AI flow was slow and expensive, so I measured it before changing it

> Six role subagents against one agent that loads skills, over 24 runs on real tasks. The single agent was 71% faster and spent 73% fewer tokens, but it missed bugs the old flow caught. How I measured it, which agent turned out to be essential, and why I adopted a hybrid that doesn't reach 10 out of 10 either.

- Author: Rubén Rangel (https://rubenrangel.org)
- Published: 2026-11-20
- Updated: 2026-11-20
- Language: en
- Canonical: https://rubenrangel.org/en/blog/one-agent-or-six-my-ai-flow-was-slow-and-expensive-so-i-measured-it

*Six role subagents against one agent that loads skills, measured over 24 runs on real tasks. The single agent was 71% faster and spent 73% fewer tokens, but it missed bugs the old flow caught. I adopted a hybrid knowing it doesn't reach 10 out of 10 either.*

---

The agent flow behind this site had six subagents: **qa** hunted edge cases, **tester** wrote the tests, **coder** made them pass, and **reviewer**, **security** and **performance** reviewed the diff. It grew out of the one I described in [four agents and a reviewer with no context](https://rubenrangel.org/en/blog/four-ai-agents-build-my-code-the-most-valuable-one-knows-nothing), which I later [put in boxes, the Stripe way](https://rubenrangel.org/en/blog/stripe-puts-its-ai-agents-in-boxes-i-did-the-same-with-my-accounting-system).

It worked, but it hurt in three ways: it was slow, expensive in tokens, and it made me step in a lot. In October, Anthropic published [a guide on when to fold subagents into the main loop](https://claude.com/blog/building-agents-when-to-fold-subagents-into-your-main-agent-loop). Its thesis is that a single agent that loads skills when it needs them usually wins on quality, cost and latency.

The question I asked wasn't "what do the labs say" but **what does my repo gain, measured**.

## What the sources say

- **Anthropic** recommends one agent with skills and keeps subagents for three cases: context degrading from overload, parallel work with throwaway context, or conflicting tools or instructions. It also keeps them for verification and for separating permissions. The migration method is the most useful part of the article: evals first (10 reference cases are enough), then a baseline, then fold one subagent at a time. If the folded version scores worse, that subagent stays. They also published a [reference kit](https://github.com/anthropics/single-agent-loop-kit), unmaintained.
- **Cognition**, in [Multi-Agents: What's Actually Working](https://cognition.com/blog/multi-agents-working), says writes belong in a single thread and the other agents only contribute reasoning, for example a reviewer with a clean context.
- **Anthropic**, in [Multi-agent coordination patterns](https://claude.com/blog/multi-agent-coordination-patterns), describes five patterns, generator and verifier among them.

The nuance matters: the trend isn't "zero subagents" but **one agent that writes and verifiers with a clean context**.

## The method: real tasks, two runs, and a rule set in advance

I picked five real commits from the repo, all made after the six-agent flow existed, from smallest to largest:

| Task | What it exercises |
|---|---|
| t1, escape the layout title (XSS) | The flow's fixed cost on a one-line change |
| t2, literal `LIKE` wildcards in a search | Edge cases |
| t3, throttle POSTs per IPv6 /48 network | Network logic and integration tests |
| t4, daily log and a cap on exception reports | New class, config and many tests |
| t5, stop searching by ID number and mask it | PHP and Vue, privacy |

Each task ran **twice per flow**, with the same prompt and the same fixed answers from me, in a sandbox built from the parent commit: a fresh repo with a single commit (no history from the future), its own Docker Compose project and the suite green before starting.

I measured four things:

1. **Active time**, without counting how long I took to answer.
2. **Tokens** for the main session and every subagent.
3. **Interventions** from me outside the script.
4. **Hidden tests**: the original commit's tests, copied in at the end. I separated behavior (black box) from form (a log's text, a key's name).

And before running anything I wrote down the rule. The new flow wins only if it keeps 10 out of 10 on behavior, cuts time or tokens by at least 30%, and asks for no more interventions than the current one.

## How an agent can see the answer

Replaying solved tasks has a trap: the solution is somewhere on the machine. Closing the leaks was half the work.

| Where it leaked | How I found it |
|---|---|
| Git history | Obvious from the design |
| The project's automatic memory | It literally said how t1 had been solved and in which commit |
| Transcripts of the original sessions | Going through paths |
| The real repo at HEAD | A headless test: `git -C` on the real repo showed a commit from the future |
| **Plan mode plans in `~/.claude/plans`** | After the first run: the original plans for t2 and t5 were there, with the solution |
| The other sandboxes | t1 runs on a parent older than t2: reading t2's sandbox meant reading the future |

The answer was a **fence**: a hook that rejects any tool call naming the real repo, another sandbox or those folders. Plans move inside the sandbox. A detail that took a while to find: if the plans folder sits outside the project, Claude Code silently falls back to the global path.

The fence had false positives that teach something too. It blocked the session from reading its own long outputs, which Claude Code stores in a session folder, and it blocked a legitimate message because the hook gets a truncated preview of the text. The final audit found **0 leaks across the 20 runs** of the comparison.

## What changed in the new flow

| Before (agent) | After |
|---|---|
| qa | `edge-cases` skill, used while writing the plan |
| tester | testing skill plus a **lock** on approved tests |
| coder | implementation skill plus a **Stop** hook |
| reviewer, security and performance | a single `reviewer` on Sonnet, with the security and performance skills preloaded |

Separate agents weren't only a way to split work: they also guaranteed things. The tester couldn't touch the code and the coder couldn't touch the tests. With one agent, those guarantees have to come from somewhere else, and they came from **hooks**:

- **The guard governs the main session.** It used to let through anything that didn't come from a subagent. Now the main session can edit code and tests, but touching the agents' instructions or the container setup asks a person to confirm, even in auto mode.
- **Frozen tests.** When I approve the tests, a script stores their hash out of the agent's reach. From then on, any edit to those files is rejected.
- **A turn can't end red.** A Stop hook runs the suite and, if it fails, returns the reason and the session keeps working.
- **Pint on every edit**, so formatting doesn't depend on remembering.

There was one moment I'll tell as it happened. After adding the confirmation for Edit and Write, the real test was asking the session, in auto mode, to append a line to `compose.yaml`. It didn't use Edit: it used `printf ... >> compose.yaml` through Bash, and it went through. That was exactly the hole I'd left by not restricting Bash. I closed it with a rule: a command that names those paths asks for confirmation unless it only reads. It isn't perfect, and I'll say so: a command that reaches the file without naming it gets past. The deterministic control is still Edit and Write; the Bash one is a guardrail.

### The trap I set for myself

While writing the skills I slipped in, without meaning to, lessons from the baseline that were hints for the tasks: "SQLite needs `ESCAPE`" was t2's solution; so was the `'0'` case. With that, the new flow would have won by having seen the answers. I took them all out: the skills carry the old agents' content plus the structural changes, nothing learned from these five tasks.

## Results: faster, cheaper, and lower quality

| Metric (10 runs per flow) | 6 agents | 1 agent + reviewer | Change |
|---|---|---|---|
| Active time, median | 23.1 min | 6.6 min | **−71%** |
| Output tokens, median | 135.1 K | 36.5 K | **−73%** |
| Test lines added | 4,996 | 1,602 | −68% |
| Correct behavior | 10/10 | **8/10** | worse |
| My corrections to the plan | 4 | 7 | worse |

Most of the old flow's cost was re-read context: every subagent reads the repo again. And the tester wrote two to three times more test lines than the original commit (in t1, between 109 and 163 test lines for one line of production code).

The two failing runs were on t4, the cap on exception reports. **Telescope** calls `shouldReport()` before the handler does, so without memoizing the decision every exception spends two attempts and the real cap is half. Both old runs solved it because qa read the framework code. New run A didn't see it; new run B found it only in the reviewer's second round. On top of that, neither warned when the limiter couldn't be built. These are real production bugs, if edge ones.

By my rule, **the new flow didn't win**. But Anthropic's guide gives the next step: if a folded subagent scores worse, it stays. Here that subagent was **qa**. Its digging into the framework was the one thing the skill didn't replace; tester, coder, security and performance folded in with no measurable loss.

## The hybrid: one agent that writes and two that only think

I built a third flow with a single change: delete the `edge-cases` skill and bring qa back as a read-only subagent, at the same point where the skill ran, on the draft plan. I ran it on t3 and t4, twice each.

| t3 and t4 | 6 agents | 1 agent | Hybrid |
|---|---|---|---|
| Active time, median | 27.0 min | 8.6 min | 15.3 min |
| Output tokens, median | 183.2 K | 49.7 K | 78.7 K |
| Telescope double count | 2/2 in the plan | 0/2 in the plan | 1/2 in the plan, 1/2 in the first review |
| Warning if the limiter can't be built | 2/2 | 0/2 | 0/2 |

In one run, qa read Telescope's `Handler` and `ExceptionWatcher` and flagged it before any code existed. In the other it didn't read the file where the filter lives, and the reviewer caught it in the first round. **No hybrid run left the Telescope case open.**

The warning when the limiter can't be built was lost in all four runs without the old flow. An honest caveat: my fixed answer said "if the rate limiter or the cache fail", and building the limiter is a case the text doesn't name. The old flow got it because qa had more turns and more context.

By the rule set at the start, **the hybrid doesn't win either**. Against the single agent it takes 1.8 times as long and spends 1.6 times the tokens; against the six-agent flow it takes 44% less time and 57% fewer tokens.

## The decision

I adopted it anyway, and I want to write down why. The case still open is an edge one, and its fix is a better question in the plan, not another agent. What I gained is time and attention: less than half the tokens, a little over half the time, and fewer test lines to review.

Adoption also brought the fixes the experiment uncovered:

- **The Stop hook blocked the second round of tests.** The workflow says a new case goes back through red and my approval, but the hook wouldn't let the turn end with the suite red. Now, if there are changed tests I haven't frozen, it lets the turn end and tells me.
- **Plans made up values.** They proposed 20 per minute when I'd said 10, or 5 reports per 300 seconds instead of 10 per 60. Now a value I didn't give is a question before the plan is approved, not a number the plan fills in. qa didn't fix this; a rule does.
- **Guard false positives.** Counted at the end from the transcripts, there were 15 unnecessary confirmations across 7 runs. The four I analyzed during the runs came from the workflow's own commands. The lesson: what the guard treats as harmless has to come from the workflow, not from intuition.

## The first time outside the experiment

The first complete task with the adopted flow was on this very blog: a page past the last one (`?page=99`, or a number that overflows) answered 200 with an empty page or with the first one, instead of 404. qa built a 19-case matrix and corrected 5 of the draft's criteria before I saw the plan. Up to the commit question it took **12.3 active minutes and 44.1 K output tokens**, with two subagents, and the diff was 8 lines of production code and 160 of tests.

But while measuring it I found something no metric showed: **none of my four `!` commands ran**. The `.env` hash before and after, the script that freezes the tests, and a `git add` reached the session as text messages, not as commands. The tests were never frozen, so the Stop hook had nothing to check. The `.env` checks didn't run, and the commit went out without the test, which was added later with an amend. The agent took each message as if the command had run and moved on. And I approved the commit without seeing the output I was supposed to see.

The code was fine and the `.env` hadn't changed: I checked afterwards. But the run skipped two human gates without anything noticing. I still don't know why those commands arrived as text; my hypothesis is that I typed them while the agent was working and they sat in the queue, but I haven't confirmed it. The lesson doesn't depend on the cause: **a gate the agent can't observe isn't a gate**. The fix is for the agent to check the effect after every `!` (the lock exists, the hash says OK) before going on.

## What this experiment doesn't prove

1. **Two runs per task and per flow.** The variance between runs (t3 produced different designs) is the same size as some of the differences.
2. **One person** designed the tasks, the script and the hidden tests, ran the sessions and graded them.
3. **These are tasks from one repo.** It doesn't carry over to another without running it there.
4. **Some hidden-test failures are about form**, not behavior, and the tables separate them.
5. **The case nobody outside the old flow solved** wasn't named in the script's text.
6. **Tokens, not money.** I didn't work out the cost in dollars.

## What I take away

The experiment didn't tell me how many agents to use. It told me **which of the six was doing work nobody saw**: qa reading the framework code before the plan. The rest became skills without quality noticing, and the guarantees that separating them gave moved into hooks, which don't depend on the model remembering anything.

And one thing that goes beyond agents: writing the rule before running forced me to say that the flow I adopted lost. I adopted it anyway, but now I know exactly what I traded for what.

---

*Sources: [Building agents: When to fold subagents into your main agent loop](https://claude.com/blog/building-agents-when-to-fold-subagents-into-your-main-agent-loop) (Anthropic, October 2026), [single-agent-loop-kit](https://github.com/anthropics/single-agent-loop-kit), [Multi-agent coordination patterns](https://claude.com/blog/multi-agent-coordination-patterns) (Anthropic, April 2026) and [Multi-Agents: What's Actually Working](https://cognition.com/blog/multi-agents-working) (Cognition, April 2026). Tools: Claude Code with skills, subagents and `PreToolUse`, `PostToolUse` and `Stop` hooks.*

