DEV Community

Cover image for I replaced one long chat with four small agents
Shubham
Shubham

Posted on Edited on Originally published at shubhkumar.in

I replaced one long chat with four small agents

Summary

My work on a ticket starts with one sentence, "let's work on ticket ABC-123." I type it into a session running the tech-lead agent, whose whole definition is a 9 KB Markdown file. The tech lead reads the ticket, writes failing tests, and hands the work to a developer, who hands it to qa until QA returns PASS. The surprise came from the checks I removed: a Sonnet reviewer inside QA made each clean QA run cost about $0.133 instead of $0.005, so it went. Most of this comes from my own use, not a controlled study.

Four files, one sentence, and a loop that stops at PASS.

One chat that reads the ticket, plans, writes the code, and judges its own work grades its own homework. It also forgets. By the time it reaches the code, the ticket details sit far back in the conversation.

Think of a small shop where the same person takes the order, cooks, tastes the food, and tells the customer it is fine. Mistakes get through because nobody checks with fresh eyes.

The fix is small roles with hard limits. Each agent is a short Markdown file in ~/.claude/agents. The file has a name, a model, the tools the agent may use, and a few rules. The longest one, tech-lead.md, is about 9 KB. The other three are 2 to 3 KB each.

Four agents, one hard limit each

Agent

Job

Model

Hard limit

tech-lead

Reviews the ticket, splits it, writes failing tests, runs the loop

Opus 5.5, pinned

Never writes feature code

developer

Builds what the acceptance criteria and the brief ask for

Sonnet 5.5

Never runs tests

qa

Runs the tests, checks the tests are real, returns a verdict

Haiku 5.5

No Edit, cannot spawn agents

documenter

Writes docs after QA passes

Haiku 5.5

Docs only, spawns no agent

The tech lead has no tool limit, because it has to spawn the others. Its model is pinned in the file, so switching the session model does not change who plans.

The developer gets Read, Edit, Write, Bash, Grep, Glob, Agent, SendMessage. It has Bash, but its file says it does not run tests. QA runs them. The developer reads the tests to know what they expect, then builds until every criterion and every point in the brief is done.

QA gets Read, Bash, Grep, Glob, Artifact. No Edit, no Agent. A checker who can fix a problem will quietly fix it instead of reporting it.

One sentence flows from you to the tech lead, developer, QA, and documenter, with QA holding the PASS gate

The most useful line in the tech lead file is a negative one: "You do not write the feature code." Start your own file with the thing the agent must not do.

One advisor, no more reviewers

The tech lead runs on Opus 5.5 and has Fable as its advisor. The advisor reads the whole conversation and answers when asked. Nothing in the settings forces or caps those calls, so the file names three moments: before the plan locks, when the developer reports BLOCKED or validation fails twice for the same cause, and before a ticket is called done.

QA and the documenter used to have a second opinion of their own. Each spawned a read-only Sonnet reviewer at a fixed step. It sounded careful. Then I measured it.

On a case where the code was right but the tests were thin, a QA run with the reviewer cost about $0.133. Without it, $0.005. That is about 25 times more, for a check that still let those tests through 7 times in 10.

So both reviewers are gone. QA now does a self-review instead: before it returns PASS, or when the same failure shows up twice, it re-reads the ticket, the tests, and the diff "as a second reviewer would." The documenter checks its own draft against the code. Neither may spawn any agent.

The cheap fix for thin tests was a rule, not a stronger model. On thin tests, ones that covered too little of a criterion, QA on its own gave 7 PASS and 3 INVALID across 10 runs. The same input, a different answer three times in ten. I added one line to its file: a criterion that names a range (a 4xx, a 5xx) needs tests with at least two values from it, or the verdict is INVALID. After that, it returned INVALID 10 times out of 10.

developer has no second opinion either. When it is stuck, it stops with BLOCKED, and the tech lead asks the advisor.

Before you add a second model to a check, write the rule it would enforce into the checker's file. Then count what the second model costs on a run where nothing is wrong.

One sentence starts the session

I start Claude Code with the tech lead as the main session:

claude --agent tech-lead --advisor fable
Enter fullscreen mode Exit fullscreen mode

The --advisor flag is hidden from --help. You can also set it once with /advisor fable. Then I type the sentence:

let's work on ticket ABC-123
Enter fullscreen mode Exit fullscreen mode

The tech lead is not a helper I call from a normal chat. It is the session itself. Its file says "Run as the main session." That matters because only the main session can spawn the other agents and talk to me at the same time.

It also caps its own team. At most 3 developer agents at once, each on its own subticket and worktree. At most one of anything else. It may spawn only the agents that have files, plus two read-only search agents, and never a general-purpose one. The developer may spawn only qa, one at a time.

Open-source add-ons shape how the agents work. ponytail is a skill that makes an agent build the smallest thing that works. unslop is a skill that cuts AI filler from writing. caveman is a style that keeps agent-to-agent messages short (part 2). They sit in each agent's frontmatter, so I never have to ask. None of them is required for the loop to work.

Run one agent as the main session before you add the rest. A subagent cannot spawn its own team and talk to you at the same time.

What happens after the sentence

The tech lead file lays out the steps. Each gets its own part in this series.

  1. Worktree. Run git fetch origin, then put the ticket in its own git worktree from the fresh remote branch, so my main checkout is never touched. A reused worktree gets pulled and merged with the base before any edit. (Part 2)
  2. Review. For a Linear ID, first check its sub-tickets, open PRs, and branches, and work under the child ticket that already covers the job. Then read the ticket and the code it touches. Report gaps, scope cuts, and whether the ticket is small or large. (Part 2)
  3. Split. Only for large tickets: write subtickets and wait for my approval before creating anything in the tracker. (Part 2)
  4. Write the tests. Failing tests that encode the acceptance criteria. A criterion that names a range gets at least two test values up front. (Part 2)
  5. Build loop. The developer builds, spawns QA, and fixes FAIL verdicts itself. It sends QA only finished work: no TODO, stub, or placeholder left in git diff. It reports DONE with QA's full PASS report pasted in. (Parts 2, 3 and 4)
  6. Learn. Save lessons to memory so the next run starts with them. (Part 2)
  7. Report. Tell me what changed, what was skipped, and what is risky. (Part 2)

Validation in step 4 used to mean a second QA run every time. Now the tech lead reuses the developer's PASS when two things hold: the full report is pasted, and nothing in the worktree changed after it. If the tech lead touched anything after that run, even a test, it spawns qa itself.

The two-values rule in step 3 is there for time. In team runs, a ticket that passed in one QA round took 92 to 103 seconds. One INVALID bounce pushed it to 231 seconds. Each bounce is a full round, so the cheapest place to catch a thin test is before the developer starts.

After PASS, the tech lead hands behavior changes to the documenter (part 5).

I step in where a wrong guess is costly. That means gaps in the ticket, the subticket list, and anything touching money, auth, or data loss. The rest runs without me.

Write down the places you must approve before the loop starts. Gap in the ticket, split list, and a risky area are enough for most teams.

Why split the work at all

Each reason comes from a failure of the one-chat approach.

One chat reads, plans, codes, tests and approves its own work; four agents split those jobs, and QA has no Edit tool

Fresh eyes. QA never saw the developer's reasoning. It sees the ticket, the tests, and the diff, so it cannot talk itself into "this is probably fine."

Smaller models where they fit. QA and the documenter run on Haiku, the developer on Sonnet, and only the planner on Opus. The split itself came from judgment. The cost numbers above back up dropping the Sonnet reviewers.

Short briefs. Each agent gets the ticket, the test paths, the test command, the files it may touch, and the worktree path. A small brief leaves little room to go wrong.

If you try one change from this post, make the checker a separate agent with no edit tools. The fresh eyes matter more than the model choice.

Where the rest of the series goes

Part

Topic

What you get

2

The tech lead

Worktree, sub-ticket check, review, split, tests first, the build loop, memory, the report

3

The developer

The short leash, no test runs, finished work only, the two-strikes rule, the report format

4

QA

Three verdicts, checking the tests themselves, the range rule, the self-review that replaced the Sonnet reviewer

5

The documenter

Docs from the changed files, a fact check against the code, every doc the change touches

6

The advisor

Opus with Fable as advisor, three set moments, why the reviewers went

7

Setup

The four files in full, the commands, and the first ticket

Each agent part has the same shape: what the agent does, its limits, its report, what it remembers, and where it gets a second opinion.

Read the part that matches the step you skip today. That is usually the missing piece.

Results: one chat against four agents

Property

One chat

Four agents

Where the ticket sits when code starts

Far back in the conversation

In a short brief, with test paths

Who judges the work

The author

qa, with no edit tool

Model per job

One model for everything

Opus for the lead, Sonnet for the developer, Haiku for QA and docs

What the developer may touch

Anything it finds

A listed set of files

Who runs the tests

The author

qa only

When I step in

Ad hoc

Gaps, splits, and risky areas

Most of that table describes the two designs, not a measured outcome. The numbers I did measure are smaller and narrower:

Measurement

Before

After

QA run on a clean case

$0.133 with the Sonnet reviewer

$0.005 without it

QA verdict on thin tests, 10 runs

7 PASS, 3 INVALID

10 INVALID with the range rule

Team run time

92 to 103 s with one QA round

231 s after one INVALID bounce

Run the same comparison on your current setup. If the same model plans, codes, and approves, you have the one-chat version with extra steps.

What this does not prove

I did not run a controlled experiment on the whole loop. I cannot tell you how many defects the four-agent loop prevents, or how much faster it ships a ticket than one chat. The model split came from judgment, and a different team may get better results with one strong agent and a strict prompt.

The cost numbers come from clean cases. A reviewer might earn its price on a messy one. I have not measured that. And a self-review by the same Haiku model is not fresh eyes. It is a fixed second pass, which is cheaper and weaker.

The loop also costs setup. Four files, a worktree per ticket, and a brief for each agent are more work than one chat. For a one-line fix, that overhead buys little.

Agent behavior changes between models and releases. The limits in the files are what keep the loop stable, not the specific model names. Recheck the file when you upgrade.

If this overhead feels larger than the ticket, skip the split and keep the ticket small. The loop is for work that touches several files and needs a second opinion. Part 2 has the full list of when to use the loop and when to skip it.

Try it

  1. Create ~/.claude/agents/tech-lead.md with one job and one thing it must not do.
  2. Add a checker agent with no edit tools and no way to spawn agents.
  3. Run claude --agent tech-lead and give it a real ticket.
  4. Write down the points where you must approve before work continues.
  5. Put each ticket in its own git worktree, made from a fresh git fetch.
  6. After the first run, note which step you had to fix by hand. That step needs a rule.

Start with steps 1 and 2 on one small ticket. Add the rest when the loop earns them.

I build payment and agent systems at work; these agent files come from my own use, not a customer setup.

Which check in your loop runs on a second model, and do you know what it costs on a run where nothing is wrong?

References

I post here every Wednesday and Sunday. Subscribers get each post one slot early, so Sunday's post reaches them on Wednesday
Subscribe

Top comments (1)

Collapse
 
promptalo profile image
PromptAlo •

Where a loop stops at PASS, the definition of PASS carries all the weight. I would write down what that check cannot see, so a clean run reads as limited and not as proof.