Codex Goals: The Feature That Lets Your Coding Agent Run for Days
Watch on TikTok
OpenAI's Codex just shipped an experimental feature called Goals that fundamentally changes how autonomous coding agents work. Instead of turn-by-turn interactions, you define a goal and let Codex run -- for hours, or even days -- without interruption.
What the Goals Feature Does
The new /goal command gives Codex a more sophisticated, integrated root loop that you can invoke on demand. You type /goal, describe what you want to build, and Codex takes over. It plans, writes code, runs tests, debugs, and iterates -- all autonomously.

The results people are seeing are remarkable. Some users have reported Codex running on a single goal for over three days without any interruptions. Others have had it work for over a day, or nine hours straight, all on complex multi-file tasks.
The Key to Making It Work
The trick is specificity. You need to give Codex very precise instructions about what success actually means. Vague goals lead to vague results. But when you define clear success criteria -- specific tests to pass, specific behaviors to implement, specific architectures to follow -- Codex can execute on complex tasks that would normally require constant human oversight.

How It Works Under the Hood
The goals feature uses a turn-by-turn mechanism with state records, static templates, and end-of-turn injection. When a user sets a goal, Codex creates a persistent state record and references continuation and budget limit templates. The runtime keeps firing turns until something stops it -- either the goal is achieved, the budget is exhausted, or the user intervenes.
Key Takeaways
- Codex's
/goalfeature enables long-running autonomous coding sessions lasting hours or days - Success depends on giving very specific instructions about what success looks like
- The feature uses a sophisticated loop with state persistence, continuation templates, and budget limits
- Users have reported successful autonomous runs of 3+ days on complex tasks
Resources
- OpenAI Codex -- OpenAI's cloud-based coding agent platform
Published May 12, 2026. Writeup generated from a favorited TikTok.