A practical guide to character lorebooks
What lorebooks actually do, why they're more powerful than character cards alone, and how to build one that works.
Apr 30, 2026 · 11 min read
A lorebook is a structured collection of context entries that get injected into your AI conversation only when relevant. The character knows about the dragon caves only when dragons or caves come up. The side character named Patches the bartender appears in the AI's awareness only when the conversation reaches the tavern. Place names, faction histories, magic systems, recurring scenarios, all of it stays in storage until something in the conversation triggers it.
This selective injection is what makes lorebooks dramatically more powerful than just packing everything into a character card. You can build a world with hundreds of detail points without burning context budget on details that aren't currently relevant. Used well, lorebooks are the difference between an AI character that feels embedded in a specific world and one that feels like it's improvising every detail freshly.
This post covers what lorebooks actually do, when they're worth the setup time, and how to build one that produces consistent results.
What a lorebook actually is
A lorebook is a list of entries. Each entry has two parts: a set of trigger keywords and a body of text that contains the context to inject. When any of the trigger keywords appears in the conversation, the entry's body gets pulled into the active context for that response.
The SillyTavern documentation describes lorebooks as functioning "like a dynamic dictionary that only inserts relevant information from World Info entries when keywords associated with the entries are present in the message text." That's the core mechanic. Keyword in the conversation triggers entry injection. No keyword, no injection.
The injection happens silently behind the scenes. You don't see the lorebook entries in the conversation; the AI just suddenly has access to context it didn't have before. If you mention "the Crimson Waste" in your message, the lorebook entry for the Crimson Waste gets added to the context the model sees, so the AI's response can reflect knowledge of that region. If the next message doesn't mention the Crimson Waste, that entry doesn't get injected, and the context budget is freed up for whatever else is relevant.
The structure looks something like this for a single entry:
Trigger keywords: dragon, dragons, wyrm, drake Entry body: "Dragons in this world are extinct from the south but persist in the northern peaks. They speak the old language but understand the common tongue. They view humans as cattle but make exceptions for those who know their true names. The last dragon seen in human territory was Veshagor the Black, who passed over Mossford in winter of the previous year."
When the conversation mentions a dragon, that whole entry gets fed into the context. The AI now knows the worldbuilding for dragons in your setting and can respond in a way consistent with it.
Why lorebooks beat packing the character card
Most consumer AI companion apps don't expose lorebooks. They have you put everything into the character description: personality, appearance, backstory, world details, all of it crammed into one document that gets included in every single response.
This works fine for simple characters in generic settings. It falls apart fast when you're trying to run something more elaborate, for two reasons.
The first is context budget. The character description gets included with every message. If you've packed a 3000-token document about your fantasy world into the character description, that's 3000 tokens of context every single message that's mostly irrelevant to whatever you're currently discussing. You're paying for it in working memory either way.
The second is attention. Even if context budget weren't a concern, the lost-in-the-middle effect means that buried detail in a long character description gets weighted less than information at the edges of the context. A character description full of worldbuilding tends to bury the personality details that should be doing the actual work of shaping how the AI responds.
Lorebooks solve both problems. World details only get injected when relevant, freeing budget for everything else. The character description stays focused on what it does best, which is anchoring personality and core relationships. Each piece sits in the layer where it works best.
The tradeoff is setup time. Building a lorebook takes more upfront effort than writing a character card. The payoff is dramatically better consistency over time, especially in long-form roleplay or worldbuilding. Power users on SillyTavern almost universally use lorebooks for any character running in a developed setting.
What goes in a lorebook
The clearest way to think about lorebook content is that it should be context-dependent rather than always-on. Anything that's only relevant in some conversations belongs in the lorebook. Anything that should always be present belongs in the character description.
Places. Each major location in your setting gets an entry. Trigger keywords are the place name and obvious associations. The body covers what the place looks like, who lives there, why it matters, what's distinctive about it. Mossford the town gets an entry. The Crimson Waste gets an entry. The Tavern of the Three-Eyed Crow gets an entry.
Side characters. Anyone who isn't the main character but might come up. Trigger keywords are the character's name and obvious aliases. The body covers their personality, their relationship to other characters, their distinguishing features. Patches the bartender, Magister Voll the magic teacher, Aldric the rival who lost his arm to a wyrm three winters ago.
Factions and groups. Religious orders, guilds, political factions, family lineages. Trigger keywords include the faction name, common shorthand, and key members or symbols. The Order of the Pale Dawn, the Glassblowers Guild, House Voren.
Magic, technology, or world rules. The systems that define how your setting works. Trigger keywords are the system names and common related terms. The casting system in your magic. The technological constraints in your sci-fi. The political rules that govern who can rule what.
Recurring scenarios or situations. Common situations that come up in your stories. Tavern scenes, court scenes, dungeon explorations, romantic encounters. Each gets entries that fire when the scenario starts.
Items of significance. Magic swords, plot-relevant artifacts, family heirlooms. Trigger keywords are the item name and obvious descriptors.
The pattern across all these is the same. Specific enough that the trigger keywords have meaning. Detailed enough that the entry body actually adds context the AI can use. Constrained enough that the entry doesn't try to do the job of the character description.
Designing trigger keywords that actually work
The keyword system is where lorebooks succeed or fail. Good keywords trigger entries when they should and don't trigger them when they shouldn't. Bad keywords either miss obvious triggers or fire constantly on irrelevant context.
A few principles that help:
Use multiple keywords per entry. The World Info Encyclopedia suggests including the primary name plus common variations and obvious shorthand. For a town called Mossford, keywords like "Mossford, town, moss" cover most ways people might reference the place.
Avoid overly common keywords for specific entries. If your dragon entry uses just "dragon" as a keyword and the character regularly speaks metaphorically about dragons, the entry will fire constantly on metaphors. Either make the keyword more specific (combining "dragon" with a name like "Veshagor") or accept the cost of frequent firing.
Use keyword combinations when single keywords are too broad. Some lorebook systems support requiring multiple keywords to trigger an entry, which lets you use common words without firing on every casual mention. "Magic + casting" can trigger only when both appear, distinguishing actual magic-system discussion from generic mentions of magic.
Test your triggers in practice. Most lorebook environments let you see which entries fired for a given response. Check that the right entries are firing and the wrong ones aren't. Adjust keywords based on what you observe.
How long entries should be
The economy of lorebooks rewards short, dense entries. Every token in an entry body is a token of context budget that gets spent when that entry fires. A 500-token entry on a frequently-firing keyword is expensive across a long conversation.
Aim for entries that pack information densely. Strip filler. Use sentence fragments where they convey meaning efficiently. Use formatting like brackets or pipes if your lorebook environment supports them, since structured formatting often communicates more in fewer tokens than prose paragraphs.
For most entries, 100 to 250 tokens is a reasonable target. Important world systems or central characters can run longer when warranted. The entries that grow large are usually the ones doing too much, trying to capture every detail when only the essential ones need to fire on triggers.
The character description and the lorebook should also be working together rather than duplicating each other. If the character description establishes the magic system at a high level, the lorebook entries on specific magical practices can reference that foundation without restating it. Avoid redundancy across layers; let each layer do its job.
Lorebooks in consumer AI companion apps
SillyTavern is the main environment where lorebooks are mainstream and exposed to the user as a first-class feature. Power users running self-hosted or API-based AI companion setups almost universally use lorebooks for serious worldbuilding.
Among consumer apps, support varies. Character.AI has a feature called definitions that functions similarly to lorebook entries. Kindroid's Codex is structured to allow some lorebook-like organization, though it's less granular than dedicated systems. Most other consumer companion apps don't expose anything resembling lorebooks; they expect everything to live in the character description.
The trend over time is moving toward better support for structured world context across the consumer category. As memory architectures evolve, the systems that platforms run for retrieval are essentially doing automated versions of what lorebooks do manually. Users on platforms with good vector retrieval are sometimes getting lorebook-like behavior without explicit lorebook controls, just because the retrieval is surfacing relevant chunks of past conversation.
For users who want the control that explicit lorebooks provide, SillyTavern remains the best environment. The setup cost is real, but for serious roleplay or worldbuilding, the consistency is worth the time.
Practical workflow
Building a lorebook from scratch can feel daunting. The pattern that works for most people is to start small and grow it organically.
Begin with the character description focused tight on the character. Personality, appearance, communication style, core relationships. Don't try to put the world in here yet.
Run conversations and notice what context is missing. The AI improvises a tavern scene. You realize you wanted that tavern to have a specific feel. Add a lorebook entry for the tavern with appropriate triggers.
Keep adding entries as scenarios come up. Each entry gets created in response to a real moment of friction in the AI's responses, where you wanted specific context that wasn't available.
Refine triggers over time. Watch which entries fire when. Adjust keywords if entries are firing too often or not often enough.
Periodically audit the lorebook. As entries accumulate, some become outdated or redundant. A periodic cleanup keeps the lorebook from bloating with stale content.
This iterative approach produces lorebooks that match your actual usage patterns. Building a lorebook in advance based on speculation about what you might need almost always creates entries that never fire and misses entries that would have been useful. Reactive building works better.
Frequently asked
Do I need a lorebook for casual AI companion use?
No. Lorebooks are most valuable for ongoing roleplay or worldbuilding scenarios. For casual conversation with an AI companion, the character description is usually enough.
Can I share lorebooks across different characters?
Yes, in environments that support it. SillyTavern allows global lorebooks that apply to all characters and character-specific lorebooks that only fire when that character is active. The pattern is useful when you have multiple characters in a shared world.
What happens when a lorebook entry doesn't fire?
The information just isn't in the AI's context for that response. The entry isn't lost; it's just not relevant to what's currently being discussed. Next time the trigger keywords appear, the entry fires normally.
How many entries can a lorebook have?
Most lorebook environments don't impose hard limits, but practical limits come from context budget. A lorebook with hundreds of entries is fine if only a few fire per response. The constraint is how much fires at once, not how much is in storage.
Can I import lorebooks from other people?
Yes, in most environments. SillyTavern, Character.AI, and similar platforms support importing lorebooks from shared community libraries. Some lorebooks for popular settings (Genshin Impact, specific anime universes, established fantasy worlds) are widely shared.
Are lorebooks the same as memory?
No. Memory in AI companion apps usually refers to information about the user and the relationship that's preserved across sessions. Lorebooks store information about the world, side characters, scenarios, and rules. The two layers serve different purposes and work differently.
Do bigger context windows make lorebooks unnecessary?
Less so than you'd think. Even with massive context windows, the lost-in-the-middle effect means that information buried in a giant character description gets weighted less than selectively-injected lorebook entries. The case for lorebooks is partly about budget and partly about attention. Bigger windows help the budget side; the attention argument stays valid regardless.
Will lorebook support get better in consumer AI apps?
Probably yes, gradually. The trend in the category is toward more structured context management, and lorebook-like features are a natural extension. Consumer apps will likely converge on either explicit lorebook UIs or sophisticated automated retrieval that serves a similar purpose.