Schedules + goals + subagents design framework
A design framework for AI agent loops built on three questions — when should it run (schedule), what does done mean (goal), and who does the isolated pieces (subagents) — with worked examples in Claude Code and Codex.
Implementation note
When to use: before building any nontrivial loop — this is a design framework, not a runnable loop, and it exists because most loop failures are design failures: fuzzy done conditions, wrong triggers, monolithic tasks. How it works: three questions structure the design. When should it run — that is the schedule. What does done mean — that is the goal, which must be concrete and checkable. Who does the isolated pieces — those are subagents, each taking a bounded slice of the work with its own context. The framework ships with worked examples in both Claude Code and Codex showing the questions applied to real automations. Safety: the discipline itself is the safety value — a loop with an explicit machine-checkable done condition and decomposed responsibilities is far less likely to run away than a vibes-based one. Whatever design emerges, still add the runtime rails: iteration caps, budgets, and review gates on anything that mutates.
More planning loops
loop-init, loop-audit, loop-cost CLI patterns
Three starter CLI tools that turn loop design into a repeatable workflow: scaffold a loop with a goal, budget, and verify step; audit an existing loop design; and estimate cost before you run.
Ralph the PRD backlog
The canonical Ralph loop: each iteration starts fresh, reads the PRD and guardrails, ships exactly one backlog item end-to-end, and records what it learned.
Set agent continuation budget
Configure max turns before agent stops, preventing runaway loops and controlling execution cost.