Give Codex a durable objective for long-running work. Use /goal when a task needs Codex to keep working across turns toward a verifiable stopping condition.
Use /goal when you want Codex to keep working toward one durable objective instead of stopping after one normal turn. It is useful for work that has a clear target, a validation loop, and enough room for Codex to make progress without asking you to steer every step.
A good goal is bigger than one prompt but smaller than an open-ended backlog. It defines what Codex should achieve, what it should not change, how it should validate progress, and when it should stop.
Define exactly one durable objective and one stopping condition. Codex knows what "done" means before it starts.
ClarityPoint Codex at the files, docs, issue, logs, or plan it must read first before making any changes.
ContextDefine the commands or artifacts that prove progress. Codex works in checkpoints and keeps a short progress log.
ValidationCodex proposes changes, runs experiments, reads results, and keeps only the ideas that improve the target metric.
AutonomyPause, resume, or clear the goal when the run is done, blocked, or changing direction.
ControlAsk for compact progress reports that name the current checkpoint, what was verified, what remains, and whether Codex is blocked.
VisibilityThe loop stays small so each improvement is easy to judge. One objective, one stopping condition, and a clear validation step keep the system narrow enough to inspect and strong enough to iterate.
Name one objective and one verifiable stopping condition. Codex reads the instructions and understands the experiment target.
Point Codex at the files, docs, issue, logs, or plan it must read first before making any changes.
Define the commands or artifacts that prove progress. Tell Codex to work in checkpoints and keep a short progress log.
Codex works independently for hours. It stops when it is fairly confident it has reached the stopping condition.
A good goal works well for migrations, large refactors, experiments, and prototypes where Codex can make scoped progress and validate each step.
Migrate projects from one stack to another. Codex runs the migration, verifies visual parity, and keeps screens identical using automated checks.
Refactor large codebases with automated testing after each checkpoint. Codex proposes changes, runs tests, and keeps only the improvements.
Create polished first versions of apps, games, or features from scratch. Use a PLAN.md to guide the creation precisely.
Optimize prompts against eval results. Codex inspects failures, updates the prompt, reruns evals, and iterates until the score improves.
Enable the experimental feature, set your first goal, and let Codex work independently. The setup takes seconds.
/goal is an experimental Codex CLI feature. Enable it from /experimental, or add goals = true under [features] in config.toml.
Run /goal <objective> to start. Check the current goal with /goal. Use /goal pause, /goal resume, or /goal clear to control the run.
Codex works independently for multiple hours without needing your input. It stops when it is fairly confident it has reached the stopping condition.
Start by having a conversation about what you want to build, then ask it to directly set a goal and start working. Codex will handle the rest.
Most coding tools automate execution. /goal automates the cycle of defining an objective, working toward it, validating progress, and knowing when to stop.
The fastest answers to the questions people ask first about Codex /goal.
/goal is an experimental Codex CLI feature that lets you give Codex a durable objective for long-running work. Instead of stopping after one normal turn, Codex keeps working toward a verifiable stopping condition, independently, for multiple hours./experimental in the CLI, or add goals = true under [features] in your config.toml file. Then use /goal <objective> to start./goal to inspect status while it runs. Use /goal pause, /goal resume, or /goal clear when the run is done, blocked, or changing direction./goal as a background task you don't need to monitor.Every claim on this page is based on the official OpenAI Codex documentation so you can verify the details yourself.
The official guide to using /goal with Codex: overview, setup, validation loop, and example workflows.
The command reference for /goal in the Codex CLI, including all subcommands and usage examples.
Explore all Codex use cases including code migration, iteration on difficult problems, and more.