A lorebook is a set of notes you write about your story world, which a roleplay chatbot pulls into the conversation only when the chat mentions them. It is the most reliable way to stop a bot from forgetting your kingdom’s name, your character’s old rival or the rule that magic costs blood. We compare AI companion and roleplay platforms at Virtualship, and lorebook support is one of the features that separates a bot that holds a world together from one that improvises a new one every session.
This guide explains what a lorebook is, how triggers decide what the bot sees, how to write entries that work, why they sometimes fail, and what to keep out of them.
TL;DR
- A lorebook stores facts you write. The bot reads an entry only when a trigger word in the recent chat matches it.
- Memory is different: it keeps selected facts from your conversation, while a lorebook holds canon you authored in advance.
- Short entries with specific trigger words beat long essays. One idea per entry, a few keywords each.
- If lore is ignored, check the triggers, the entry length, and whether the platform has a limit on how much lore it injects.
- Treat a lorebook as stored text on someone else’s service: leave out real names, addresses and anything you would not want to see again.
Table of Contents
- What a lorebook actually is
- How triggers decide what the bot says
- How to build a lorebook that holds together
- Lorebook ideas by genre
- Why the bot ignores your lore, and how to fix it
- Limits you should plan around
- Privacy: what to put in a lorebook
- Picking a platform for lorebook roleplay
- A starter lorebook you can build in 20 minutes
- FAQ
- Sources
What a lorebook actually is
Think of a lorebook as an index of cards. Each card has two parts: the keywords that make it relevant, and the text the bot should know when those words come up. Write a card for “Silvergate” that says it is a port city ruled by a council of smugglers, and the bot receives that text when you or the bot say “Silvergate”. When nobody mentions it, the card stays out of the way and costs you nothing.

That last point is the reason lorebooks exist. A chatbot can only read a limited amount of text at once, called the context window. If you want the basics of that limit, our explainer on what a long context window actually is covers it in plain terms. Everything you want the bot to know has to fit inside that window, along with the chat so far. A lorebook lets you keep hundreds of facts on file and spend window space only on the ones the current scene needs.
Lorebook, memory and character description
Three things get confused:
- Character description: who the bot is. It is usually loaded every time.
- Memory: facts the platform keeps from your conversation. One independent guide describes memory as retaining selected conversation facts, and a lorebook as retrieving authored world information when triggered. It also notes that memory summaries can lose nuance, merge events or leave things out, and that how memory works varies by product.
- Lorebook: world canon that you wrote, retrieved on demand.
The practical rule that follows: put what was always true in the lorebook, and let memory handle what happened during play. We unpack the same split in context window versus memory.
How triggers decide what the bot says
Every entry has keys. The platform scans recent messages for them. When one matches, the entry’s text is added to what the model reads for its next reply. Different platforms change the details, but the pattern is common:
- You send a message mentioning a keyword.
- The system checks the last few messages for any entry keys.
- Matching entries are inserted into the prompt, usually up to a size limit.
- The bot replies with that text in view.
The scanning range matters. Some tools search only the last couple of messages by default, as this guide to one popular roleplay interface explains. If the keyword was last used ten messages ago, the entry is no longer in play, and the bot may drift. Your fix is to work the keyword into a message, or to mark a few critical entries as always on, where the platform offers that.
Two consequences for how you write:
- Keys must be words that really appear in play. If your entry is keyed to “Order of the Ashen Veil” but everyone says “the Veil”, add “Veil” as a key.
- The text is read, the keys are not. The bot never sees your keyword list, so the entry itself must name the thing it describes.
How to build a lorebook that holds together
This is the part that decides whether your story feels coherent in session thirty. For a deeper look at designing the world itself, see our guide to worldbuilding for AI roleplay.
Step 1: List what the bot must never get wrong
Start with the facts that break immersion when they slip: names, relationships, the rules of magic or technology, the geography you travel through, and the tone of the setting. If you can’t picture the bot contradicting it, it doesn’t need an entry yet.
Step 2: One entry, one idea
Split your world into small cards: one person, one place, one faction, one rule. A single entry called “The Kingdom” that contains politics, history, food and religion triggers on every mention of anything and fills the window with text the scene doesn’t need.
A good entry is two to five sentences. Write it as plain statements, in the present tense, in the voice of fact:
Keys: Silvergate, the port, harbor council Entry: Silvergate is a walled port city on the southern coast. A council of five smuggler captains governs it. Outsiders must pay a harbor tithe or be refused entry. The city is cold and foggy year round.
That is about forty words, and it gives the bot a place, a ruler, a rule and a mood.
Step 3: Choose keys the way players talk
Give each entry three to six keywords: the formal name, the nickname, a common misspelling and one related term. Avoid very common words such as “king” or “night” as the only key, because they fire constantly and crowd out better entries.
Step 4: Separate canon from events
Stable canon goes in the lorebook: “Mira is afraid of deep water.” Events that become true during play, such as “Mira and the player crossed the strait together,” belong in memory or in a short running summary you update. Mixing the two means you’ll constantly edit your lorebook and eventually contradict yourself.
This habit also helps with consistency in companion chats generally. Our piece on five memory details that keep chats consistent applies the same logic to ongoing relationships.

Step 5: Keep a style and boundary entry
One entry for how the story should read (pacing, point of view, level of detail) is worth the space. If you want hard limits on content, our guide to locking roleplay boundaries in AI chat explains how to place those instructions so they persist.
Step 6: Test with a short scene
Open a fresh chat, mention each keyword once, and ask the bot a direct in-world question: “Who runs Silvergate?” If it answers correctly, the entry fires. If not, adjust the keys before you write more lore.
Lorebook ideas by genre
The same structure works across story types, with different cards on top.
| Genre | Entries that earn their place |
|---|---|
| Fantasy | Factions, magic rules and costs, regional customs, named artifacts |
| Sci-fi | Ship systems, technology limits, political blocs, ship crew roster |
| Slice-of-life or romance | Shared history, routines, favorite places, pet names, boundaries |
| Mystery | Timeline of known facts, suspect profiles, what each character knows |
| Historical | Era details, social rules, vocabulary to use or avoid |
For evolving stories, add a “current situation” card and rewrite it every few sessions. That small habit keeps a long arc steady better than adding more background. The same principle applies in other persistent worlds: writers who track established fictional details, as in keeping story details straight in a long-running game, find that a short reference beats rereading everything.
Why the bot ignores your lore, and how to fix it
When lore doesn’t show up, the cause is usually one of five things.
- The trigger never fired. The keyword wasn’t in the scanned messages. Mention it, add synonyms, or mark the entry as always active if the platform allows.
- The entry is too long. Large entries use up the window and may be cut or skipped when the platform caps lore. Trim to the facts that change what the bot says.
- Too many entries fired at once. Platforms that limit lore size drop the overflow. Narrow your keys so fewer cards compete.
- Two entries contradict each other. The bot will pick one, or blend them. Search your lorebook for repeated claims and keep one version.
- The wording is vague. “Mira is a bit of a loner” gives little to work with. “Mira avoids crowds and answers questions in one sentence” changes the next reply.
If the bot knew the lore and then lost it later in a long chat, that is a context problem rather than a lorebook problem. Our notes on what gets forgotten under memory limits show how it plays out on one popular platform, and the same pattern appears on others, as in our write-ups of the Janitor AI memory limit and the Talkie AI memory limit.
Limits you should plan around
Lorebooks are powerful, not unlimited.
- They share the window. Lore that gets injected takes space from the chat history, so a huge lorebook can crowd out recent conversation.
- They depend on triggers. The bot only knows what the keywords bring in. A fact with no matching key effectively doesn’t exist for that reply.
- They vary by platform. Entry counts, size caps, scan range, and whether lorebooks exist at all differ from one service to the next. Check the platform’s help pages before you invest hours in a big world.
- They steer, they don’t command. A model usually follows lore closely, but it can still blur a detail, especially in long or fast-moving scenes. Short, direct entries lower that risk.
When you are choosing a platform, ask what it offers for worldbuilding, how much lore it can hold, and how it handles memory. Those questions matter more for story-driven roleplay than for casual chat.
Privacy: what to put in a lorebook
A lorebook is text you save on a service. Some platforms let you keep it private, and some let you publish it for other users. Read the platform’s privacy settings before you write anything personal, and check whether a lorebook is visible to others once it is shared.
A safe approach for companion and romance roleplay:
- Use invented names and places instead of real ones.
- Leave out your address, workplace, phone number, financial details and health information.
- Describe emotional preferences and story history, not identifying facts about you or other real people.
- Keep your intimate or sensitive scenarios in private entries if the platform has them, and don’t publish those.
Our privacy checks for desktop AI companions go through the questions worth asking about any companion app.
Picking a platform for lorebook roleplay
If lorebooks are central to how you play, the platform’s feature list matters as much as the characters. We review AI companion and roleplay platforms on customization, memory, personalization, roleplay and NSFW options, privacy, and messaging, voice, video and image features, so you can compare them side by side. Our AI companion platform comparison is the place to start, and our best AI roleplay chatbots for romance and friendship page goes further into tailored recommendations for romance, friendship and roleplay.

If you want a wider field, our tested list of AI roleplay platforms covers 21 picks, and our comparisons are updated regularly so you are not choosing from last year’s feature list.
A starter lorebook you can build in 20 minutes
To put it together, write these ten cards and stop:
- The main setting (place, mood, era)
- Your own character (traits, goals, one fear)
- The bot character (traits, speech style, one secret)
- Two supporting characters
- The central faction or institution
- One rule of the world (magic, technology or social law)
- A shared history card (how your characters met)
- A current situation card
- A tone and style card
- A boundaries card
Play five or six scenes, note which entries never fired and which the bot misused, then revise those. A small tested lorebook beats a sprawling one you never verified.
FAQ
Do lorebooks work the same on every roleplay chatbot?
No. The idea is shared, but entry limits, trigger options, scan range and sharing rules differ by platform. Some services don’t offer lorebooks at all and rely on character descriptions and memory. Check the platform’s help pages before building something large.
What is the difference between a lorebook and memory?
A lorebook holds facts you wrote in advance and inserts them when keywords appear. Memory keeps facts the platform pulls from your conversation. Use the lorebook for stable canon and memory for what happens during play.
How long should a lorebook entry be?
Two to five sentences is a good range for most entries. Short entries are easier for the bot to follow, use less of the context window, and leave room for other entries to trigger in the same scene.
Why isn’t my lorebook entry triggering?
Usually the keyword isn’t in the recent messages the platform scans, or the entry is too long or competing with others. Add the nickname people actually use as a key, trim the text, and mention the keyword in your next message to test it.
Is it safe to put personal details in a lorebook?
Treat it as stored text on a third-party service. Use invented names, leave out identifying and financial details, and check whether your lorebook can be seen by other users before you save anything sensitive.
Sources
- Context Window vs Memory vs Lorebook for Consistent AI Roleplay
- SillyTavern Lorebooks: How World Info Works



