Backyard AI Logo
HomeCommunity HubSubscriptions
Android AppiOS AppDocs

Lorebooks

There are limits to the amount of information we can fit into our Character's prompt. However, there may be some information that you want the AI to understand outside of this permanent context.

This is where a Lorebook comes into play. Each item in the Lorebook is a keyword with an associated value. When this keyword is used in your chat, the entry is added dynamically to the chat context so that the model understands what you are referring to.

Lorebook

Lorebooks can be especially helpful for Characters adapted from a fictional world. You can easily define a vast amount of important information about the world without overloading your Character's prompt.

Basic Example #

  • Keyword: home
  • Value: A two story house on a cul-de-sac in a middle class neighborhood. {user}'s bedroom is on the top floor. The house is cozy.

In this example, whenever you or your Character mentions "home", the associated keyword and value are added to the context. This data is injected immediately before the last two chat messages. If the Character is supposed to be your longtime friend, this is something they should know, but it's not necessarily something that belongs in the Character's prompt.

Usage in Backyard AI #

Scroll down within Character settings to Lorebooks. Click New Item which will bring up a Keyword / Value pair. Enter as many associated keywords as you like (eg. home, house, pad) and then the associated entry. Then, save your changes and you are ready.

Message Context #

Lore will remain in context only if the keyword appears in the four most recent messages of your chat history.

Size Limits #

Lorebook entries have a combined limit of 384 tokens when chatting. You can add more items, but only the first 384 tokens will be included in the context window. This limit ensures there's enough room for your chat history in the context window. Keep each entry brief and to the point, since multiple entries may be triggered at once and their tokens add up together.

Multiple Keywords #

Each Lore Item can have multiple keywords associated with it, each separated by a comma.

Case Insensitivity #

Lore keywords are case insensitive, so “Den” would match with “den”, “dEN” "DEN", etc.

Matching a Suffix or Prefix #

You can use * wildcards to match a suffix or prefix in the key.

For example:

*house would match lighthouse or house in the chat history.

house* would match houseboat or house in the chat history.

Recursive Entries #

Recursive Lore entries are not supported. In other words, Lore entries cannot trigger other lore keywords. Lore entries are not searched within when finding Lore keywords.

Multiple Words #

Keywords can be multiple words, but the full string must be matched exactly to trigger a lore insertion.

Overlapping Entries #

If multiple keywords are overlapping, only the first keyword will be used.

Start Guide
Overview
Creating Characters
Character PromptTips and TricksResponse FormattingLorebooksAuthor NoteGrammarsAdvanced Tips
© 2025 Backyard AI
Community Hub Guidelines
Terms of Use
Privacy Policy