cd /news/ai-agents/how-to-design-ai-agent-loops-schedul… · home topics ai-agents article
[ARTICLE · art-30990] src=lennysnewsletter.com ↗ pub= topic=ai-agents verified=true sentiment=· neutral

How to design AI agent loops: schedules, goals, and subagents in Claude Code and Codex

Claire Vo breaks down four types of AI agent loops—heartbeat, cron, hook, and goal—and demonstrates live builds of a daily aging-PR reviewer in Claude Code and a weekly skills-identification loop in Codex that spawns subagents. The episode covers the five essential components every effective loop needs and warns about cost pitfalls.

read2 min views1 publishedJun 17, 2026

I break down every loop type from scratch—what a heartbeat, cron, hook, and goal loop actually are, when each one fits, and the five things any effective loop needs before it touches production. Then I build two live loops: a daily aging-PR reviewer in Claude Code that schedules itself at 10:15 a.m. and spins off its own subagents, and a weekly skills-identification loop in Codex that spawns goal-based subagents to validate its own output in real time.

Listen or watch on YouTube, Spotify, or Apple Podcasts

What you’ll learn:

The plain-English definition of a loop—and why it’s just an automated prompt, not a scary new paradigm

The four loop types (heartbeat, cron, hook, and goal) and when each one actually fits your workflow

How to think about loop design using the “onboarding an employee” mental model

The five things every effective loop needs: work trees, skills, plugins/connectors, subagents, and state tracking

How to build a scheduled PR-review routine in Claude Code that babysits aging PRs and alerts your team

How to set up a weekly skills-identification automation in Codex that spawns its own validating subagents

Why goal-based loops are the hardest to write well—and where most people burn tokens for nothing

The two warning signs that your loop is going to get expensive before it gets useful

Brought to you by:

** WorkOS**—Make your app enterprise-ready today

** Runway**—The creative AI platform for images, video, and more

In this episode, we cover:

([00:00](https://www.youtube.com/watch?v=JoXbk2fm7jM)) Prompts are out and loops are in

([02:30](https://www.youtube.com/watch?v=JoXbk2fm7jM&t=150s)) Defining a loop

([03:03](https://www.youtube.com/watch?v=JoXbk2fm7jM&t=183s)) The four ways to automate a prompt: heartbeat, cron, hooks, and goals

([06:03](https://www.youtube.com/watch?v=JoXbk2fm7jM&t=363s)) Five things every effective loop needs

([09:26](https://www.youtube.com/watch?v=JoXbk2fm7jM&t=566s)) The “onboarding an employee” framework for designing loops

([11:58](https://www.youtube.com/watch?v=JoXbk2fm7jM&t=718s)) Live build #1: Daily aging PR loop in Claude Code

([17:08](https://www.youtube.com/watch?v=JoXbk2fm7jM&t=1028s)) Subagents inside loops

([19:00](https://www.youtube.com/watch?v=JoXbk2fm7jM&t=1140s)) Live build #2: Weekly skills identification loop in Codex

([22:57](https://www.youtube.com/watch?v=JoXbk2fm7jM&t=1377s)) Watching subagents spin up in real time

([25:28](https://www.youtube.com/watch?v=JoXbk2fm7jM&t=1528s)) Warning signals around loops

([27:31](https://www.youtube.com/watch?v=JoXbk2fm7jM&t=1651s)) What listeners are doing with loops

Tools referenced:

• Claude Code: [https://claude.ai/code](https://claude.ai/code)

• Codex: [https://chatgpt.com/codex](https://chatgpt.com/codex)

• OpenClaw: [https://openclaw.ai/](https://openclaw.ai/)

Other references:

• Claire’s article “Why OpenClaw Feels Alive Even Though It’s Not”: https://x.com/clairevo/article/2017741569521271175

• Addy Osmani’s article on loop engineering: https://addyosmani.com/blog/loop-engineering/ • Using Goals in Codex: https://developers.openai.com/cookbook/examples/codex/using_goals_in_codex

Where to find Claire Vo:

ChatPRD: [https://www.chatprd.ai/](https://www.chatprd.ai/)

Website: [https://clairevo.com/](https://clairevo.com/)

LinkedIn: [https://www.linkedin.com/in/clairevo/](https://www.linkedin.com/in/clairevo/)

Production and marketing by [https://penname.co/](https://penname.co/). For inquiries about sponsoring the podcast, email [[email protected]](/cdn-cgi/l/email-protection).
── more in #ai-agents 4 stories · sorted by recency
── more on @claude code 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/how-to-design-ai-age…] indexed:0 read:2min 2026-06-17 ·