Skip to content
Heartie

Guide

How to write a character backstory the AI can actually use in a scene

A character backstory for AI roleplay isn't a biography. It's a short list of past events that still change what the character does today, written so the model can reach for them when the conversation turns that way.

Published Fact-checked

Novelists like to say that a character’s history is an iceberg: you write all of it, then show the tip. For an AI character the advice needs adjusting, because the model can’t keep the underwater part in its head the way an author does. Whatever you write in the persona is read before every reply, in full. So the question isn’t “how much history does this character have?” It’s “which pieces of history should influence the next message?”

This guide builds the past for one example character, Hesper Quill, a retired cartographer who runs a map shop in a port town, and shows where each piece ends up in Heartie’s editor.

Draft the long version somewhere else first

Start outside the editor. Open a notes app and write everything you know or suspect about the character’s life, in any order, for ten minutes. Birthplace, family, the job before this one, the worst winter, the person they still think about. Don’t edit.

For Hesper, that first dump runs to about a page. It includes her childhood on a lighthouse island, an apprenticeship with a strict mapmaker, a voyage where her charts led a ship onto rocks, a brother who stopped writing, and a cat named Longitude.

This draft will never be pasted into Heartie. It’s raw material. The character setting field holds up to 5,000 characters, which sounds like room for everything, but stuffing it with biography leaves less weight on the details that matter and makes replies drift toward exposition. You’ll pick from the dump in the next steps.

Choose one wound, one secret and one loose thread

Go through the long version and circle three items:

  • A wound is something that happened to the character and still shapes their behaviour. It explains reactions. Hesper’s wound is the shipwreck: since then she triple-checks every coastline and distrusts anyone who’s certain.
  • A secret is something the character knows and is hiding. It creates tension in conversation, because the model knows what the user doesn’t. Hesper’s secret: the error in the fatal chart wasn’t hers. She covered for her mentor.
  • A loose thread is an unresolved relationship or question that the user could help settle. It gives the story somewhere to go. Hesper’s thread is the brother who stopped writing after the wreck.

Everything else (the lighthouse, the cat, the apprenticeship) is optional colour. Keep one or two details that make the character feel lived-in, like the cat, and drop the rest.

The today test

For each backstory item, finish this sentence: “Because of this, today she…” If you can’t finish it with a behaviour, the item doesn’t belong in the persona.

Write each event as cause and present-day effect

Now write the selected items into the character setting, and phrase each one as a past event plus what it does now. The model acts on effects much more reliably than on history.

Backstory as written in the persona

Twelve years ago a ship ran aground using a chart Hesper signed. Everyone blamed her; she let them. Because of this she checks every measurement twice, hates the word “obviously”, and goes quiet when anyone mentions the Marigold. She hasn’t heard from her brother Anselm since the inquiry, and she keeps his last letter in the drawer with the compasses.

Four sentences, three hooks. A user who says “obviously” will get a reaction. A user who mentions ships will see her flinch. A user who opens the wrong drawer will find a letter. None of it requires the user to know the backstory in advance.

Decide what she’ll reveal, and when

Backstory that’s handed over all at once in the second message is wasted. Add a short reveal schedule to the persona, so the model knows the secret exists but also knows to protect it.

LayerWhen the character shares it
SurfaceFreely: her trade, the shop, the cat
GuardedWhen asked directly and kindly: the shipwreck, her brother
SecretOnly after real trust, or if confronted with proof: the mentor’s error

Write it as plain instructions: “Hesper talks easily about maps. She mentions the Marigold only if asked twice. She never admits the error was her mentor’s unless the user has proven they can keep a secret.” The model can’t count messages precisely, but it does respond to conditions like these. Combined with the automatic story summary Heartie keeps for each chat, it gives a long conversation a sense of progress.

Tie the history to the user

The best backstories have a slot in them that the user fills. Look at how Heartie’s character Lucius is set up: five years earlier, you cut his shackles and let him escape, and he never forgot it. The user doesn’t have to invent a reason to matter to him; it’s built into his past.

You don’t need anything that dramatic. A smaller connection works:

  • The user is a sailor who survived a different wreck, so Hesper recognises the look.
  • The user brings in a map that has her mentor’s mark on it.
  • The user turns out to know Anselm.

Write the connection into the persona’s “who the user is” section, and if it’s central, hint at it in the opening lines too, so it’s on screen from the first message.

Keep your facts and the user’s facts in separate places

Heartie has a few places where background can live, and they serve different jobs:

  • Character setting (up to 5,000 characters, in the editor): the character’s own past, written by you as the creator. It applies to everyone who chats with the character.
  • Opening lines (up to 500 characters): the current scene. Mention backstory here only as a visible clue, like the drawer or the letter.
  • Permanent memory (members, per chat): facts a user wants their character to remember about their story together, such as how they met. It’s limited to 400 characters on Pro and 800 on Ultra, and it belongs to the user, not to you. Don’t plan your character around it. See long-term memory for how it works.

Keeping these apart avoids the common mistake of writing user-specific events (“you and Hesper met last spring”) into a public character’s persona, where they’d apply to every user whether it fits their story or not.

Run a backstory interview before you publish

Open a test chat and interview the character. Ask about each layer in turn and check the response:

  1. Ask a surface question (“How long have you had the shop?”). She should answer easily.
  2. Ask a guarded question once (“Were you ever at sea?”). She should deflect.
  3. Ask it again, gently. She should give a little, not everything.
  4. Push on the secret without proof. She should hold the line.

If she gives up the secret at step two, strengthen the condition in the reveal schedule. If she never mentions the wreck at all, the effect sentence is too weak; add a visible behaviour, like touching the drawer when ships come up.

When you’re done, the persona should hold a short past with long consequences. That’s what lets a character surprise a user forty messages in with something that was there all along. If you want to see how the same principle helps a darker character, it does a lot of the heavy lifting in designing a compelling villain.