Codex CLI 0.128.0 adds goal-based looping mode

OpenAI’s Codex CLI 0.128.0 now includes a /goal command that keeps the agent looping until it decides the task is done or the token budget runs out. According to Link Blog, the feature is mainly driven by injected prompts in goals/continuation.md and goals/budget_limit.md.

Codex CLI 0.128.0 adds goal-based looping mode

OpenAI’s Codex CLI coding agent has added a new /goal command in version 0.128.0, giving it a built-in way to keep working on a task until it decides the goal has been completed or it hits a configured token budget.

The update was noted by Link Blog in a post on 30 April 2026. The blog described the feature as OpenAI’s own version of the “Ralph loop,” a pattern where an agent repeatedly continues execution instead of stopping after a single response.

⚡ New to this?

This news is about a coding tool that can keep working on a task without being restarted after every step. A token budget is the amount of text the model is allowed to process and generate, so it acts like a usage limit and a safety cap.

For non-experts, the important part is that AI coding tools are moving from single-response helpers toward agents that can keep going until they think a job is done. That changes how people supervise them and how long they may run on one task.

🦞 OpenClaw angle

If you build self-hosted agents, treat this as a reminder to separate task goals from stop conditions. Add explicit completion checks and hard budgets in your own loops so the agent cannot run forever just because it keeps finding new work.

If you use prompt files to control agent behavior, keep continuation logic in one place and make it easy to audit. Also log when a loop ends because the goal was met versus when it stops because the token budget was reached; that will help you spot brittle prompts and runaway tasks.

With /goal, a user can set an objective and let Codex continue through multiple turns. The agent then evaluates whether the goal has been met, and if not, it keeps looping until the task is finished or the budget limit is reached.

According to the post, the mechanism appears to be implemented mainly through two prompt files: goals/continuation.md and goals/budget_limit.md. These prompts are automatically injected at the end of a turn, which suggests the looping behavior is controlled through prompt-based orchestration rather than a separate visible workflow layer.

That matters because it shows how coding agents are being pushed toward longer-running, self-directed task execution. Instead of asking for one response at a time, the operator can give the agent a goal and let it manage the continuation logic itself.

The token budget limit remains part of the design. In practice, that gives the user a hard stop if the agent keeps extending the run without deciding the goal is complete.

The /goal feature arrives as part of Codex CLI 0.128.0, according to the source post. The article did not say whether the command is enabled by default for all users or how broadly it is being rolled out beyond the CLI release itself.

Source: Simon Willison ↗

More from OpenClaw News