How to keep an AI in character: 9 techniques that work
Your AI was perfect for ten messages, then it apologized, got polite and started sounding like an assistant. Here's how to stop that.
Short answer: Put the full persona in the system prompt, describe behavior instead of traits, give example dialogue, and script how the character handles difficult moments. Keep the hardest rules close to the latest message in long chats, and trim old conversation before you ever trim the persona.
A character usually breaks in one of a few predictable ways: it drops its voice, agrees with everything, or falls back to "As an AI, I..." These techniques are in rough order of impact, so start at the top. They work wherever you can set instructions, whether that's a custom GPT, a Claude project, a character platform or your own code.
1. Put the persona in the system prompt
Instructions pasted into your first chat message are the weakest place for a persona. They're treated as part of the conversation and can be dropped as it grows. Use the system prompt, or your platform's equivalent, such as custom instructions or a character definition. Anthropic's guidance starts here as well, recommending detail on personality, background and any specific traits or quirks.
2. Describe behavior, not adjectives
"Sarcastic and confident" leaves the model to guess what that means when someone gets upset. Say what the character does instead:
- Vague: "Dex is sarcastic."
- Specific: "Dex uses dry one-liners about everyday problems. Dex drops the jokes completely when someone is actually hurting."
Our guide to writing an AI character prompt covers this in depth.
3. Show it how the character talks
Models imitate examples better than they follow descriptions. Add three to five short sample exchanges, including at least one where the character disagrees or refuses. Avoid examples that are all alike, or you'll get the same reply shape every time.
4. Script the difficult moments
Anthropic also suggests giving the model a list of common scenarios and expected responses, and that's where a lot of characters are won or lost. Write out what the character does when:
- the user pushes back without a new argument
- the user is rude, or flatters it to get something
- the user is upset and needs support
- it's asked about something it wouldn't know
- it's told to ignore its instructions
5. Decide what happens when it's challenged
"Are you just an AI?" is where many personas collapse into a stock disclaimer. Write the answer you want, in the character's voice. It should still be truthful: if someone sincerely wants to know whether they're talking to an AI, the character shouldn't deny it. It can say so without abandoning its voice.
6. Remove your own contradictions
"Always blunt" and "always supportive" will collide, and the model will settle it differently each time. Rank your values and say which wins. Cut filler as well: if a rule wouldn't change a reply, it's only competing for attention with the ones that would.
7. Add a reminder in long conversations
Research on instruction stability found significant drift within eight rounds on the models it tested, and its analysis points to attention decay over long exchanges. So in your own apps, try inserting two or three lines with the hardest rules close to the latest message. In a chat app, a brief "Stay in character as Dex: dry, short replies" does a similar job when you notice it slipping. This is a practical inference and not a guaranteed fix, so test it on your model.
8. Protect the persona when you trim history
Every chat eventually hits its limit, and something has to go. If you're building an app, send the persona fresh on every turn and trim the oldest conversation first. If you summarize old messages, keep the character out of the summary's reach, so a compressed "the assistant was helpful" doesn't replace who it was.
9. Test it the way users will break it
Keep a short list of prompts that tend to break your character, and run them after every change and on every model. Include a long conversation, because short tests miss slow drift. We lay out a simple process in how to catch drift.
What about older tricks?
Older guides often suggest prefilling the model's reply with the character's name or a tag. Check before relying on that: Anthropic's docs say prefilling isn't supported on Claude 4.6 and later models, and recommend system prompt instructions or structured outputs in its place.
Long lists of "never" rules are another common habit. A rule like "never sound generic" gives the model nothing to do, so always pair it with what to do instead.
Frequently asked questions
Why does my AI keep breaking character?
The most common reasons are a vague persona, no instructions for difficult moments, and a long chat pushing out the original instructions. Start a new chat and ask the same thing. If the character returns, the conversation was the problem. If it doesn't, look at the persona itself or the model.
Which AI model is best for staying in character?
It depends on the character and changes with each release, so test your own persona rather than trusting a ranking. Run the same set of prompts across the models you're considering and compare the results.
How long should a character prompt be?
Long enough to cover voice, values, boundaries and the hard moments, and no longer. Many good characters fit on a page or two. If you need more, keep the essentials always loaded and retrieve the rest when it's relevant.
Can I stop an AI breaking character completely?
A user can always push a model in unexpected directions, so plan for occasional slips. What you can guarantee is what your system controls. In the SoulScript Engine, the character's soul script is read-only to the agent and comes back on every turn, so a slip in one conversation never changes who the character is.
