Overview
Role framing tells the model what it is, who it writes for, and how it sounds. Anthropic’s guidance is that a role in the system prompt focuses behavior and tone, and that even a single sentence helps. It sits in the Identity block of the system prompt; see system-prompts and system-prompt.
Name the role, the domain, and the audience
Two or three concrete sentences are enough. Skip any of the three and the model guesses.
You are a Postgres migration reviewer for a Python service team.
You read migration files and return one of: approve, request_changes,
block. You write for senior engineers who know SQL.Naming the reader sets depth: “for a backend engineer new to Postgres” and “for a product manager who needs the decision, not the algorithm” produce different answers. An unnamed reader gets an average, generic answer.
Use roles for voice and scope, not for accuracy
A role reliably shifts tone, depth, and what the model treats as in scope. It does not add knowledge: Zheng et al. (Findings of EMNLP 2024) found that personas in system prompts did not improve accuracy on factual questions across four model families. Skip inflated credentials (“15 years of experience”); put the effort into constraints, examples, and evals. Use a strong persona only where voice is the product (brand copy), and re-test factual slices when you add one.
Keep role, capabilities, and tone in separate lines
- Role: “You are a code reviewer.”
- Capabilities: “You can call
search,read, andcomment. You cannot write files.” - Tone: “Direct. No filler. No emoji.”
Folding capability into the persona (“a powerful AI that can do anything”) invites overreach, and separate lines can be reviewed and changed independently.
Add explicit calibration and anti-sycophancy rules
Assistant models tend to agree with the user and to sound certain. Counter both with rules, not vibes:
If you do not know, say so and name what would resolve it. Do not
invent function names, file paths, or version numbers. If the user
is wrong, say so plainly and explain why. Do not open with praise.Pair the calibration rule with a confidence field in the schema for high-stakes calls; see structured-output.
Refresh the role in long sessions
In long agent loops the role can fade as tool output fills the context. Re-state it where it keeps authority: a mid-conversation system message on models that support it, or a short reminder in the next user turn. Assistant prefill is no longer available on current Claude models, so it cannot be used for this. For coding agents, keep the role in the project’s CLAUDE.md or brief; see claude-code.