OpenAI Codexcodex-cli 0.154 · macOS, Linux, WSL, Windows
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
26 small wins to finish your pathNext lesson

Prompting Codex

You do not need a formula. You do need to say the four things a task cannot be finished without.

The documentation's own list, and it holds up: the goal, the context, the output, and the boundaries. Use the parts that help and skip the rest.

PartThe question it answers
GoalWhat should it do?
ContextWhat information or files help?
OutputWhat format, length or level of detail?
BoundariesWhat must stay unchanged, and what should it check with you first?

The same task, twice

text
fix the shortener bug

That will produce something. Which bug, in which file, and what counts as fixed are all left to a guess, and next week you get a different guess.

text
After removing a link, the next code collides with an existing one and
overwrites it. Fix that in shorten.py.

Do not change store.py. Run python3 demo.py afterwards and show me the
output. If the fix needs a change to how codes are stored, stop and tell
me rather than doing it.

Goal, context, output, boundary. It is longer, and length is not the point: every sentence removes a decision the agent would otherwise make on its own.

Start with the result

Describe what you want back, not the steps to get there. A prompt that names the commands to run turns an agent into a slow shell, and it breaks the moment the repository is shaped slightly differently.

  • Say what done looks like. Tests passing, output matching, a file existing.
  • Say what not to touch. This is the line people leave out, and the one that saves reverts.
  • Say when to stop and ask. Anything ambiguous, anything destructive.
When to stop retyping it
Anything you find yourself writing into every prompt belongs in AGENTS.md. That is the difference between a prompt and a convention, and lesson 6 is where conventions live.
Try it yourself
  • Take your last Codex prompt and mark which of the four parts it had.
  • Rewrite it with the missing part and compare the result.

Slow is fine. Stopping is the only problem.