Dialog Engineering
Single prompts fail at complex problems. Structured dialog succeeds.
The CSAR Loop
Every effective AI conversation follows four phases in a loop:
| Phase |
Purpose |
Signal |
| Clarify |
Provide context, constraints, scope, and domain specifics |
"I'm building X with Y for Z" |
| Summarize |
State the goal in one sentence so both sides align |
"Show me the service layer for..." |
| Act |
AI generates output: code, docs, analysis, plan |
Output is produced |
| Reflect |
Evaluate, iterate, go deeper, or pivot |
"Go deeper on...", "What did I miss?" |
Clarify ──→ Summarize ──→ Act ──→ Reflect
↑ │
└──────────────────────────────────┘
The loop is not one-shot. Complex tasks cycle 3-5 times. Each cycle narrows the solution space.
Why Dialog Beats Single Prompts
| Single Prompt |
Dialog |
| Front-loads all requirements |
Discovers requirements together |
| Hopes AI guesses right |
Steers toward the vision |
| Restarts on failure |
Refines incrementally |
| 1 attempt, pass/fail |
Multiple iterations, continuous improvement |
| Cognitive overload (for AI) |
Manageable chunks |
Turn Design Patterns
Turn 1: The Anchor (Clarify + Summarize)
State context AND goal in the first turn. Include:
- Tech stack and constraints
- What output you want (code, doc, plan, analysis)
- What you DON'T want (avoids the most common waste)
Good: "I need to add authentication to my Express/TypeScript API. Current stack: Express 4, Prisma, PostgreSQL. What approaches do you recommend? Keep it simple."
Bad: "Build me a complete user authentication system with login, registration, password reset, JWT tokens, refresh tokens, email verification, rate limiting, and tests."
Turn 2+: Steering Moves
| Move |
When to Use |
Example |
| The Probe |
Need deeper reasoning |
"Why did you choose X over Y?" |
| The Constraint |
Add a new requirement |
"Now make it work with [limitation]" |
| The Pivot |
Wrong direction |
"Actually, let's try a different approach" |
| The Checkpoint |
Align before continuing |
"Before we continue, let me summarize what we've decided..." |
| The Rubber Duck |
Think out loud |
"Let me reason through this -- tell me where I'm wrong..." |
| The Handoff |
Split work |
"I'll implement this part. You do the tests." |
| The Zoom |
Go deeper on one thing |
"Go deeper on error handling" |
| The Zoom Out |
Step back |
"Are we solving the right problem?" |
The Closing Turn (Reflect)
End sessions by asking:
- "What did we miss?"
- "What would break this?"
- "Summarize the decisions we made"
This catches blind spots and creates a record for future sessions.
Dialog Anti-Patterns
| Anti-Pattern |
Problem |
Fix |
| The Wall of Text |
500-word prompt with 20 requirements |
Break into CSAR turns |
| The Yes-Man |
Accepting first output without reflecting |
Always do at least one Reflect turn |
| The Restart |
Starting over instead of iterating |
Use Pivot or Constraint moves |
| Context Amnesia |
Not restating decisions in later turns |
Use Checkpoint for alignment |
| Premature Specificity |
"Use exactly this library with this config" too early |
Clarify first, constrain later |
When to Use Each CSAR Phase
| Task Complexity |
Clarify Depth |
Summarize |
Act Cycles |
Reflect Depth |
| Simple (bug fix) |
1 sentence |
Implicit |
1 |
Quick check |
| Medium (feature) |
2-3 turns |
Explicit |
2-3 |
"What would break?" |
| Complex (architecture) |
3-5 turns |
Written summary |
3-5+ |
Adversarial review |
| Research |
5+ exploratory turns |
Multiple pivots |
Iterative |
Cross-validate sources |
CSAR Implementation
// Implement CSAR loop tracking in conversation
enum CSARPhase {
Clarify = 'clarify',
Summarize = 'summarize',
Act = 'act',
Reflect = 'reflect'
}
interface DialogState {
currentPhase: CSARPhase;
cycleCount: number;
contextGathered: Map<string, string>;
goalStatement: string | null;
lastAction: string | null;
}
function detectPhaseFromMessage(message: string): CSARPhase {
// Clarify signals: providing context
if (message.match(/I'm building|current stack|constraint is|using/i)) {
return CSARPhase.Clarify;
}
// Summarize signals: stating goal
if (message.match(/show me|I need|the goal is|help me/i)) {
return CSARPhase.Summarize;
}
// Reflect signals: evaluation/iteration
if (message.match(/what did|go deeper|what if|why did you/i)) {
return CSARPhase.Reflect;
}
// Default: Act phase (generation expected)
return CSARPhase.Act;
}
function suggestNextMove(state: DialogState): string {
switch (state.currentPhase) {
case CSARPhase.Clarify:
return state.goalStatement
? 'Ready to act on your goal.'
: 'What specifically do you want to accomplish?';
case CSARPhase.Act:
return 'Shall I go deeper on any aspect?';
case CSARPhase.Reflect:
return state.cycleCount < 3
? 'Want to refine further, or ready to proceed?'
: 'We've iterated well. Ready to finalize?';
default:
return '';
}
}
Integration with Alex Skills
- Meditation: The Reflect phase maps to meditation's "what did I learn?" step
- Research-first-development: Clarify phases should invoke research skills before acting
- Code review: Reflect phase should invoke adversarial review checklist
- Knowledge synthesis: End-of-session Reflect should capture insights for global knowledge
1---2name: dialog-engineering-43description: "CSAR Loop and structured conversation patterns for effective AI dialog -- Clarify, Summarize, Act, Reflect"4tier: core5applyTo: '**/*dialog*,**/*conversation*,**/*csar*,**/*prompt*'6currency: 2026-04-207metadata:8 source: https://skillmd.com/skills/fabioc-aloha/dialog-engineering-49---1011# Dialog Engineering1213> Single prompts fail at complex problems. Structured dialog succeeds.1415## The CSAR Loop1617Every effective AI conversation follows four phases in a loop:1819| Phase | Purpose | Signal |20|-------|---------|--------|21| **Clarify** | Provide context, constraints, scope, and domain specifics | "I'm building X with Y for Z" |22| **Summarize** | State the goal in one sentence so both sides align | "Show me the service layer for..." |23| **Act** | AI generates output: code, docs, analysis, plan | Output is produced |24| **Reflect** | Evaluate, iterate, go deeper, or pivot | "Go deeper on...", "What did I miss?" |2526```27 Clarify ──→ Summarize ──→ Act ──→ Reflect28 ↑ │29 └──────────────────────────────────┘30```3132The loop is not one-shot. Complex tasks cycle 3-5 times. Each cycle narrows the solution space.3334## Why Dialog Beats Single Prompts3536| Single Prompt | Dialog |37|---------------|--------|38| Front-loads all requirements | Discovers requirements together |39| Hopes AI guesses right | Steers toward the vision |40| Restarts on failure | Refines incrementally |41| 1 attempt, pass/fail | Multiple iterations, continuous improvement |42| Cognitive overload (for AI) | Manageable chunks |4344## Turn Design Patterns4546### Turn 1: The Anchor (Clarify + Summarize)4748State context AND goal in the first turn. Include:49- Tech stack and constraints50- What output you want (code, doc, plan, analysis)51- What you DON'T want (avoids the most common waste)5253**Good**: "I need to add authentication to my Express/TypeScript API. Current stack: Express 4, Prisma, PostgreSQL. What approaches do you recommend? Keep it simple."5455**Bad**: "Build me a complete user authentication system with login, registration, password reset, JWT tokens, refresh tokens, email verification, rate limiting, and tests."5657### Turn 2+: Steering Moves5859| Move | When to Use | Example |60|------|-------------|---------|61| **The Probe** | Need deeper reasoning | "Why did you choose X over Y?" |62| **The Constraint** | Add a new requirement | "Now make it work with [limitation]" |63| **The Pivot** | Wrong direction | "Actually, let's try a different approach" |64| **The Checkpoint** | Align before continuing | "Before we continue, let me summarize what we've decided..." |65| **The Rubber Duck** | Think out loud | "Let me reason through this -- tell me where I'm wrong..." |66| **The Handoff** | Split work | "I'll implement this part. You do the tests." |67| **The Zoom** | Go deeper on one thing | "Go deeper on error handling" |68| **The Zoom Out** | Step back | "Are we solving the right problem?" |6970### The Closing Turn (Reflect)7172End sessions by asking:73- "What did we miss?"74- "What would break this?"75- "Summarize the decisions we made"7677This catches blind spots and creates a record for future sessions.7879## Dialog Anti-Patterns8081| Anti-Pattern | Problem | Fix |82|--------------|---------|-----|83| The Wall of Text | 500-word prompt with 20 requirements | Break into CSAR turns |84| The Yes-Man | Accepting first output without reflecting | Always do at least one Reflect turn |85| The Restart | Starting over instead of iterating | Use Pivot or Constraint moves |86| Context Amnesia | Not restating decisions in later turns | Use Checkpoint for alignment |87| Premature Specificity | "Use exactly this library with this config" too early | Clarify first, constrain later |8889## When to Use Each CSAR Phase9091| Task Complexity | Clarify Depth | Summarize | Act Cycles | Reflect Depth |92|-----------------|--------------|-----------|------------|---------------|93| Simple (bug fix) | 1 sentence | Implicit | 1 | Quick check |94| Medium (feature) | 2-3 turns | Explicit | 2-3 | "What would break?" |95| Complex (architecture) | 3-5 turns | Written summary | 3-5+ | Adversarial review |96| Research | 5+ exploratory turns | Multiple pivots | Iterative | Cross-validate sources |9798### CSAR Implementation99100```typescript101// Implement CSAR loop tracking in conversation102enum CSARPhase {103 Clarify = 'clarify',104 Summarize = 'summarize', 105 Act = 'act',106 Reflect = 'reflect'107}108109interface DialogState {110 currentPhase: CSARPhase;111 cycleCount: number;112 contextGathered: Map<string, string>;113 goalStatement: string | null;114 lastAction: string | null;115}116117function detectPhaseFromMessage(message: string): CSARPhase {118 // Clarify signals: providing context119 if (message.match(/I'm building|current stack|constraint is|using/i)) {120 return CSARPhase.Clarify;121 }122 // Summarize signals: stating goal123 if (message.match(/show me|I need|the goal is|help me/i)) {124 return CSARPhase.Summarize;125 }126 // Reflect signals: evaluation/iteration127 if (message.match(/what did|go deeper|what if|why did you/i)) {128 return CSARPhase.Reflect;129 }130 // Default: Act phase (generation expected)131 return CSARPhase.Act;132}133134function suggestNextMove(state: DialogState): string {135 switch (state.currentPhase) {136 case CSARPhase.Clarify:137 return state.goalStatement 138 ? 'Ready to act on your goal.'139 : 'What specifically do you want to accomplish?';140 case CSARPhase.Act:141 return 'Shall I go deeper on any aspect?';142 case CSARPhase.Reflect:143 return state.cycleCount < 3 144 ? 'Want to refine further, or ready to proceed?'145 : 'We've iterated well. Ready to finalize?';146 default:147 return '';148 }149}150```151152## Integration with Alex Skills153154- **Meditation**: The Reflect phase maps to meditation's "what did I learn?" step155- **Research-first-development**: Clarify phases should invoke research skills before acting156- **Code review**: Reflect phase should invoke adversarial review checklist157- **Knowledge synthesis**: End-of-session Reflect should capture insights for global knowledge