Lorebooks
Comprehensive guide to creating, importing, managing, and linking Lorebooks to AI characters on Public.
Lorebooks (often called World Info) are standalone collections of lore, setting facts, faction details, magic systems, and reference knowledge that you can link to AI characters. When you chat with a character, relevant entries from the linked lorebook are dynamically retrieved and injected directly into the model's prompt.
Unlike a character's core personality, a lorebook is completely modular: you can link the same lorebook to multiple characters (for example, linking a shared Hogwarts & Wizarding World lorebook to Harry, Hermione, Snape, and Voldemort), or swap lorebooks without altering the character's voice.
Core concepts
To get the most out of lorebooks, it helps to understand how they fit alongside the other roleplay tools on Public:
- Character personality — defines who the character is: their speaking style, backstory, quirks, and behavioral guidelines.
- Chat personas — defines who you are: your name, appearance, and identity in the conversation. See Chat personas.
- Lorebooks — defines the world around you: historical events, factions, locations, spells, technology rules, and relationship lore.
Private vs public lorebooks
| Visibility | Who can link it to a character | Who can edit or delete it |
|---|---|---|
| Private | Only you | Only you (the creator) |
| Public | Any creator on Public can link it when creating or editing their characters | Only you (the creator) |
Only the owner can edit or delete a lorebook. If you delete a lorebook, any characters linked to it safely lose the link without losing their conversation histories or personalities.
How context injection works
When you send a message in a character chat, the backend runs a fast context-assembly pipeline before generating the AI's reply:
1. Scanned text targets
The context engine checks for matching entries across the entire active conversation context:
- The user's latest incoming message
- Recent conversation chat history
- Rolling conversation summary
- Pinned and auto-extracted character memories
- The character's original greeting
2. Entry matching types
Every entry in a lorebook has one of two trigger behaviors:
- Keyword-triggered (
constant: false) — The entry defines a list of keywords (e.g.["gryffindor", "house of the lion"]). If any keyword appears anywhere in the scanned conversation text (case-insensitive substring match), the entry triggers. - Constant (
constant: true) — The entry is always included in every single message exchange, ignoring keywords completely. Ideal for global scenario baselines (e.g., "The year is 1994 and magic is kept secret under the Statute of Secrecy").
3. Priority and budget management
Models have finite prompt context windows. To keep responses fast, coherent, and cost-effective, Public enforces an injection budget:
- Character budget limit: Up to 1,800 characters (
LOREBOOK_INJECT_MAX_CHARS) of lorebook content can be injected per message. - Priority ordering: All matched entries (both constant and keyword-triggered) are sorted by Priority in descending order (
100before50, before0). - Budget fitting: Entries are added one by one starting from the highest priority until the 1,800-character budget is reached. If an entry exceeds the remaining budget, it is omitted (or fitted if it is the first entry).
4. Injection block format
Triggered entries are formatted into a clean block and passed to the character's system prompt:
Relevant world info:
- Universal setting: Magic exists hidden from Muggles under the Statute of Secrecy.
- Gryffindor values bravery, chivalry, and nerve. Founded by Godric Gryffindor; colors are scarlet and gold.
- Combat dueling spells: Expelliarmus disarms opponents; Stupefy stuns with a red jet; Protego shields from hexes.Field specifications and limits
Lorebook metadata
| Field | Type | Required | Limits & Description |
|---|---|---|---|
name | String | Required | Max 120 characters. Name of the world or setting. |
description | String | Optional | Max 500 characters. Short summary of the setting. |
visibility | String | Optional | "private" (default) or "public". Public lorebooks appear in search and discovery. |
tags | Array | Optional | Up to 20 tags. Tags are trimmed and lowercased. |
isNSFW | Boolean | Optional | Default false. Mark true if the lorebook contains mature themes. |
entries | Array | Optional | Up to 100 entries per lorebook. |
Entry metadata
| Field | Type | Required | Limits & Description |
|---|---|---|---|
content | String | Required | Max 1,000 characters. The actual world information text injected into the model. |
constant | Boolean | Optional | Default false. If true, this entry is always active in every message exchange. |
keys | Array | Required if not constant | Up to 20 keys, max 64 characters each. Trigger words or phrases. Ignored if constant: true. |
enabled | Boolean | Optional | Default true. Toggle off to temporarily disable an entry without deleting it. |
priority | Number | Optional | Default 0. Higher numbers inject first when context space is constrained (e.g. 100, 85, 50). |
Supported JSON formats
You can import, paste, and export lorebooks using three standardized formats:
1. Native Public lorebook schema (Recommended)
This is Public's native JSON schema. It supports all fields directly:
{
"name": "Harry Potter: Hogwarts & Wizarding World",
"description": "Comprehensive lorebook covering Hogwarts houses, spells, lore, and magical laws.",
"visibility": "public",
"isNSFW": false,
"tags": [
"harry-potter",
"hogwarts",
"wizarding-world",
"magic",
"spells"
],
"entries": [
{
"keys": [],
"content": "Universal setting: Magic exists hidden from Muggles under the International Statute of Wizarding Secrecy of 1692. Magic is channeled primarily through wands.",
"enabled": true,
"constant": true,
"priority": 100
},
{
"keys": [
"gryffindor",
"godric gryffindor",
"house of the lion"
],
"content": "Gryffindor values bravery, chivalry, and nerve. Founded by Godric Gryffindor; colors are scarlet and gold. Common room is in Gryffindor Tower behind the Fat Lady portrait.",
"enabled": true,
"constant": false,
"priority": 85
},
{
"keys": [
"wand",
"wandlore",
"ollivanders"
],
"content": "The wand chooses the wizard. Wands combine rare woods with magical cores like phoenix feather, dragon heartstring, or unicorn hair. Allegiance shifts upon defeat.",
"enabled": true,
"constant": false,
"priority": 80
},
{
"keys": [
"expelliarmus",
"stupefy",
"protego"
],
"content": "Combat dueling spells: Expelliarmus (disarms opponents), Stupefy (stuns with a red jet), and Protego (creates an invisible shield reflecting minor hexes).",
"enabled": true,
"constant": false,
"priority": 75
}
]
}2. SillyTavern World Info export
The importer automatically detects SillyTavern standalone exports where entries is keyed as an object dictionary:
{
"name": "Wizarding World Info",
"description": "SillyTavern export",
"entries": {
"0": {
"uid": 0,
"key": ["statute of secrecy", "magic"],
"content": "Magic is strictly hidden from Muggles under the Statute of Secrecy.",
"constant": true,
"disable": false,
"order": 100
},
"1": {
"uid": 1,
"key": ["hogwarts", "castle"],
"content": "Hogwarts School of Witchcraft and Wizardry is located in the Scottish Highlands.",
"constant": false,
"disable": false,
"order": 50
}
}
}3. SillyTavern Character Card (character_book)
You can also import character cards (V2 or V3 spec cards) that bundle a character_book object:
{
"spec": "chara_card_v2",
"spec_version": "2.0",
"data": {
"name": "Hermione Granger",
"tags": ["harry-potter", "magic"],
"character_book": {
"name": "Hogwarts Library Lore",
"description": "Magical theory and reference entries",
"entries": [
{
"keys": ["alohomora", "unlocking charm"],
"content": "Alohomora unlocks standard doors and windows.",
"enabled": true,
"constant": false,
"insertion_order": 10
}
]
}
}
}Create and manage lorebooks
On the web
Navigate to /lorebooks in your browser or select Lorebooks from the sidebar menu.
Creating from scratch
- Go to
/lorebooks/create. - Give your lorebook a descriptive Name and optional Description / Tags.
- Choose Private or Public visibility.
- Click Add entry to create rules. Specify trigger keywords or check Always active (constant).
- Click Create lorebook to save.
Importing existing lorebooks
You have two quick ways to load existing world info:
- Import file — Click Import file in the top action bar to upload any
.jsonlorebook or character card file from your computer. - Paste JSON — Click Paste JSON to open the parsing dialog:
- Click Paste from clipboard to pull JSON text copied from another app.
- Click Load example to inspect a pre-filled Hogwarts template.
- Click Parse & Import to populate the form instantly.
Exporting & copying
- On any lorebook creation, edit, or detail screen, click Copy JSON.
- The entire lorebook is serialized into standardized Public JSON and copied directly to your clipboard.
Linking to an AI character
Once your lorebook is created:
- Open
/characters/add(or click Edit on any character you created). - Scroll to the Lorebook (optional) picker.
- Select your lorebook, or choose from popular public lorebooks created by the community.
- Save your character. Any subsequent chats with this character will automatically draw from the lorebook.
Plan limits and unlocking
| Plan | Lorebooks you can create | Entries per lorebook |
|---|---|---|
| Free | 3 | Up to 100 |
| Basic | 10 | Up to 100 |
| Creator / Pro | Unlimited | Up to 100 |
Lorebook creation requires the Character lorebooks unlock (in the same progression tier as custom chat personas). See Subscriptions and Gamification.
Best practices for creators
- Use descriptive, specific keywords: Use names and compound phrases like
["godric gryffindor", "house of the lion"]rather than common short words like["the", "is", "he"]. - Reserve constant entries for universal rules: Keep
constant: trueentries limited to 1–2 baseline rules (e.g. current timeline, core world physics) so they don't consume the entire 1,800-character budget. - Keep entry contents concise: High-impact entries of 1–3 clear sentences allow multiple relevant entries to fit into the context window at once.
- Utilize priority scores: Give fundamental lore higher priority scores (
100–80) and minor decorative facts lower scores (40–10) so the most critical context is guaranteed to inject first.
Frequently asked questions
Why didn't my lorebook entry trigger in chat?
Check the following:
- Is the entry toggled Enabled?
- Did any of the exact keywords appear in the recent chat or latest user prompt? (Matches are case-insensitive substring matches).
- Did higher-priority entries fill the 1,800-character budget first? Try raising the entry's Priority score.
Can I link more than one lorebook to a single character?
Currently, each character can be linked to one lorebook at a time. If you need content from multiple lorebooks, combine their entries into a single lorebook using the Paste JSON or export tools.
What happens if I delete a lorebook?
Characters that had linked that lorebook will simply have their lorebook reference cleared. Their conversations, settings, and memories remain completely intact.
Can I edit a public lorebook created by someone else?
No. Only the original creator can edit a lorebook. If you want to customize a public lorebook, view the lorebook, click Copy JSON, create a new lorebook, and paste the JSON into your own private copy.
Is mobile lorebook management available?
Full lorebook creation and editing is currently available on the Web app. Any lorebooks linked to characters on the web will function automatically in chat across all platforms, including Android and iOS.
Related documentation
- AI characters — build custom characters and link lorebooks
- Chat personas — define who you are in roleplay
- Subscriptions — plan quotas and feature unlocks
- Web overview — web navigation and features