Codex /goal: Simple Harness for Hour-Long AI Coding Agents

Chase AIgo watch the original →

Codex's experimental /goal command runs autonomous ReAct-like loops for long coding tasks, with built-in budget handling, pausing, and Playwright verification—no extra orchestration needed.

The Breakthrough

Codex's /goal command implements an integrated ReAct loop that autonomously executes long-running coding objectives for hours without intervention, using invisible continuation.md and budget-limit.md files to manage state, budgets, and graceful shutdowns.

What Actually Worked

  • Enable the experimental feature by adding features.goals = true to config.toml in the Codex desktop app or CLI, or prompt Codex directly with the same config.
  • Invoke with /goal followed by a detailed objective, such as planning and implementing a top-down arcade survival game named Rift Salvage using original assets generated via GPT image gen 2 (player drone sprite, three enemies, boss creature, energy core, hazard mine, rift background, badges, two UI flavor assets).
  • Define precise completion criteria in the prompt, including npm run build with no errors, starting the dev server and providing the local URL, and running an automated Playwright verification script that confirms app loads, canvas is non-blank, simulates keyboard movements, simulates collectible events, forces damage, confirms health changes, verifies boss win state, and checks UIs.
  • Handle end-of-turn paths automatically: continue if work remains and budget allows; inject budget-limit.md to wrap up gracefully near token caps with a final report; call update_goal tool on completion after auditing deliverables; support pausing, editing, or resuming after crashes.
  • Run iterative goals in separate threads/sessions for refinements, such as adding a combat system (lasers shooting at enemies that shoot back with hit points), quicker boss phase trigger, improved contrast, and extra ideas.

Context

The author compares /goal to a basic ReAct loop (a bash loop reading prompt.md for tasks/completion criteria and state.md for progress), which lacks built-in budget management, crash recovery, or verification. Tools like GSD or superpowers add orchestration layers on Claude Code, but /goal embeds this in Codex as a single slash command. In the demo, Codex built a functional canvas-based 2D game (keyboard/touch controls, spawning enemies/mines, scoring, shield power-ups, boss phase, win/lose/pause/restart) with 11 unique bitmap assets and Playwright tests in ~30 minutes for the initial pass and 15 minutes for combat upgrades, outperforming Claude Code by natively accessing image gen 2 without extra CLIs like Higsfield.

Notable Quotes

  • "Codex is now the easiest way to execute long-running autonomous coding tasks without having to include any sort of additional orchestration layers."
  • "You need to be extremely specific about what the end result needs to be... a very quantifiable set of things it must hit in order for it to complete the loop."
  • "This can kind of just run forever so instead of having to set up your own sort of ReAct loop and your own scaffolding... it's kind of just built in for you."

Content References

Empty—no books, papers, datasets, or events cited beyond tool mentions.

  • #demo
  • #tutorial
  • #review

summary by x-ai/grok-4.1-fast. probably wrong about something. check the source.