Claude and Claude Code

The Claude loop setupwith the meal plan

What a loop is, then the same meal plan loop set up two ways: in a normal Claude chat, and in Claude Code with /goal.

  • ToolClaude
  • Time5 to 15 min
  • You needAny Claude account (Claude Code for way 2)
  • Reel keywordLOOP

Boris Cherny runs Claude Code at Anthropic. In his words: “I don’t prompt Claude anymore” and “My job is to write loops.”

This guide shows you what a loop is, then sets one up two ways, step by step, with the meal plan from the video. Follow it in order and it works first time.

Before you start

What you need: way 1, any Claude account. Way 2, Claude Code on a computer.

How long: way 1, 5 minutes. Way 2, 15 minutes the first time, including setup.

Tech skills: way 1, none. Way 2, copy and paste a few lines into a terminal.

Free or paid: way 1 works on any plan. Claude Code needs a paid Claude plan.

Which way should I use? Start with way 1. It works anywhere, today. Way 2 is the real loop: Claude keeps going on its own and a separate checker decides when it’s done. Use it once way 1 makes sense.

What a loop is

Normal prompting: you ask, Claude answers, it stops. Checking it is your job.

A loop: you add a goal. Claude doesn’t stop when it produces something. It stops when the goal is met, and if it isn’t there yet, it has another go.

The goal is the finish line, written so it can be checked.

The rule that makes or breaks it

Your goal needs a number or a checklist. Something that can actually be measured.

Doesn’t work Works
Make it healthy Every dinner is 30 minutes or less, start to finish
Make it good Under 200 words, with 3 examples
Get the details right Every ingredient is on the shopping list, with a quantity

If there’s nothing to measure, there’s no way to know when it’s done. Every goal in this guide passes this test.

Every good goal has 3 parts

  1. The finish line. One thing you can measure. “5 dinners, each 30 minutes or less.”
  2. The proof. How Claude has to show it. “Print a table of every dinner and its total time.”
  3. The limits. What must not happen on the way. “No dinner uses an oven.” Plus a stop point, like “or stop after 10 turns.”

Way 1: In a normal Claude chat

You build the goal and the check into the prompt. Claude goes back over its own work before it hands anything over, and shows you the checklist so you can see it actually did.

Step 1: Paste the meal plan prompt

Open a new chat. Fill in the brackets and paste this:

Plan 5 dinners for this week for [number] people.

Things to know: [dietary needs, foods we don't eat, what's already in the fridge]

The goal. Don't hand anything over until all of this is true:
1. There are exactly 5 dinners.
2. Every dinner takes 30 minutes or less in total, prep plus cooking.
3. Every single ingredient in every recipe is on the shopping list, with a quantity. Include oil, salt, spices and anything else that's easy to forget.
4. The shopping list is grouped by section of the supermarket.

How to check:
- Write the 5 recipes first, each with an ingredient list and a prep time plus cook time.
- Then build the shopping list.
- Then go back through every recipe one at a time. For every ingredient, confirm it's on the shopping list. If it's missing, add it.
- Add up each dinner's prep and cook time. If any dinner goes over 30 minutes, swap it for a different dinner and check that one from the start.
- Repeat until every check passes. Don't skip a check because it probably passes.

Then give me, in this order:
A. The 5 recipes
B. The shopping list
C. A proof table with one row per ingredient: the ingredient, which dinner uses it, and whether it's on the shopping list (yes or no). Every row must say yes.
D. A proof table with one row per dinner: prep time, cook time, total. Every total must be 30 or under.

Step 2: Read the proof tables, not the recipes

Scroll straight to tables C and D. Every ingredient row should say yes, and every total should be 30 or under. If any row fails, it didn’t finish the loop.

Step 3: Make it go round again

Even when the tables look clean, paste this in the same chat. It’s the second lap of the loop, and it catches what the first lap missed:

Check your work again from scratch. Go through each recipe line by line and compare every ingredient to the shopping list, including the small ones. Re-add every time. Fix anything that fails, then show me tables C and D again. If nothing needed fixing, say "All checks pass" and nothing else.

Turn thinking or effort up for this. In the menu next to the send button, pick a higher effort level, or switch on Thinking if you see it. Claude checks more carefully when it’s given room to think.

You’ll know it worked when the second check says “All checks pass”, and at the shops nothing’s missing and no dinner turns into an hour and a half.

Way 2: In Claude Code, with /goal

This is the real loop. You type /goal and your finish line. Claude starts working straight away and keeps going, turn after turn, without you prompting each step. After every turn, a separate small model reads the conversation and decides: not yet met (keep going), met (stop), or impossible (stop and tell you why).

Step 1: Update Claude Code

/goal is a newer command, so update first. In your terminal:

claude update

Step 2: Make a folder for the meal plan

Claude will write two files, so give it its own folder:

mkdir ~/meal-plan && cd ~/meal-plan && claude

The first time Claude Code opens a folder, it asks if you trust it. Choose Yes. /goal won’t run in a folder you haven’t trusted.

Step 3: Stop it asking permission every turn

By default Claude asks before it creates each file, which pauses the loop every turn. Press Shift+Tab until the bottom of the screen says accept edits on. Now it can write files in this folder without stopping to ask.

Step 4: Do a 30-second test run

Before the real thing, check /goal works on your setup. Paste this:

/goal hello.txt exists in this folder and contains the word done. Prove it by printing the file's contents. Or stop after 3 turns.

You should see a ◎ /goal active indicator, then a verdict saying the goal was met. If you see that, you’re ready.

Step 5: Run the meal plan goal

Fill in the brackets and paste the whole thing as one message:

/goal meals.md contains exactly 5 dinners for [number] people, and each dinner lists its ingredients with quantities, a prep time and a cook time, with prep plus cook adding up to 30 minutes or less. shopping-list.md contains every ingredient used anywhere in meals.md, with a quantity, grouped by supermarket section, including oil, salt and spices. Things to know: [dietary needs, foods we don't eat, what's already in the fridge]. To prove it, end every turn by printing two tables: (1) every dinner with its prep, cook and total minutes, and (2) every ingredient in meals.md with yes or no for whether it is on shopping-list.md. The goal is met only when every total is 30 or under and every ingredient row says yes. Don't change a dinner that already passes unless you have to. Or stop after 10 turns.

Then leave it. Claude writes the files, prints the tables, the checker reads them, and if anything fails Claude fixes it and goes again.

Why the proof tables matter. The checker can’t open files or run anything. It can only read what Claude has printed in the conversation. If the proof isn’t printed, the checker can’t see it, and the loop can’t finish properly. That’s why every goal in this guide ends with “prove it by printing…”

Step 6: Check on it and stop it

  • Type /goal on its own to see the goal, how many turns it’s taken, the tokens used and the checker’s latest reason.
  • Press Ctrl+O to see why the checker gave its last verdict.
  • Type /goal clear to stop it early.

You’ll know it worked when you see the goal marked as achieved, and meals.md and shopping-list.md are sitting in your meal-plan folder.

Steal this shape for anything

In a chat:

[What you want done.]

The goal. Don't hand anything over until all of this is true:
1. [Something with a number]
2. [Something on a checklist]
3. [Something that must not happen]

How to check: go through your work against every point, one at a time. If anything fails, fix it and check again from the start. Repeat until everything passes.

At the end, show me a proof table with one row per point and pass or fail for each. Every row must say pass.

In Claude Code:

/goal [the finish line, with a number or checklist]. [Anything that must not change]. To prove it, end every turn by printing [the table, count or test result that shows it]. Or stop after [number] turns.

The final check

  • My goal has a number or a checklist, not “make it good”
  • My goal says how to prove it, and asks for a proof table
  • (Chat) I read the proof tables, then ran the second check
  • (Claude Code) I updated, trusted the folder and turned on accept edits
  • (Claude Code) The test goal passed before I ran the real one
  • (Claude Code) My goal has a turn limit

If something looks different

It says it’s done but something’s still wrong. Your goal had a gap. Turn the thing it missed into another numbered line in the goal, and add it to the proof table.

“/goal” isn’t recognised. Run claude update, then start Claude Code again. /goal is only in Claude Code, including the Claude desktop app’s Code tab, not in normal Claude chats. Use way 1 there.

/goal says it can’t run here. The folder isn’t trusted, or hooks are turned off in your settings (/goal runs on the same system as hooks). Open the folder fresh and choose Yes when it asks to trust it. On a work computer, your company’s settings may block it.

It keeps stopping to ask me things. That’s permission prompts. Press Shift+Tab until it says accept edits on. If it wants to run commands too, you can approve those once with “don’t ask again”.

It keeps going and won’t finish. The goal is probably impossible as written, or the proof isn’t being printed. Type /goal clear, make the finish line clearer, check it asks for a printed proof, and keep the turn limit in.

It stopped with “Goal paused” or “Goal cleared”. “Paused” usually means you hit your usage limit. It carries on when the limit resets, or you can send a message to restart it. “Cleared after an unrecoverable error” means something like a login problem. Fix that, then paste the /goal again.

I closed Claude Code halfway through. Open it again in the same folder and run claude --continue. The goal comes back with it.

The weekly email

New guides, first.

One short email a week: the best AI tip I found, and what happened in the ANZ startup scene. Five minutes, no fluff.

By joining, you agree to get emails from jack gpt (Jack Ryan) and to the Privacy policy and Terms. Unsubscribe any time. You must be 18 or over.