1# Follow a goal | Codex use cases1---
2 2name: Follow a goal
3Codex use cases3tagline: Give Codex a durable objective for long-running work.
4 4summary: Use `/goal` when a task needs Codex to keep working across turns toward
55 a verifiable stopping condition.
6 6bestFor:
77 - Long-running coding work with a clear success condition and validation loop.
8 8 - Code migrations, large refactors, deployment retry loops, experiments,
9Codex use case9 games, and side projects where Codex can keep making scoped progress.
10 10 - Teams that need to run long experiments with clear success criteria.
11# Follow a goal11starterPrompt:
12 12 title: Set a Long-Running Goal
13Give Codex a durable objective for long-running work.13 body: /goal Complete [objective] without stopping until [verifiable end state].
14 14relatedLinks:
15Difficulty **Advanced**15 - label: "`/goal` in CLI slash commands"
16 16 url: /codex/cli/slash-commands#set-or-view-a-task-goal-with-goal
17Time horizon **Long-running**17 - label: Codex workflows
18 18 url: /codex/workflows
19Use `/goal` when a task needs Codex to keep working across turns toward a verifiable stopping condition.19 - label: Run code migrations
20 20 url: /codex/use-cases/code-migrations
21## Best for21 - label: Iterate on difficult problems
22 22 url: /codex/use-cases/iterate-on-difficult-problems
23- Long-running coding work with a clear success condition and validation loop.23---
24- Code migrations, large refactors, deployment retry loops, experiments, games, and side projects where Codex can keep making scoped progress.
25- Teams that need to run long experiments with clear success criteria.
26
27# Contents
28
29[← All use cases](https://developers.openai.com/codex/use-cases)
30
31Copy page [Export as PDF](https://developers.openai.com/codex/use-cases/follow-goals/?export=pdf)
32
33Use `/goal` when a task needs Codex to keep working across turns toward a verifiable stopping condition.
34
35Advanced
36
37Long-running
38
39Related links
40
41[`/goal` in CLI slash commands](https://developers.openai.com/codex/cli/slash-commands#set-a-goal-with-goal) [Codex workflows](https://developers.openai.com/codex/workflows) [Run code migrations](https://developers.openai.com/codex/use-cases/code-migrations) [Iterate on difficult problems](https://developers.openai.com/codex/use-cases/iterate-on-difficult-problems)
42
43## Best for
44
45- Long-running coding work with a clear success condition and validation loop.
46- Code migrations, large refactors, deployment retry loops, experiments, games, and side projects where Codex can keep making scoped progress.
47- Teams that need to run long experiments with clear success criteria.
48
49## Starter prompt
50
51/goal Complete [objective] without stopping until [verifiable end state].
52
53Open in the Codex app
54
55/goal Complete [objective] without stopping until [verifiable end state].
56 24
57## Introduction25## Introduction
58 26
59Use `/goal` when you want Codex to keep working toward one durable objective instead of stopping after one normal turn. It’s 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. When you use `/goal`, Codex can work independently for multiple hours without needing your input.27Use `/goal` when you want Codex to keep working toward one durable objective instead of stopping after one normal turn. It's 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. When you use `/goal`, Codex can work independently for multiple hours without needing your input.
60 28
61Set a goal with `/goal <objective>`, check the current goal with `/goal`, and use `/goal pause`, `/goal resume`, or `/goal clear` when you need to control the run.29Set a goal with `/goal <objective>`, check the current goal with `/goal`, and use `/goal pause`, `/goal resume`, or `/goal clear` when you need to control the run.
62 30
63If `/goal` doesn’t appear in the slash command list, enable `features.goals`31If `/goal` doesn't appear in the slash command list, enable `features.goals`
64in `config.toml`:32in `config.toml`:
65 33
66```34```toml
67[features]35[features]
68goals = true36goals = true
69```37```
72 40
73## Choose the right work41## Choose the right work
74 42
75A good goal is bigger than one prompt but smaller than an open-ended backlog. It should define what Codex should achieve, what it shouldn’t change, how it should validate progress, and when it should stop.43A good goal is bigger than one prompt but smaller than an open-ended backlog. It should define what Codex should achieve, what it shouldn't change, how it should validate progress, and when it should stop.
76 44
77This works well for:45This works well for:
78 46
915. Use `/goal` to inspect status while it runs.615. Use `/goal` to inspect status while it runs.
926. Pause, resume, or clear the goal when the run is done, blocked, or changing direction.626. Pause, resume, or clear the goal when the run is done, blocked, or changing direction.
93 63
94The important part is the contract. Codex should know what “done” means before it starts. If the goal is a migration, “done” might mean the new path passes contract tests and the legacy path still has a rollback. If the goal is a game or prototype, “done” might mean the app builds, launches, and matches the input reference or expected behavior.64
65
66The important part is the contract. Codex should know what "done" means before it starts. If the goal is a migration, "done" might mean the new path passes contract tests and the legacy path still has a rollback. If the goal is a game or prototype, "done" might mean the app builds, launches, and matches the input reference or expected behavior.
95 67
96Ask Codex to help: start by having a conversation about what you want to68Ask Codex to help: start by having a conversation about what you want to
97build, then ask it to directly set a goal and start working.69 build, then ask it to directly set a goal and start working.
98 70
99## Let Codex work independently71## Let Codex work independently
100 72
101During a goal, ask for compact progress reports that make the run easier to trust. A useful status update names the current checkpoint, what was verified, what remains, and whether Codex is blocked.73During a goal, ask for compact progress reports that make the run easier to trust. A useful status update names the current checkpoint, what was verified, what remains, and whether Codex is blocked.
102If the status becomes vague, tighten the goal rather than adding more one-off instructions. Tell Codex exactly which checkpoint matters next, which command proves it, and what should cause it to pause.74If the status becomes vague, tighten the goal rather than adding more one-off instructions. Tell Codex exactly which checkpoint matters next, which command proves it, and what should cause it to pause.
103 75
104When Codex follows a goal, it can work independently for many hours without you having to check in. It will stop running when it’s confident it has reached the stopping condition, so you should think of `/goal` as a background task you don’t need to monitor.76When Codex follows a goal, it can work independently for many hours without you having to check in. It will stop running when it's confident it has reached the stopping condition, so you should think of `/goal` as a background task you don't need to monitor.
105 77
106## Example goals78## Example goals
107 79
108### Migrations80### Migrations
109 81
110Whether you’re migrating games to a new stack, mobile apps to a new platform, or a codebase to a new framework, you can use `/goal` to have Codex run the migration:82Whether you're migrating games to a new stack, mobile apps to a new platform, or a codebase to a new framework, you can use `/goal` to have Codex run the migration:
111
112/goal Migrate this project from [legacy stack or system] to [target stack or system]. Make sure all screens stay exactly the same visually, using playwright interactive to verify the output.
113 83
114### Prototype creation84### Prototype creation
115 85
116Whether you’re creating a new app from scratch, a new game, or a new feature, you can use `/goal` to have Codex complete a polished first version. You can use a PLAN.md file to guide the creation of the first version, describing precisely what you want to build.86Whether you're creating a new app from scratch, a new game, or a new feature, you can use `/goal` to have Codex complete a polished first version. You can use a PLAN.md file to guide the creation of the first version, describing precisely what you want to build.
117
118/goal Implement PLAN.md, creating tests for each milestone and verifying the output with playwright interactive. [include reference screens as needed]
119 87
120### Prompt optimization88### Prompt optimization
121 89
122When you have an eval suite, you can use `/goal` to optimize prompts against the eval results. Codex can inspect failures, update the prompt, rerun the evals, and keep iterating until the score improves or it reaches your stopping condition.90When you have an eval suite, you can use `/goal` to optimize prompts against the eval results. Codex can inspect failures, update the prompt, rerun the evals, and keep iterating until the score improves or it reaches your stopping condition.
123
124/goal Optimize the prompts in [prompt file or directory] until the eval suite reaches [target score or pass rate]. After each change, run [eval command], inspect the failing cases, and keep the prompt edits minimal and targeted. Stop when the target is met or when further prompt changes would need product or policy guidance.
125
126## Related use cases
127
128[
129
130### Create a CLI Codex can use
131
132Ask Codex to create a composable CLI it can run from any folder, combine with repo scripts...
133
134Engineering Code](https://developers.openai.com/codex/use-cases/agent-friendly-clis)[
135
136### Create browser-based games
137
138Use Codex to turn a game brief into first a well-defined plan, and then a real browser-based...
139
140Engineering Code](https://developers.openai.com/codex/use-cases/browser-games)[
141
142### Remediate a vulnerability backlog
143
144Bring in approved findings from ticketing tools or vulnerability reporting systems, then use...
145
146Engineering Quality](https://developers.openai.com/codex/use-cases/remediate-vulnerability-backlog)
147