Operator Playbook · July 2026

The Loop Engineering Playbook

How to prompt and loop your AI operator. Distilled from Andrej Karpathy, Boris Cherny and the Claude Code core team, Anthropic's engineering playbooks, Jarred Sumner's 750,000-line Bun port, Geoffrey Huntley, Simon Willison, and DHH.

A great prompt is a brief with a built-in test. A great operator turns repeat prompts into loops. A great loop never grades its own homework.
Audiobook · 14 min

Part 1: The Task Brief

Every top operator converged on the same 3-line brief. You don't need paragraphs. Three short lines beat ten vague ones.

GOAL: what success looks like (outcome, not activity)
CONSTRAINTS: what NOT to touch / non-goals / budget
DONE WHEN: how we both know it's done (the verification)

Weak vs. strong, in your style

Weak"fix the login bug"
Strong"login fails after session timeout. probably token refresh. done when a failing test reproduces it, then passes"
Weak"make the dashboard better"
Strongscreenshot + "match this design. screenshot your result, compare, list diffs, fix"
Weak"add tests"
Strong"test the quote flow edge case where hours = 0. no mocks. done when npm test is green"
"Don't tell it what to do. Give it success criteria and watch it go." Andrej Karpathy, January 2026. Declarative prompts keep agents working longer and better than step-by-step orders.

The 7 operator laws (consensus of 3+ top sources)

  1. Always give a "done when." A test command, an expected output, a screenshot target, a metric. Anthropic's #1 tip. Without it, "looks done" is the agent's only stop signal, and that's how you get confident garbage.
  2. One unit per ask. Hashimoto: "don't draw the owl in one mega session." If the task has 4 parts, hand over part 1 or say "plan first." Kitchen-sink prompts are the #1 named anti-pattern.
  3. Point, don't describe. "Do it like the Aria config" beats 3 paragraphs describing style. Name a file, a past PR, a live page, a git commit. Reference code is the strongest prompt there is.
  4. Two-strike rule. Corrected the same thing twice in one session? The context is polluted. Say "fresh session" and restate the task with what you learned. Grinding a dirty context wastes your time.
  5. Correction = rule, never just a fix. When the agent screws up, say "make that a rule." It goes to the corrections file permanently. Cherny does exactly this: "write it to CLAUDE.md and Claude runs forever." A correction that isn't persisted is a correction you'll repeat.
  6. Plan-first when you can't describe the diff in one sentence. Say "plan first" and review the plan before any code. One-sentence diffs, just say do it.
  7. Vague is fine when vague is the point. "What would you improve here?" or "research X" needs no structure. The brief format is for build tasks where correction is expensive.
The 2026 reversal
The Claude Code team now says long "don't do X" lists and stacks of examples in prompts HURT current models (their own system prompt shrank 80%). Short commands with a "done when" attached are the modern best practice. Your natural style is right, it just needs the finish line bolted on.

For big features: say "interview me"

The official Anthropic workflow for spec-sized work: the agent interviews you (edge cases, tradeoffs, out-of-scope), writes SPEC.md, then a fresh session executes the spec. Time spent making the spec precise pays off more than time spent watching the build.

Part 2: The Loop Layer

The shift the whole industry made this year: stop prompting tasks one at a time, start designing loops that prompt the agent for you.

"I don't prompt Claude anymore. I have loops prompting Claude and figuring out what to do. My job is to write loops." Boris Cherny, creator of Claude Code. Armin Ronacher, creator of Flask, says the identical sentence.
The rule of thumb
Anything you've asked for more than twice is a loop candidate. Say loop that and it gets built.

The loop menu (what you say, what runs)

You sayWhat runsUse for
"do X"One-shot sessionNormal tasks
"plan first"Plan mode, your approval, then buildMulti-file or uncertain work
"interview me"Spec interview, SPEC.md, fresh build sessionFeature-sized work
"keep going until X"/goal (an independent judge model checks the condition every turn)"until all tests pass", "until Lighthouse hits 90"
"loop that every N"/loop or a cron jobMonitors, CI babysitting, recurring checks
"ralph it"ralph.sh: fresh context each iteration, PLAN.md backlog, one item per pass, commit only on green, 25-iteration capLong backlogs, migrations, overnight grind work
"schedule it"Cron / scheduled routineDaily and weekly jobs while you're away

Anatomy of every real loop

The six-part anatomy, identical across Anthropic's harness design and Cherny's loop guidance:

TRIGGER -> every 15 min / overnight / on CI failure
DOER    -> the agent works ONE task
CHECKER -> a separate model or test suite grades the output
STOP    -> success signal, or N iterations, or $X spent (whichever first)
MEMORY  -> progress file read at the start of every run, updated at the end
SKILLS  -> frozen project knowledge, kept short ("a bloated rules file
           gets paid for on every beat of the loop")

The checker is the load-bearing part. The 2026 iron law: the worker never grades its own homework. A separate model, a test suite, or CI declares "done", never the agent that did the work. Verification collapse is real: an agent grading itself will delete the failing test and call it done. And every loop carries an iteration cap AND a budget cap, or it's not a loop, it's a runaway.

Copy-paste templates (work verbatim in Claude Code)

/loop [verifiable end state], only touching [scope], stop after [X iterations],
use [skill] for the work, use verifier agents at [checkpoint], and keep a
memory file of all your work.
You have a maximum of 20 attempts. If all tests pass, report "TASK_COMPLETE"
and stop. If you hit an error you cannot resolve after 3 retries, report
"TASK_FAILED: [reason]" and stop.

The 10-80-10 model split: first 10% (planning) on the smartest model, 80% grunt work on cheaper models, final 10% review back on the smartest model.

What we never loop
Ambiguous requirements. Architecture decisions. Security-sensitive code. Production debugging. Money. Outbound sends. Loops are for work with a mechanical pass/fail. Judgment stays human-gated.

The overnight cadence (the compounding habit)

Every top operator runs the same rhythm. Hashimoto spends the last 30 minutes of each workday kicking off overnight agents.

  1. End of day: queue the loops. "ralph the moldscanner backlog overnight", "loop the PR babysitter."
  2. Morning: review outcomes. Merge green PRs, kill bad branches. You review outcomes, not keystrokes.
  3. Every correction becomes a rule. So tomorrow's loops are smarter than today's.

Part 3: The Cheat Sheet

The whole playbook on one screen.

Handing off a task

  • Goal + constraints + done-when. 3 lines max
  • One unit per ask
  • Point at reference code or pages, don't describe
  • Attach the proof: error text, screenshot, URL

Mid-task

  • Drift? Interrupt immediately
  • 2 failed corrections = "fresh session" + restated brief
  • Mistake worth remembering = "make that a rule"

Scaling up

  • Asked twice already = "loop that"
  • Big feature = "interview me"
  • Backlog grind = "ralph it"
  • Recurring check = "schedule it"
  • Airtight = "adversarial review"

Never loop

  • Money
  • Production
  • Outbound sends
  • Judgment calls

Part 4: What the Top Guys Actually Do

The apex tier, with their documented workflows. They all flipped to agent-first within the same window (December 2025, when model capability "crossed a threshold of coherence"), and they all converged on the same method independently.

Andrej Karpathy (OpenAI co-founder, ex-Tesla AI director, now at Anthropic)

The most credible witness in the industry because he was the biggest skeptic. October 2025: agents were "net unhelpful," he hand-built nanochat with autocomplete. January 2026: "I rapidly went from 80% manual coding in November to 80% agent coding in December... easily the biggest change in 2 decades of programming." April 2026 he named the discipline agentic engineering. His documented rules:

  1. Declarative, not imperative. "Don't tell it what to do, give it success criteria and watch it go." This is the "done when" law from Part 1, stated by the top guy in the field.
  2. Watch them like a hawk on important code. Agent mistakes look like "a careless, impatient, but very knowledgeable junior developer." Multiple agent windows on one side, an editor on the other purely for reviewing diffs.
  3. The autonomy slider. Match the leash length to trust: small edits on a short leash, well-scoped repo work on a long one. Break work into chunks, validate sequentially.
  4. The verifiability law. "Traditional software automates what you can specify. LLMs automate what you can verify." Tasks with an automatic pass/fail signal are where agents shine; everything else stays jagged.
  5. Agents implement, humans generate. His 8-agent research-org experiment (Feb 2026) found agents "very good at implementing well-scoped ideas, bad at creatively generating them." Ideas, architecture, and taste stay human.
  6. "You can outsource your thinking, but you can't outsource your understanding." The agentic engineer "designs specs, supervises plans, inspects diffs, writes tests, creates evaluation loops, manages permissions, and preserves quality."

Boris Cherny and the Claude Code core team (Anthropic)

  1. Cherny (creator): "I don't prompt Claude anymore. I have loops prompting Claude. My job is to write loops." Brief = goal + constraints + acceptance criteria. Every correction becomes a permanent rule. 259 PRs in one month without opening an IDE.
  2. Adam Wolff (engineer, ex-Robinhood Head of Eng): "90% of the code we ship to production is written by or with Claude." "When implementation cost goes to zero, the feedback loop becomes everything. The speed of learning becomes the only competitive advantage."
  3. Cat Wu (founding PM): scale gradually. Never kick off a run on 100,000 items; test on 1, iterate the prompt, scale to 10, then expand. And stop stuffing prompts with examples and "don't do X" lists, current models work better without them.
  4. Team stats (verified): 5 PRs per engineer per day, 60 to 100 internal releases daily, 80%+ of Anthropic engineers use it daily.

Jarred Sumner (Bun creator): the biggest loop run ever documented

May 2026: ported Bun, 535,496 lines of Zig, to ~750,000 lines of Rust in 11 days using 64 concurrent Claude instances, ~50 workflows, and 6,502 commits. The rules that made it work:

  1. 2+ adversarial reviewers per implementer. "The reviewer's only job: find bugs and reasons why the code does not work." Not style, not opinions, just breakage.
  2. An untouchable ground truth. 1,380,000 pre-existing test assertions, which the agents were never allowed to modify, served as the verifier. 99.8% pass at publication.
  3. The human runs the org, not the code. "For most of those 11 days, I monitored workflows, manually reading outputs to check for issues." He held merge authority and audited that tests genuinely executed.

The rest of the tier, one line each

Anthropic engineering"Done when" as tip #1, the interview-to-spec workflow, the two-strike rule, sprint contracts (agents negotiate "what done looks like" before building).code.claude.com/docs/en/best-practices
Geoffrey HuntleyInvented the Ralph loop. 2026 law: "back pressure" (the verifier layer) IS the engineering, the loop itself is trivial.Don't Waste Your Back Pressure
Simon WillisonRed/green TDD for agents, never trust unexecuted code, a robust test suite means agents can fly.Agentic Engineering Patterns
DHH (Rails creator)Went from hand-typing everything to agent-first ("a mech suit"): parallel agents, human reviews every diff before merge, quality bar unchanged.Promoting AI agents
Greg Brockman / OpenAI Codex teamTests-first loop: commit failing tests as a checkpoint, agent implements until green WITHOUT touching the tests. Codex reviews 100% of OpenAI PRs.Brockman interview
Addy Osmani + Mitchell HashimotoCoined "loop engineering." Test ratchets, done-criteria written before execution, the overnight cadence.Long-Running Agents
The 4-point consensus (every apex figure independently)
1. Declarative success criteria, not step-by-step orders.  2. Parallel sessions with the human reviewing diffs.  3. Tests or an independent reviewer as ground truth the worker cannot touch.  4. Humans keep architecture, spec, and merge authority. Nobody credible ships unreviewed autonomous merges.
Footnote
Beware the viral "Karpathy CLAUDE.md rules" repo circulating on GitHub: it is third-party attribution, not actually written by Karpathy. The primary sources on this page are the real canon.

Part 5: Our Upgrade Backlog

We already run 80% of this: the ralph.sh fresh-context loop, /loop, crons, the 7-agent team, and the corrections-to-rules pipeline. The research surfaced 5 upgrades, in value order.

  1. Independent judge on loop completion. Our loops currently trust the worker's own "complete" signal. Add a separate cheap-model judge pass before accepting done.
  2. Budget caps. Iteration caps exist; dollar and token caps don't yet.
  3. PR-gated loop variant. Each iteration opens a PR, blocks on CI green, merges, continues. Fits our always-use-PRs law perfectly.
  4. Sprint contracts. Done-criteria written to a contract file and agreed BEFORE the loop starts, so the goal can't drift mid-run.
  5. Test ratchet. Loops may never weaken checks. Verification only tightens.