# How to design AI agent loops: schedules, goals, and subagents in Claude Code and Codex Page: https://stenobird.com/podcast/how-i-ai-7304222/how-to-design-ai-agent-loops-schedules-goals-and-subagents-in-claude-code-and-codex Text version: https://stenobird.com/podcast/how-i-ai-7304222/how-to-design-ai-agent-loops-schedules-goals-and-subagents-in-claude-code-and-codex.md Podcast: [How I AI](https://stenobird.com/podcast/how-i-ai-7304222) Published: 2026-06-17T11:00:00+00:00 Episode link: https://podcasters.spotify.com/pod/show/pen-name/episodes/How-to-design-AI-agent-loops-schedules--goals--and-subagents-in-Claude-Code-and-Codex-e3ks6mt Audio file: https://anchor.fm/s/1035b1568/podcast/play/121559197/https%3A%2F%2Fd3ctxlq1ktw2nl.cloudfront.net%2Fstaging%2F2026-5-16%2F426259555-44100-2-1b61a314a7bc8.mp3 Processing state: not_requested JSON: https://stenobird.com/v1/public/podcasts/how-i-ai-7304222/episodes/how-to-design-ai-agent-loops-schedules-goals-and-subagents-in-claude-code-and-codex Duration seconds: 1746 ## Resource 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. 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) Prompts are out and loops are in (02:30) Defining a loop (03:03) The four ways to automate a prompt: heartbeat, cron, hooks, and goals (06:03) Five things every effective loop needs (09:26) The “onboarding an employee” framework for designing loops (11:58) Live build #1: Daily aging PR loop in Claude Code (17:08) Subagents inside loops (19:00) Live build #2: Weekly skil… ## Actions - request_transcript: `POST https://stenobird.com/v1/public/podcasts/how-i-ai-7304222/episodes/how-to-design-ai-agent-loops-schedules-goals-and-subagents-in-claude-code-and-codex/transcription-requests` — Idempotently request low-priority transcript generation for this episode. - read_markdown: `GET https://stenobird.com/podcast/how-i-ai-7304222/how-to-design-ai-agent-loops-schedules-goals-and-subagents-in-claude-code-and-codex.md` — Read the agent-friendly Markdown representation of this episode resource. A page view does not enqueue transcription. Agents should invoke `request_transcript` explicitly when they need this episode processed. ## Transcript Full transcripts are not published on public pages unless there is a clear rights basis.