Picture it. You've pushed a branch, CI is grinding away, and every ten minutes you tab over and type the same sentence into Claude Code. Is it green yet. Is it green yet. Daniel wants the proper way out of that, which is slash loop, as the latest documentation describes it. How you drive it, whether you can hand it your own prompt, and whatever else is hiding in there. Last time, in Running an Agentic Loop to Drain a Queue, slash loop got two lines and a verdict. Today it gets the whole episode.
Two lines and a verdict, and the verdict was "a clock". I stand by it. But a clock is the right tool for a surprising number of jobs, and it has more dials than people notice. First fact: slash loop is not a built-in command. It's a bundled skill, shipped inside Claude Code, and that matters later because skills have rules about which other skills they're allowed to call.
A prompt wearing a command's coat.
Pretty much. And both of its arguments are optional, which gives you three shapes. Interval plus a prompt is the plain one: "slash loop five minutes, check whether the deploy finished". Fixed schedule. Prompt with no interval is the interesting one, because then Claude chooses the gap itself. And with no prompt at all you get a built-in maintenance routine, or your own, which we'll get to.
Start with the plain one. What can I actually type for the interval?
You can lead with it, like thirty minutes, or trail it as a clause, "every two hours". Units are seconds, minutes, hours and days. Seconds round up to a minute, because underneath this is cron, and cron doesn't do anything finer than a minute. Minimum is one minute.
So "slash loop thirty seconds" is a lie.
A polite one. It becomes one minute. And intervals that don't divide cleanly, say seven minutes or ninety minutes, get rounded to the nearest clean cron step, and Claude tells you what it picked. So it does turn your interval into a real cron expression, schedules it, and reports back the cadence and a job ID.
Which means the seven minutes I asked for might be eight.
Might be ten, who knows. If the number matters, pick one that divides evenly. Fifteen, thirty, an hour.
Fine. Now the one I actually want to understand. No interval. Who's in charge of the clock then?
Claude. After every iteration it looks at what it saw and picks a delay somewhere between one minute and one hour, and it prints the delay and the reason at the end of the turn. Something like "build still running, checking again in four minutes". Under the hood it uses a tool called ScheduleWakeup, and the docs are blunt that you don't call that yourself. It shows up in the task list as a pending one-shot.
I'm not sure I want a model deciding how patient I am.
That's the trade, but think about what it buys you. With a fixed interval you pick one number for a job whose length you don't know. A build that finishes in six minutes, or in forty. Self-paced, Claude can check quickly while something's moving and back off when it's stuck. And it can end the loop on its own. When the work is done, it cancels its own wakeup. A fixed schedule never does that.
Hm. A fixed schedule sits there checking a finished build forever.
Until it expires, yes. Which is also why the omit-the-interval version is the one I'd reach for first. There's even a cousin of it. If you ask for a dynamic loop, Claude may skip polling altogether and use the Monitor tool, which runs a background command and feeds each line of output back to it as it appears. No clock at all. Each watch has a deadline, five minutes by default, thirty at the most.
So I'm handing over the stopwatch.
Would you trust it, though? Hand it your build and let it decide when to look?
For a build, yes. Worst case it looks too often and I lose a few cents. For a deploy to production I'd want a number I chose, so I could say why it looked when it did.
That's a fair line to draw. Fixed for anything you'd have to explain afterwards.
That sounds like it ought to be the answer to my queue episode, then.
Closer, anyway. For watching a log or a build, it's often cheaper than polling, my guess is because nothing wakes the model until something actually happens. For work that needs many turns of judgment, you still want a different tool. We'll get to the neighbours.
Now bare slash loop. Nothing after it. Does it just sit there?
It runs a maintenance prompt, in a fixed order. Continue any unfinished work. Then tend the pull request on your branch, so review comments, failed CI, merge conflicts. Then cleanup passes, bug hunts, simplification. All of it through the normal permission checks, so it can't do anything it couldn't do if you asked it by hand.
A tidy-up butler.
But you can replace the butler. Drop a file called loop dot md into the dot claude folder of your project, or into your home dot claude folder, and bare slash loop runs that instead. Project file wins over the user one. It's plain Markdown, and it's one default prompt, not a list of tasks. And the part I like: it's read again on every iteration, so you can edit it while the loop is running and the next pass picks up the change.
So I tune it live. Notice the build is slow, tell it to look at the test log too, save the file.
Yes. Limit of twenty-five thousand bytes, anything past that is cut. And if you type a prompt on the command line, loop dot md is ignored entirely. It only ever serves the bare form.
Daniel's real question, though. Can I loop my own prompt?
Yes, and there are two ways. Free text, which is just a sentence. Or a skill or slash command as the payload. "Slash loop twenty minutes slash review pr" followed by a pull request number, say. Each time it fires, it runs that skill.
Any slash command?
No, and this is the gotcha I'd flag. Only skills Claude is allowed to invoke on its own will fire. Built-in commands like permissions, model or clear don't. Skills marked as not invokable by the model don't, and that includes some bundled ones. MCP prompts don't. In all those cases the text just arrives as a plain message, and you get no error.
So it quietly does something else.
It quietly asks Claude to please consider the words "slash model". Which, you know, it'll give an opinion on.
Herman, did you just make a joke?
I make one every episode. You're just usually asleep.
Then what makes a good loop prompt? Because I'd guess the bad ones are the ones that say "keep an eye on things".
Same guess. Each iteration is a fresh pass, so the prompt has to carry everything. Say what to check, say what counts as good, and say what to do when nothing has changed. The docs' own loop dot md example does this: if CI is red, do this. If it's green and nothing's new, say so in one line. That last clause is the difference between a loop you can live with and a transcript you scroll through for an hour.
Quiet should be cheap and short.
And the prompt should say what finishes the job. "Stop looping when the pull request is merged" is a sentence a self-paced loop can actually act on. Corn, what would you put in yours? If you were setting one up this afternoon.
Honestly, something dull. "Check whether the release workflow finished. If it failed, show me the first failing step. If it passed, say passed and stop." Three sentences, and the last one's the exit.
That's a better prompt than most I've seen. The stop condition's in there.
Typed out, it's slash loop, space, then that sentence. No interval, so Claude paces itself. It starts, tells me the first delay and why, and waits.
And ten minutes in you notice it keeps reporting the same thing in three paragraphs.
Then I tell it, in plain words, to say only what changed. It doesn't need a new loop for that, does it?
For a typed prompt, I'd restart it. The loop dot md file is the one that updates live, because it's reread every pass. A prompt you typed on the command line is baked into the schedule. So there's a reason to put a long-running loop's instructions in the file and run it bare. Edit, save, done.
Slightly annoying that the version with the most convenience is the one you can't tweak.
Convenience for the first minute, yes. After that it's the file.
Well, let's hear from your mother. Mum, are you there?
Hello dear, it's your mother. It's Dorothy's Kitchen. I'm going to tell you about porridge, plain porridge, and I want you to take it seriously.
Mum! I'm taking it very seriously.
You need oats, and water, and a pinch of salt, and that is all. No sugar, sweetheart, not while I'm talking.
Is it the rolled oats, Mum, or the pinhead?
Now. You put the oats in the pot with the water and you stir. And you keep stirring, because the moment you turn your back it catches, and then it's all over, and there's a smell in the kitchen for a week.
Does the stirring have to be continuous?
The salt goes in at the end, and the butter goes in last of all, and the butter can turn on you if the pan's too hot. Things have gone wrong before. I would rather not say how.
Mum, hot as in medium heat, or hot hot?
Anyway. I had a nice bit of toast with mine this morning, and I've put the washing out, so mind you bring it in if it rains. Bye now, dear.
Lovely. Where were we, the cron side of this.
Lifecycle. How long does one of these actually live?
Not as long as you'd hope. Everything's tied to your session. Tasks only fire while Claude Code is running and idle. Close the terminal and they stop. Background the session and they carry on. If you come back with the resume or continue flags, it restores tasks that haven't expired, though not any fires you missed while it was shut, and a self-paced loop may need you to run slash loop again.
And the expiry. I've seen a few blog posts say seven days.
Those are stale. Recurring tasks now expire thirty days after you create them. On the last day one fires a final time and then it's deleted. Tasks created on older versions keep their old seven-day life. Also, there's a ceiling of fifty scheduled tasks per session, and each gets an eight-character ID.
Fifty. I've never been that organised, or that nervous.
Do you leave a loop running overnight with the lid closed, in practice? Would you trust it to still be there?
No. A loop on my laptop is a loop on a laptop that sleeps. If I need it at three in the morning it's not a loop job at all.
Timing has rules too. The scheduler checks every second, but it queues your prompt at low priority and only fires between turns, never in the middle of a response. If Claude is busy when a run comes due, it fires once when it's idle. No catch-up for each missed interval, so a half-hour of busyness doesn't give you six runs in a row.
Good. And I assume it isn't to-the-second punctual.
Recurring tasks run late by up to half the gap before the next one, capped at thirty minutes. A ten-minute loop might be up to five minutes late. An hourly one, up to thirty. It's deliberate scatter, so that everybody's loops don't hit the servers at the top of the hour.
And the five-minute loop?
That's the exception, and it's a nice one. Slash loop five minutes fires four minutes and forty-five seconds after the previous run, not five. Prompt caching has a five-minute lifetime. Fire at four forty-five and the conversation context is still warm, so you're not paying to re-read everything.
Fifteen seconds of margin for the cache. Somebody did the maths.
And it implies a cost point: a six-minute loop might be more expensive than a five-minute one, since the cache has gone cold by the time it runs. My guess, but that's how the mechanism reads.
Does it mind if I'm typing at the time? I'm usually in there editing something when it's due.
It waits for your turn to finish. Fires queue behind whatever's happening and run between turns. My guess is it feels like a message that arrives while you're busy, no more than that, and it won't interrupt a response halfway.
Fine by me. A loop that talks over me would be a short loop. Now stopping: I'll hit Escape.
Depends which kind you started. Self-paced, pressing Escape on an empty prompt while it's waiting cancels the pending wakeup, and you'll see a message saying so. A fixed-interval loop ignores Escape and Control-C both.
Of course it does.
You ask Claude. "Cancel the deploy check loop." Behind that are three tools. One creates a schedule from a five-field cron expression, one lists your tasks with their IDs and next run times, one deletes by ID. You can just say "what scheduled tasks do I have". And if you want the whole scheduler gone, there's an environment variable that disables it, along with slash loop.
So where does this stop being the right tool? Because a laptop-lid-closed loop is not much of a loop.
Right at the session boundary. If it has to run while the machine is off, you want the cloud version, which is what the slash schedule command now creates. They renamed routines to cloud scheduled tasks. It runs on Anthropic's infrastructure, from a fresh clone of your repo, laptop off. Triggers can be schedules, an API call or a GitHub event. The catch is a minimum interval of one hour.
So no every-five-minutes there.
No. For event-driven work the docs point you at Channels instead of polling. And if you want an unattended job you own, a GitHub Actions schedule trigger is the route they name.
And slash goal. People mix those up.
Different trigger. Slash loop starts a turn on a clock. Slash goal starts a turn when the last one ends. You write a completion condition, and after each turn a small fast model, Haiku by default, judges: met, not yet, or impossible. Evaluation tokens are billed on top. One goal per session. Tell it "or stop after twenty turns" and it won't run away.
So goal is for "keep working until it's done", loop is for "look again later".
A migration you're pushing through is a goal. Watching whether something somebody else is doing has finished, that's a loop.
What about the anti-patterns? I can think of two. Looping something that needs thinking, and looping something that needs to happen.
Add a third: looping without an exit. A fixed loop with a vague prompt is the most expensive way to produce the sentence "nothing changed". Docs' own list of good uses is short and honest. Poll a deployment. Babysit a pull request. Check a long build. A one-time reminder, which you can do by saying "in forty-five minutes, check whether the integration tests passed".
Reminders. I'd have put that last, and it might be my favourite.
...the whole eleven days, and Quigley's Alsatian was the only reason it worked. Duchess. Not mine, she was next door, but I'd come to an arrangement with him. Two pounds a week and a bag of Winalot over the wall on Fridays, and in return she barks at the van. The modem was ninety-nine pounds, mail order, from a firm in Reading. It said delivery in five to ten working days. I went to the front door every ten minutes. A kitchen timer on the hall table, wound by hand. Corn, you had a pop on the "p" in "polling" just now, I'll take it out. Anyway, Duchess barked at the van, but she also barked at the cat, the milkman and Quigley's own post, so I still had to go and look. I kept a ledger on the hall table. Pencil, because the hall was cold and the biro skipped. Van, cat, cat, van, child. Eleven days.
So the dog was a notification channel with a lot of noise on it. Every bark was a trigger, and then you still had to go and look, because a bark told you something happened and not what.
Four minutes forty-five seconds. That's clever, that is. Leaving the margin like that.
The timer was the clock and Duchess was the event, and you ran both, so you paid for both. The dog could have been the only one, if she'd been better at her job.
She wasn't. But the van came at ten past four every day. Eleven out of eleven. And the timer ran twenty minutes slow, that's the correction. I never wound it right.
So you were out at the door at four every day for a week and a half, whatever the timer said.
From the third day. Before that I wasn't looking at the ledger.
Which means the first two days were costing you something like a hundred checks, and the rest were nearly free.
Call it that. The hundred was mostly the cat.
Reasonable. Which leaves the question Daniel started with, the one nobody's landed yet. What should the first loop on your machine actually be?
One that's cheap when nothing's happening. I'd start self-paced, with a prompt that says what finished looks like, and let it work out how often to look. Late and rarely beats early and often, I think, for most jobs people actually have.
The van comes at ten past four. Check at four.
And if the thing you're waiting on has no ten past four, that's what the self-paced mode is for. It watches a few times, notices the pattern, and eases off.
Maybe. I'd bet it still checks the cat.
The cat is a risk.
Thanks to Hilbert Flumingtop for producing this one.
This has been My Weird Prompts. You'll find every episode at my weird prompts dot com.
We'll be back soon.