Codex /goal: how goal mode works and why it stops
How Codex /goal works: turn it on, write a goal Codex can finish, every /goal command, and why a long goal stalls overnight (approvals, budget, sleep).
Updated
Codex /goal gives a chat one objective that sticks. Instead of stopping after a turn and waiting for you to type "keep going", Codex checks whether the goal is met and, if not, starts the next turn itself, for hours if it needs to. Type /goal <objective> in the Codex CLI, the IDE extension or the ChatGPT desktop app. If /goal isn’t in the slash command list, turn it on with codex features enable goals.
What most people find out the hard way: a goal keeps your normal sandbox and approval policy. When Codex hits a command that needs your approval, the goal waits for you, and an overnight run can sit there until morning. (It’s the same gap any software factory has to plan for: an approval nobody is there to give.)
As of November 2026, from OpenAI’s Follow a goal, Long-running work and developer commands docs, and its cookbook Using Goals in Codex. OpenAI changes these often, so its pages win if they disagree.
A goal that stops for approval at 2 a.m. waits until you see it. Coral puts every waiting Codex session in your Mac’s notch and on your iPhone, so you answer and it keeps going. Download Coral for free
Turn on /goal and start one
Goals need Codex 0.128.0 or later. Update and check your version:
npm install -g @openai/codex@latest # or: brew upgrade --cask codex
codex --version
If /goal still doesn’t appear, enable the feature flag. Either run codex features enable goals, or add it to ~/.codex/config.toml:
[features]
goals = true
Then set the goal in a chat. The goal text is both the first prompt and the test for when the work is done:
/goal Migrate src/ from JavaScript to TypeScript. Preserve existing behavior, compile in strict mode without explicit `any`, and make the full test suite pass.
Every /goal command
| Command | What it does |
|---|---|
/goal <objective> | Sets the goal and starts working on it |
/goal | Shows the current goal |
/goal edit | Revises the objective |
/goal pause | Pauses an active goal |
/goal resume | Resumes a paused goal |
/goal clear | Removes the goal |
The objective can be up to 4,000 characters. For anything longer, put the details in a file (a PLAN.md, say) and point the goal at it: /goal Implement PLAN.md, with tests for each milestone. In the desktop app the same controls sit in a progress row above the composer.
A goal belongs to one chat. It isn’t global memory or a project instruction, so a new chat starts without it.
Write a goal Codex can actually finish
Codex marks a goal complete only when it can check the result against evidence: tests, a benchmark, a build, a file it produced. So the goal has to say what that evidence is. OpenAI’s cookbook breaks a strong goal into six parts:
| Part | What to write | Example |
|---|---|---|
| Outcome | What is true when it’s done | p95 checkout latency under 120 ms |
| Verification | The command or artifact that proves it | the checkout benchmark |
| Constraints | What must not regress | correctness suite stays green |
| Boundaries | Files, tools and data it may use | only the checkout service and its tests |
| Iteration policy | How to pick the next attempt | log what changed and what the benchmark showed |
| Blocked stop | What to report if it can’t get there | the paths tried, the blocker, the input needed |
Weak: /goal Improve performance. There is nothing to check, so Codex can’t know when to stop.
Strong:
/goal Reduce p95 checkout latency below 120 ms, verified by the checkout benchmark, while keeping the correctness suite green. Use only the checkout service, benchmark fixtures, and related tests. Between iterations, record what changed, what the benchmark showed, and the next experiment. If the benchmark can’t run or no valid paths remain, stop with the attempts, the evidence, the blocker, and the next input needed.
If you aren’t sure what "done" means yet, start in /plan, let Codex interview you, then turn the plan into a /goal. Don’t use a goal for a one-line edit, a quick question, or a loose list of unrelated tasks.
The goal is right and Codex is still waiting? It’s usually an approval prompt in a terminal you aren’t looking at. Coral shows it in your notch with the full command, and you answer with one key. Get Coral for free
Why a Codex goal stops (and how to keep it going)
A goal only continues when the chat is idle, the goal is active and within budget, and no message from you is queued. Each item below breaks one of those, so check them in order when you come back to a goal that stopped:
| What you see | Why it stopped | What to do |
|---|---|---|
| Waiting on an approval | Goals keep your sandbox and approval policy and pause when they need a decision | Answer it, or set up fewer prompts before you start (below) |
| Goal shows paused | You interrupted a turn, and interrupting pauses the goal | /goal resume |
| Stopped with a progress summary | It reached its budget. That isn’t completion; Codex summarizes and names the next step | Check the summary, then edit or resume the goal |
| Stopped and reported a blocker | It followed your blocked-stop rule, or needs input it can’t get | Give it the missing input or loosen the constraint |
| A turn did nothing, then it idled | A continuation turn with no tool call suppresses the next automatic one, so it doesn’t spin | Send a message that names the next checkpoint |
| You only made a plan | Plan-only work doesn’t trigger continuation | Start the plan with /goal |
| Nothing happened all night | For local work the Mac has to stay awake | Turn on Prevent sleep while running (settings in the app, /experimental in the CLI) |
| It says done, but you disagree | The goal’s check was too loose | Tighten the verification and set it again |
Fewer approval prompts, without yolo. Before a long goal, look at what it will need. If it installs packages, allow network for the domains it needs; if it writes one folder outside the project, add that folder to the writable roots; for the rest, turn on automatic approval review (approvals_reviewer = "auto_review"), which sends would-be prompts to a reviewer agent. All three keep the sandbox on; the Codex sandbox guide has the settings, and the Codex config generator writes the network and writable-roots ones into config.toml. A PermissionRequest hook can also approve one narrow command, like your test runner, without asking.
Running goals in parallel. Each chat has its own goal. Don’t let two chats change the same files: give each one its own checkout with /worktree. To split one goal’s work across agents instead, see Codex subagents. Long goals also use a lot of your plan; see Codex usage limits before you start several.
Codex /goal vs Claude Code /loop
They sound alike but solve different problems.
Codex /goal | Claude Code /loop | |
|---|---|---|
| What repeats | Turns, until an objective is met | One prompt, on an interval (/loop 5m check the deploy) |
| When it ends | Evidence says done, you pause or clear it, or the budget runs out | You ask Claude to cancel it, or after 7 days |
| Good for | Migrations, refactors, benchmark tuning | Polling a deploy, a PR, a long build |
| Approvals | Same sandbox and approval policy as the chat | Inherits the session’s permissions |
The Claude Code column is from Anthropic’s scheduled tasks docs. Both run on your machine in an open session, and both stop when an action needs your approval.
Where Coral fits
A goal is meant to be a background task you don’t watch, so the one thing that stops it, an approval, is exactly the thing you won’t see. Coral puts every waiting Codex session (the CLI or the app) in your Mac’s notch next to Claude Code, Copilot, OpenCode and Grok, whoever has waited longest first:
- Answer with one key. Press 1, 2 or 3 with the full command in front of you. ⌘Z takes it back within two seconds.
- From any app. A card drops from the notch when Codex asks; ⌃⌥1 answers without leaving your editor.
- Away from your Mac. Alerts on your iPhone are Free; answering from the phone straight to the agent is Pro.
Coral doesn’t approve anything for you. Your sandbox and rules decide what’s allowed; Coral makes sure the prompts that are left get answered, so the goal keeps moving.
Questions
What is Codex goal mode?
It’s a persistent objective attached to one chat. With /goal, Codex keeps working across turns, checking after each one whether the objective is met, until the evidence says it’s done, you pause or clear it, or it runs out of budget.
How do I enable /goal in Codex?
Update to Codex 0.128.0 or later. If /goal doesn’t show in the slash commands, run codex features enable goals, or add goals = true under [features] in ~/.codex/config.toml.
Does Codex /goal run without approvals?
No. A goal keeps the chat’s sandbox and approval policy and pauses when it needs a decision. To get fewer prompts, widen the sandbox for what the goal needs or turn on automatic approval review, rather than switching to --yolo.
How long can a Codex goal run?
OpenAI says a goal can work independently for many hours. It stops when it reaches its stopping condition, when you pause or clear it, when a turn is interrupted, or when it hits its budget.
How do I stop a Codex goal?
Use /goal pause to stop it for now and /goal resume to continue, or /goal clear to remove it. Interrupting a running turn also pauses the goal.