20 loop prompts for a solo business
What we can learn from how Boris Cherny, Andrej Karpathy and Peter Steinberger create their loops
The people who build AI agents have stopped typing prompts one at a time. They write loops: instructions that prompt the agent, check the result and decide the next step. Below are 20 loops you can copy for your business, and what three of the best builders teach about how to write them.
From prompts to loops
“I don't prompt Claude anymore. I have loops that are running. They're the ones that are prompting Claude and figuring out what to do. My job is to write loops.”
“You should be designing loops that prompt your agents.”
A loop is more than a timer. A prompt that runs at 9 a.m. is a scheduled task. A loop finds its own work, checks its own result and decides what to do next. Your job changes from typing prompts to writing the instructions the loop follows.
Two ways to build a loop
Karpathy: the ratchet
Steinberger: inner and outer loop
What each builder teaches
Boris Cherny
Creator of Claude Code
- Give the loop a standing job: “babysit my checkout,” not “check my checkout at 9.”
- Let it find its own work in a source, such as your inbox, comments or support requests.
- Send the work to a second agent. Let a separate check decide when it is done.
- His starter loop:
/loop babysit all my PRs. Auto-fix build issues, and when comments come in, use a worktree agent to fix them.
Andrej Karpathy
Creator of autoresearch
- One thing changes and one number decides. Keep a change only if the number improves.
- Give each test a fixed time. His autoresearch loop trains for five minutes, checks the result, keeps or discards the change, and repeats.
- Write the instructions file, program.md, and let the agent do the work.
- His agents ran about 700 experiments in two days and found 20 improvements that gave an 11% speedup.
Peter Steinberger
Creator of OpenClaw
- The agent runs the inner loop. You set the direction and make the decisions in the outer loop.
- Build a command-line tool first, so the agent can run the software and check the output itself.
- Check in on slow agents. Redirect them, stop them or let them continue.
- You still own the system design, the features and what makes users happy.
Words you will see
- Loop
- Instructions that tell an AI agent to do a job again and again, check the result and choose the next step. Example: a loop that reads your support email each hour and drafts answers.
- Agent
- An AI that can use tools, such as files, web pages or code, to finish a task without you at each step.
- program.md
- A plain text file with the loop's instructions. You save each prompt below as this file.
- Verifier
- The check that decides if the work is good. Example: “each page loads in under two seconds.”
- Ratchet
- A loop that keeps a change only when the score improves, so the work only moves forward.
- Git, commit and undo
- Git saves versions of your files. A commit saves one version. Undo goes back to the last saved version.
- Worktree
- A separate copy of your project, so two agents can work at the same time without overwriting each other.
- Pull request
- A proposed change that waits for approval before it joins the main version.
- /goal and /loop
- Claude Code commands.
/goalkeeps going until a condition is true./looprepeats a prompt on a timer while your session is open. - Scheduled task
- A prompt that runs at set times, even when you are away from your computer.
How to run any loop
- Make one folder for each loop. Copy the prompt and save it in that folder as
program.md. Put the shared rules at the top. - Add the files that the prompt lists under FILES. Replace each
[bracket]with your real detail. - Fast-score loops: open Claude Code in the folder and type
/goal Follow program.md until its STOP rule is true. - Slow-score loops: make a scheduled task with the prompt
Run one round of program.md.Set it to run as often as the card says.
Shared rules for every loop
RULES FOR EVERY LOOP - Work in your own git branch or worktree. - After each round, write one line to log.md: what you tried, the score, and kept or undone. - Read log.md before each round. Try an idea you have not tried yet. - Stop at the round limit, after five rounds with no gain, or at a budget of [token budget]. - Ask me yes or no before anything goes public, gets sent, or costs money. - Keep facts, prices, and promises the same unless this file says you can change them.
Ratchet loopsInner and outer loopsTeam and meta loops
Ratchet loops: change one thing, keep it only if the number improves
Title judge
Builds a judge that learns from your past titles, then scores your new ones.
GOAL A title judge that picks the winning title from my past issues as often as possible. FILES judge.md: the judge prompt. You change this file. titles.csv: pairs of my past titles and which one won. This file stays the same. SCORE Use pairs 1 to 30 for practice. Keep pairs 31 to 40 aside for the final test. Score = the number of practice pairs the judge gets right. EACH ROUND 1. Read log.md. 2. Pick one new idea to improve the judge. 3. Edit judge.md. 4. Run the judge on the practice pairs. 5. Score goes up: commit. Score stays the same or goes down: undo with git. STOP 25 of 30 right, 30 rounds, or five rounds with no gain. REPORT The final test score on pairs 31 to 40, and the best judge.md.
Sales page
Tests one section of your sales page at a time and keeps only the winners.
GOAL More signups per 100 visitors on [page URL]. YOU CHANGE One section per round: headline, first paragraph, offer box, button text, or proof. STAYS THE SAME Price, product promise, and every fact. SCORE Signups per 100 visitors, from [analytics tool]. Count a version only after 200 visitors see it. EACH ROUND 1. Read log.md. 2. Write one change and one sentence on why it should win. 3. Send it to me for yes or no. 4. On yes, publish it. 5. After 200 visitors, compare it with the current best. 6. At least 20% better: keep. Less: put back the best version. STOP Eight rounds, or three rounds in a row with no gain.
Site speed
Makes each page load faster on a phone without changing how it looks.
GOAL A phone speed score of 95 or more on every page of [site]. YOU CHANGE Images, scripts, CSS, and fonts. STAYS THE SAME Text, links, and how each page looks on screen. SCORE Lighthouse mobile performance score. Run it three times per page and use the average. Take a screenshot of the page before and after each change. EACH ROUND 1. Pick the slowest page. 2. Make one fix. 3. Build the site and score the page. 4. Score goes up and the screenshots match: commit. Else: undo with git. STOP Every page at 95 or more, or 40 rounds.
AI citations
Gets your page cited in more answers from ChatGPT, Claude and Perplexity.
GOAL More AI answers that cite [page URL]. YOU CHANGE The opening answer, FAQ, headings, and schema markup on that page. STAYS THE SAME Facts, product claims, and the URL. FILES questions.md: 20 questions my buyers ask. This file stays the same. SCORE Ask each question in questions.md in ChatGPT, Claude, and Perplexity. Score = the number of answers that cite the page (60 possible). EACH ROUND 1. Read log.md. 2. Make one change and publish it. 3. Wait seven days so the AI tools can read the new page. 4. Score again. 5. Score goes up: keep. Else: put back the last version. STOP Ten rounds, or three rounds in a row with no gain.
Prompt pack
Improves each prompt you sell until it passes its test cases.
GOAL Every prompt in [prompt pack folder] passes its tests. FILES prompts/: you change one prompt per round. tests/: ten test inputs for each prompt. This folder stays the same. rubric.md: the checklist for a good answer. This file stays the same. SCORE Run each prompt on its ten test inputs with [model]. A separate grader agent checks each answer against rubric.md: pass or fail. Score = total passes. EACH ROUND 1. Pick the prompt with the lowest score. 2. Make one edit. 3. Run its tests and grade them. 4. Score goes up and no other prompt drops: commit. Else: undo with git. STOP Every prompt passes nine of ten, or 50 rounds.
Skills
Improves a Claude skill, scored on ten real tasks.
GOAL The [skill] skill gets a higher score on real tasks. FILES SKILL.md: you change this file. evals/: ten real tasks, each with the result I want. This folder stays the same. SCORE Run the skill on each task in a fresh session. A grader agent compares each result with the result I want and gives 0, 1, or 2 points. Score = total points (20 possible). EACH ROUND 1. Read log.md and the lowest-scoring results. 2. Make one change to SKILL.md. 3. Run all ten tasks and grade them. 4. Score goes up: commit. Else: undo with git. STOP 18 points, 25 rounds, or five rounds with no gain.
Welcome email
Tests your welcome email so more new subscribers click.
GOAL More new subscribers click a link in their first seven days. YOU CHANGE One part of the welcome email per round: subject, first two lines, or the one link. STAYS THE SAME Sender, send time, and the offer. SCORE Click rate for the first 100 new subscribers who get each version. EACH ROUND 1. Read log.md. 2. Write one change and send it to me for yes or no. 3. On yes, set it live. 4. After 100 new subscribers, compare it with the current best. 5. Better: keep. Else: put back the best version. STOP Six versions.
FAQ
Improves your FAQ until it answers your real customer questions.
GOAL My FAQ answers real customer questions correctly. FILES faq.md: you change this file. questions.md: my last 50 real customer questions, with answers I approved. This file stays the same. SCORE A separate agent answers each question using only faq.md. A grader compares each answer with my approved answer: right or wrong. Score = right answers. EACH ROUND 1. Pick one wrong answer. 2. Add or fix one FAQ entry. 3. Run all 50 questions again. 4. Score goes up and no right answer turns wrong: commit. Else: undo with git. STOP 48 of 50, or 30 rounds.
Cost
Cuts the tokens a loop uses without lowering its quality.
GOAL The same quality for fewer tokens in [loop folder]. YOU CHANGE The model and the files loaded at each step of that loop. STAYS THE SAME That loop's SCORE test. SCORE Two numbers: the loop's quality score, and tokens per finished task. EACH ROUND 1. Pick one step. 2. Move it to a smaller model, or load fewer files. 3. Run ten tasks. 4. Quality stays the same or goes up, and tokens go down: keep. Else: undo. STOP After you test each step once.
Inner and outer loops: the agent works, you decide
Command-line tool first
Gives the agent a way to run and test your app by itself.
GOAL [app] has a command for each main feature, so you can test the app yourself. FILES features.md: the list of features. tests/cli/: test inputs and the output I expect for each command. EACH ROUND 1. Pick the next feature in features.md that has no command. 2. Build the command. 3. Run it with its test inputs. 4. Compare the output with the expected output. 5. Fix and run again until they match. 6. Commit, then go to the next feature. STOP Every feature has a command that passes its tests. REPORT Each command and its test result.
Agent check-in
Finds stuck agents and gives you one fast decision for each.
GOAL Every running agent makes progress or gets a fast decision from me. EACH ROUND (every 30 minutes) 1. Read each agent's last status and log. 2. Mark each one: moving, stuck, or done. Stuck = the same error twice, or no new commit in 60 minutes. 3. For each stuck agent, pause it and send me one message with: - the agent and its task - the problem in one line - three choices: redirect, stop, or continue 4. For each done agent, run its checker and tell me pass or fail. STOP When no agents are running.
Taste
Turns your design choices into written rules for the next build.
GOAL Screens that match my taste, with my taste written down as rules. FILES DESIGN.md: my design rules. You add to this file. screens.md: the list of screens to design. EACH ROUND 1. Build three versions of the next screen, each in its own worktree. Give each a different direction that follows DESIGN.md. 2. Take phone and desktop screenshots of each version. 3. Put the three versions side by side on one page and send it to me. 4. When I pick one, add one rule to DESIGN.md that says why it won. 5. Merge the winner. Start the next screen from the updated DESIGN.md. STOP Every screen in screens.md has a winner.
Personal agent
Moves your open tasks forward and asks you only for decisions.
GOAL My open tasks move forward, with as few messages to me as possible. EACH WAKE 1. Read my inbox, my calendar for the next 48 hours, and tasks.md. 2. Pick one next step you can finish alone in 15 minutes: a draft, research, filing, or a calendar slot. 3. Do it. 4. Write what you did in today.md. 5. Message me only when you need a decision. Ask it as a yes or no question. LIMITS Save emails as drafts. Ask me before you send, pay, or delete anything.
Ship
Tests each change on a preview link before you say yes to go live.
GOAL Every merged change goes live safely. FILES smoke-test.md: the steps a user takes on the site. EACH ROUND (when a pull request merges) 1. Run all tests. 2. Build and deploy to a preview link. 3. Open the preview with a browser agent. Do each step in smoke-test.md at phone and desktop sizes. Take a screenshot at each step. 4. All steps pass: send me the preview link, the screenshots, and "Go live? yes or no." 5. On yes: move it to production and run smoke-test.md on the live site. 6. A step fails: open a fix pull request and start again from step 1. STOP After the live check passes.
Security
Attacks your own apps each night, then fixes what it finds.
GOAL Find and fix security holes in my apps before someone else does. SCOPE Test only the apps in scope.md, on preview or local copies. FILES attacks.md: the attack list. - hidden instructions in each text input and uploaded file (prompt injection) - secret keys in code or logs - pages and APIs that open without a login - one user who can see another user's data - packages with known security holes EACH NIGHT 1. Run each attack in attacks.md against each app. 2. For each hole you find: a. Write a test that proves the hole. b. Fix it in a worktree. c. Run that test and all other tests. d. Open a pull request. 3. Run the attack again to confirm the fix. REPORT (each morning) Found, fixed, and still open, with the worst problem first.
Team and meta loops: loops that run other loops
Idea team
Five agents research five product ideas, and a judge picks the one with the most proof.
GOAL Pick the one product idea with the strongest proof that people want it. FILES ideas.md: five product ideas. STEPS 1. Start five research agents, one for each idea. 2. Each agent collects proof: matching reader questions, search demand, competitor products and their reviews, and prices people pay now. Each agent writes a one-page case with a source for each claim. 3. Start a judge agent that saw none of the research. It ranks the five cases by proof only. 4. For the winner, build a waitlist page and draft one Note. Send both to me for yes or no. 5. On yes, publish them. After seven days, report the signups. STOP After the seven-day report. I decide: build it or drop it.
Research team
Several agents test ideas at once and share one results log.
GOAL Raise the score of [loop] faster, with several agents testing at once. USE WITH Loops with fast scores: 1, 3, 5, 6, or 8. FILES results.md: every agent's results, shared by all agents. SETUP Start four agents. Give each one direction, for example: wording, structure, examples, length. EACH ROUND 1. Each agent reads results.md. 2. Each agent tests one new idea in its direction, in its own worktree. 3. Each agent writes its idea and score to results.md. 4. Every 24 hours, a lead agent combines the best kept changes and scores the combination. 5. The combination beats the best single change: merge it. Else: merge only the best single change. STOP The STOP rule of [loop].
Search rewriter
Improves how your other loops choose what to try next.
GOAL My ratchet loops find wins in fewer rounds. YOU CHANGE The "pick one new idea" step in one loop's program.md. SCORE Rounds per kept win, over 20 rounds of that loop. EACH ROUND 1. Read the log.md files of loops 1 to 9. 2. List which kinds of ideas won and which lost. 3. Rewrite the idea step for the loop with the most rounds per win. 4. Run that loop for 20 rounds. 5. Fewer rounds per win: keep the new step. Else: put back the old step. STOP After you test each loop once.
Loop audit
Checks the claims of each loop and gives it more or less freedom.
GOAL Each loop gets the freedom its checker has earned. FILES loops.md: each loop and its level. Level 1: ask me before each action. Level 2: ask me before anything goes public. Level 3: act, then report to me. EACH ROUND 1. For each loop, pick five "kept" or "done" claims from its log.md. 2. Check each claim against real proof: a test result, the live page, or a number from the source tool. 3. Five of five true in two audits in a row: move the loop up one level. 4. Three or fewer true: move it down one level and tell me why. 5. Update loops.md. REPORT Each loop, its level, and any change.
Rules from your answers
Turns your repeated yes and no answers into rules, so your loops ask you less.
GOAL Each loop asks me fewer questions, because its rules match my decisions. FILES decisions.md: every yes or no I gave a loop, with the question. EACH ROUND 1. Read decisions.md for the last 30 days. 2. Find the questions I answered the same way three times or more. 3. Write each one as a one-line rule under "Rules from me" in that loop's program.md. 4. Send me the new rules on one page for one yes or no. 5. On yes, save them. SCORE Questions to me per week. This number should go down.
The rule that matters most
Match the speed of the loop to the speed of its score. Code and site loops can run every few minutes, because a test gives an answer in seconds. Audience loops, such as a sales page or a welcome email, need days and enough readers. If you decide too early, you keep changes because of luck.
And check the claims. A loop that says “done” has not proved that its work is correct. Loop 19 exists for this reason.