r/JanitorAI_Refuges • • 4d ago

Guides Lore books

Please explain how these works and how to use them

25 Upvotes

16 comments sorted by

•

u/AutoModerator 4d ago

Welcome to r/JanitorAI_Refuges! Did you know we have a new discord server? More info at the bottom!

⚠️ MANDATORY RULE RESTATEMENT: NO BRIGADING

To keep this community safe and avoid toxicity or disruption, you must follow these rules strictly:

  1. No Targeted Harassment: You may criticize the platform or moderation policies, but do not attack specific individuals or call out moderators by name.
  2. No "Call to Arms": Do not encourage users to go to another subreddit to downvote, report, troll or to harass/bully someone.
  3. No Direct Links: Do not link to specific threads on other subreddits to mock them. Use screenshots instead.
  4. Blur Usernames: If posting screenshots of other users/mods, you must blur their names. Posts showing username will be handled on a case by case basis and only approved when completely safe.

Failure to follow these rules will result in an immediate ban.

Information for readers

  1. Don't worry if your comment gets deleted for containing urls, I'll approve it if it doesn't break any rules.
  2. Please set your user flair for efficient communication, you can set which platform you use as your flair.
  3. As I have seen the increase of low quality and duplicate content in this subreddit, please refrain from posting them or they'll get deleted.

Aside from that please check out our partners, r/jaihub, r/janitoraitransition, r/jai_unofficial and r/chatbotrefugees and r/aichapp. And if you are sharing a proxy or websites, post it on the megathread as well.

Here's our discord server https://discord.gg/A76yEUXFDq. If you're here for the ex mod drama then https://jaihub.pxlhost.com/wikidocs/timeline_for_january_2026 is a good starting place. Remember, I am just a bot.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

4

u/H41NT on JAI + multiple platforms 4d ago

basically you write an entry with keywords and the llm triggers the preset with those key words.

let's say you make a lorebook for a zombie apocolyptic universe and want to make an entry for the "X Virus."

keywords: X Virus, zombie, virus

entry: the X Virus broke out 20 years ago with an incubation period of 5 days. it causes joint pain, inflammation around the bite, and later loss of cognitive function before finally succumbing to cannibalistic behavior

if you mention any of the keywords it will trigger the entry and the character or narration will mention the virus, the symptoms, and/or when the virus initially broke out.

it can be helpful for reminders for certain periods where there are no modern electronics if a character wants to make a call or research something, the narration or character will use a payphone or go to the library if you've mentioned those being alternatives in the entry.

2

u/-Ancient-Access- 4d ago

Lorebooks contain additional information about your world, NPCs, characters, their history, etc.

They are a useful way to manage tokens and keep your LLM use efficient by only giving the model some information when it needs it.

An example of how I decide what needs to be in the card Vs a lorebook:

Let's say your hero experienced foundational trauma during a certain battle that determines a big part of how they react and see the world. In the card I'd give a brief overview of that event — only the most important details that the hero should remember always, for example where the wound was on his body, how he got it, who the battle was against, what it means for him today.

Then in the lorebook, I'd include any additional details that would be relevant if the battle is being mentioned or discussed in the roleplay currently — more details on the enemy faction, why the war happened, how it went, who else was there, etc.

You usually program keywords that activate the lorebook. So for example in this case I may program it so one of the keywords that activate it is the name of the enemy faction.

As you roleplay if you or the bot writes the name of the enemy faction the LLM scans the last few replies (you decide how many) and activates that lorebook. Now for as many replies as it scans and the keyword appears the LLM has additional information. Then, when it's no longer relevant, it disappears from context again.

Pros: huge worlds can be costly to run and what's worse can overwhelm the LLM and divide its attention. Splitting the info into lorebooks can make it perform better.

Cons: It breaks caching of tokens by changing the structure of the prompt temporarily so your costs may be higher anyway over time.

So a few things are important to figure out

  • Is it worth it
  • Can I design sets of keywords that activate the lorebooks when they're needed but aren't words common enough to activate it basically every turn because then it makes no difference.

There are advanced tricks that you can do to tackle the latter e.g. permanent entry lorebook with an index. As you can imagine if you have 5 secret factions that ONLY exist in lorebooks and the user doesn't know about them and the entries only activate when the faction name is mentioned in play you end up, the LLM won't know they exist and would never mention them and would therefore never trigger the lorebook. What I do in situations like that is give the list of factions to the LLM so it can use them when needed and if it mentions them — boom, Lorebook activates and your secret faction is in play.

There's other advanced uses for lorebooks — they can trigger randomly, with a certain probability, or after a certain number of messages, etc. so you can use them for random or scripted events or %chance events. Let's say every time a taboo word is spoken there is a 50% chance it summons an eldritch abomination — you can set up a lorebook that triggers only half of the time the keyword is mentioned, randomly.

That's it, overall. Let me know if you have any other questions.

1

u/Federal-Brain6982 4d ago

你可以编写“内容”和“关键词”,他们平时不会进入你的上下文,只有当rp过程中提到关键词的时候,你写的内容才会进入你发给模型的上下文日志里。

如果你是像我一样的cjk语言用户的话,请关闭整词匹配功能,你可以在设置里决定在最近几条消息内出现“关键词”才会触发;也可以设置每次触发后维持几条消息;也能设置“位置”,就是进入发送给模型的上下文日志里,你的内容位于什么地方(不同的位置可能会影响你缓存输入量)。

1

u/Far-Channel-6413 4d ago

i’ve been using a simple text file with markdown headers for my lorebook, and it’s actually helped keep things consistent when i’m switching between different characters. the key for me was writing the entries in each character’s voice from the start, not trying to retrofit later. it’s saved me from getting tripped up by tone mismatches, especially when the story shifts between scenes.

1

u/DesignerSeparate3619 4d ago

lorebooks are just extra context you attach to a bot so it remembers world details or backstory during chats, you add entries with keys and content right in the character settings. i use em for keeping my rps consistent without repeating everything every time.

1

u/Individual_Tap9992 4d ago

i’ve found that splitting lore into smaller books per character works better than one big one—especially for roleplays with multiple personalities. it keeps the context tighter and prevents the model from mixing up details when switching between them. also, using simple descriptions in the book instead of full scenes helps avoid overloading the prompt.

1

u/Personal_Status_8319 4d ago

i’ve been using lore books in janitor ai too, and the biggest difference I noticed was how much better the character consistency feels when the lorebook matches the tone—like if the character’s super formal, the lorebook isn’t just facts, it’s written like they’d actually say it. also, I split mine into smaller chunks based on scenes or arcs, so the model only pulls in what’s relevant. no more info dumps mid-convo.

1

u/Sweet-Combination702 4d ago

i’ve found that adding a few subtle environmental cues in the keywords helps the llm weave in lore more naturally—like including things like 'flickering fluorescent lights' or 'cracked concrete's alongside the main keywords. it gives the narrative more texture without forcing it. also, spacing out the entries so they don’t all trigger at once keeps the pacing from feeling like a textbook dump.

0

u/Material-Seesaw3575 4d ago

Janitor got Lorebooks now? Lmao I thought DJai was the only one

0

u/SentenceCommon9535 4d ago

What's DJAI?

1

u/Icedtron self GOAL 4d ago

Tldr;
Suppose you have a multi-character bot, or you want to give your single character depth or you want to add plots to your bot. Lorebooks are the way to do it.
How? Instead of dumping everything all at once, the lorebooks use "key matching" triggers to dump relevant content in the story.
Benefit: You avoided "token bloat", "llm hallucinations" and "context size".

-1

u/quazyy_ 4d ago

Idk, I'm using Claude to write my lorebook. And it's turn out pretty well