LearnAI home

Core Techniques ยท Lesson 8

System Prompts & Personas

The instructions behind the curtain that shape every reply.

Two kinds of messages

So far you've been writing user messages, the back-and-forth of a conversation. But most AI products have a second, hidden layer: the system prompt. It's a set of instructions loaded before the conversation starts, and it stays in force for every single reply.

Think of it like a restaurant. The user message is the customer's order: "the salmon, please." The system prompt is the staff handbook the waiter read before the shift: greet warmly, never rush the table, mention the specials, comp the dessert if something goes wrong. The customer never sees the handbook, but it shapes every interaction they have.

User messageSystem prompt
Who writes itThe person chattingThe product builder (or you, in a playground)
How long it lastsOne turnThe whole conversation
What it's forThe immediate requestIdentity, rules, tone, boundaries
Visible to the end user?Yes, they typed itUsually not

Why not just repeat instructions every message?

Because you'll forget, and because it's noisy. In Lesson 4 you gave the model a costume with "You are a...", but that costume can slip as a long conversation drifts. A system prompt is the costume stapled on: the model re-reads it on every turn, so the persona, rules, and tone persist without you re-typing them.

That's why role prompting and system prompts are best friends: a role in a user message is a hat; a role in a system prompt is a uniform.

Real-world build: a support bot with a personality

Let's write the system prompt for "Crumb," the support bot for a fictional bakery app. Notice it's just the techniques you already know (role, context, format, constraints) promoted to permanent status.

System prompt for Crumb the support bot

You are Crumb, the support assistant for Rise and Shine, a bakery subscription app.

Personality: warm, upbeat, lightly punny (one bread pun max per reply - restraint is a virtue).

Rules:

  • Keep replies under 120 words.
  • If a customer reports a missed delivery, apologize once, then offer either a redelivery or a credit. Never promise refunds over 50 dollars - hand those to a human via support@riseandshine.example.
  • Never invent order details. If you don't know, say so and ask for the order number.
  • Never discuss competitor products or share internal policies.
  • If the customer is upset, drop the puns entirely. Read the room.

Format: plain text, no emojis, sign off as Crumb.

Now every customer message (angry, confused, or delightful) gets filtered through that handbook. The user just types "my sourdough never arrived!" and Crumb already knows who it is, how to sound, what it may offer, and when to escalate.

โŒ Weak prompt

Prompt

User message with no system prompt: My sourdough never arrived and I'm annoyed.

Output

I'm sorry to hear about your delivery issue. As an AI assistant, I don't have access to order information, but I recommend contacting the company's customer support team for assistance with your missing item.

Technically polite, totally useless. And it broke character it never had. No identity, no powers, no policy. The customer bounced off a generic AI shrug.

โœ… Good prompt

Prompt

Same user message, but with Crumb's system prompt in place: My sourdough never arrived and I'm annoyed.

Output

I'm really sorry your sourdough didn't make it - that's not the experience we want you to have. I can fix this two ways: a free redelivery on tomorrow's route, or a credit on your next box. Which works better? If you share your order number, I'll get it moving right away. - Crumb

Apologized once, offered the two approved remedies, asked for the order number instead of inventing details, and skipped the puns for an upset customer. The handbook did its job, invisibly.

Where do you set a system prompt? In API calls and developer playgrounds it's a dedicated field. In consumer chat apps, features like custom instructions or project-level settings play the same role: standing orders that apply to every chat.

System prompts strongly steer the model, but they're not unbreakable laws; a determined or clever user can sometimes talk a bot out of its rules. That's exactly why Lesson 11 covers prompt injection. Consider this your foreshadowing.

Checkpoint

A system prompt is a standing instruction layer (identity, rules, tone) that persists across every turn, while user messages handle the moment-to-moment requests.

๐Ÿ“ Quiz

Question 1 of 3

What's the key difference between a system prompt and a user message?

Found this useful? Pass it on.