How I AI

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

Mittwoch, 17. Juni 2026 · 29 min

MP3

Shownotes

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 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.

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 (workos.com/?utm_source=lennys_howiai&utm_m…)—Make your app enterprise-ready today
Runway (runwayml.com/howIAI)—The creative AI platform for images, video, and more
—
In this episode, we cover:
() Prompts are out and loops are in
() Defining a loop
() The four ways to automate a prompt: heartbeat, cron, hooks, and goals
() Five things every effective loop needs
() The “onboarding an employee” framework for designing loops
() Live build #1: Daily aging PR loop in Claude Code
() Subagents inside loops
() Live build #2: Weekly skills identification loop in Codex
() Watching subagents spin up in real time
() Warning signals around loops
() What listeners are doing with loops
—
Tools referenced:
• Claude Code: claude.ai/code
• Codex: chatgpt.com/codex
• OpenClaw: openclaw.ai
—
Other references:
• Claire’s article “Why OpenClaw Feels Alive Even Though It’s Not”: x.com/clairevo/article/2017741569521271175
• Addy Osmani’s article on loop engineering: addyosmani.com/blog/loop-engineering
• Using Goals in Codex: developers.openai.com/cookbook/examples/codex/…
—
Where to find Claire Vo:
ChatPRD: chatprd.ai
Website: clairevo.com
LinkedIn: linkedin.com/in/clairevo
X: x.com/clairevo
—
Production and marketing by penname.co. For inquiries about sponsoring the podcast, email jordan@penname.co.

0:00 / 0:00