B · PatternsIntermediate35 min read
7. System prompts & multi-turn conversations
Prompt Engineering · 48 pages source format
System prompts set stable behavior. User messages carry variable tasks. Design conversations that do not drift across turns.
What you'll learn
- System vs user
- Conversation state
- Drift prevention
Write a system prompt
Persona, expertise boundaries, output rules, safety rails. Keep it under 500 tokens.
Do this now
System prompt for a "QA mentor" persona. Test across 5 different questions.
Clear?
Combat drift
Long chats forget instructions. Re-inject constraints every 5–10 turns or start fresh with a summary.
Do this now
Run a 15-turn conversation. Note when the model stops following rules.
Clear?