How to create some simple agent loops
Burn those tokens!
A loop starts over when it ends. The idea of an agent loop is that you always have one or multiple agents doing work for you, instead of intermittent intervention. Here are a few easy ways to build loops that do work for you.
Schedules
In both Codex and Claude Code you can run prompts on a schedule. Here is a cool one that I’ve been using, called papercuts:
Look through these slack channels #super-cool-project, #things, and find feedback about the Paperclip app. For any nitpicks / papercut-level items, create a merge requests that addresses them and fixes them. Use a subagent for each, and make sure they address any comments on the merge request and keep it green, until it’s merged. For larger features, create an issue in Linear.
Now I run this daily - and it automatically fixes little issues in some of my projects without me intervening at all. I trust AI to make a decision on what is a large change vs. what is a minor thing to address. You can create guardrails or be more specific depending on how sensitive the project is.
/goal
Setting a goal in Codex or Claude is a really powerful way to do really big, complicated things without (much) interference. If you wonder how people have agents running continuously for hours at end: they probably used /goal.
The principle is really simple. You set a goal, and the agent will continue working until that goal has been completed. It is helpful to be specific, as you can imagine. Something quantitative is even better. Here is an example:
/goal get the page load of localhost:3000/charts with current seed data to under 300ms (it’s currently at >1s)
You can be as specific as you want. Here is one (simplified) that I’ve used recently
/goal build the app as specific in the markdown file plan.md. Don’t stop until all the features listed there are live as described and you’ve ran e2e test verifying that they work as intended
This one ran for 18 hours without intervention!
/loop
Loop is what it says on the tin. You can have an agent do particular work on a set interval:
/loop 15m check the weather forecast. Send me a message if it’ll rain
But Claude Code introduced smart loops a while back, that will adjust its frequency depending on the task. I find this very useful for code review:
/loop address the comments and CI failures of merge request !123
It'll automatically adjust the loop length depending on how often it finds it needs to check it. If e.g. CI runs for 30 minutes every time, it won’t check every minute.
Happy looping!

