# Lorebooks (/docs/lorebooks)



Lorebooks extend chat context with reusable worldbuilding, reference facts, and structured terminology. They are especially useful for long-running roleplay, faction memory, and setting canon.

What a lorebook contains [#what-a-lorebook-contains]

Each lorebook combines metadata and a set of entries. Entries can include keys, priority, content, and regex or case-sensitive matching when needed.

Important controls [#important-controls]

| Control            | Purpose                                          |
| ------------------ | ------------------------------------------------ |
| Scan depth         | How far back Tavern Cozy looks for matches       |
| Token budget       | How much lorebook content can enter the prompt   |
| Recursive scanning | Whether matched content can trigger more entries |
| Visibility         | Public, unlisted, or private access              |

How it behaves in practice [#how-it-behaves-in-practice]

The browse and creation flows both expect lorebooks to be coherent and searchable. Good lorebooks stay focused on a specific setting, species, faction, or campaign premise.

Entry design [#entry-design]

* Use short, specific keys.
* Put the most important rule or fact first.
* Keep high-priority entries narrowly scoped.
* Avoid duplicating the same fact across many entries unless you need different match patterns.

Public versus private [#public-versus-private]

Public lorebooks can be read without a user session, while private lorebooks stay behind auth. That lets Tavern Cozy support community sharing without compromising private worldbuilding notes.

Authoring tip [#authoring-tip]

If a lorebook feels too noisy, trim keys before trimming the content. Matching quality usually matters more than raw length.
