# Lorebook

### Overview!

Think of a **Lorebook** as your character’s *world memory*.

Your character’s description (persona) can only hold a limited information — just the basics about who they are and what they do. \
\
A **Lorebook** is where you can store much more — details about the world they live in, other characters, events, items, or special rules that shape your story.

Instead of cramming everything into the character’s profile, you can keep all that extra information safely inside a Lorebook.

\
Then, when you chat, the system automatically brings up only the **relevant parts** at the right time.So your character always remembers what’s important — without getting confused or running out of space.

### 🧩 How it Works

* A Lorebook is made up of **entries** (think of them like statements of information).
* Each entry has two main parts:
  1. **Keywords** — triggers that tell the system to load the entry’s content into the chat context.
  2. **Content** — the facts or story that should be added to chat context when those keywords appear.

<figure><img src="https://3060264960-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZHNBN3T5KDxoXWSU7L3d%2Fuploads%2F1S9zwLPgkeubXw2RjwHo%2FScreenshot%202025-10-30%20at%206.17.55%E2%80%AFPM.png?alt=media&#x26;token=3b9b0e81-604a-44dd-90ab-924a7cd15b68" alt="" width="563"><figcaption></figcaption></figure>

* When any of the keywords show up in the **last 4 messages** (both {user} and {char}), that entry’s content is added to the chat’s **context and** used to generate a new response.
* It stays active for about **2 turns** (user message and the AI’s next one). If the keyword keeps coming up, it stays active longer.
* The system limits how much lore can load at once so that the whole context memory is not consumed by the lore — about **20%** of the total context memory.
  * Around **740 tokens** for Free users.
  * Around **1600 tokens** for True Supporters.
  * Around **3,080 tokens** for I’m All In users.

### ✏️ Creating a Lorebook

1. Go to the **main menu** and click **Create → Lorebook.**
2. You’ll see a new Lorebook page. Fill out these parts:
   * **Name:** What your Lorebook is called (for you to recognize it).
   * **Description:** A short summary (this doesn’t affect chat).
   * **Cover Image:** Pick or generate an image that fits your world.
   * **Tags:** Add relevant tags.

<figure><img src="https://3060264960-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZHNBN3T5KDxoXWSU7L3d%2Fuploads%2FoqXgFyEMqLSdjwd3Y8ML%2FScreenshot%202025-10-30%20at%206.10.23%E2%80%AFPM.png?alt=media&#x26;token=5fd65519-1288-4772-bf19-cad202e88519" alt="" width="563"><figcaption></figcaption></figure>

1. Click **Add Entry** to start building your Lorebook.
2. You can have up to **5,000 entries** in one Lorebook.

(coming soon) You'll also be able to **import** Lorebooks from other platform&#x73;*.*\
Just upload them in **.JSON** format — they’ll appear in the editor and can be edited right away.

### 📜 Adding Entries

Each entry is one piece of information — such as a character, place, event, or rule.

**Here’s what you’ll fill in:**

* **Name:** A label for your entry.&#x20;
* **Keywords:**
  * Add words or phrases that will “wake up” this entry.
  * Type one, then press **Enter** to save it.
  * You can add several keywords for one entry.
  * Keep them specific — like names or key terms.
  * If two entries share a keyword, both will be added when that word appears in chat.
* **Content:**
  * Write the info that should be added to context.
  * Keep it clear and simple — 2–5 sentences are usually perfect.
  * Maximum: **1,000 characters per entry.**

**Example:**

<figure><img src="https://3060264960-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZHNBN3T5KDxoXWSU7L3d%2Fuploads%2FdBOkyGUmaPO5YWIZ5yif%2FScreenshot%202025-10-30%20at%206.12.38%E2%80%AFPM.png?alt=media&#x26;token=b59a1565-1dca-44f8-8a6d-0d628c3bc93f" alt="" width="563"><figcaption></figcaption></figure>

If You or the Character mention “café” in chat, that bit of information will be added to the chat context, generating a response based on that info.&#x20;

### Keyword Matching

#### Prefix and Suffix

You can use a `*` symbol (called a wildcard) to match parts of a word.\
This helps trigger lore when the keyword appears as part of a bigger word.

**Examples:**

* `*book` → will match “storybook,” “notebook,” “logbook”
* `home*` → will match “homeland,” “homework,” “homemade”

#### Recursive Entries

Lore entries can’t trigger each other.\
That means if one entry mentions another keyword, it won’t cause more lore to load.\
Only the actual chat messages are checked for keyword matches — not the content inside other entries.

#### Multiple Words

Keywords can include more than one word, but the full phrase has to match exactly.

**Example:**

* The keyword `coffee shop` will only match when **coffee shop** appears together in chat — not if the words are separated.

#### Shared Keywords

If two or more entries share the same keyword, they’ll all be added to the context when that keyword appears in chat.

#### Using {{user}} and {{char}}

You can also use `{{user}}` and `{{char}}` as keywords.\
These automatically match whenever the user’s name or the character’s name is mentioned in chat.\
It’s a handy way to add background information when someone refers to the user or the character directly.

### 🔗 Attaching a Lorebook to a Character

1. Open your **Character Editor**.
2. Scroll to the **Advanced** section.
3. Under **Lorebook**, click **Attach Lorebook.**
4. Pick one from your list and hit **Save.**

Once attached:

* The Lorebook connects to that character’s all chats.
* You can **Edit** or **Remove** it anytime.
* **Only one Lorebook** can be attached to a character.
* Any changes you make to the Lorebook apply to existing chats as well — no need to reattach.

<figure><img src="https://3060264960-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZHNBN3T5KDxoXWSU7L3d%2Fuploads%2FjBc2Ij9jf3Mf4Yh7UdoT%2FScreenshot%202025-10-30%20at%206.28.57%E2%80%AFPM.png?alt=media&#x26;token=8cfd35a0-b267-4013-85a1-248cc89de2c1" alt=""><figcaption></figcaption></figure>

### 💡 Tips for Better Results

✅ **One topic per entry.**\
Each entry should focus on one thing — one character, place, rule, or event.

✅ **Be specific with keywords.**\
Use specific names or titles — not general words like “world” or “magic.”

✅ **Keep content short and factual.**\
Don’t write full stories in one entry — just what’s needed for the AI to stay accurate.

### ❓FAQ

**Q: Can I use more than one Lorebook per character?**\
A: Not right now — one per character.

**Q: Can I add Lorebooks to public characters?**\
A: No, right now Lorebooks are only supported for private characters

**Q: Can I share my Lorebook with others?**\
A: Not yet. Public and shared Lorebooks are planned for a future update.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.spicychat.ai/product-guides/lorebook.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
