Prompt Engineering Codex Β· CH 10

Chapter 10: Designing Multi-Turn Conversations

⏱️ 4 min read·Updated Jul 2026

Beyond the Single Prompt

Most prompt engineering resources focus on single-turn interactions: one prompt, one response. But the highest-value use cases for AI β€” complex analysis, iterative design, personalised recommendation, debugging sessions β€” require multiple turns.

Multi-turn conversation design is not just 'chat.' It is a structured approach to guiding the model through a reasoning or production process that unfolds over several exchanges.

---

The Conversation State Problem

Each model call is stateless. The model has no memory of previous conversations unless you explicitly include them in the current request. This means managing conversation state is your responsibility.

What the Model Sees in Turn N

At turn N, the model receives the full conversation history: every message from turn 1 to turn N-1, plus the current user message. This is the context window in action.

As conversations grow longer, two problems emerge:

    • Context window limits: Very long conversations eventually exceed the model's context window (though with 1M+ token windows in 2026, this is less common)
    • Recency bias: Models pay more attention to recent messages. Important context from early turns can be effectively forgotten in practice even when it is technically present.
---

The Four Multi-Turn Conversation Architectures

Architecture 1: Progressive Refinement

Use the conversation to iteratively improve a single output. Each turn addresses a specific dimension.

code
Turn 1: "Draft the landing page copy for [product]."
- Model produces first draft

Turn 2: "Good structure. Now revise the headline and subheadline only β€” make them more specific about who this is for and what result they get in what timeframe."
- Model improves headers

Turn 3: "The headers are better. Now revise the features section β€” convert the feature names into outcome statements."
- Model converts features to outcomes

Turn 4: "Keep everything but tighten the whole piece by 30%. Cut filler, not substance."
- Model condenses

Architecture 2: Structured Elicitation

Use turns to gather necessary information before the model attempts the main task.

``` Turn 1: "I want you to write a job description for a role I am hiring for. Before we start, ask me the 5 most important questions you need answered to write an excellent job description."

Turn 2: [User answers the questions]

Turn 3: "Now write the job description based on those answers."

code
### Architecture 3: Socratic Dialogue

Use turns to guide the model through a reasoning process, challenging each step.
Turn 1: "What are the three most important technical decisions for a new SaaS startup to get right?"

Turn 2: "You mentioned [decision X]. Why is that more important than [decision Y]?"

Turn 3: "Given that, what would you prioritise differently for a startup with a non-technical founder versus one with a CTO?"

code
### Architecture 4: Role Assignment Rotation

Assign the model different roles across turns to get multiple perspectives on the same problem.
Turn 1: "You are an enthusiastic advocate for this product idea. Give me the strongest possible case for building it."

Turn 2: "Now you are a skeptical investor who has seen 100 similar ideas fail. What are the three biggest reasons this will not work?"

Turn 3: "Now you are a pragmatic product manager. Given both perspectives, what is the highest-probability path to making this work?"

code
---

## Context Window Management

For long conversations, use these techniques to prevent context decay:

**Technique 1: Periodic summarisation**
Every 10-15 turns, ask the model to summarise what has been decided so far. Use this summary to reset the conversation with a compressed history.
javascript const summary = await client.chat.completions.create({ messages: [ ...conversationHistory, { role: 'user', content: 'Summarise all decisions and conclusions from our conversation so far in bullet points.' } ] });

const compressedHistory = [ { role: 'system', content: systemPrompt }, { role: 'assistant', content: 'Previous conversation summary:\n' + summary } ];

code
**Technique 2: Explicit state anchoring**
At critical moments, ask the model to explicitly state what it knows:
"Before we proceed, confirm: what are the three requirements we agreed on earlier?"
code
---

## Designing the Opening Turn

The first turn of a multi-turn conversation sets the frame for everything that follows.

A strong opening turn:
1. Establishes the full context (what are we trying to accomplish and why)
2. Defines the model's role for this conversation
3. Sets expectations for the conversation structure
4. Specifies the output format for each turn if it varies
Opening turn template: "We are going to [overall goal]. Here is the context you need: [context]. For this conversation, you are playing the role of [specific role]. In each turn, I will [what you will do]. You should [what the model should do in each turn]. Let's start with: [first actual task]." ```

Finished reading this chapter?

Mark it completed to update your AI Builder skill profile score on your dashboard.

πŸ“‹

Download Printable Chapter Checklist

Get a print-friendly, formatted checklist of workspace actions to apply this chapter offline.