**Claire Vo** (0:00)
Prompts are out and loops are in. If your agent isn't able to prompt itself through an automation, what are you even doing? In today's episode, I'm going to teach you what a prompt is in normal person speak, how to write one, when it's useful, and some pitfalls to watch out for. We will be doing this in Codex and in Claude Code. And at the end of this episode, you'll be one of the cool kids whose agents prompt itself. Let's get to it. This episode is brought to you by Work OS. AI has already changed how we work. Tools are helping teams write better code, analyze customer data, and even handle support tickets automatically. But there's a catch. These tools only work well when they have deep access to company systems. Your copilot needs to see your entire codebase. Your chatbot needs to search across internal docs. And for enterprise buyers, that raises serious security concerns. That's why these apps face intense IT scrutiny from day one. To pass, they need secure authentication, access controls, audit logs, the whole suite of enterprise features. Building all that from scratch, it's a massive lift. That's where Work OS comes in.
Work OS gives you drop-in APIs for enterprise features, so your app can become enterprise-ready and scale up market faster. Think of it like Stripe for enterprise features. OpenAI, Perplexity and Cursor are already using Work OS to move faster and meet enterprise demands.
Join them and hundreds of other industry leaders at workos.com. Start building today.
Okay, so why are we all prompt maxing? Of course, it's Pete at OpenClaw who told us we are old news if we are prompting and we really need to be designing loops where our agents can prompt themselves. Now, this one tweet spun off tons of content about what is a loop, how to use a loop. And to be honest, I don't think any of them explained it very well. So I am here to answer your safe space questions about what is a loop, how do I get one set up, is it really that useful, and should I really be letting my agents prompt itself? I think the answer is yes and yes, there are tons of great use cases for loops. And we're going to talk about how you can use those and how they can be beneficial, especially with software engineering. But there are some reasons why you wouldn't want to use loops. And honestly, I still do a little prompting. So don't worry if you are not loop maxing, you are in good company and you can still get a lot done with AI.
So to answer what a loop is, I'm just going to make this super simple for you all. And this goes back to one of the earliest articles I wrote on OpenClaw, which was this article about why OpenClaw feels alive even though it's not. And the core of this article was explaining that there are many ways you can prompt an AI agent. And often, we only think about one way to prompt an agent, but actually, there are many ways an agent like Claude Code, like Codex, like ChatGBT, like name your favorite agent here, can be prompted. And I want to go over what those ways are. First, there are messages. This is a human-triggered input. This is probably how most of us are prompting our agents. We are going to a chatbot, and we are typing in some sort of prompt, waiting for a response, and then typing another response. That is a message turn-based prompting strategy. I still think there's use for this kind of prompting. I use it all the time, but that is not what we're talking about when we're talking about loops. Instead, when we're talking about loops, we're talking about automated prompting of an agent. And there are a couple of form factors that can take, and I just want to remind you what those are. And I'm using OpenClaw because I think it demonstrates these types of prompt loops, but it's not the only system that does them. So the first one is a heartbeat. You can set a schedule like every 30 minutes, every hour, every five minutes. And on that schedule, it's going to kick off a task. And so you're going to say, every five minutes, check if I have a new JIRA ticket, and if so, start a coding agent to triage and fix that JIRA agent. That's sort of like on a heartbeat. Every five minutes, I want it to do that. Then there is a cron. A cron is at this time or on this schedule, do this.
So it can be at 9 a.m., it can be at a specific time, it can be every Sunday night. These crons are a little bit more scheduled. A heartbeat is kind of on a regular basis. Crons are more on a set defined schedule. Then the last thing that I've talked about are hooks. So you can prompt an agent based on an internal lifecycle, like a tool was called, a session was started, a session was reset, or an external hook, like a web hook from an external session. Every time I receive an email, I want to get a web hook and kick off some sort of agent. And I only remind you of these things because these are common ways to do automations outside of AI. So we were doing automations on heartbeats, on crons, on hooks way before AI even happened. But now you can do that in order to prompt your AI. And so I think this whole concept of a loop is really just reminding people you do not have to use your human fingers to type in a prompt in order for your agent to do work on your behalf. Now, what's different between when I wrote this article and now is a new type of loop has been shipped as a first class citizen of both Claude Code and Codex, which is a goal. A goal is a type of loop that sets an outcome and runs an agent against that outcome until the outcome can be measured and validated or the agent is blocked. And so I would say there's one more loop type that's becoming pretty common in AI coding in particular, although I think there's lots of use cases for it. But again, pretty simply, a loop is a scheduled or kind of semi-autonomous automation that allows an agent to instruct itself what to do, prompt itself and get that work done. Now, what do you need to write an effective loop? I like this article by Addy Osmani about loop engineering. I think it's really good. It does break this down pretty well. You can see it's fairly recent as from this month. But my favorite part about this article is what you need to write a good loop. To write an effective loop, you need these five things. I like how this is written out in this block in that it tells you what the thing is. It's an automation, kind of what its job is. It's like triage of a task to be done or a prompt to be set on a schedule. Then it shows you how Codex and Claude Code do this.
20 more minutes of transcript below
Try it now — copy, paste, done:
curl -H "x-api-key: pt_demo" \
https://spoken.md/transcripts/1000651996090
Works with Claude, ChatGPT, Cursor, and any agent that makes HTTP calls.
From $0.10 per transcript. No subscription. Credits never expire.
Using your own key:
curl -H "x-api-key: YOUR_KEY" \
https://spoken.md/transcripts/1000773109920