AI lorebooks explained: keywords, scenes and story rules
What a lorebook (World Info) is, why it saves tokens compared with a giant system prompt, and how keywords, insertion order and probability drive relationships, open worlds and story beats.
Verification
- Test environment
- Unknown
- Tested on
- Unknown
- Last updated
- 2026-11-20
A good character card is usually prompt + lorebook. The system prompt sets the character's core identity; the lorebook (called World Info in SillyTavern) stores extra background, such as places, events, relationships and game rules, that the app inserts only when it becomes relevant.
Why use one
The system prompt is sent on every turn, and the context window is finite. Stuffing a whole world into it raises token costs and can confuse the model with too much mixed information. Keyword-triggered lorebook entries add material only when needed, which keeps prompts smaller. Activated entries still consume tokens, and their effect depends on the platform.
How entries work
Lorebook features look much the same across platforms (SillyTavern, AstrBot and others). An entry has trigger keywords and content. When a message from the user, or from the character, contains a keyword, the content is added to the prompt. For example, if the user says something like "one person can't change anything", an entry can add the character's reassuring reply ("It's okay. If everyone were like us, the world would surely get better.").
Two common settings:
- Insertion order affects how the model weighs the entry; put the most important, helpful entries where the platform gives them priority. Platforms interpret the number differently, so don't assume smaller always means more important.
- Activation probability is handy for games, e.g. a 20% chance of finding an item on an adventure.
Three ways to use a lorebook
- Relationship rules: keep an affinity module in the system prompt and let entries detect what the user or character says to adjust it, rather than leaving the model to tally points on its own.
- An open world: set the scene in the prompt, then add location triggers ("outside", "school", a city name) whose content describes each place:
When {{user}} feels better, the character may take them somewhere peaceful:
Forgotten Library: a wooden bookshop under a huge banyan tree. Painful memories written on paper and slipped into the hollow become falling leaves.
Tidal Coast: the waves feel almost physically soothing; translucent shells hold other people's luck and dreams.
Starlight Plain: flowers that bloom only at night, glowing like a galaxy on the ground.
- Story beats: for fan role-play, recognizable lines can trigger your own summary of the relevant scene, improving continuity without expecting the model to know the source work.
See the SillyTavern World Info documentation for one detailed implementation.
Adapted from the XMLans blog: AI Lorebooks Explained: Keywords, Scenes, and Story Rules (Chinese original: AI写卡指南:世界书是什么?).
Sources
- AI写卡指南:世界书是什么?(星梦博客)www
.xmlans .com (opens in a new tab) · checked 2026-11-20 - AI Lorebooks Explained: Keywords, Scenes, and Story Rules (XMLans blog)en
.xmlans .com (opens in a new tab) · checked 2026-11-20