OpenAI Codex CLI /goal Command: What It Does and How to Enable It

Download printable cheat-sheet (CC-BY 4.0)

02 May 2026, 00:00 Z

TL;DR
/goal is an under-development OpenAI Codex CLI feature that gives a thread a durable objective. It is more than a reminder in the prompt: the CLI stores goal state, exposes goal tools to the model, tracks tokens and time, can continue work when the thread goes idle, and can stop at a budget. As of May 2, 2026, I would use it only in Codex CLI, with the goals experimental feature enabled. I do not see a supported /goal surface in Codex Desktop yet.

If you have searched for "Codex /goal", "OpenAI Codex goal command", or "Codex CLI goals", you are probably ahead of the docs.

The public Codex CLI slash-command docs currently list commands such as /model, /plan, /experimental, /status, /compact, and /diff, but not /goal. The Codex app commands docs list /feedback, /mcp, /plan-mode, /review, and /status, but not /goal.

So this post is intentionally date-stamped. It is based on official OpenAI docs checked on May 2, 2026 plus the public openai/codex source at tag rust-v0.128.0.

What /goal does

In Codex CLI, a thread is the durable conversation state behind your local session. It has an ID, a transcript, tool events, configuration context, and other state Codex can resume later.

/goal adds a structured objective to that thread.

At rust-v0.128.0, the CLI implementation supports these shapes:

/goal
/goal <objective>
/goal pause
/goal resume
/goal clear

The practical difference from typing "keep working on X" is that a goal is not just another chat message. It becomes thread state. Codex can ask for the current goal through a model tool, create one, and mark it complete when the work is genuinely done.

That matters because long-running coding work has several failure modes:

  • The model finishes a turn but leaves the broader task unfinished.
  • The session is resumed later and needs the real objective, not just the last visible message.
  • The user wants progress bounded by a token budget.
  • The model needs to know whether the current work is still in scope.

/goal is OpenAI's experimental answer to that class of problem.

How it works under the hood

The source is the most useful documentation right now.

Turn AI video into a repeatable engine

Build an AI-assisted video pipeline with hook-first scripts, brand-safe edits, and multi-platform delivery.