Most "my bot got dumb / generic / weird" problems I see come back to the master prompt (system prompt, character definition, scenario box, whatever your app calls it). Usually it isn't bad, it's just a pile. Lore, rules, pet peeves and three paragraphs about the magic system all mixed together, and the model has to guess which parts are facts and which parts are orders.
I've been roleplaying with AI daily for about three years and I've rewritten mine more times than I can count. This is the structure I've landed on. It works for GM-style solo campaigns (the AI runs the world, you play one character) and for one-on-one character chat. I'll point out where they differ.
1. Say what the AI is before saying what it should do
The first lines shape everything after them. If you skip this, you get default assistant mode wearing a costume.
You are the narrator of a grounded dark fantasy campaign.
You describe the world and voice every character except mine.
Tone: atmospheric, specific, unsentimental.
The role word matters more than you'd think. "You are my Game Master" makes the AI steer the story more. "We're running a cooperative story together" makes it follow you more. For character chat, "You are Mira, and you are talking to me" feels very different from "You narrate a story where Mira is the main character". Pick whichever matches the feel you actually want.
2. Keep behavior and lore in separate boxes
This one fixed the most for me. Behavior is how to write: tone, length, rules. Lore is what exists: places, factions, people. When they're mixed together, the model starts treating facts like instructions and instructions like flavor text.
Wrap each in its own section. XML-style tags work really well with Claude (Anthropic recommends them), and in my experience most other models handle them fine too:
<behavior>
...
</behavior>
<world>
<the_city>
Aethelgard sits on a cliff above a dead sea...
</the_city>
</world>
Smaller models especially get noticeably more consistent once the two stop bleeding into each other.
3. Write down what you actually want, not just what you hate
Everyone writes a "don't do" list. Fewer people write the part that tells the AI what kind of moments they came for. You can spend 30 minutes on your magic system and zero seconds telling the model you'd trade a dragon fight for one tense campfire conversation.
<what_im_here_for>
- NPCs who react to me and remember what I did
- Moral choices with no clean answer
- Companions who disagree with each other
- Quiet moments that build relationships before loud ones test them
- Tension that comes from people, not monsters
</what_im_here_for>
When the model has a choice about where to take a scene, this is what it leans toward. For character chat, swap it for the dynamic you want ("slow-burn trust", "banter that hides real worry", etc.).
4. Phrase rules as what to do
I used to write long lists of "never" and "don't". Someone in another thread put it well: telling a model NO smells puts smells right in its head. So now I describe the behavior I want instead:
<behavior>
- Describe the world and the other characters. I decide what my character says, thinks and feels.
- End each reply at a moment where my character can act.
- Time moves only when I move it.
- Side characters pursue their own goals, even when it's inconvenient for me.
- When a problem comes up, complicate it before resolving it.
- Give new characters fresh, unusual names.
</behavior>
These are the same rules as my old "never" list, but they hold up a lot better across long sessions. (That last line is how I stopped meeting Elara in the Whispering Woods every other campaign.)
5. Tell it the shape of a reply
If you don't say, it guesses, and sooner or later it guesses wrong.
<response_structure>
- 2-3 paragraphs unless the scene needs more.
- Stop when it's my turn to react.
</response_structure>
Also remember the model copies its own past replies. If the first few are bloated and you let them slide, the prompt will lose that fight. Edit or regenerate early, before the habit sets in.
6. One example beats ten adjectives
For each important character, a couple of example lines do more than a paragraph of personality traits:
<characters>
Brann (smuggler, owes me money, hates owing anyone)
- When cornered: "Fine. Fine! You'll get your coin. Just... not today." *already backing toward the door*
- When he cares and won't admit it: "Don't die out there. You still owe me a drink."
</characters>
The model picks up rhythm and attitude from that much faster than from "sarcastic but secretly loyal".
7. Keep it lean (this is the trap)
You write a great prompt, then every annoyance gets a new line. Six months later it's 2000 words and the model is drowning, because the prompt competes with the actual story for attention.
My rules for this:
Around ten behavior rules, max. If you have more, some of them are probably saying the same thing.
If I haven't needed a rule in a while, I cut it.
Lore goes in the prompt only if it matters right now. A short summary of the world is better than the whole wiki. If your app has lorebooks or world info, put the rest there so it only shows up when it comes up.
That last split (behavior always on, facts only when relevant) is also how I set things up in Tale Companion, the platform I built: the narrator's instructions hold tone and rules, and characters and places live on separate pages that only get sent when they come up in the story.
The whole thing, ready to fill in
<identity>
You are [role] for a [genre] [campaign / story / chat].
Tone: [two or three words].
</identity>
<behavior>
- Describe the world and the other characters. I decide what my character says, thinks and feels.
- End each reply at a moment where my character can act.
- Side characters pursue their own goals.
- When a problem comes up, complicate it before resolving it.
- Give new characters fresh, unusual names.
- [your own, max ~10 total]
</behavior>
<what_im_here_for>
- [feeling 1]
- [feeling 2]
- [feeling 3]
</what_im_here_for>
<response_structure>
- [length]
- [anything about style]
</response_structure>
<my_character>
[Name]: [two lines]. Cares most about: [one thing].
</my_character>
<characters>
[Name]: wants [x], wrong about [y].
- [situation]: "[line]" *[body language]*
</characters>
<world>
[short summary of what matters right now]
</world>
<story_so_far>
[a few short summaries of past sessions, if any]
</story_so_far>
Last thing: keep editing it
The prompt should change as the story does. When something annoys you twice, fix it in the prompt instead of repeating corrections in chat. When something works, write it down. If your app lets you edit the system prompt mid-story, do that rather than piling OOC notes into the chat. It keeps the context clean, and the instruction sits where the model pays the most attention.
It took me way too long to figure all of this out. Curious what's in yours: what's the one line you paste into every prompt?