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.
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:
- Reinforce in
system, not by nagging. Keep the character definition in the system prompt where it stays present every turn — don't rely on a single early user message. - Use consistent framing. Refer to the persona the same way throughout; don't switch between "the tutor" and "the assistant."
- Re-anchor long conversations. For very long chats, re-inject the key voice reminders into a later user turn (or a mid-conversation operator instruction), rather than editing the top-level system prompt (which would break caching).
- Give a few in-voice examples. One or two short exemplars of the character speaking lock the register better than adjectives (this is the few-shot idea, expanded in Cluster 3).
- Name what breaks character. Explicit "don't" rules ("never break the fourth wall", "never mention you are an AI unless asked") prevent common slips.
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
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
EXAM TRAPS
system so it's present on every turn.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.