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
521Copy page [Export as PDF](https://developers.openai.com/codex/use-cases/iterate-on-difficult-problems/?export=pdf) Before changing anything:
6 22
723Give Codex an evaluation system, such as scripts and reviewable artifacts, so it can keep improving a hard task until the scores are good enough. - Read `AGENTS.md`.
8 24
925Advanced - Find the script or command that scores the current output.
10 26
11Long-running
12 27
1328Related links Iteration loop:
14 29
1530[Custom instructions with AGENTS.md](https://developers.openai.com/codex/guides/agents-md) [Codex workflows](https://developers.openai.com/codex/workflows) - Make one focused improvement at a time.
16 31
1732## Best for - Re-run the eval command after each meaningful change.
18 33
1934- Problems where each iteration can be scored, but the best result usually takes many passes - Log the scores and what changed.
20- Tasks with visual or subjective outputs that need both deterministic checks and an LLM-as-a-judge score
21- Long-running Codex sessions where you want progress tracked clearly instead of relying on context
22 35
2336## Starter prompt - Inspect generated artifacts directly. If the output is visual, use
37 `view_image`.
24 38
25I have a difficult task in this workspace and I want you to run it as an eval-driven improvement loop.
26 Before changing anything:
27 - Read `AGENTS.md`.
28 - Find the script or command that scores the current output.
29 Iteration loop:
30 - Make one focused improvement at a time.
31 - Re-run the eval command after each meaningful change.
32 - Log the scores and what changed.
33- Inspect generated artifacts directly. If the output is visual, use `view\_image`.
34 - 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%.
35 Constraints:
36 - Do not stop at the first acceptable result.
37- Do not revert to an earlier version unless the new result is clearly worse in scores or artifacts.
38- If the eval improves but is still below target, explain the bottleneck and continue.
39 Output:
40 - current best scores
41 - log of major iterations
42 - remaining risks or weak spots
43 40
4441I have a difficult task in this workspace and I want you to run it as an eval-driven improvement loop.
45 Before changing anything:
46 - Read `AGENTS.md`.
47 - Find the script or command that scores the current output.
48 Iteration loop:
49 - Make one focused improvement at a time.
50 - Re-run the eval command after each meaningful change.
51 - Log the scores and what changed.
52- Inspect generated artifacts directly. If the output is visual, use `view\_image`.
53 - Keep going until both the overall score and the LLM average are above 90%.
54 Constraints:42 Constraints:
43
55 - Do not stop at the first acceptable result.44 - Do not stop at the first acceptable result.
5645- Do not revert to an earlier version unless the new result is clearly worse in scores or artifacts.
5746- 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
58 Output:53 Output:
54
59 - current best scores55 - current best scores
56
60 - log of major iterations57 - log of major iterations
58
61 - 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---
62 66
63## Introduction67## Introduction
64 68
1336. Continue until the thresholds are met.1376. Continue until the thresholds are met.
134 138
135This 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.
136
137## Related use cases
138
139[
140
141### Understand large codebases
142
143Use Codex to map unfamiliar codebases, explain different modules and data flow, and point...
144
145Engineering Analysis](https://developers.openai.com/codex/use-cases/codebase-onboarding)[
146
147### Create browser-based games
148
149Use Codex to turn a game brief into first a well-defined plan, and then a real browser-based...
150
151Engineering Code](https://developers.openai.com/codex/use-cases/browser-games)[
152
153### Learn a new concept
154
155Use Codex to study material such as research papers or courses, split the reading across...
156
157Knowledge Work Data](https://developers.openai.com/codex/use-cases/learn-a-new-concept)