Summary: OpenAI Codex is an autonomous coding agent that introduced Goals — persistent, thread-scoped objectives that define "what done looks like" and iterate until evidence confirms completion. Goals transform Codex from a prompt-response tool into an evidence-driven autonomous agent.
Overview
| Property | Value |
|---|---|
| Provider | OpenAI |
| Type | Autonomous coding agent + Goals API |
| Key Innovation | Persistent objectives with evidence-based termination |
| Scope | Thread-scoped (not global memory) |
| Verification | Benchmark/test-driven outcomes |
Goals: The Mental Model Shift
PROMPT: ask → work → result → wait (you drive)
GOAL: work → check → continue or complete (evidence drives)
Prompt vs Goal Example
| Approach | Example |
|---|---|
| Prompt | "Fix the checkout latency" |
| Goal | Reduce p95 checkout latency below 120ms on the checkout benchmark while keeping the correctness suite green |
Anatomy of a Strong Goal (6 Elements)
| Element | Purpose | Example |
|---|---|---|
| 1. Outcome | End state | p95 checkout latency < 120ms |
| 2. Verification | How to prove it | checkout benchmark |
| 3. Constraints | What must hold | correctness suite green |
| 4. Boundaries | Files/tools allowed | checkout service, benchmark fixtures, related tests |
| 5. Iteration Policy | Next action selection | record what changed, benchmark result, next experiment |
| 6. Blocked Stop | What to report when stuck | attempted paths, evidence, blocker, next input needed |
Research Workflow Example
Weak: /goal Reproduce Deep Hedging paper
Strong:
/goal Produce the strongest evidence-backed reproduction of Buehler et al. "Deep Hedging" using available materials. Attempt every headline result, verify outputs, and end with a report separating:
- Confirmed mechanics (exact replay)
- Approximate trained results (close numerical match)
- Blocked claims (missing seeds/checkpoints/data)
- Remaining uncertainty
Results achieved by this Goal:
- ✅ Rebuild pricing/hedging mechanics
- ✅ Reproduce Heston reference price
- ✅ Train CVaR hedge policies
- ✅ Rebuild main figures
- ✅ Honestly label what couldn't be exactly replayed (missing seeds, TF graph, checkpoints)
Key insight: The Goal prevented overclaiming. Final audit preserves epistemic levels instead of flattening to "reproduced ✓".
Architecture Insights
- Thread-scoped state — Goals live with context (files read, commands run, diffs, reasoning trail)
- Continuation — Only at safe boundaries (idle thread, active Goal, within budget)
- Budget limits → Summaries, not fake completions
- Pause/resume — Preserves objective
When NOT to Use Goals
| Avoid Goals For | Use Goals For |
|---|---|
| One-line edits | Debugging with evidence (flaky tests, perf) |
| Vague finish lines ("make it better") | Multi-step refactors with test gates |
| Hiding uncertainty | Research with clear evidence standards |
| Any task where next action depends on what you just learned |
Related
- autonomous-agents — Architecture comparison across SDKs
- tool-use-patterns — Tool execution patterns in Codex
- context-window-management — Budget continuation, thread scoping
- using-goals-in-codex — Full blog post with examples
Sources
- using-goals-in-codex — OpenAI Codex Cookbook: Using Goals in Codex