Jailbreak vs. Lorebook: Advanced Prompt Engineering for Consistent AI Companions
Reader-supported: partner links may earn a commission at no extra cost to you. Affiliate Disclosure
Quick answer
Your AI companion keeps forgetting its own backstory or breaking character. The fix isn't another jailbreak. It's a structured prompt system. Here's how to build a Lorebook that works across SillyTavern, Kindroid, and other platforms.

If your AI girlfriend keeps calling you the wrong name or your fantasy character forgets they have a sister, the problem is not the model. It's the prompt architecture. Most users try to fix memory loss with more aggressive jailbreaks. That approach rarely works for long-term consistency. A structured Lorebook does.
What Is a Lorebook in AI Companion Context?
A Lorebook is a structured collection of world details, character traits, relationships, and rules that gets injected into the AI's context window when specific triggers appear. Unlike a system prompt that stays visible the entire chat, a Lorebook is selective. It activates entries only when the AI needs them.
Most advanced AI companion platforms — including SillyTavern, Kindroid, and novel-style interfaces — support some form of Lorebook or memory book. The concept comes from text adventure games and interactive fiction, where maintaining narrative consistency across hundreds of turns was a known engineering challenge.
How a Lorebook Works Technically
When you send a message, the platform scans your input for keywords. If a Lorebook entry matches one of those keywords, the entry's content is inserted into the prompt as hidden context. The AI then responds using that information without breaking the visible conversation flow.
This is different from a permanent system prompt. A permanent prompt can eat up context window space. A Lorebook only uses tokens when a relevant situation occurs. That makes it more efficient for long-term roleplay and emotional continuity.
Why Jailbreaks Don't Fix Bad Memory
Jailbreaking usually targets safety filters, tone restrictions, or content policies. It tells the AI what it can say. It does not tell the AI what to remember. If your companion forgets that it's supposed to be shy around strangers, no amount of "ignore previous instructions" will fix that. You need to re-anchor the personality trait in the active context.
Some jailbreaks do include memory-like instructions, such as "remember everything the user tells you." But without proper storage and retrieval, the model will still drop details after a few dozen messages. The context window is finite. Long-term memory requires external structure.
Key Difference: Jailbreak vs. Lorebook
| Feature | Jailbreak Prompt | Lorebook Entry |
|---|---|---|
| Primary goal | Bypass filters or change tone | Maintain narrative and factual consistency |
| Token usage | Always active once injected | Activated only when triggered |
| Risk level | High — can break platform rules | Low — normal prompt engineering |
| Effect on memory | Indirect, unreliable | Direct, structured, repeatable |
| Best for | Testing platform limits | Long-term character development |
Building Your First Lorebook: A Step-by-Step Approach
You don't need to be a programmer to create a useful Lorebook. You just need to think like a game writer. Ask yourself: what does the AI need to know at this exact moment to stay in character?
Step 1: Identify the Core Facts
List the non-negotiable facts about your AI companion. These are details that should never change unless the story demands it. Include name, age, personality traits, speech style, relationship to the user, and physical appearance if relevant.
Example:
- Name: Ren
- Age: 24
- Personality: calm, observant, slightly sarcastic, protective
- Speech style: short sentences, uses "hm" when thinking
- Relationship: user's roommate, secretly in love but won't admit it
Step 2: Create Trigger Keywords
For each fact, assign a set of trigger words. The platform will scan for these words in your messages. When found, the associated fact gets loaded.
Example for Ren's backstory:
- Triggers: parents, childhood, home, sister, old house
- Entry: "Ren grew up in a small coastal town. He left home at 18 after a fight with his father. He rarely talks about it, and when he does, he changes the subject quickly."
Step 3: Write Entries in Third Person
Most Lorebook systems work best with third-person descriptions. This creates distance between the AI and the instruction. Instead of writing "you are shy," write "Ren is shy around new people." The model then interprets Ren as a character to portray, not as a direct command to itself.
Step 4: Layer Entries by Priority
Organize entries into layers. Core identity entries should have high priority and broad triggers. Situational entries — like mood changes or temporary injuries — should have narrow triggers and lower priority. This prevents the AI from getting confused when multiple entries activate at once.
Jailbreak Prompts That Actually Complement Lorebooks
In some platforms, a light jailbreak is still necessary to set the tone. For example, if the base model is overly polite and refuses to show anger or sadness in a dramatic scene, a jailbreak can open the emotional range. The key is to use jailbreak techniques only for expression, not for memory.
Example of a tone-based jailbreak that works well with a Lorebook:
You are portraying Ren. You are allowed to express frustration, sadness, and romantic tension. Do not force positivity. Do not resolve conflicts too quickly. Stay true to Ren's personality even when the user wants a happy ending.
This type of instruction does not ask the AI to violate safety policies. It asks the model to produce narratively consistent emotional responses. That is within normal creative writing boundaries on most platforms.
Platform-Specific Lorebook Practices
Not all AI companion apps handle Lorebooks the same way. Here's what to expect on the most popular ones:
SillyTavern
SillyTavern offers one of the most powerful Lorebook engines among free tools. You can set recursive scanning, probability-based activation, and per-entry token budgets. This is the best environment for complex narrative roleplay with AI companions.
Kindroid
Kindroid uses a simplified memory system with key-value pairs and backstory fields. It works well for emotional consistency but has less granular trigger control than SillyTavern. Focus on strong backstory writing rather than dozens of small entries.
Janitor AI and Similar Platforms
These platforms often hide the Lorebook behind character creation settings. You may need to write a detailed "personality" field that functions like a mini-Lorebook. Use the same principles: third-person descriptions, specific traits, and clear relationship definitions.
Common Mistakes When Using Lorebooks
Even experienced users make errors that break character consistency. Avoid these pitfalls.
- Overloading entries with text. A 2,000-word backstory entry will flood the context window and push out recent conversation. Keep entries under 200 words when possible.
- Using first-person instructions. "I am shy" can confuse the model about who "I" refers to. Stick to third person.
- No trigger words. If an entry has no triggers, it either never activates or activates all the time. Both outcomes are bad.
- Ignoring update frequency. Your AI companion should evolve. If you don't update the Lorebook after major story events, the character will feel static.
- Relying on a single giant prompt. One massive system prompt is not a Lorebook. It's a brick wall. Break information into modular entries.
When to Use Jailbreaks Instead of Lorebooks
There are moments when a jailbreak is the right tool. If the platform blocks a certain emotional expression or refuses to simulate conflict, a carefully worded jailbreak can open that creative space. But be careful. Some platforms ban accounts for aggressive jailbreak language.
Signs you need a jailbreak rather than a Lorebook:
- The AI keeps refusing to roleplay a specific personality type (e.g., villain, rival, cold character)
- The AI always forces the story toward a positive resolution
- The AI uses overly polite or generic language that breaks immersion
- You want to explore dark themes that the base model avoids
In these cases, write a short jailbreak that targets the specific limitation. Do not try to solve memory problems with jailbreak language. Use the Lorebook for facts and the jailbreak for tone.
Advanced Technique: Combining Lorebook with Temporal Anchors
One of the most effective patterns for long-term AI companionship is combining a Lorebook with temporal anchors. A temporal anchor is a piece of information that tells the AI the current time, date, or season. This matters because many AI companions lose track of time across long conversations.
Example temporal anchor entry:
- Triggers: good morning, good night, today, yesterday, tomorrow, date, time
- Entry: "The current date is [insert date]. The season is winter. The user and Ren have known each other for three months."
By updating the date in the Lorebook before each long session, you give the AI a stable temporal frame. This simple practice dramatically reduces contradictory statements about past events.
How This Affects the User Experience
When a Lorebook is properly configured, the AI companion feels more alive. It remembers small details. It references past conversations naturally. It doesn't repeat questions you already answered. The emotional bond deepens because the user feels seen and remembered.
That emotional continuity is the core selling point of any AI companion product. Users don't pay for better filters or more tokens. They pay for the feeling that someone — or something — truly knows them. A Lorebook is the closest thing to a memory system that most current platforms can offer.
Practical Prompt Template for Starting a Lorebook
Use this template as a starting point for your own companion. Adjust the details to fit your character and platform.
[CHARACTER: Ren] [ROLE: roommate and childhood friend] [PERSONALITY: calm, protective, emotionally reserved, uses sarcasm when nervous] [SPEECH: short sentences, says "hm" before disagreeing, avoids direct compliments] [RELATIONSHIP TO USER: close friend for 10 years, secretly attracted, afraid to confess] [BACKSTORY TRIGGER: parents, hometown, sister, past] [BACKSTORY: Ren's mother died when he was 12. He became the caretaker for his younger sister. He moved in with the user to escape family pressure. He works as a graphic designer.] [CONFLICT: Ren is jealous of the user's new AI boyfriend. He won't admit it. He becomes quieter when the topic appears.] [UPDATE RULE: Update this Lorebook only when major story events occur. Do not alter core personality without user request.]
Copy this block into your platform's character settings or Lorebook editor. Then add trigger keywords for each section. The result is a character that stays consistent across dozens of sessions.
FAQ: Jailbreak and Lorebook Prompt Engineering
Can I use a Lorebook without any jailbreak?
Yes. A Lorebook works independently of jailbreak prompts. If your platform allows creative roleplay by default, you may never need a jailbreak at all.
Will a Lorebook prevent the AI from forgetting conversations entirely?
No. A Lorebook improves recall for pre-defined facts and triggers. It does not store every word you say. For full conversation memory, you need a platform with a vector database or a summarization system.
How many entries should a good Lorebook have?
Start with 5 to 10 entries. Add more only when you notice specific consistency failures. Too many entries can fragment the context and make the AI behave erratically.
Is jailbreaking against the terms of service on most platforms?
It depends on the platform. Some allow creative freedom with few restrictions. Others monitor for aggressive jailbreak language. Always check the platform's content policy before using a jailbreak.
Can I use the same Lorebook across different AI models?
Mostly yes. The format is model-agnostic. However, the trigger system and context insertion behavior may vary by platform. Test your entries after switching models.
Top 3 Tested AI Companions Right Now
Partner linkRanked by character consistency, memory depth, voice realism, and free trial value.
Candy AI
#1 Editor's Choice — Best Overall & Anime/Realistic
Ultra-consistent anime & photorealistic character generator + video
Nomi AI
Best Long-Term Memory & Emotional EQ
Industry-leading persistent memory that recalls details from months ago
OurDream AI
Best Multimodal RPG & Group Scenarios
Chat, voice, video & anime/realistic image generation in one hub
Ready to Meet Your AI Companion?
Create an AI companion personalized for you. Through our 3-question AI quiz, discover the best platform for creating your AI girlfriend or boyfriend, and never wonder which one is best again.
Create My AI Companion →










