The ultimate guide to Codex goals - by Jeff Morhous
The AI-Augmented Engineer
SubscribeSign in
The ultimate guide to Codex goals<br>Learn how to use goals in Codex to execute on long-running tasks<br>Jeff Morhous<br>Jun 02, 2026
Share
Goals are an awesome new addition to Codex, and I’m super pumped about what they mean for agentic software development.
Codex goals are a new way to ensure Codex actually works until it’s finished<br>Goals are a built-in way to move your conversation away from a sequence of isolated prompts and into a work loop that iterates until it hits a measured outcome.<br>You can use /goal in the Codex app or in the CLI, so you can just stick to your preference.<br>If this is the first you’re hearing of goals in Codex, you’re probably a bit curious how they differ from ordinary prompts. We’ll start by answering that question, then show you the helpful goal commands, then we’ll wrap up with a real example.<br>Ready to dig in?<br>What is the difference between a prompt and Codex goal?
Codex prompts vs Codex goals<br>Prompts work for this workflow<br>ask -> work -> result -> wait<br>Goals work like this<br>work -> self-eval -> loop if not complete<br>In short, Goals are outcome-driven.<br>If Codex can learn something from what it just done, a goal can help it keep going without you.<br>But do use goals, you need a verification surface (like tests or browser use) and a measurable outcome.<br>When to use a goal instead of a prompt
Have you ever been using an agent in Codex or some other tool and found yourself typing the same thing over and over again as responses to agent completions?<br>Nice, do the next test now.
Or<br>Awesome, clean up the next controller to use this new method in the parent class
Or<br>Don’t just show me how to do it, keep going and finish it
If you’re ever in a situation like this, the /goal command is probably going to be very helpful.<br>Today’s newsletter is generously sponsored by Friday , a powerful agent harness that connect to the software you already use.
Friday helps you get more done with AI agents, without having to glue tools together. You can bring your own API key for your preferred models, bring your existing skills , and connect to the tools you need with MCPs .<br>One of my favorite things in Friday is the incredible support for scheduled jobs. Friday lets you describe recurring agentic workflows in plaintext but gives you the option to edit and extend them as code.<br>Check it out today!<br>Try Friday
Some helpful Codex goal commands
The /goal command is really simple, and there’s a few variations that can help you in both the Codex app and CLI.<br>How to set a goal in Codex
Setting a goal in codex is simple with the slash command:<br>/goal Your goal goes here
How to view the current Codex goal
If you have a long-running goal, you might need reminded of what you initially asked for:<br>/goal
How to pause the current Goal in Codex
If you want to pause a goal without losing progress or context, you can do so:<br>/goal pause
How to resume a goal
Resuming a paused goal is easy with:<br>/goal resume
How to delete a goal
Deleting a goal will remove the context and allow you to set a new one. Just run:<br>/goal clear
How to write a Codex goal
The OpenAI docs are a great place to go for instructions on writing goals, but I’ll give you the most important stuff here.<br>Goals need outcomes . This is how Codex knows when it’s done.<br>Goals need a way to verify the outcome . Tests, benchmarks, browser use, etc.<br>Goals should have constraints . You’ll get better results if you tell Codex what not to change.<br>Goals should know when to report as blocked . If you tell Codex what would indicate that it’s blocked, you’ll save yourself from wasting tokens.<br>Template for a good goal
Here’s a template for a good goal:<br>/goal verified by while preserving . Use . Between iterations, . If blocked or no valid paths remain, .<br>You could simplify this as:<br>/goal Complete this thing without stopping until you’ve passed this success criteria
Here’s a goal I used to add some test coverage to a project that doesn’t have any tests.
Using goals in Codex to add tests to a project<br>Goals and token usage warnings
One word of warning for you is to pay attention to your token usage while using goals. The /goal command lets Codex iterate over and over, which will consume truly absurd amounts of tokens. On a sufficiently large project, you’ll probably start hitting your five hour limits long before five hours (on the Plus plan).<br>Fortunately your limits will reset, so you won’t be stuck for the month, but it’s something to keep in mind.<br>This is one reason I keep a Codex, Claude Code, and Cursor subscription all active at the same time. Having all three is cheaper than any top-tier plan, gets me ton more usage, and lets me daily-drive whatever tool as the best edge at a given time.<br>Goals actually work in Codex too, and I suspect Cursor will follow-suit soon.
Claude Code vs Cursor<br>Jeff Morhous<br>Jan 22
Read full story
Codex and Claude Code each made a landing...