What Is the Hotly Debated ‘Loop’ in AI Programming? A Full Breakdown

The article dissects the rapidly debated concept of “Loop” in AI programming, tracing its origin from a viral tweet, defining it through Boris Cherny’s explanation, outlining its five evolutionary layers, practical usage, cost implications, and how it differs from traditional cron jobs.

ShiZhen AI
ShiZhen AI
ShiZhen AI
What Is the Hotly Debated ‘Loop’ in AI Programming? A Full Breakdown

Why the "design Loop" tweet sparked a frenzy

On June 7, Peter Steinberger (founder of PSPDFKit) tweeted “You shouldn’t be prompting coding agents anymore. You should be designing loops that prompt your agents,” which instantly turned the comment section into a heated debate because most people could not explain what a Loop actually is.

Boris Cherny’s concrete definition

Boris Cherny, creator of Claude Code, described a Loop as a small program that automatically prompts an agent, reads the result, decides whether the task is finished, and repeats until completion. He frames his work as “writing Loops” rather than manually prompting Claude.

Three stages of Loop evolution (according to Cherny)

Stage 1 (≈1 year ago): Hand‑written code plus auto‑completion.

Stage 2 (≈6 months ago): Run 5‑10 Claude sessions in parallel, prompting each.

Stage 3 (now): No manual prompting; write a Loop that lets the agent run autonomously.

In the past 30 days Cherny contributed 259 PRs, 497 commits, and 40 k lines of code, all generated by Claude Code.

Five‑layer history of the “Loop” concept

Layer 1 – Academic while‑loop (2022): Formalized in the ReAct paper (model thinks → calls tool → reads result → repeats).

Layer 2 – AutoGPT era (2023): Give the model a goal so it can prompt itself, though early versions suffered from endless “spinning”.

Layer 3 – Ralph Loop (July 2025): Geoffrey Huntley’s one‑line Bash loop while :; do cat PROMPT.md | claude-code ; done that resets context each iteration; he spent $297 to build a tiny language around it.

Layer 4 – /goal command (Spring 2026): Codex and Claude Code expose a productized Ralph Loop via the /goal command, which runs until a small model confirms task completion.

Layer 5 – Orchestrated Loop (2026 present): Four key changes:

Loop becomes a work unit, not a single task.

Loops supervise other Loops and run concurrently.

Scheduling replaces manual starts, running on infrastructure without user attention.

Persistence via Git backup and crash recovery.

Loop vs. cron job

Both rely on scheduling, but a Loop also contains a decision‑making model that reads its current state, decides the next step, executes it, and verifies success before looping again. Cron jobs run fixed scripts without such dynamic reasoning.

Cron Job vs Loop comparison
Cron Job vs Loop comparison

Getting started with a Loop

The simplest entry point is the Claude Code /loop command. Boris’s example is:

/loop babysit all my PRs. Auto‑fix build issues, and when comments come in, use a worktree agent to fix them.

He also shares five practical tips for production Loops:

Use auto mode to skip permission confirmations.

Leverage dynamic workflows to orchestrate hundreds of agents.

Run continuously with /goal or /loop until completion.

Deploy Claude Code in the cloud and close your laptop.

Ensure the Loop can end‑to‑end verify its own work.

The last point is often overlooked: a Loop’s reliability hinges on its self‑validation capability.

Cost shift and safety guards

When model‑generated code becomes cheap, the dominant expense moves to managing Loops. Companies like Uber cap AI tooling spend at $1,500 per engineer per month because Loops can quickly exhaust budgets.

Production Loops therefore enforce three hard stop conditions:

Maximum iteration count.

No‑progress detection (the loop runs but state does not change).

Token or dollar budget limits.

Loop safety guard diagram
Loop safety guard diagram

Loops, Skills, and automation value

A Loop that merely repeats a primitive while‑true is useless without reusable “Skills”. Turning frequently performed or hard‑to‑repeat tasks into Skills lets a Loop call a tested library, creating compounding automation value.

Take‑away checklist

Stop being the human inside the Loop.

Write Loops that invoke valuable Skills and include self‑checking feedback.

Set hard limits so Loops can stop.

Run Loops on cron‑like schedulers.

Decide the next step yourself, not the model.

For anyone already using Claude Code, Cursor, or similar tools, try the /loop command on a simple PR‑monitoring task and begin moving from manual prompting to automated Loop design.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

automationAI agentsPrompt EngineeringLoopClaude Code
ShiZhen AI
Written by

ShiZhen AI

Tech blogger with over 10 years of experience at leading tech firms, AI efficiency and delivery expert focusing on AI productivity. Covers tech gadgets, AI-driven efficiency, and leisure— AI leisure community. 🛰 szzdzhp001

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.