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.

prompt
→ Claude
Design framework: choose schedule (when), goal (what done means), subagents (who does isolated pieces) — with worked examples in Claude Code and Codex.
claude-code

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.

Source: Lenny's Newsletter

More planning loops

loop-init, loop-audit, loop-cost CLI patterns

/ralphnew

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.

prompt
→ Claude
Starter CLI tools: `loop-init` scaffolds a loop (goal, budget, verify step), `loop-audit` reviews an existing loop design, `loop-cost` estimates spend before running.
planningmedium risk

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.

prompt
→ Claude
/loop start each iteration with fresh context: read PROMPT.md, prd.json, and .ralph/guardrails.md; pick the single highest-priority item in prd.json not marked done, implement it with tests, run the full check suite, commit and mark it done only if green; if blocked or a check fails twice the same way, append the lesson to .ralph/guardrails.md and move on; stop when every item is done or after 30 turns
planninghigh risk

Set agent continuation budget

/goalnew

Configure max turns before agent stops, preventing runaway loops and controlling execution cost.

prompt
→ Claude
/goal budget <n Set max continuation turns
planninglow risk