Lorebook
A Character.ai world-building feature: reusable keyword-triggered entries (locations, side characters, rules, items) that inject into chat only when relevant keywords appear.
How it works
A Lorebook is a collection of text entries, each associated with a set of trigger keywords. During conversation, the system monitors the current context for any keyword matches. When a keyword is detected, its associated Lorebook entry is automatically injected into the context window (usually in a hidden system section). This allows persistent world-building information — character backstories, location descriptions, magic system rules — to be retrieved dynamically only when relevant, conserving context window space.
Why it matters
Lorebooks solve the context window problem for long-form interactive fiction and roleplay: a rich fictional universe with dozens of characters and locations cannot all fit in the context at once. By injecting only relevant details triggered by keyword detection, Lorebooks allow characters and worlds to remain internally consistent across very long conversations. This architecture has broader implications for knowledge injection in AI systems — it is essentially a hand-crafted, keyword-based RAG system.