CHAPTER 03 · Building the Prompt · 5 / 5
Key takeaways
- A model request has three parts worth knowing: layered
instructions, a list oftools(JSON schemas), and aninputlist of structured conversation items. - Roles carry authority, in order: system, developer, user, assistant.
- Store history as typed items, and link each tool call to its result with a shared
call_idso the model understands cause and effect. - Put stable content (instructions, tools) first and variable content (the latest message) last. This is what makes caching possible.
- The model only knows what is in the prompt. Brief it like a sharp colleague who just walked into the room.
Original sources: OpenAI's Unrolling the Codex agent loop and Jonathan Fulton's "Inside the Agent Harness" analysis of the Codex codebase.