OpenAI Codex
Codex was first to ship /goal as a built-in Ralph loop, with persisted goals, explicit lifecycle states and optional token budgets.
OpenAI's coding agent runs on one shared harness across all its surfaces, built on the Responses API. The January 2026 post Unrolling the Codex agent loop by Michael Bolin is the best public description of how a production inner loop assembles context and uses prompt caching (Technology.org summary).
/goal (since 0.128.0, April 30, 2026)
Simon Willison's one-line description: a built-in Ralph loop that keeps going until the goal is judged complete or the configured token budget runs out (blog).
- Continuation
- A continuation prompt template is inserted every turn, telling the model to take the next step if the goal is not yet achieved. The working model judges its own progress.
- Budget
- An optional token budget per goal (unset by default). When hit, a budget-limit prompt tells the model to stop and report. Reports disagree on exact syntax and defaults. contested
- States
- pursuing, paused, achieved, unmet and budget-limited. /goal pause keeps the full audit context.
- Persistence
- The goal is stored on the thread, so it survives a crash or reboot, but the agent only runs while a session is open.
- Status
- features.goals defaults to true and is marked stable; one source says it left experimental status in a May 21 changelog entry.
Sources: Daniel Vaughan on goal mode and on pause/resume/budgets, SmartScope, Codex Insider, AI Catchup, JD Hodges' hands-on review.
The token-burn controversy
Codex goal mode is also the source of the most detailed complaints about loop cost:
- An analysis by relux.works of 3,808 sessions found that the 52 goal-mode sessions consumed about half of all input tokens. Its explanation: goal mode re-fires about 0.03 s after each turn, and when the agent is waiting (for CI, a deploy) each poll re-reads the whole context. One run made 173 continuations in 48 minutes, each re-reading 120k–470k tokens, until a 429. anecdotal
- Separate reports of burning a weekly limit in a day point to other causes too, such as a regression around 0.111.0 involving Fast mode defaults and more aggressive multi-agent spawning (issue #14593, DEV, qcode). contested
The general lesson, a goal loop needs a way to wait without spinning, is covered in Budgets and lifecycle.
Beyond /goal
By November 2026, Codex lists goals, memories, hooks and plugins as core features, and spawns parallel sub-agents with a configurable thread cap (Morph comparison). Hooks (lifecycle scripts around tasks, including before/after compaction) reached general availability in May (Developer's Digest). OpenAI's developer blog describes long-horizon work as a plan → edit → run tools → observe → repair loop (Run long horizon tasks with Codex).
Further reading
Claude Code
Anthropic's agent has the widest set of loop primitives: a goal loop with a separate evaluator, interval loops, routines, Stop hooks and agent teams.
Hermes Agent
Nous Research's open-source agent treats goals as persistent objectives with a configurable judge model, a turn cap and kanban for multi-goal work.