Stop Prompting Claude — Use Andrej Karpathy's Loops Instead
A breakdown of Claude Code's native /loop and /goal commands, shown live on a race-simulator agent and a newsletter-writing agent that grades its own drafts until they pass.
Posted
yesterday
Duration
Format
Tutorial
educational
Views
319
16 likes
Big Idea
The argument in one line.
Claude Code now has built-in /loop and /goal commands that let an agent repeatedly test and improve its own work against a measurable target without a human re-prompting it each round, turning Andrej Karpathy's hand-built autonomous research loop into a standard feature.
Who This Is For
Read if. Skip if.
READ IF YOU ARE…
You use Claude Code regularly and want it to keep working on a task instead of stopping after one attempt.
You run a content or marketing operation and want an automated quality gate before anything ships.
You're curious what Andrej Karpathy's autonomous research loop actually does, beyond the original tweet.
SKIP IF…
You've never used Claude Code or a similar coding agent — this assumes you already know the basics.
You want a no-code explainer; this walks through actual prompt files and slash commands on screen.
TL;DR
The full version, fast.
Andrej Karpathy popularized a looping agent, Auto Research, that reran an optimization task every few minutes for days without him watching, finding gains he'd missed by hand. Claude Code has since built a simplified version of this into two native commands: /loop, which wakes the agent up repeatedly to check on something, and /goal, which keeps it working until a defined, measurable condition is met by an evaluator model. The video demonstrates both live: a race-simulator agent restricted to editing one file cuts lap time from 60 to under 40 seconds across four experiments, and a newsletter agent rewrites an email against three custom scoring rubrics (a 'humanness' score, a marketing-strength score, and a predicted open-rate score) for five attempts, climbing from 7.1/30 to a best of 26.8/30. The takeaway: define the task, the evaluator, the stop condition, and a hard attempt cap, then let the agent iterate unattended instead of hand-holding every prompt.
Free for members
Chat with this breakdown — free.
Sign in and you get 23 free chat messages on us — ask for the hook, quote a framework, find the exact transcript moment, generate a markdown action plan. Bring your own key when you want unlimited.
Cold open: Karpathy's claim that prompting is outdated, and the 650-experiment stat that frames the episode.
00:33 – 01:25
02 · The Problem With Prompts
Most people give Claude one attempt per task and accept whatever comes back, even if it's mediocre.
01:25 – 02:44
03 · How Karpathy's Loop Works
Karpathy's loop reran an optimization task every five minutes for two days, finding gains he'd missed by hand.
02:44 – 03:19
04 · Auto Research and the Future of AI
Karpathy's Auto Research README frames AI research as continuous agent swarms rather than periodic human meetings; the code becomes self-modifying and opaque.
03:19 – 04:14
05 · Loops Are Now Built Into Claude
Claude Code's native /loop and /goal commands are introduced as a distilled version of Auto Research, plus a four-type loop taxonomy (turn/goal/time/proactive-based).
04:14 – 05:50
06 · Live Example 1: The Race Simulator
A /goal loop is set up to speed up a simulated race car, restricted to editing one file, driver.js, across four controlled experiments.
05:50 – 07:14
07 · The Race Loop Results
Lap time drops from a 60.08s baseline to under the 40s goal across four unattended experiments; the loop stops itself once the target is hit.
07:14 – 07:53
08 · Live Example 2: Real World Newsletter Loop
The same /goal mechanic is applied to marketing: an evaluator model scores a newsletter draft instead of a lap time.
07:53 – 09:43
09 · The Three Cartridges Explained
Three scoring cartridges are introduced — Humanify (sounds human), a Hormozi-style marketing score, and an Open Rate prediction score — combined into one 27/30 target.
09:43 – 10:47
10 · Running the Newsletter Loop
The /goal prompt specifies score thresholds, hard constraints (word count, subject length, one CTA, no spam phrases), and a five-attempt cap.
10:47 – 12:27
11 · The Full Results Breakdown
Scores climb from 7.1 to a best of 26.8 out of 30 by attempt 4, dip on attempt 5, and the loop hits its cap two points short of the 27 target — followed by the Dream Labs community pitch.
Atomic Insights
Lines worth screenshotting.
Most people use an AI agent for exactly one attempt per prompt, so they only ever see its first idea — never its tenth.
Andrej Karpathy's Auto Research loop ran 650 experiments over two days on his own website while he did something else entirely.
Claude Code ships two native loop commands: /loop, which wakes Claude up repeatedly to check on something, and /goal, which keeps it working until a measurable condition is met.
A goal-based loop needs three parts: a task, an evaluator model that scores the result, and a stop condition — the loop only ends when the evaluator confirms the condition or the turn limit is hit.
A race-car AI agent cut simulated lap time from 60.08 seconds to under 40 seconds by being restricted to editing a single file across four controlled experiments.
The agent's very first attempt at speeding up the race car made lap times worse, not better, before later attempts found real gains.
A 'cartridge' is a reusable custom scoring rubric — a Humanify score for how human writing sounds, a Hormozi-style score for marketing strength, an Open Rate score predicted from past send data — that an agent loop can be graded against.
A newsletter loop combining three cartridges was told to hit 27 out of 30 combined, with no single cartridge below 8, under 150 words, under a 45-character subject line, and exactly one call to action.
The email loop's first draft scored 7.1 out of 30; by its fourth attempt it reached 26.8 out of 30 — still short of the 27 target when the five-attempt cap was hit.
The loop's fifth attempt scored lower than its fourth (25.5 vs. 26.8), showing these agent loops don't improve monotonically on every single try.
Restricting an agent to changing only one file or lever per experiment is framed as the single most important rule for making a Karpathy-style loop actually work.
A 40-minute newsletter-improvement loop can run entirely unattended once the goal, evaluator, and constraints are defined upfront.
Takeaway
Claude can now loop on a task until it actually meets your bar.
AGENT LOOPS
Claude Code's /goal and /loop commands turn Andrej Karpathy's manually-built autonomous research loop into a built-in feature: define a task, a scoring evaluator, and a stop condition, then let the agent retry and improve on its own.
02The Problem With Prompts
A single prompt gives an AI agent exactly one attempt at a task, so you get whatever it produces on that first pass — not its best possible output.
Treating an AI agent like a one-shot request is like asking an employee to make a website 10% faster and accepting that as done, instead of asking how much faster it could actually go.
03How Karpathy's Loop Works
Karpathy's loop re-ran the same optimization task every five minutes for two days, each attempt building on the previous one's result, without him checking in.
Even after Karpathy personally tuned his own website and believed he'd hit the practical limit, an overnight unattended loop still found further improvements he hadn't seen.
The stated goal of this style of loop is to keep more agents running for longer stretches without a human in the middle slowing down each cycle.
04Auto Research and the Future of AI
Karpathy's Auto Research project frames current AI-driven research as agents running continuously across compute clusters, in contrast to the older model of humans meeting periodically to compare notes.
A self-looping codebase raises a real transparency question: once agents run thousands of unattended generations of changes, it becomes harder for anyone to say for certain the current code is correct.
05Loops Are Now Built Into Claude
Claude Code has a /loop command that wakes the agent up repeatedly to check on something, and a /goal command that keeps it working until a defined condition is met — simplified, built-in versions of what Karpathy had to hand-build.
The four native loop types differ by what you hand off to the agent: a check (turn-based), a stop condition (goal-based), a trigger to work outside your session (time-based), or a fully recurring workflow (proactive).
With a goal-based loop, an agent keeps optimizing an ongoing deliverable — content, code, a landing page — indefinitely until a human explicitly steps back in and says it's good enough.
06Live Example 1: The Race Simulator
Constraining an agent to editing a single file is described as the most important rule for making a loop like this actually work — narrow the surface area it's allowed to touch.
The agent's very first experiment made lap times worse, not better, before later experiments found real gains — improvement was not linear.
07The Race Loop Results
Across four controlled experiments, simulated lap time dropped from a 60.08-second baseline to under the 40-second goal, with the biggest single jump coming from adding a predictive-safety package.
The loop stopped itself the moment the goal condition was satisfied — it didn't keep running past the target once the metric was hit.
08Live Example 2: Real World Newsletter Loop
The same /goal mechanic applies directly to marketing work: an evaluator model can score a piece of content instead of a lap time, and the loop keeps rewriting until the score clears a bar.
Nearly any recurring business deliverable — social content, landing pages, page speed, customer service replies — can be wrapped in this same loop-until-it-passes pattern.
09The Three Cartridges Explained
A 'cartridge' is a custom scoring rubric — one cartridge can grade how human the writing sounds, another can grade marketing strength, another can predict open rate from past send data.
Stacking multiple cartridges into one combined target forces the agent to satisfy several quality dimensions at once instead of over-optimizing for just one.
Hard constraints — word count, subject-line length, exactly one call to action, no spam phrases — were set alongside the score target so the winning draft still had to be usable, not just high-scoring.
10Running the Newsletter Loop
The instruction to Claude specified the goal, the exact score thresholds per cartridge, the hard constraints, and a hard cap of five attempts — everything the loop needed to run unsupervised.
The original AI-generated email scored 7.1 out of 30 and read as generic, boilerplate marketing copy with stock phrases like 'buy now' and 'learn more.'
11The Full Results Breakdown
Scores rose from 7.1 to 25.2 to 26.2 to a peak of 26.8 across the first four attempts, then dipped to 25.5 on the fifth — the loop hit its cap without reaching the 27 target.
The best draft improved by strengthening the outcome-focused subject line and tightening the call to action, not by any single dramatic rewrite.
Falling short of a stated goal was left in the video rather than cut — a reminder that these loops converge toward a target, they don't guarantee hitting it.
Glossary
Terms worth knowing.
Cartridge
A custom, reusable scoring rubric (e.g. a 'humanness' score or a marketing-strength score) that an AI evaluator model applies to grade a piece of work on a 1-10 scale inside a goal-based loop.
Auto Research
Andrej Karpathy's project where an AI agent autonomously runs iterative optimization experiments on a codebase over long unattended stretches, reporting back only when a result changes.
Evaluator model
The model or scoring function inside a /goal loop that checks the agent's latest attempt against the stated condition and decides whether the loop should stop or send the work back for another pass.
/goal (Claude Code command)
A Claude Code slash command that keeps an agent working on a task, retrying and improving, until an evaluator confirms a stated condition is met or a turn limit is reached.
/loop (Claude Code command)
A Claude Code slash command that wakes the agent up repeatedly on a schedule to check on or continue a task, without requiring a defined pass/fail condition.
“That's what Andre Kapathi created with Auto Research, a looping agent that autonomously ran 650 experiments across two days while Kapathi watched Singles Inferno.”
concrete stat plus a comedic, relatable contrast→ TikTok hook↗ Tweet quote
02:15
“The name of the game is how can you get more agents running for longer periods of time without your involvement doing stuff on your behalf.”
Karpathy's own words, distilled thesis of the whole episode→ IG reel cold open↗ Tweet quote
06:56
“Your website will keep getting faster and faster until you jump back in the loop being like, hey, good job, Claude, we're done here.”
concrete, funny mental model for what a goal-based loop feels like day to day→ newsletter pull-quote↗ Tweet quote
12:07
“The best one did not quite reach our goal at 27. It was two points below it, but it was extremely close.”
honest miss instead of a fabricated perfect result — unusual credibility beat for a tool demo→ newsletter pull-quote↗ Tweet quote
The Script
Word for word.
Read-along
Don't just watch it. Burn it in.
See every word as it's spoken — crank it to 2× and still catch all of it. The same dual-channel trick behind Amazon's Kindle + Audible.
17px
metaphor
00:00So Andre Kapathi now believes that prompting Claude is outdated. Instead, imagine telling your Claude your business goals, then walking away and letting it test and improve its own work until it achieves the goal that you gave it. Well, that's what Andre Kapathi created with Auto Research, a looping agent that autonomously ran 650 experiments across two days while Kapathi watched Singles Inferno.
00:22Well, today, I'll show you how you can build your own Kapathi style loop inside your business so we can all stop prompting it like a pleb and get 10 times the power out of our cords. So let's start with the problem with prompts. To get the most out of the tools that have become available now, you have to remove yourself as the as the bottleneck.
00:41You can't be there to prompt the next thing. You're you take yourself outside. Right now, most people are using their Claude like this.
00:47They open it up. They type a task into it. Claude gets the task, goes and gives it one attempt at the task, and returns it back to you being like, hey.
00:55I did what you said. Sometimes the results are incredible, sometimes pretty mediocre, and sometimes we question why we even pay for Claude in the first place. But the problem is not Claude.
01:05It's how we are using him. We only gave him one attempt to do what we asked. Imagine we had a developer as an employee, we said, hey.
01:11Can you speed up this website for us? You give it to him. He makes it 10% faster.
01:15He sends it back. He says, I'm done. Now it's not the fastest website possible, but it did satisfy the request we made of it.
01:22This is what our Chlords are currently doing with all of our prompts. And this is where the beauty of Kapathi's loop comes into play. Kapathi gave his cord one clear goal, to speed up his website.
01:34But instead of giving it just a single prompt, he looped it. Meaning, every five minutes, the agent would try again to make the website faster and faster and faster building upon its past results. And over the two days of this loop running in the background without Kapathi having to be in the mix, his website got way faster even after Kapathi personally tried to speed it up himself, and he thought he reached the cap of how fast the website could be.
01:58Yeah. And I'd gotten to a certain point, and I thought it was, like, fairly well tuned. And then I let our research go for, like, overnight, and it came back with tunings that I didn't see.
02:06In fact, Andre Kapathi thinks that it's funny that our human meat suits are in the way of agents doing better and better jobs as it is. The name of the game is how can you get more agents running for longer periods of time without your involvement doing stuff on your behalf. I don't wanna be, like, the researcher in loop, like, looking at results, etcetera.
02:22Like, I'm I'm holding the system back. This is his auto research GitHub. We're not gonna go into the technical side of this, but he has this fascinating paragraph right here that says, one day, frontier AI research used to be done by meet computers between eating, sleeping, having fun, and synchronizing once in a while using sound waves talking back and forward interconnecting in the ritual of a group meeting.
02:43That era is long gone. Research is now entirely the domain of autonomous swarms of AI agents running across compute cluster megastructures in the skies.
02:52This looping feature is the start of this future, a utopian future in many people's eyes. It does sound pretty dystopian based on what we've been taught so far, though. The agents claim that we are now in the ten thousandth generation of the code base.
03:04In any case, no one could tell if that's right or wrong as the code is now a self modifying binary that has grown beyond human comprehension.
03:13And he says this repo or this loop feature called auto research is how it all began. This is March 2026 where he tweeted this out. But since March 26, Andre Kapathi's auto research has come a long way.
03:24Now they are actually stored inside Claude as innate features. There's forward slash loop where you can wake Claude up repeatedly to check on something, and there's forward slash goal which keeps Claude working until the clear condition is met, which is this distilled down version of Kapathi's auto research. Auto research is just, yeah, here's an objective.
03:44Here's a metric. Here's your boundaries of what you can and kinda do, and go. But the biggest difference is that your Claude will work on whatever task you give it until you tell it to stop, optimizing it over and over.
03:56So if you're working on social media content, the social media content's gonna get better and better until the human or you with your big old meat suit get back in there and tell it, okay. That's enough. It's as good as I want it to be now.
04:06Or your website will keep getting faster and faster until you jump back in the loop being like, hey. Good job, Claude. We're done here.
04:11I'm gonna show you two live examples that we're working through together of a Kapathi loop. The first one, I wanted to be extremely visual, so it's a race simulator. And the second one is a real world business loop integration.
04:22Starting with our race simulator. So we have this little guy here racing around the track, but he hasn't learned how to drive. And there's a bunch of variables that go into how quick his lap time is going to be, such as the driver, the wheels, the turning, the weather.
04:36And we wanna put Claude as a race engineer to find the fastest and cleanest lap around the track to improve his time. So he started with a time of sixty point o eight seconds per lap, but we gotta get a Kapathi loop onto him to speed him up. I open up my Claude code and I type forward slash goal.
04:58Then I say read Claude prompt dot m d, which is actually the master prompt to set up this loop. So we are telling Claude that they are the autonomous race engineer for the Apex loop. Your job is to search for the best complete race package through a Kapathi style experiment loop.
05:14The goal, keep improving the race package until all three deterministic seated runs finish. The median lap is to be, in the goal here, below forty seconds. Remember, it started at sixty seconds.
05:24We have a few more things in the prompt here that the rules to set it up properly. But coming back to this prompt, then run the Apex loop race package experiment exactly as written. Follow its four controlled experiment phases changing only the driver and driver JS.
05:36Remember, we it can't change how we're actually scoring this. This is the most important thing of a Kapathi loop is that the agent only has access to the file or the thing that you want to improve. And do this until you reach a time under forty seconds.
05:48So we're gonna send that off to our Claude code and start our Kapathi style loop. So our Kapathi loop has finished, and you can see where it started. It studied the physics engine.
05:56It then tracked the model and geometry. He had a complete model of the physics, and then he went into his first experiment, which was the baseline. Run all three runs with the median.
06:06He's got his stats and data here. And, unfortunately, was really bad. I'm gonna show you the results in just a second.
06:10He went on to experiment two, telling us what he's optimizing for and what he's changing every time. Remember, there was no human in the loop. I did not touch it after I set this loop off.
06:20He then went on to experiment three, which was, uh, improving another variable that we had, and experiment four as well. So when we scroll down and we see these in a table, you can see the baseline was sixty seconds. His first experiment actually made it worse with more collisions.
06:35Then he had a predictive safety package installed. Remember, no human in the loop, no meat suit touching the keyboard at all, and he took off 23 of the lap time.
06:46And then his fourth experiment was even better again, getting it under the goal of forty seconds, which is where the loop stopped. And you can see this is the new and improved driver package thanks to our Claude code loop displayed visually here on the Apex Loop Racetrack, which is really fun in theory.
07:03But I also like putting these into real world practices for us so we can actually use them for our business and use them for our personal life and have these Kapathi loops set up at all times running hundreds of sub agents working towards our goals for us while we go watch Singles Inferno. Okay. So for a real world example, this is Claude's official diagram of a goal based loop.
07:22It came out with this on Twitter. Claude will work on the task, and once it's done its work, it's gonna try to stop. But it only gets to stop the task once it reaches the evaluating model's condition that you've given it.
07:35In the last experiment we just did together, it was a forty second lap time. In this one, it's going to be a little bit different. I'm gonna show you right now.
07:42For example, you can make the evaluator model anything based on any criteria. This is the magic of a Kapathi loop. How can you get more agents running for longer periods of time without your involvement doing stuff on your behalf?
07:53Get our email to score at least a nine out of 10 on the Humanify cartridge. So if you're sending out emails or newsletters to your list and you want them to sound human, you could put in something like a Humanify cartridge where it analyzes the voice, the variety, the predictability, just like any AI slop detector, create an algorithm, and give it a score out of 10.
08:14And only once it ranks nine or 10 out of 10 is that email available to be sent by you. Another example, you might want your email to be extremely good on the marketing front. And, of course, Alex Homosey is a wizard with his marketing.
08:27So you could pull in Alex Homosey's public tweets, his public emails, his public YouTube data, create a Homose AI algorithm that is gonna score it out of 10 on how good that email is marketing wise, and you can have it loop and keep creating a better and better email according to that cartridge until you reach a nine or a 10 out of 10.
08:48The last one we have, which is an interesting loop because it actually takes back real world data, is an open rate email analytics engine where it takes your past emails, your past audience behavior, and your subject line patterns to try and predict based on real world data that you've actually sent with the email list the predicted open rate.
09:06And therefore, also give it a score out of 10, which is the objective measure that the loop can grade itself on and keep looping until it hits that. In this example, we've actually put all three of these cartridges and all three of these evaluated goals together to get our email to score at least a 27 out of 30 from the cartridge evaluator.
09:24By the way, if you wanna get these cartridges or build your own cartridges and build your own loops, come and join us inside the Dreamlabs community. The link to that is in the description below. We are building cutting edge AI systems for your business in there every single day.
09:36So you can come and use all of our templates or even create your own and learn how to do this and be on the cutting edge of AI tech. So we've come back to Chord code to get this Kapathi loop out into the real world. We've typed forward slash goal because it's working towards a goal.
09:50Read the Claude PromptMD, then run the controlled newsletter improvement loop exactly as written. Keep improving the local field note signal draft until Humidify, Hormoz AI, and Open Rate Total at least 27 out of 30. No cartridge can be below eight on score.
10:04The The body's under a 150 words. The subject is under 45 characters, and there's only one call to action in the email. No block spam phrase appears.
10:13Stop after five attempts. Save it as a draft mode only and never send it. So we're gonna send that off now to see how this loop goes.
10:20Okay. So that loop has finished, which running these loops is pretty incredible because you literally can walk away from your computer, you can start doing something else, and you know this email is getting sharper and sharper by all the criteria that I set it.
10:32And, of course, you can plug anything in here from social media content, the websites, landing pages, speeds, products, customer service. Almost every part of our business can be looped. Now you can see there's about five different attempts that this loop had on improving this email and getting it judged by those cartridges that we went through.
10:49So attempt three, attempt four, attempt five. Coming down here is a table where you can see the total score. It started at really weak at 7.1, and this was the original email.
10:59In today's fast paced world, managing your inbox can be overwhelming. It's a very generic looking thing. It looks 1.9 out of the humidifier cartridge, 2.2 from the Hermos AI, and the open rate was only a three point o on the rating, which gave it a 7.1 out of 30.
11:13And you can see even the buy now and the learn more, it's a very generic feeling email. It then absolutely blasted. It almost tripled its score here to get a nine on the open rate, 7.5 on the Homos AI, and 8.7 on the Humanify to pass, but it did not reach the 27 out of 30 that we wanted to.
11:30And so it went again and improved it by another one point, which this is the updated email here which reads a lot more concise, lot more personal than that original one. Then it hit number four, which is the best rating out of all of them, 26.8, 9.2 on the Humanify, 8.2 on the Humos AI, and the open rate a 9.2.
11:48And then it went on to five and actually fell back a little bit to 25.5. So the best one did not quite reach our goal at 27. It was two points below it, but it was extremely close.
11:58And so this took about forty minutes to keep looping and get our email better and better all the way to attempt number four, which was this email right here. So if you wanna set up your own Kapathi loops and would like some personalized one on one help, come and join our Dreamlabs community. We wanna create the best AI community in the world.
12:15I'm literally in there waiting for you to help create the perfect loops, the perfect agents, and the perfect omnipresent AI setup for your business. The link to that is in the description below. Thanks for watching.
Andrej Karpathy thinks one-shot prompting is already outdated. His fix, Auto Research, ran 650 unattended experiments on his own website over two days while he watched Netflix — and Claude Code has since folded a simplified version of that same trick into two built-in commands.
Frameworks
Named ideas worth stealing.
03:19list
The Four Loop Types
Turn-based — you hand off the check, use it when exploring or deciding, reach for custom verification steps
Goal-based — you hand off the stop condition, use it when you know what done looks like, reach for /goal
Time-based — you hand off the trigger, use it when the work happens outside your project on a schedule, reach for /loop or /schedule
Proactive — you hand off the prompt, use it when the work is recurring and well-defined, reach for all of the above plus dynamic workflows
A getting-started table matching four ways of delegating recurring Claude Code work to the specific command each one calls for.
Steal fordeciding which Claude Code automation mechanism fits a given recurring task before building it
07:53model
Cartridge Scoring System
Humanify — scores how human a piece of writing sounds, out of 10
Hormozi AI — scores marketing strength (offer, hook, proof), out of 10
Open Rate — predicts likely email open rate from past sends and audience behavior, scored out of 10
Three independent AI scoring rubrics stacked into one combined target so a /goal loop has to satisfy several quality dimensions at once instead of over-optimizing for just one.
Steal forany content-quality gate — build a small set of named scoring cartridges and require every draft to clear all of them before it ships
CTA Breakdown
How they asked for the click.
VERBAL ASK
11:52link
“If you wanna set up your own Kapathi loops and would like some personalized one on one help, come and join our Dreamlabs community. The link to that is in the description below.”
Verbal pitch delivered twice — once mid-video after the cartridge explainer (~08:57) and again in the outro (~11:52) — reinforced by an on-screen Dream Labs AI community screenshot; description link carries a tracking param (?v=K5).
A creator runs the same workout-app build through Opus 4.8, Fable 5, and three advisor-mode hybrids to find the cheapest way to get Fable-level output without paying full price.
A tweet-reaction breakdown of Anthropic's viral five-archetype framework — and the Slack-embedded Claude agent quietly filling the sixth role nobody named yet.
A YouTube host reverse-engineers Boris Cherny's one-line CLAUDE.md snippet, then runs a live three-way Claude Code test to prove a self-learning lessons file beats a static one.
A 10-minute walkthrough of Anthropic's internal classification of agent loops — four types, two slash commands, and the stop-condition rule that prevents a $6,000 night.