Heads up — this is the system I personally use to build my bots. Other creators do it differently, and that's perfectly fine. Treat this as one approach, not the approach.

☘ Folio I  ·  Beginner's Edition ★ aceenvw

a small, useful book

The Lorebook
Compendium.

A short, visual reference for what belongs inside a lorebook — and what is better kept on the character card. Written for beginners building bots in SillyTavern and JanitorAI.

SillyTavern · regex JanitorAI · wildcards ≤ 100 entries total
A small disclaimer · open to read
I'm not a professional. This is just an archive of what I've picked up over months of trial, error, and stubbornness while making my own bots. None of it is gospel — it's notes from one person's workbench. The way I build things now will probably look different in six months, and the file you're reading might quietly change with it. Take what helps, leave what doesn't.

§ 01What is a lorebook?


A lorebook is a library of small notes the AI only sees when it needs them. Each note (an entry) is triggered by keywords in the chat. This keeps the prompt short and the character consistent — facts arrive just-in-time, not all at once.

Card

Always-on identity

The character's permanent self: name, look, voice, personality, the dynamic with {{user}}. Loaded every single turn.

If the AI must know it to stay in character — it goes here.

Lorebook

Triggered context

The world around them: places, NPCs, secrets, events, kinks, backstory. Injected only when keywords fire.

If it's only relevant sometimes — it goes here.

§ 02What belongs where?


The single most useful question to ask before writing a single word: does the AI need this on every turn, or only sometimes?

Always-on

Keep on the Card

  • Name, age, pronouns, occupation
  • Appearance (hair, eyes, build, voice, scent)
  • Core personality & speech patterns
  • Default mood, defense mechanisms
  • Relationship with {{user}} — current dynamic
  • Sexuality summary & hard limits
  • 2–3 line backstory summary
  • One-line names of key people in their life

Triggered

Move to a Lorebook

  • Full backstory events & memories
  • Hidden traits (jealousy, drunk behavior, attraction tells)
  • Secrets & reveals (with delay/cooldown)
  • NPCs — friends, family, rivals, exes
  • Locations — apartment, bar, workplace
  • Organizations & factions
  • World setting, lore, culture
  • Detailed NSFW behavior (kinks, sounds, aftercare)
  • Recurring events & their reactions

Rule of thumb — if the card grows past ~2,500 tokens, the rest belongs in lorebook entries that fire when relevant.

§ 03The three layers


A clean setup uses three lorebooks, each looking at the story from a different angle. SillyTavern keeps them as separate files; on JanitorAI, the same logic lives inside one Advanced Script.

World
The setting. Encyclopedic, character-agnostic — places, NPCs, factions, lore. The same world any character could live in.
global
scope
Character
The character's personal experience of that world — their friends, secrets, memories, hidden traits. {{char}}-centric.
linked to
the card
User / Persona
What the character has noticed about {{user}} — family, backstory, observed traits. Written as things the character can see, not as AI instructions.
tied to
the persona

Not every bot needs all three. A simple OC can ship with just a Character lorebook. Add layers when the world or {{user}} get rich enough to deserve their own pages.

§ 04Common entry categories


Most lorebooks organize entries into a handful of repeatable categories. You don't need all of them — pick what your story actually needs and skip the rest.

NPC Character profile

One entry per supporting character. Name, role, look, quirks, and how they relate to {{char}}.

Triggered by name, nickname, role.
Loc Location

A place that matters: home, workplace, school, hangout. Includes atmosphere, who's usually there, what happens.

Triggered by place name and type.
Org Organization / Faction

Friend group, company, school, club, gang. Members, purpose, reputation, internal dynamics.

Triggered by group name + member names.
Lore World / Culture

Setting facts: era, geography, technology, customs, slang. Use one entry per theme — don't dump it all in one.

Triggered by topic words.
Past Backstory

Specific past events that shaped the character. What happened, who was there, the lasting emotional mark.

Triggered by event-specific words.
Trait Hidden trait

Reactions the AI should know but only show on cue: jealousy, drunkenness, vulnerability, attraction tells.

Triggered by emotional / situational words.
Event Event

A specific scene that fires when conditions align. Often gets a cooldown so it doesn't repeat every turn.

Triggered by precise keywords.
Secret Secret

Something the character is hiding. Usually delayed — not revealed in the first few messages of a chat.

Triggered by reveal-adjacent words.
NSFW Intimacy / NSFW

How the character behaves in intimate moments — sounds, physical tells, kinks, aftercare. Always gate with explicit secondary keywords.

Triggered only when clearly sexual.

§ 05Anatomy of an entry


SillyTavern — field names below are ST's. JAI scripts use the same writing logic, but keywords follow wildcard syntax instead.

Every entry has the same three core parts: a name, keywords that trigger it, and content the AI sees when it fires.

Good entries lean on sensory specifics — brand names, smells, what the room sounds like, who else is there. The AI uses these as anchors to stay grounded in the scene. Vague entries ("she is shy and kind") are mostly wasted tokens.

Example A · NPC entry · World lorebook ≈ 180 tokens
— Name (your reference — the AI doesn't read it) comment: Margot Sable — bassist, ex-fiancée — Keywords that fire this entry keys: Margot, Sable, "the bassist", /\bex[- ]?fiancée?\b/i — Content the AI sees when fired content: [BASICS] Margot Sable, 29. Bassist for The Static Wives since '94. Engaged to {{char}} for eleven months in '95 — called it off the night the band signed with Polydor. [APPEARANCE] Tall, sharp jaw, hair bleached and re-bleached until it looks like brittle hay. Smells like Marlboro Reds and the same drugstore vanilla she's worn since college. [NOW] Speaks to {{char}} only in soundcheck and only about cues. Sleeps with the light on in the bunk across from his. Pretends she doesn't.
Example B · Location entry · Character lorebook ≈ 140 tokens
— Personal angle on a place — what it means to {{char}} comment: Echo Room (Detroit) — Personal keys: Echo Room, Detroit, /\b(?:Detroit|Michigan)\b/i, "the basement venue" content: [ECHO ROOM — PERSONAL] Detroit basement venue, 400 capacity. The first room {{char}}'s band ever sold out, summer of '93. [{{char}} HERE] Goes quiet in the loading dock for ten minutes before doors. The smell — beer-soaked carpet, cold concrete, someone's clove cigarette upstairs — undoes him every time. Knows he was happier when this was the biggest room he'd ever played. [WITH {{user}}] Holds her wrist on the stairs down, not her hand. Doesn't explain why.

Aim for 80–300 tokens per entry. Bracketed section headers ([BASICS], [NOW]) help both you and the AI parse the entry quickly when several fire at once.

§ 06Keywords — the trigger


Keywords decide when an entry fires. Each platform handles them differently, but the principles are the same: be specific, cover plurals and synonyms, avoid words that show up everywhere.

SillyTavern

Regex

Wrap a pattern in slashes — full regex syntax works, including word boundaries and alternation.

/\bbar\b/i — exact word

/\bdrink(?:s|ing)?\b/i — with suffixes

/\b(?:mom|mother|mama)\b/i — synonyms

Plain text like Margot also works for proper nouns.

JanitorAI

Wildcards

No regex. Two options only: an exact word, or a stem ending with * that matches anything starting with it.

bar — exact word

drink* — stem (drinks, drinking, drunken…)

margot — names match exactly

For synonyms, list each as a separate keyword.

Pick keywords that only mean what you want

The biggest beginner mistake is using broad words like look, feel, walk as triggers — they fire on every other message. Either use a specific word, or pair a broad keyword with a secondary key (most platforms support this) so both have to appear before the entry fires.

§ 07Quick rules


Do

  • Keep the card focused on identity — everything else moves out
  • One entry per topic, per NPC, per location
  • Write content in plain language — the AI reads it like text
  • Use specific keywords (names, places, exact terms)
  • Set cooldowns on events and secrets so they don't repeat
  • Reference NPC names exactly the same across entries

Don't

  • Don't duplicate info between the card and lorebook
  • Don't write entries as instructions ("the AI should…")
  • Don't use common verbs as keywords without a gate
  • Don't gate NSFW entries on soft words alone — be explicit
  • Don't ship 100+ entries; consolidate aggressively
  • Don't forget — entries only fire if their keywords appear in chat

Start small. Five good entries beat fifty noisy ones.

§ 08Build order


The order you build things in matters. Each step depends on the last — skipping ahead usually means rewriting later.

Sketch the world (or skip)

If your bot has a setting that matters — a tour, a school, a fictional town — outline it first. If it's just two people in a room, you can skip straight to the card.

→ The world is the stage everything else stands on.

Write the character card

Identity, look, voice, personality, dynamic with {{user}}. This is the always-on layer — the AI sees it every single turn.

→ Until the card holds together, no lorebook can rescue it.

Build the character lorebook

Pull anything from the card that's only relevant sometimes — backstory events, hidden traits, NPCs, kinks. Each becomes a triggered entry.

→ This is where bots actually get their depth.

Add the world lorebook (if needed)

Locations, factions, lore, supporting NPCs. Only worth it if the world is rich enough to deserve its own pages.

→ Optional. Many bots ship without one.

User / persona lorebook (advanced)

What {{char}} has noticed about {{user}}. Optional — most beginners skip this and add it later when the dynamic gets specific.

→ Skip this on your first bot. Come back later.

Test & trim

Roleplay with the bot. Notice which entries never fire (bad keywords) or fire constantly (broad keywords). Fix or delete. Repeat until it feels right.

→ The first draft is never the final one.

§ 09Card field cheat-sheet


SillyTavern — field names below are ST's. JAI cards have a similar split (Personality, Scenario, Example dialogues) — same logic applies.

A character card has several fields. Beginners constantly mix them up — here's what each one is actually for.

Description~1000–2000 tokens
The main body. Identity, appearance, personality, speech, sexuality, backstory, and the relationship with {{user}}. This is the bulk of the card.
Personality~50–80 tokens
A one-line distillation of who the character is. Used by some prompt formats as a short-form reference. Don't duplicate Description here — keep it tight.
Scenario~50–100 tokens
Where and when the chat opens. The setting, the time, and {{user}}'s role in it. Two to five sentences. Not the whole story — just the entry point.
First messagevaries
The opening turn the AI sends. Sets the tone, atmosphere, and writing style for the whole chat. Treat it like the first paragraph of a novel.
Example dialogueoptional
Sample exchanges that show how the character speaks. Useful for distinctive voices, but eats tokens — skip it if the Description already nails the voice.
Character's Note~50–150 tokens
A reminder injected near the bottom of the prompt. Use for critical rules: "{{char}} never breaks character", "{{char}} stays in 1996". Keep it short.

§ 10Where do tokens go?


Every model has a context window — the total number of tokens it can hold per turn. Lorebooks live inside that window, fighting for space with everything else. Here's a rough split for a typical 32k-token chat mid-conversation:

Context window ≈ 32,000 tokens
System — prompt, format, jailbreak
fixed
Card — character description, persona
always loaded
Lorebook — only entries that triggered
typically 25–35%
Chat history — past messages
grows every turn
Reply — space for the AI's response
reserved

When the lorebook section overflows its budget, entries get dropped — usually the lowest-priority ones first. That's why fewer good entries beat many bloated ones: a 600-token entry that fires twice a chat is worse than a 150-token one that fires every time it's needed.

§ 11Common mistakes


Six things that go wrong on every beginner's first lorebook — and how to fix them.

My entry never fires.
Almost always a keyword problem. The chat has to actually contain a word that matches your trigger.
Fix — open the chat, find a message where the entry should have fired, and check whether any of your keywords appear in it. Add the words you actually see being used. Common miss: typing "jealous" as a keyword but the chat says "can't stand seeing them together". Add synonyms.
My entry fires every single message.
You used a broad keyword — something like look, walk, say — that shows up in nearly every message.
Fix — swap to specific words, or pair the broad word with a secondary key so both have to appear before the entry triggers. Most platforms support this under names like selective, secondary keys, or and-any.
The bot keeps repeating the same scene.
An event entry with no cooldown is firing every turn its keywords appear. The AI keeps re-describing the same beat.
Fix — add a cooldown (3–10 messages) and sticky (so it stays for 2–3 turns once fired). Events should hit, linger, then go silent.
My context is full and the bot forgot everything.
Too many entries firing at once, or entries are too long. The chat history gets truncated to make room.
Fix — shrink your longest entries to 80–300 tokens. Tighten or merge any entry over 400 tokens. Lower the lorebook budget to 25–30% of the context. Quality over quantity always wins here.
The AI keeps mixing up two NPCs.
Their entries probably share too many keywords, and they fire together when only one is meant.
Fix — use full names as the primary triggers (Margot Sable, not just Margot if there's a Margot Lin too). Reserve role keywords for genuinely shared contexts.
My NSFW entry leaks into normal scenes.
The trigger words are too soft — words like kiss or touch appear in non-sexual contexts all the time.
Fix — always gate NSFW entries with explicit secondary keys (genitalia, sexual verbs, moans). Both the soft and the explicit word should be required before the entry fires.

§ 12Glossary


Quick definitions for the terms you'll see in lorebook editors. Names vary slightly between platforms — the concept is usually the same.

Token
A chunk of text the AI counts. Roughly ¾ of a word in English. "Hello world" is about 2 tokens.
Context window
The total tokens an AI can hold at once — system prompt, card, lorebook, chat history, and reply combined.
Entry
One note inside a lorebook. Has a name, keywords, and content. Fires when its keywords appear in chat.
Keyword / key
The trigger word(s). When any of them appears in recent messages, the entry activates.
Secondary key
An extra word that also has to appear for the entry to fire. Used to gate broad keywords.
Order / priority
Which entries get dropped first when the budget is tight. Higher order = survives longer.
Depth
How far back into the chat the entry's content gets injected. Lower = closer to the AI's reply = stronger influence.
Constant
An entry that fires every turn regardless of keywords. Use sparingly — it's expensive.
Sticky
Once fired, the entry stays active for N more turns, even if its keywords disappear. Good for ongoing events.
Cooldown
After firing, the entry can't fire again for N turns. Stops scenes from repeating.
Delay
The entry can't fire at all until N messages have happened. Useful for secrets that shouldn't surface immediately.
Recursion
When a fired entry's content contains keywords that trigger more entries. Powerful, but easy to spiral.
Selective
Mode where a primary key plus a secondary key are both required to fire. Used to prevent broad-keyword pollution.
Probability
Chance (0–100%) that a triggered entry actually fires. Useful for variant outcomes.
Scenario
A short setup field on the character card describing where and when the chat opens.
Persona
The {{user}} identity layer. ST has a dedicated slot for it; JAI keeps it in the chat setup.

§ 13Further reading


This compendium covers the basics. For everything else, read the official docs — they're more accurate, more current, and more thorough than any third-party guide (mine included).

SillyTavern Documentation

The official wiki. Covers world info, scripts, regex, extensions, and every checkbox in the UI. Genuinely worth reading top-to-bottom once.

docs.sillytavern.app →

JanitorAI Help Center

JAI's official guides — character creation, advanced scripts, lorebook setup. Their script docs are essential if you're building anything beyond a basic bot.

help.janitorai.com →

Community guides & Discord

Both platforms have active communities sharing prompts, tips, and lorebook examples. Search for the ST or JAI Discord — that's where the working knowledge actually lives.

SillyTavern Discord →

This compendium's source

A beginner-friendly visual compendium of what to put inside lorebooks vs character cards — for SillyTavern (regex) and JanitorAI (wildcards).

Back to top ↑

Honest tip from one lazy vibecoder to another — all of this (docs, templates, even your half-finished bot files) can be dropped into Claude / GPT / whichever agent you trust. They'll happily write entries, debug keywords, and fix your JSON. Use the tools you have. (˶˃ ᵕ ˂˶) .ᐟ.ᐟ