a very talked-about matter with coding brokers currently. Loops are principally an idea the place you’ve an agent work in a self-verifying loop and have the agent work extra autonomously.
That is in distinction to how we used coding brokers earlier, the place you spin up a brand new coding agent, make the coding agent implement one thing, confirm its outcomes, and proceed like that till you’re performed along with your work.
Loops are extremely highly effective as a result of they permit you to take extra of a backseat as a human and get extra duties performed. It’s because you don’t must comply with up the agent as intently, and it really works extra autonomously itself and is extra capable of full work end-to-end.
On this article, I’ll focus on why try to be working in loops whereas interacting with coding brokers and the way you are able to do it. I’ll cowl some strategies try to be actively using when interacting with coding brokers to successfully arrange loops and make your coding brokers as efficient as attainable.

Why use loops with coding brokers?
Initially, let’s cowl why try to be utilizing loops when utilizing coding brokers. The only reply is that loops permit you to do extra work.
The explanation for that is that whenever you arrange a loop, the agent is extra capable of autonomously full duties end-to-end, which frees up time for you as a human, permitting you to do extra work.
You possibly can think about these two situations:
State of affairs 1: You spin up agent A, make a plan with it, and have it start work. You then spin up agent B, and earlier than you’re performed planning the duty with agent B, agent A is asking you questions or telling you it’s accomplished some work and desires you to confirm it. You resolve to complete agent B, and proper after you’re performed there, you return to agent A. Work together with it, have it proceed to work, and earlier than you’re performed there, agent B wants enter from you once more. You then proceed like this, and also you’re solely capable of work together with two brokers without delay, basically, finishing two duties without delay.
State of affairs 2: You spin up Agent A and have it run a loop to self-verify its work. Agent A will then begin engaged on a activity, and also you inform it to solely come again to you as soon as it’s completed that activity. When you’ve completed instructing Agent A, you can begin doing the identical for Agent B, setting a aim and having it work in a loop. This time, Agent A doesn’t interrupt you for extra enter as a result of it has the self-verification loop and doesn’t want your enter in the identical means anymore. Thus, you’ll be able to proceed setting duties on brokers C, D, E, and so forth, till agent A finishes its work.
The conclusion right here is that situation 2 merely lets you spin up extra brokers and full extra duties, which is, in fact, extremely priceless as a result of it lets you do extra work without delay.
How you can work in loops
Now, the massive query, in fact, is how do you truly work in loops? There are quite a lot of other ways to do it, however I’ll cowl the only approach you can begin implementing immediately.
This system is to make use of the /aim command with both Claude Code or Codex.
/aim
I, for instance, say:
/aim Implement every part I requested for. Confirm it finish to finish by clicking
by means of the browser utilizing the Playwright MCP. It is not acceptable to check
the applying solely by means of integration assessments. You might want to truly click on
across the app. Proceed like this till it really works. Repair any points if you happen to
encounter them then do an finish to finish check once more. Run Codex exec and run
the evaluation ability with Codex and make him approve it and iterate till
Codex has authorised it. When Codex has authorised it, come to me and inform
me which servers I can check it on and precisely learn how to check it.
Basically, what /aim does is implement a hook. This hook is triggered each time Claude Code or Codex finishes its work, and it principally makes the coding agent replicate on whether or not it accomplished the duty you wrote underneath /aim or not. Whether it is accomplished, it comes again to you and informs you of its work. If it thinks it’s not accomplished, it’ll proceed working in the direction of that aim till it’s completely happy.
It’s basically a strategy to simply make the coding brokers proceed working till they really attain your aim, or they consider it’s utterly unattainable. A really highly effective strategy to make coding brokers work for longer intervals of time, and thus work extra autonomously and full extra work.
Additionally, discover within the immediate that I give the agent quite a lot of different data on learn how to confirm its work. This can be a matter I’ll cowl within the subsequent part, because it’s extremely necessary if you wish to get essentially the most out of the /aim command.
How you can make /aim efficient
On this part, I’ll cowl learn how to make the /aim command efficient. After all, you’ll be able to simply give a aim to the agent, however if you happen to’re not explicit about which aim you set and the way the agent can confirm the aim, you’re not going to get good outcomes.
You might want to present the agent with a strategy to confirm its personal work and reduce the possibility of bugs. I do that in two fundamental methods:
- Inform the agent to confirm its work end-to-end utilizing the Playwright MCP and interacting with the browser
- Have the agent run Codex Exec to evaluation the code it’s offering to attenuate the possibility of bugs
I’ll cowl the primary level: I used Playwright MCP, however you should use any browser interplay methodology that you simply wish to. I like Playwright as a result of it really works very nicely, and the agent is ready to full all of its work. Telling the agent to confirm its work end-to-end could be very efficient as a result of the agent goes into the browser or into my app, takes screenshots, and verifies every part works as supposed. That is an extremely highly effective and actually easy change you can also make to no less than double the effectiveness of your coding brokers.
In the event you’re not working with a UI, you’ll be able to, in fact, inform the agent to simply truly make API calls and verify the databases or logs to see that issues are working as anticipated. The entire level is that you simply don’t solely make the coding agent confirm its work by wanting on the code. You make it truly run the code and have it confirm the outputs and outcomes of the code.
Secondly, I often use Claude Code as my fundamental driver when creating code, however I came upon you can nonetheless get quite a lot of worth from Codex.
I take advantage of Codex to offer my brokers, my Claude Code brokers, with evaluations. Every time they publish code or wish to publish code and get code into dev, I make Codex evaluation the code and approve it earlier than Claude is allowed to merge it into dev. This has saved me so many bugs, it’s exhausting to even comprehend.
There’s additionally a big distinction in my expertise from having Claude Code evaluation the code versus Codex. If I’m utilizing Claude Code as my fundamental driver to implement code, I positively wish to use Codex to confirm the code afterward and never Claude Code. It’s because Codex is just capable of finding extra bugs. I create an iterative setup the place Claude Code implements the code, makes Codex evaluation it, fixes the evaluation feedback, and tags Codex for evaluation once more. We proceed like this till Codex has authorised the code.
It will drastically decrease the variety of bugs you expertise from Claude Code.
Conclusion
On this article, I mentioned learn how to arrange loops in Claude Code. Loops as an idea have turn into very fashionable currently as a result of it’s a means for coding brokers to work extra autonomously and get extra work performed. You possibly can arrange loops tremendous just by utilizing the /aim command, which makes the agent proceed working in the direction of a aim till it’s achieved. Nonetheless, you even have to provide the agent a strategy to confirm its personal work, which I additionally coated on this article. I consider creating loops like that is the way forward for software program engineering. You’ll create brokers working in loops and provides them a strategy to confirm their very own work. This offers you the power to work on extra duties without delay. Loops as an idea will also be expanded to have bigger loops that arrange different smaller loops and self-improving loops as nicely, that are extra ideas I’ll cowl in future articles.
👉 My free eBook and Webinar:
🚀 10x Your Engineering with LLMs (Free 3-Day E mail Course)
📚 Get my free Imaginative and prescient Language Fashions book
💻 My webinar on Imaginative and prescient Language Fashions
👉 Discover me on socials:
💌 Substack















