Here's why schedules and goals are worth your while.

By Daniel Nest

Published: 2026-06-25

URL: https://www.whytryai.com/p/loop-engineering


A few weeks ago, Boris Cherny (who runs Claude Code at Anthropic) went viral with this short clip about his mindset shift from prompting to “loops”:

Here’s what he said:

“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.”

In less than a millisecond, “loop engineering” became the next big hype train:

YouTube feed screenshot showing three loop engineering videos published within weeks of each other: "7 INSANE loops you need to try right now" by Matthew Berman (80k views), "Loop Engineering in 9 Minutes" by Developers Digest (29k views), and "Claude Code Creator: Write Loops, Not Prompts" by Sean Kochel (33k views). \Source: YouTube feed\

Between prompt engineering, context engineering, and loop engineering, we’ve officially overengineered ourselves into oblivion.1

But “loop engineering” is just a fancy word for a concept most of us already know.

Let’s talk about loops and what “regular people” versions of them look like.

Why Try AI is proudly reader-supported. Subscribe to get every future post. Go paid to unlock extra stuff.

What’s a “loop,” even?

Strip away the hype, and a loop is just a set of instructions that runs based on a trigger until it meets a certain condition.

That’s it, really.

As a simple example, a recurring scheduled task that scans your inbox, identifies high-priority messages, and sends you a filtered summary is a loop.

Go to ChatGPT’s “Scheduled” section, and guess what you’ll find? Loops!

ChatGPT's Scheduled tasks panel showing 8 active automated tasks including Daily brief, Email monitor, World Cup recap, Weekend long read, Sale monitor, Concert alerts, and Weekend ideas, with a Schedule a task button at the top. \Source:ChatGPT\

If you want a slightly more agent-adjacent definition, I like this one from Addy Osmani:

“[a loop is] a recursive goal where you define a purpose and the AI iterates until complete.”

This is closer to what Boris referred to. In this maximalist case, the agents might also be responsible for setting their own goals, spawning sub-tasks, and triggering future loops.

But unless you’re building complex agentic systems, this kind of loop engineering is pure overkill.

For most of us, basic loops are plenty.

But how exactly do you build them?

How to create loops in Claude Code & Codex

You can think of there being two complementary types of loops:

  • Scheduled (or action-triggered) loops
  • Goal-driven (“run until condition is met”) loops

Scheduled vs Goal Loops

The two most popular agentic platforms—Claude Code and Codex—handle both of these natively, and the setup isn’t nearly as complicated as the term “loop engineering” would have you believe.

Here’s my primer for making Claude Code and Codex work together.

Let’s look at the platforms’ triggered loops first.

Scheduled loop: Routines & Automations

Remember that most loops have triggers, which can be several things:

  • Manual trigger: Task starts when you, say, send a prompt to a chatbot or agent. (This one literally has a human in the loop, so it’s technically not an agentic loop.)
  • Schedule: Task starts at a specific time or date (often recurring).
  • Event: Task starts when something happens (e.g. a sheet is updated or a new email comes in).

Both Claude Code and Codex have built-in event and schedule triggers.

In Claude Code, they’re called “Routines”:

Claude Code's Routines page in empty state showing 8 starter templates: Briefing, Email triage, System health check, Issue triage, PR review digest, Dependency update check, Release notes drafter, and Flaky test tracker, each with a title, short description, and run schedule.

In Codex, they’re called “Automations”:

Codex Automations templates panel showing 8 automation cards with icons and brief descriptions, including scanning commits for bugs, drafting weekly release notes, summarizing git activity for standup, and comparing changes against benchmarks.

Both platforms offer a healthy selection of starter templates you can explore.

To set up a routine/automation, provide instructions and pick a trigger that’ll initiate it:

Codex new routine creation form with "Build the Death Star" as the name, instructions reading "Source the required components and build a functioning Death Star," model selector showing Sonnet 4.6, and three trigger options: Schedule, GitHub event, and API.

But a more interesting type of loop works toward meeting an explicit, measurable condition.

Goal-driven loop: the /goal command

With events or schedules, the “loop” is triggered externally (the clock strikes three or a new Slack message pops up).

With goals, the loop is built into the process: The agent keeps taking turns until the condition is fully satisfied.

Claude Code and Codex have an identical native command for this called “/goal”:2

Claude Code:

Claude Code chat interface showing the /goal slash command being typed, with an autocomplete tooltip reading "Set a goal — keep working until the condition is met."

Codex:

Codex chat interface showing /goal typed with two options below: "Approve for me" and "Goal: Set a goal that Codex will keep working towards."

You type it and then describe the “Done” condition to check against:

Claude Code main interface showing a typed /goal prompt: "build the Death Star. Keep going until its lasers can destroy Alderaan or a similarly sized planet." Branch shown is claude-code main; Auto mode is enabled.

Now, the agent works autonomously on the task, tests its results against the given condition, and continues over multiple turns until the condition is met.

So, a loop.

Note: There is some discipline to defining effective goals and setting guardrails and fallbacks (e.g. “stop after 10 turns”). Otherwise, the agent can chew through your tokens or usage limits like a hungry hungry hippo with nothing to show for it.

Now that you know about the two types of loops, let’s look at two examples.

Two loops to try right now

Here’s an example of each type of loop:

1. Actionable news briefing (schedule loop)

Set up your recurring schedule in a Routine (Claude Code) or Automation (Codex), then paste this into the “Instructions” field:

I want to [my goal] related to [topic]. Search for relevant developments from the past [time period]. Only include developments related to my goal. For each one, summarize what happened and whether I should act on it now, keep watching, or ignore it. For anything actionable, suggest one specific next step.

2. Product or service recommendation (goal loop)

Use this prompt in combination with the /goal command in either tool:

/goal Research [type of product/service] and recommend the best option based on [my criteria]. Don’t stop until you’ve identified and evaluated at least three options with confirmed pricing from the vendor’s own website (not third-party sites), a rating from a reputable platform (G2, Capterra, Trustpilot, etc.) with at least 10 reviews, and at least one real user complaint from those reviews.

🔁30 loops for your inspiration

Claude and I put together a “Loop Starter Kit” with 30 loop ideas (15 of each type), complete with copy-paste prompts and examples.

Loop Starter Kit paid subscriber bonus

Paid subscribers can grab it here:

Paid subscriber bonus box reading "Upgrade to unlock," listing 100+ downloads, the Claude Code Essentials hub, the full post archive, and a Cozora AI discount.


Thanks for reading!

If you enjoy my work, here’s how you can help:

  • ❤️Like this post if it resonates with you.
  • 🔄Share it to help others discover this newsletter.
  • 🗣️Comment below, I love hearing your opinions.

Why Try AI is a passion project, and I’m grateful to those who help keep it going. If you’d like to support me and unlock cool perks, consider a paid subscription:

1

Yes, this was just a thinly veiled excuse for all-out alliteration. Thanks for asking!

2

In Claude Code, /goal spawns a separate “evaluator” agent to check if a condition is met.