11# Iterate on difficult problems | Codex use cases---
2name: Iterate on difficult problems
3tagline: Use Codex as a scored improvement loop to solve hard tasks.
4summary: Give Codex an evaluation system, such as scripts and reviewable
5 artifacts, so it can keep improving a hard task until the scores are good
6 enough.
7bestFor:
8 - Problems where each iteration can be scored, but the best result usually
9 takes many passes
10 - Tasks with visual or subjective outputs that need both deterministic checks
11 and an LLM-as-a-judge score
12 - Long-running Codex sessions where you want progress tracked clearly instead
13 of relying on context
14starterPrompt:
15 title: Keep Iterating Until the Eval Passes
16 body: >-
17 I have a difficult task in this workspace and I want you to run it as an
18 eval-driven improvement loop.
2 19
3[← All use cases](https://developers.openai.com/codex/use-cases)
4 20
521Give Codex an evaluation system, such as scripts and reviewable artifacts, so it can keep improving a hard task until the scores are good enough. Before changing anything:
6
7Advanced
8
9Long-running
10
11Related links
12
13[Custom instructions with AGENTS.md](https://developers.openai.com/codex/guides/agents-md) [Codex workflows](https://developers.openai.com/codex/workflows)
14 22
1523## Best for - Read `AGENTS.md`.
16 24
1725- Problems where each iteration can be scored, but the best result usually takes many passes - Find the script or command that scores the current output.
18- Tasks with visual or subjective outputs that need both deterministic checks and an LLM-as-a-judge score
19- Long-running Codex sessions where you want progress tracked clearly instead of relying on context
20 26
21## Starter prompt
22 27
23I have a difficult task in this workspace and I want you to run it as an eval-driven improvement loop.
24 Before changing anything:
25 - Read `AGENTS.md`.
26 - Find the script or command that scores the current output.
27 Iteration loop:28 Iteration loop:
29
28 - Make one focused improvement at a time.30 - Make one focused improvement at a time.
31
29 - Re-run the eval command after each meaningful change.32 - Re-run the eval command after each meaningful change.
33
30 - Log the scores and what changed.34 - Log the scores and what changed.
3135- Inspect generated artifacts directly. If the output is visual, use `view\_image`.
36 - Inspect generated artifacts directly. If the output is visual, use
37 `view_image`.
38
32 - Keep going until both the overall score and the LLM average are above 90%.39 - Keep going until both the overall score and the LLM average are above 90%.
40
41
33 Constraints:42 Constraints:
43
34 - Do not stop at the first acceptable result.44 - Do not stop at the first acceptable result.
3545- Do not revert to an earlier version unless the new result is clearly worse in scores or artifacts.
3646- If the eval improves but is still below target, explain the bottleneck and continue. - Do not revert to an earlier version unless the new result is clearly worse
47 in scores or artifacts.
48
49 - If the eval improves but is still below target, explain the bottleneck and
50 continue.
51
52
37 Output:53 Output:
54
38 - current best scores55 - current best scores
56
39 - log of major iterations57 - log of major iterations
58
40 - remaining risks or weak spots59 - remaining risks or weak spots
60relatedLinks:
61 - label: Custom instructions with AGENTS.md
62 url: /codex/guides/agents-md
63 - label: Codex workflows
64 url: /codex/workflows
65---
41 66
42## Introduction67## Introduction
43 68
1126. Continue until the thresholds are met.1376. Continue until the thresholds are met.
113 138
114This discipline matters. If each iteration changes too many things at once, Codex cannot tell which idea improved the score. If it skips logging, the session becomes hard to trust and hard to resume.139This discipline matters. If each iteration changes too many things at once, Codex cannot tell which idea improved the score. If it skips logging, the session becomes hard to trust and hard to resume.
115
116## Related use cases
117
118[
119
120### Understand large codebases
121
122Use Codex to map unfamiliar codebases, explain different modules and data flow, and point...
123
124Engineering Analysis](https://developers.openai.com/codex/use-cases/codebase-onboarding)[
125
126### Create browser-based games
127
128Use Codex to turn a game brief into first a well-defined plan, and then a real browser-based...
129
130Engineering Code](https://developers.openai.com/codex/use-cases/browser-games)[
131
132### Analyze datasets and ship reports
133
134Use Codex to clean data, join sources, explore hypotheses, model results, and package the...
135
136Data Analysis](https://developers.openai.com/codex/use-cases/datasets-and-reports)