AI Briefing
KOSign in

Cockroach Labs Details 'MOLT Sinai' Coding Agent Pipeline Using Teaching Hospital Metaphor

·2026.10.09 09:00

Key point

The pipeline generated over 1 million lines of code in five months for $135,000 in Claude token costs, achieving a 164x speedup for Db2 migration compared to previous efforts.

1 / 4

Details

Cockroach Labs engineers Adam Storm and Rafi Shamim published details on MOLT Sinai, a coding agent pipeline designed to build the MOLT migration toolset. The system adopts a teaching hospital metaphor to ensure production-grade code quality, prioritizing maintainability and rigorous review over raw throughput. By treating issues as patients and agents as medical staff, the pipeline enforces strict safety guardrails and structured handoffs.

Performance and Cost Metrics

The pipeline demonstrated significant efficiency gains during the addition of IBM Db2 migration support. This task, which previously took 9 months and cost $160K for Oracle support in 2024, was completed in approximately 2 days (Wednesday evening to Friday afternoon). Key metrics include:

  • Speed and Cost: 164x faster and 38x cheaper than the previous Oracle implementation.
  • Token Cost: $4,172 for the Db2 sprint, with zero human-written code.
  • Overall Spend: Over $135,000 in Claude token costs for the five-month period (April 21 – September 11, 2026).
  • Volume: Over 1 million lines of code merged, split into small, reviewable units.
  • Issue Generation: 1,299 issues (nearly half of the repository's total) were generated internally by the hospital pipeline, including decomposition children and safety corrective actions.

Architecture and Safety Guardrails

MOLT Sinai operates on GitHub Actions, using issue labels to manage state and role-specific prompts to define agent behavior. The system enforces six core safety rules to prevent common agent failures:

  1. No code before a plan: Fellows must publish a treatment plan (diagnosis, files, tests) reviewed by an Attending agent before implementation.
  2. Don't improvise: Scope changes require stopping and returning to plan review.
  3. No shortcuts around testing: Agents cannot disable or weaken tests; failed tests are treated as ground truth until proven otherwise.
  4. Never flail: Agents must use I-PASS handoffs to escalate blocked issues rather than retrying indefinitely.
  5. Discharge Nurse audits: A final gate ensures reviews were properly conducted (CI green, no unresolved threads) before merging.
  6. Precedent checks: Agents consult an append-only log of human decisions before escalating to a human Chief.

Operational Insights and Future Work

The pipeline evolved from fully autonomous operation to a human approval mode for all merges to ensure customer-ready quality. While the system reduced human intervention to admission decisions after the second month, it faced challenges with bureaucratic overhead and prompt rot (accumulation of redundant rules in skill files).

Key lessons included the effectiveness of persona prompts and plan reviews (which caught risks like hostname exposure that code reviews missed). However, the system struggled with non-converging review loops, leading to the implementation of a circuit-breaker that hands off issues after multiple reworks. Future work focuses on improving agent efficiency, adding educational features for junior engineers, and validating the Migration Assistant (Postgres to CockroachDB), which was almost entirely written by the hospital workers.

This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.

Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.