Dream Labs AI
12 min video
3 min read
Karpathy Loops: Stop Prompting, Start Looping
You just saved 9 min.
The big takeaway
Andrej Karpathy's looping approach replaces one-shot prompting with autonomous agents that iteratively improve work toward a goal. Claude's /loop and /goal features enable this: set a clear objective and evaluation metric, then let Claude refine results repeatedly without human intervention until the goal is met.
The Problem with Single-Prompt Workflows
One Attempt, One Result
Current Claude usage gives the AI a single task, receives one attempt, and accepts whatever result comes back—often mediocre. This mirrors hiring a developer, giving them one shot to speed up a website, and accepting a 10% improvement as final, even though better solutions exist.
Humans Are the Bottleneck
The constraint is not Claude's capability but the user's presence. You must remove yourself from the loop so the agent can work autonomously without waiting for your next prompt.
Karpathy's Loop: Iterative Autonomous Improvement
Auto Research: The Origin
Karpathy built Auto Research, an agent that ran 650 experiments across 2 days to optimize his website speed, discovering tunings he had missed despite thinking he'd reached the maximum. The agent looped every 5 minutes, building on past results without human intervention.
650
experiments run autonomously over 2 days
Karpathy's Auto Research looped continuously while he watched Singles Inferno
The Future of Research
Karpathy describes a shift from human researchers working between eating and sleeping to autonomous AI agent swarms running on compute clusters. This looping feature marks the beginning of that era, where agents modify code beyond human comprehension.
Claude's Built-In Loop Features
/loop and /goal Commands
Claude now has native looping features: /loop wakes Claude repeatedly to check on a task, and /goal keeps Claude working until a clear condition is met. These are distilled versions of Auto Research, enabling any user to set an objective and metric, then let Claude optimize until told to stop.
How It Works
You provide an objective, a metric to measure success, and boundaries on what the agent can change. Claude then iterates, improving the output over and over until you stop it or it reaches the goal condition.
1
Set clear goal and success metric
2
Define boundaries (what Claude can and cannot change)
3
Claude attempts task and evaluates against metric
4
Claude refines and tries again
5
Loop repeats until goal reached or human stops it
Karpathy loop workflow
Live Example 1: Race Simulator
Baseline and Goal
A race car driver starts with a lap time of 60.08 seconds. The goal is to optimize driver behavior, wheels, turning, and weather variables to achieve a lap under 40 seconds using a Karpathy loop.
Starting lap time
60.08 seconds
Goal lap time
Under 40 seconds
Race simulator optimization target
Controlled Experiments
Claude ran four controlled experiment phases, changing only the driver.js file (the only variable it was allowed to modify). The baseline was 60 seconds; experiment one made it worse with collisions; experiment two installed a predictive safety package and cut 23 seconds; experiment four achieved the sub-40-second goal.
Baseline
60 seconds
Experiment 1
62 seconds
Experiment 2 (safety package)
37 seconds
Experiment 4 (final)
39 seconds
Race simulator lap time progression across experiments
Critical Constraint
The agent only had access to the driver.js file. It could not change scoring logic or physics. This constraint is essential to a Karpathy loop: limit the agent to modifying only the target variable, not the evaluation itself.
Live Example 2: Email Newsletter Loop
Three Evaluator Cartridges
The email loop used three scoring systems: Humanify (analyzes voice, variety, predictability to detect AI slop), Hormozi AI (scores marketing quality based on Alex Hormozi's public data), and Open Rate Engine (predicts open rate from past audience behavior and subject line patterns). The goal was a combined score of at least 27 out of 30.
1
Humanify cartridge
Max 10
2
Hormozi AI cartridge
Max 10
3
Open Rate cartridge
Max 10
Three evaluation criteria combined for 27/30 goal
Constraints and Boundaries
The loop had strict rules: no cartridge below 8, body under 150 words, subject under 45 characters, only one call to action, no spam phrases, maximum 5 attempts, save as draft only (never send).
Results and Progression
The original email scored 7.1 out of 30 (generic, weak on all metrics). Attempt 2 nearly tripled to 24.2. Attempt 4 reached 26.8 (9.2 humanify, 8.2 Hormozi, 9.2 open rate)—the best but 2.2 points short of the 27 goal. The loop ran for 40 minutes across 5 attempts, progressively refining the email without human intervention.
Qualitative Improvement
The original email was generic ('In today's fast-paced world, managing your inbox can be overwhelming'). By attempt 4, it became concise, personal, and compelling—a dramatic shift in tone and effectiveness despite falling 2.2 points short of the numerical goal.
Broader Applications
Any Business Process Can Loop
Karpathy loops apply to social media content, websites, landing pages, speed optimization, products, and customer service. Any task with a measurable goal and clear boundaries can be handed to an autonomous agent.
The Human Advantage
Once the loop is set up, you walk away. The agent works toward the goal while you do something else, returning only when the loop completes or reaches your stopping condition. This removes the human as a bottleneck.
Worth quoting
"You need to take yourself outside. You're the bottleneck."
— Andrej Karpathy (paraphrased), at [0:30]
"I'm holding the system back. I don't want to be the researcher in the loop."
— Andrej Karpathy, at [2:02]
"The name of the game is how can you get more agents running for longer periods of time without your involvement."
— Andrej Karpathy, at [2:02]
Try this
Set up a /goal loop in Claude Code: define one clear objective, a measurable success metric, and boundaries on what Claude can modify.
Choose an evaluator metric (e.g., humanify score, open rate, lap time) and hardcode it so Claude cannot change the evaluation itself.
Test with a low-stakes task (email, social post, or code snippet) to see the loop iterate 3–5 times and observe quality improvement.
Document the best result from each attempt to understand what changes drove improvement.
Scale to business processes: apply loops to landing pages, customer service responses, or product copy with relevant cartridges or scoring systems.
Made with Glimpse by Wozart
glimpse.wozart.com/v/p0iarqbz
Share this infographic
Read this infographic as text

Karpathy Loops: Stop Prompting, Start Looping

Summary of the video “Stop prompting Claude. Use Andrej Karpathy's Loops Instead... by Dream Labs AI.

Andrej Karpathy's looping approach replaces one-shot prompting with autonomous agents that iteratively improve work toward a goal. Claude's /loop and /goal features enable this: set a clear objective and evaluation metric, then let Claude refine results repeatedly without human intervention until the goal is met.

The Problem with Single-Prompt Workflows

One Attempt, One Result

Current Claude usage gives the AI a single task, receives one attempt, and accepts whatever result comes back—often mediocre. This mirrors hiring a developer, giving them one shot to speed up a website, and accepting a 10% improvement as final, even though better solutions exist.

Humans Are the Bottleneck

The constraint is not Claude's capability but the user's presence. You must remove yourself from the loop so the agent can work autonomously without waiting for your next prompt.

Karpathy's Loop: Iterative Autonomous Improvement

Auto Research: The Origin

Karpathy built Auto Research, an agent that ran 650 experiments across 2 days to optimize his website speed, discovering tunings he had missed despite thinking he'd reached the maximum. The agent looped every 5 minutes, building on past results without human intervention.

The Future of Research

Karpathy describes a shift from human researchers working between eating and sleeping to autonomous AI agent swarms running on compute clusters. This looping feature marks the beginning of that era, where agents modify code beyond human comprehension.

Claude's Built-In Loop Features

/loop and /goal Commands

Claude now has native looping features: /loop wakes Claude repeatedly to check on a task, and /goal keeps Claude working until a clear condition is met. These are distilled versions of Auto Research, enabling any user to set an objective and metric, then let Claude optimize until told to stop.

How It Works

You provide an objective, a metric to measure success, and boundaries on what the agent can change. Claude then iterates, improving the output over and over until you stop it or it reaches the goal condition.

Live Example 1: Race Simulator

Baseline and Goal

A race car driver starts with a lap time of 60.08 seconds. The goal is to optimize driver behavior, wheels, turning, and weather variables to achieve a lap under 40 seconds using a Karpathy loop.

Controlled Experiments

Claude ran four controlled experiment phases, changing only the driver.js file (the only variable it was allowed to modify). The baseline was 60 seconds; experiment one made it worse with collisions; experiment two installed a predictive safety package and cut 23 seconds; experiment four achieved the sub-40-second goal.

Critical Constraint

The agent only had access to the driver.js file. It could not change scoring logic or physics. This constraint is essential to a Karpathy loop: limit the agent to modifying only the target variable, not the evaluation itself.

Live Example 2: Email Newsletter Loop

Three Evaluator Cartridges

The email loop used three scoring systems: Humanify (analyzes voice, variety, predictability to detect AI slop), Hormozi AI (scores marketing quality based on Alex Hormozi's public data), and Open Rate Engine (predicts open rate from past audience behavior and subject line patterns). The goal was a combined score of at least 27 out of 30.

Constraints and Boundaries

The loop had strict rules: no cartridge below 8, body under 150 words, subject under 45 characters, only one call to action, no spam phrases, maximum 5 attempts, save as draft only (never send).

Results and Progression

The original email scored 7.1 out of 30 (generic, weak on all metrics). Attempt 2 nearly tripled to 24.2. Attempt 4 reached 26.8 (9.2 humanify, 8.2 Hormozi, 9.2 open rate)—the best but 2.2 points short of the 27 goal. The loop ran for 40 minutes across 5 attempts, progressively refining the email without human intervention.

Qualitative Improvement

The original email was generic ('In today's fast-paced world, managing your inbox can be overwhelming'). By attempt 4, it became concise, personal, and compelling—a dramatic shift in tone and effectiveness despite falling 2.2 points short of the numerical goal.

Broader Applications

Any Business Process Can Loop

Karpathy loops apply to social media content, websites, landing pages, speed optimization, products, and customer service. Any task with a measurable goal and clear boundaries can be handed to an autonomous agent.

The Human Advantage

Once the loop is set up, you walk away. The agent works toward the goal while you do something else, returning only when the loop completes or reaches your stopping condition. This removes the human as a bottleneck.

Notable quotes

You need to take yourself outside. You're the bottleneck. — Andrej Karpathy (paraphrased)
I'm holding the system back. I don't want to be the researcher in the loop. — Andrej Karpathy
The name of the game is how can you get more agents running for longer periods of time without your involvement. — Andrej Karpathy

Action items

  • Set up a /goal loop in Claude Code: define one clear objective, a measurable success metric, and boundaries on what Claude can modify.
  • Choose an evaluator metric (e.g., humanify score, open rate, lap time) and hardcode it so Claude cannot change the evaluation itself.
  • Test with a low-stakes task (email, social post, or code snippet) to see the loop iterate 3–5 times and observe quality improvement.
  • Document the best result from each attempt to understand what changes drove improvement.
  • Scale to business processes: apply loops to landing pages, customer service responses, or product copy with relevant cartridges or scoring systems.

More like this