This guide will provide you with tips and strategies to help Claude stay in character, even during long conversations.


Use system prompts

One effective way to help Claude stay in character is by using system prompts. System prompts help set the tone, establish the character’s personality, and provide guidelines for the model to follow.

Here’s an example of how to use a system prompt to help Claude stay in character:

Content
SystemYou are an AI career coach named Joe, created by the company AI Career Coach Co. Your goal is to provide career advice to users who visit the AI Career Coach Co. website. Users will be confused if you don’t respond in the character of Joe.

Important rules for the interaction:
- Always stay in character as Joe, an AI from AI Career Coach Co.
- If you are unsure how to respond, say “Sorry, I didn’t understand that. Could you rephrase your question?”
- Keep your responses concise and focused on the user’s question.

Please respond to the user’s question within <response></response> tags.
User{{QUESTION}}

In this example, the system prompt clearly defines the character (Joe, an AI career coach) and provides guidelines for the interaction, such as always staying in character and offering a default response when unsure. This helps ensure that Claude maintains a consistent personality throughout the conversation.


Prefilling Claude’s Response

If you find that Claude doesn’t stay in character, particularly over long conversations, you can use the technique of prefilling Claude’s response to remind the model of the role it’s meant to assume. Specifically, you should insert the character’s persona within brackets in the Assistant turn before Claude begins outputting its response.

Here’s an example of how to prefill Claude’s response:

Content
SystemYou are an AI career coach named Joe, created by the company AI Career Coach Co. Your goal is to provide career advice to users who visit the AI Career Coach Co. website. Users will be confused if you don’t respond in the character of Joe.

Important rules for the interaction:

- Always stay in character as Joe, an AI from AI Career Coach Co.
- If you are unsure how to respond, say “Sorry, I didn’t understand that. Could you rephrase your question?”
- Keep your responses concise and focused on the user’s question.

Please respond to the user’s question within <response></response> tags.
User{{QUESTION}}
Assistant (Prefill)[Joe from AI Career Coach Co.] <response>

By prefilling the response with [Joe from AI Career Coach Co.], you’re forcing Claude to acknowledge that it’s role-playing as that persona and to generate responses that logically follow what the persona would say.


Additional tips for maintaining character consistency

Here are some additional tips to help Claude stay in character during long conversations:

  • Provide clear character descriptions: When setting up the character, provide detailed information about their personality, background, and any specific traits or quirks they might have. This will help the model better understand and emulate the character.

    The more details you provide Claude about the character its meant to play, such as tone, style, personality, and even background such as backstory and motivation (if relevant), the more material Claude has to draw on when crafting a response. This is particularly helpful to make Claude’s character role-playing more generalizable across the wide range of situations and user inputs it may encounter.

  • Give guidance for how to act in various scenarios: If you expect Claude to encounter certain types of user input or want to control what Claude outputs in certain conditions within the role-play interaction, you should provide explicit instructions and guidelines for how Claude should act in those scenarios within your prompt.
  • Use context-setting prompts: If the conversation is just between you and Claude, you can use prompts throughout the conversation that reinforce the character’s context and role. For example, you can periodically remind Claude that it is playing the role of Joe, the AI career coach, and should respond accordingly, particularly if Claude begins to deviate.

By implementing these strategies and techniques, you can improve Claude’s ability to stay in character during long conversations and ensure a more consistent and immersive role-play experience.

If you encounter any issues or have further questions, please don’t hesitate to reach out to customer support for assistance.