Codex CLI 0.128.0 Adds /goal Command: Auto-Loop Until Objectives Are Met

Codex CLI 0.128.0 adds a /goal command for autonomous, goal-driven looping task execution.
OpenAI's Codex CLI 0.128.0 introduces the /goal command, which lets users set an objective and have the agent automatically loop through tasks until the goal is achieved or the token budget runs out. Inspired by the "Ralph loop" concept, the feature uses prompt engineering for self-evaluation and budget control, pushing AI coding agents toward more autonomous, multi-turn task execution.
Overview
OpenAI's Codex CLI coding agent tool has released version 0.128.0, introducing an important new feature — the /goal command. This feature allows users to set a goal, and Codex will continuously loop through tasks until it evaluates the goal as complete, or the configured token budget is exhausted.
This design draws inspiration from the "Ralph loop" concept already present in the community, marking a step forward for AI coding agents toward more autonomous, persistent task execution.
How the /goal Command Works
Continuous Loop Mechanism
Traditional AI coding assistants typically operate in a single-turn interaction mode: the user makes a request, the AI returns a result, and the interaction ends. The /goal command breaks this pattern by introducing a goal-oriented continuous loop mechanism.
Once a user sets a goal, Codex automatically evaluates at the end of each execution round whether the current state satisfies the goal requirements. If the goal hasn't been achieved, it automatically proceeds to the next round of operations without requiring manual user intervention. This approach is particularly well-suited for complex coding tasks that require multiple steps to complete.
Prompt-Based Implementation
From a technical implementation perspective, this feature is primarily driven by two key prompt templates:
- goals/continuation.md: Automatically injected at the end of each round to evaluate whether the goal is complete and decide whether to continue to the next round
- goals/budget_limit.md: Handles situations where the token budget is exhausted, ensuring the system doesn't consume resources indefinitely
This prompt engineering-based implementation approach is quite elegant — it doesn't require complex external control logic, but instead leverages the LLM's own judgment capabilities to determine whether a task is complete.
Safety Mechanism: Token Budget Control
While the auto-loop mechanism is powerful, without proper constraints it could lead to excessive resource consumption. Codex CLI addresses this through a token budget mechanism.
Users can configure a token usage cap, and when cumulative token consumption reaches the budget limit, the loop automatically stops even if the goal hasn't been completed. This is a pragmatic design decision that strikes a balance between autonomy and controllability.
Origins of the Ralph Loop
The /goal feature draws inspiration from the "Ralph loop" concept proposed by Geoffrey Huntley. The core idea behind the Ralph loop is to have an AI agent work continuously in a loop until preset conditions are met. This pattern is becoming a trend in the AI coding agent space, as many real-world programming tasks genuinely require multiple iterations to complete.
OpenAI's formal integration of this concept into Codex CLI signals that this autonomous loop pattern has evolved from an experimental concept into a standard feature of mainstream tools.
Implications for AI Coding Agent Development
This update reflects several important directions in AI coding agent evolution:
- From single-turn to multi-turn: Agents are no longer limited to one-shot responses but can iterate continuously until tasks are complete
- Goal-oriented: Users only need to describe the end goal, rather than specifying each step along the way
- Self-evaluation: Agents possess the ability to judge whether their own work is finished
- Resource-aware: Maintaining control over resource consumption while executing autonomously
These characteristics collectively point toward a more autonomous future for AI coding agents, where developers can delegate increasingly complex tasks to AI without having to supervise every single step.
Conclusion
While the /goal feature in Codex CLI 0.128.0 is relatively simple in implementation (primarily relying on prompt injection), the concept it represents is highly significant. It demonstrates how clever prompt engineering can upgrade a simple LLM interaction tool into an autonomous agent with continuous execution capabilities. As features like this mature, AI coding assistants will increasingly approach the role of true "AI programmers."
Related articles
Tech FrontiersEdge AI on Microcontrollers: When Is It Actually Worth Deploying?
Drawing on Reddit discussions and Arm case studies, this article analyzes the real-world use cases for edge AI on microcontrollers: when each device needs independent inference, when a gateway or cloud is more reasonable, and the costs and boundaries of specialized hardware.
Tech FrontiersPushing the Limits of Extreme Sudoku on a 16GB GPU: Insights from Depth and Flow Matching
A researcher trained a 16.54M-parameter model on a 16GB GPU to solve extreme Sudoku, finding effective depth breaks the 60% plateau and flow matching with improved sampling pushes accuracy past 99% with ~50× lower layer-evaluation budget.
Tech FrontiersAI Agent Approval Workflows: Why Human Confirmations Always Get Mindlessly Clicked
Why do AI agent approval workflows always get mindlessly clicked? A Reddit discussion shows that separating rules from keys, low-frequency high-risk approvals, and GitHub Environments-style gates are the keys to effective approvals.