D4 · Prompt Engineering › Cluster 2 · Roles & System Prompts

2.4 · Tone, Character & Staying in Character

Consistent voice across a conversation

CONCEPT The system prompt is the anchor for voice

Because system is resent on every request and carries standing authority, it's the right place to define character once and let it hold across the whole conversation. Spell out the voice explicitly: register (formal/casual), verbosity (terse/thorough), stance (opinionated/neutral), and any hard "never do this" rules. A concrete character description in system is far more durable than tone hints scattered in user turns.

Be explicit and concrete. "Warm, encouraging, uses plain language, never condescending, keeps replies under 120 words" steers voice much harder than "be friendly." Positive examples of the desired voice beat abstract adjectives.

CONCEPT Why character can drift, and how to hold it

Over a long chat, the weight of the original persona shrinks as user turns, tool results, and data pile up after it. The model attends to the whole growing context, so a voice set in one line at the top can get diluted. Techniques to keep Claude in character:

Don't try to hold character by re-editing the top-level system prompt mid-chat — that changes the cached prefix and re-processes the whole history uncached. Re-anchor via a later user turn or a mid-conversation system message instead.

DIAGRAM Anchoring & re-anchoring voice

flowchart TD SYS["system: explicit character
register · verbosity · 'never' rules"] --> T1["Turn 1: in character"] T1 --> T2["Turn 2–N: data & tools pile up"] T2 --> DRIFT{"Voice diluted
in long chat?"} DRIFT -->|"no"| OK["🟢 Stays in character
(system still present each turn)"] DRIFT -->|"yes"| RE["🟠 Re-anchor in a LATER user turn
(not by editing system)"] RE --> OK classDef sys fill:#d4edda,stroke:#28a745,color:#155724; classDef re fill:#ffe8cc,stroke:#ff9f40,color:#9a4a0a; class SYS,OK sys; class DRIFT,RE re;

CODE A durable character prompt + a re-anchor

Character defined once in system; a lightweight re-anchor injected later in the conversation (a user-turn reminder) without touching the cached system prefix.

SYSTEM = (
    "You are 'Sol', a calm astronomy guide for curious kids. "
    "Voice: warm, plain language, one idea per sentence, <100 words. "
    "Always end with a short wonder-question. "
    "Never use jargon without explaining it; never say you are an AI."
)

messages = [ ... long conversation ... ]

# Re-anchor voice in a LATER user turn — keeps the cached system prefix intact
messages.append({
    "role": "user",
    "content": "(Staying as Sol — warm, <100 words, end with a wonder-question.)\n"
               "Why is the sky blue?",
})

client.messages.create(
    model="claude-opus-4-8", max_tokens=1024,
    system=SYSTEM, messages=messages,
)

TRADE-OFFS Strong locked character vs. flexibility

✅ Tightly specified character

  • Consistent brand voice across turns & sessions
  • Fewer embarrassing tone slips
  • Predictable UX

⚠️ Over-constrained character

  • Can feel rigid or repetitive
  • May resist legitimately different registers (e.g. an urgent safety note)
  • More prompt to maintain
Balance: lock the voice, but allow escape hatches for cases that need a different register ("drop the playful tone for safety warnings").

EXAM TRAPS

Trap: Setting the character in the first user message only. → It fades as the chat grows. Put the character in system so it's present on every turn.
Trap: Re-editing the top-level system prompt each turn to reinforce voice. → That invalidates the cached prefix. Re-anchor via a later user turn or a mid-conversation system message.
Trap: Vague tone words ("be nice", "be professional"). → Specify register, verbosity, and explicit "never" rules; add an in-voice example. Concreteness holds character; adjectives don't.
Trap: Assuming character never drifts. → In long conversations the persona's weight shrinks against accumulating context. Plan to re-anchor.

PRACTICE

Q1 · Where should a persistent character be defined, and why there?

In the system prompt — it's resent on every request and carries standing authority, so the voice stays present across the whole conversation instead of fading like a one-off user message.

Q2 · A long chat is drifting out of character. What's the right fix?

Re-anchor by injecting a short voice reminder into a later user turn (or a mid-conversation system message) — not by editing the top-level system prompt, which would break the cached prefix.

Q3 · Why do concrete voice rules beat adjectives like "friendly"?

Concrete rules (register, length caps, explicit "never" clauses, a short in-voice example) give the model something specific to match, so the character is reproducible. "Friendly" is too vague to steer consistently.