← Back to library

Treat agent tickets like patients with staged review gates

Adam Storm of Cockroach Labs describes MOLT Sinai, styled like a hospital: each ticket is a patient and a merge counts as discharge. A planner split IBM Db2 support into 15 sub-issues; reviewers sent work back 55 times and stuck agents wrote handoffs before escalating. Landed in under two days ($4,172 tokens); an Oracle port once took nine months.

  • OutcomeShip a large, correctness-critical feature written entirely by agents, with planning, review rounds and escalation rules that keep quality at human standard.
  • SetupAn afternoon+
  • LevelAdvanced
  • CreditAdam Storm
View original
Works with
Claude CodeCustom agent

Published Oct 23, 2026Updated Oct 23, 2026AI dry run on sample input: passed Oct 23, 2026Source verified Oct 23, 2026

When should you use it?

  • A bug in your code could corrupt customer data
  • You care more about correctness than throughput
  • You can afford slower agent runs

Not for: Quick prototypes; Teams that will not maintain the pipeline's own skills

What do you need, and what do you get?

You need

  • A mirrored repo to trial the pipeline
  • Issue tracker labels for each stage
  • Skill and prompt files per role

You get

  • Child tickets ordered by what depends on what
  • Small reviewable pull requests
  • Structured escalation notes for humans

How does it work, step by step?

  1. Trial on a mirrorBuild the pipeline in a copy of the repository before touching the real one.
  2. Decompose big asksLet a planner split large issues into dependent children, and split again if a child is still too big.
  3. Review repeatedlySend work back until reviewers are satisfied; Db2 needed fifty-five send-backs.
  4. Never flailA stuck agent stops, writes a structured handoff borrowed from clinical practice and escalates.
  5. Turn on human approvalAfter the first week they required a person to look at every merge.

The prompt

Our own prompt, inspired by Adam Storm and written to work in Claude Code and Custom agent. Values in lime are placeholders.

Prompt0 variables
You are the planner for issue [number]. If it is too large for one small pull request, break it into child tickets, state which depend on which, and acceptance tests, and stop. If you are a worker and you are stuck after [N] attempts, do not keep trying: write a handoff with severity, summary, actions tried, current situation and your best hypothesis, then label the issue for human attention.

Inspired by Adam Storm: Five months treating bugs like patients and coding agents like a medical team. The prompt above is written by playbooks.bot in our own words; nothing from the original is quoted.

What can go wrong?

  • Skill files rot like code; an audit found 23% of 100,000 words removable.
  • Long instruction files cost tokens on every run before any work starts.

Our take

This is among the most rigorous public accounts of agent coding, and its framing is the lesson: measure how many pull requests you would be embarrassed to merge, not how many ship. Reviewers sending work back dozens of times is a feature, not a failure, if the alternative is merging weak code. The rule that stuck agents write a structured handoff instead of trying harder is worth copying anywhere, because endless retries burn money and rarely fix a wrong approach. So is a periodic prompt audit; schedule one quarterly to catch instructions that drift. Smaller teams can start with just the decompose, review and escalate stages without copying the full hospital metaphor. Keep a human owner for interface design and for anything that touches production data. Track token spend per epic so surprises like a multi-thousand-dollar burst are visible. Trial the process on a mirror of a hard problem before pointing it at the real migration.

Where the time goes back: Slow, gated agent work replaces months of engineering on features where mistakes are expensive.

FAQ

What has it cost overall?
About $135,000 of model usage across roughly five months, or some $84 per ticket.
Did humans write any Db2 code?
No. Agents wrote it all; humans handled two escalations and later approved merges.

Source and credit

Inspired by Adam Storm. We describe the idea in our own words, link to the original, and wrote the prompt ourselves; nothing is quoted.

Inspired by
Five months treating bugs like patients and coding agents like a medical team
Creator
Adam Storm
Published on
cockroachlabs.com
Original date
Oct 9, 2026
License
Not openly licensed (the poster keeps all rights), so we quote nothing and link to the original
Originally for
Claude Code
AI dry run
Oct 23, 2026: passed. Dry-run tested by our AI test agent on sample input. PASS: Gates held on desk check; no live sends or purchases.
AI dry run on sample data; not run with live connected accounts. The playbooks.bot test agent filled the prompt with synthetic inputs, produced the output and checked it against the page's stated outputs and guardrails.
Verified
Oct 23, 2026: source link resolves to the original, the credited creator published it, our excerpt or prompt matches it, and the license allows our use.

Are you the creator? Claim or correct this page.

More in Operations & Admin

All 203 Operations & Admin playbooks →

Related playbooks

Operations & AdminWorkflow✓ AI dry run

Add a merge check for every way coding agents break code

Keep a running list of the specific ways coding agents have damaged your repository, from hollow tests and invented fake responses to deleted files and silenced type errors, and turn each one into an automated gate that blocks the merge, so the same mistake cannot slip through review twice.

Credit: u/alexmarquardt on r/ClaudeCode

An afternoon+
Operations & AdminPrompt✓ AI dry run

Give your agents one shared wiki that only one agent edits

Replace scattered agent memories with a single Markdown wiki in git: every agent reads a short daily brief from it, agents and scripts file sourced notes into an inbox instead of editing pages, one steward agent checks and merges those notes each morning, and private agent memory keeps only personal preferences.

Credit: Siim Tolk

An afternoon+
Operations & AdminWorkflow✓ AI dry run

Test every agent change against 20 fixed real tasks

Collect about twenty real jobs your agent handles, including a few it should refuse or stop on, lock that list, and rerun all of them after each change to its prompt, tools, model or setup, scoring completion, forbidden actions, correct hand-offs to a person and cost so you can see what a change improved and what it broke.

Credit: u/ChefOk4636 on r/AI_Agents

Under an hour
Operations & AdminRoutine✓ AI dry run

Unused subscription tokens become small PRs to review

Let a scheduled bot check your remaining subscription quota before the weekly reset and use it to open small PRs toward the goals and to-dos you list.

Credit: ariwilson on Hacker News

Under an hour