/goal in Codex CLI: The agent works autonomously for hours, but the cost is unpredictable

/goal in Codex CLI: The agent works autonomously for hours, but the cost is unpredictable

On April 30, 2026, Codex CLI 0.128.0 was released, featuring its flagship addition: the /goal command. This is an implementation of OpenAI's Ralph loop: you set a thread-level goal, and the agent writes code, tests, reflects, and continues until it hits a budget limit or achieves the result. Combined with GPT-5.5, this integration changes how you work with an agent more significantly than the changelog suggests.

What arrived with 0.128.0

The release marks a shift from "a smart assistant that writes code based on a task" to "a process that maintains a goal and hammers away at it until it hits a budget." Specifically:

  • /goal — a persistent thread-level goal. The agent writes code, tests, reflects, and continues on its own.
  • /side — an ephemeral side-thread that doesn't disrupt the main goal.
  • /title and /statusline — editable on the fly within an active session.
  • codex update — native self-update instead of manual reinstallation.
  • --full-auto deprecated — replaced by explicit permission profiles.

And GPT-5.5 is the recommended model. Without it, /goal doesn't reach its full potential—older models require too many cycles to achieve the same objective.

What's under the hood of /goal

Internally, it is a thread-level state machine with five layers. Persistence stores the goal, status (pursuing/paused/achieved/unmet/budget_limited), time, and tokens. App-Server API v2 provides RPC for goal management and push notifications between clients. Model tools allow the model to check the status and mark a goal as achieved—but it cannot pause, resume, or reset. Only you can do that via the TUI.

What drives the model to hammer at a goal turn after turn? The system prompt. On every continuation turn, Codex injects two template files: goals/continuation.md—focusing on the goal and setting the rule "do not accept proxy signals and treat uncertainty as not achieved," and goals/budget_limit.md—a soft-stop when the budget is reached. The agent doesn't crash; it finishes its work by preparing a summary of what was done and what remains.

Real-world case: +25% fps in an hour

The best public example is a tweet from game developer Nicolas Zu on May 1st. He ran /goal for performance optimization. Runtime: one hour, GPT-5.5 xhigh. Result: +25% fps, npm run perf:guard passed with an average improvement of 25.7%.

What the agent did during that hour:

  • Reduced hot-path allocations for zombie movement and collisions.
  • Cached static WASM metadata for conveyor mechanics.
  • Reused scratch objects for the timing/accumulator logic of tower combat mechanics.
  • Added fast helper functions for terrain/turret-center in hot paths.

This is the scenario /goal was designed for. The goal is measured automatically (perf-metric), the environment provides feedback (perf-guard), and the agent iterates cyclically. One hour of work, a concrete measurable result, and a clear commit.

The main pitfall: tokens

The biggest pain point of /goal isn't code quality or infinite loops—it's the unpredictability of token consumption. The same class of tasks might cost 80k tokens in one instance and 400k in another, for no apparent reason. Sometimes the agent finds a solution quickly and closes the goal in two cycles. Sometimes it enters a spiral of refinements and burns five times as much.

This is more frustrating than it sounds because you cannot budget for it. If you have a 5-hour plan in ChatGPT, you don't know how many /goal sessions will fit. Maybe three. Maybe one.

When you hit a weekly or 5-hour limit, /goal doesn't crash. The agent continues to generate text. But it fails on MCP calls that require LLM-approval (because the approval itself requires a token, and the quota is zero). Therefore, search_docs, db_seeds, and similar functions silently stop working. The session looks "alive," but it is actually disarmed.

The main advice: do not leave /goal unattended. Not yet. Check back every 15-20 minutes, see what has been consumed, and be ready to hit /goal pause if things go off track.

/side — two scenarios

The second command is /side. It is the equivalent of Claude Code's /btw: open an ephemeral side-thread without disrupting the main task. Press Escape to return. You cannot open another /side inside a /side—recursion is prohibited.

The obvious scenario is asking for clarification without breaking the cycle. A less obvious one: Codex (and GPT-5.5 especially) uses a massive amount of Anglicisms. You get an explanation filled with words like "coalesce," "obviation," and "debouncing" all at once. I open /side and ask: "decipher this paragraph in simple terms, what does X mean in the context of my task?" I get a short answer. I close it. I return to the main goal.

The context of the main task remains clean. The agent doesn't get distracted. I get clarification—and move on.

Who adopted it first

I thought /goal would be picked up first by those writing code—performance, refactoring, migrations. They didn't. They tried it, but it didn't stick consistently.

The first to really adopt it were researchers. Those working on projects involving information and data gathering. /goal resonated with them most because a typical task structurally fits the /goal paradigm: there is a specific research goal, a measurable result (a metric is a number), and a limited context in which the agent operates.

They run /goal to increase research accuracy—and it works. The goal is concrete, the domain is clear, and the metric is measurable. All three conditions that /goal loves.

When /goal doesn't work

To avoid overhyping: /goal is not a silver bullet. Scenarios where it consistently breaks:

  • Vague goals. If you ask to "make the code better," the agent will enter an infinite loop. A goal needs a definition of done expressed in something measurable.
  • Lack of feedback. If the agent doesn't have access to tests or metrics, it cannot verify its work. The solution is to configure MCP tools in advance.
  • Production. Running /goal in production is dangerous. The agent might commit, merge, or restart. Only use it in production in read-only mode.
  • Quota walls. If you hit your weekly limit, MCP-approvals will silently fail, while the session will appear alive.
  • Long, unstructured tasks. "Rewrite this service to a new architecture" without decomposition—/goal won't handle it.

The bottom line

OpenAI has shifted Codex from a chat assistant to an autonomous goal-oriented agent. Behind /goal lies a real architecture with persistent state, soft-stops, and system prompt injection against proxy signals. It works. Sometimes impressively, like the +25% fps case in an hour.

But this autonomy has a flip side: unpredictable costs and the impossibility of budgeting. Do not leave /goal unattended. For now.

On the other hand, experimenting with /goal is mandatory right now. Not because the feature is magical, but because the skill of "working alongside processes that also write code" is being added to the skill of "writing code by hand." The latter isn't going anywhere—someone still has to read diffs, catch proxy signals, and understand why the agent committed nonsense. There are just more engineering tasks, and some of them are now about orchestration.

And that part currently works poorly. You can't budget it, you can't leave it unattended, and you can't use it in production. It is better to start learning now, on small goals and in safe environments—so that when /goal leaves Experimental, you won't be dealing with unpredictable tokens for the first time.

You can try GPT-5.5 and other models for coding in GEMERA AI—via our Telegram bot or web dashboard. Access to chat with advanced models, image and video generation, voice synthesis—all in one place.