Codex Goals Guide: How to Make Long-Running Tasks Actually Finish
You keep typing "keep going" and "run the benchmark again" while Codex stops after each step. What does a Goal need so the run keeps going to the finish line and knows when to stop?

If you repeatedly type “keep going,” “try the next fix,” and “run the benchmark again,” you may need an objective that persists across turns. A Codex Goal keeps the completion condition in the thread so work can continue after intermediate results.
You define the desired outcome and the actions Codex may take. Codex uses tests, benchmarks, files and reports in the thread to decide whether the result meets the completion condition. The Goal remains subject to those limits on its work.
Use a Goal when the outcome is clear but the steps may change
Performance tuning, reproducing intermittent test failures, migrations and repeated attempts to investigate a bug suit Goals because each result determines what to try next.
Use a normal prompt for a typo, short explanation or a single review. A Goal is useful when the objective needs to remain active while Codex works out how to reach it.
Start, inspect, pause, resume or clear a Goal with /goal
The official guide says Goals are available starting with Codex 0.128.0. Enter /goal followed by the objective to start one. Enter the command alone to inspect the current Goal, or add pause, resume or clear to control its state.
A Goal belongs to its thread. Codex evaluates progress using the files it has inspected, command results, diffs and failed attempts in that thread; the Goal does not become global memory or a project-wide instruction.
/goal Reduce p95 checkout latency below 120 ms without regressing correctness tests
/goal # view the current Goal
/goal pause # pause it
/goal resume # continue
/goal clear # remove it The six parts of a strong Goal
The outcome states what must be true when the work is done. Verification names the test, benchmark, report or artifact that will demonstrate it. Constraints specify behavior that must remain correct; boundaries define which files, tools and data Codex may use.
The iteration policy tells Codex how to choose the next experiment after each result. The stop condition specifies when no valid way forward remains and which attempted approaches, evidence and missing inputs to report.
- Outcome: the result that must be achieved
- Verification: the evidence that demonstrates the result
- Constraints: behavior that must remain correct
- Boundaries: the files, tools and data Codex may use
- Iteration policy: how to select the next experiment
- Stop condition: when to stop if blocked and what to report
Add a measurable target, correctness tests and a stop condition
“Improve checkout speed” specifies neither how fast checkout should be nor how to measure it. Adding “p95 below 120 ms” still leaves out correctness requirements and the measurement environment.
The following Goal names the benchmark, requires correctness tests to keep passing and asks for a record of each attempt. It also states what to report if the benchmark cannot run or no valid approach remains, so an incomplete run can be distinguished from a successful one.
/goal Reduce checkout p95 below 120 ms on the checkout benchmark while keeping the correctness suite green.
Use only the checkout service, fixtures and related tests.
After each iteration, record the change, result and next best experiment.
If the benchmark cannot run or no valid paths remain, stop with attempted paths, evidence, blocker and required input. Require evidence that the completion condition was met
For performance work, require before-and-after measurements under comparable conditions. For changes that must preserve existing behavior, require test results. Documentation work needs a successful build and accurate commands. Code that looks plausible does not establish any of those results.
For a research Goal, define how findings should be reported before the investigation begins. Label a result as confirmed when the evidence directly establishes it. Label an approximate reconstruction when it reproduces only part of the result or uses conditions that differ from the original. Identify supporting evidence that makes a claim more plausible without proving it. For a claim that cannot be checked because required data, access or tools are missing, state the blocker. Record any uncertainty that remains after reviewing the available evidence. These distinctions keep incomplete evidence from being reported as a confirmed result.
Why long-running Goals still fail
“Improve the whole system” gives a reviewer no specific result to check. Without a stop condition, Codex may keep trying actions that require access it does not have. Without correctness constraints, it may improve a metric by changing behavior that needed to remain intact.
Before starting a Goal, read its completion condition and the evidence required to prove it. Could another reviewer use that evidence to tell whether the target was met and the required behavior was preserved? If not, specify the test, benchmark or artifact the reviewer should inspect and what result counts as success.
Use prompts for tasks, AGENTS.md for repository rules, Skills for procedures and Goals for objectives that span turns
Subagents handle independent parts of a task; MCP connects external tools and information. Giving each a distinct role keeps instructions shorter and execution more predictable.
Frequently asked questions
How is a Codex Goal different from a prompt?
A normal prompt requests an action and then waits after the response. A Goal keeps a completion condition in the thread so Codex can evaluate whether to continue, finish or stop.
Does a Goal give Codex unlimited autonomy?
No. The work remains subject to the user’s scope, approval requirements, budget and explicit stop conditions.
What makes a good completion criterion?
Specify a result another person can inspect, such as a test, benchmark, built page or reproduction report backed by evidence.
When should I avoid Goals?
Use a normal prompt for one-line edits, short explanations, a single review or work without a clear completion criterion.