Skip to Content
Loremind Platform APILore Documents

Lore Documents

Give your NPCs knowledge about your game world.

Overview

Documents hold all the lore and information your NPCs can reference:

  • World history and events
  • Location descriptions
  • Items and artifacts
  • Factions and politics
  • Creatures and monsters
  • Legends and rumors

When players talk to NPCs, LoreMind automatically retrieves relevant lore based on what’s being discussed.

Accessing Documents

  1. Go to Documents  in the dashboard

Documents list

Adding Documents

Uploading Documents

Documents are uploaded as Markdown files with optional YAML frontmatter:

  1. Click Upload in the Documents tab
  2. Drag and drop your .md, .txt, or .markdown files
  3. Click Upload Files

Upload Lore Files dialog

File Format

Use YAML frontmatter to set title and tags:

--- title: The Ashwood Forest tags: [location, forest, danger] --- A dense woodland east of Millbrook Village. Travelers avoid it after dark due to rumors of strange creatures. The forest is home to rare medicinal herbs that fetch high prices at market.

If you omit frontmatter, the filename becomes the title.

Document Format

Write lore as if describing to someone unfamiliar with your world:

Good example:

The Dragon War (Year 847-852) The Dragon War was a devastating five-year conflict between the united human kingdoms and a coalition of dragons led by Scorath the Elder. The war began when Scorath's mate was killed by hunters from the northern village of Thornhaven. Key battles: - The Burning of Thornhaven (847) - Scorath's first attack destroyed the village - The Defense of Riverwatch (849) - First human victory using enchanted ballistae - The Final Stand at Dragon's Hollow (852) - King Aldric's army defeated Scorath The war ended with the Dragon Accords, a peace treaty that created protected dragon territories in the mountains. Today, dragons are rarely seen in human lands. Notable figures: - Scorath the Elder - Lead dragon, killed at Dragon's Hollow - King Aldric the Brave - United the kingdoms, died of wounds after final battle - Grom the Smith - Forged the enchanted weapons that turned the tide

Avoid:

  • Single-sentence entries (too little context)
  • Novel-length documents (harder to retrieve relevant parts)
  • Game mechanics descriptions (NPCs shouldn’t know about “HP” or “damage”)
TypeIdeal LengthExample
Location100-300 wordsTown description, notable buildings, atmosphere
Character150-400 wordsBackground, personality, relationships
Historical event200-500 wordsWhat happened, key figures, consequences
Item/Artifact50-150 wordsDescription, history, powers

Organizing with Tags

Tags control which NPCs can access which lore. Think of them as knowledge domains.

Creating Tags

Tags are created inline when editing a document:

  1. Click on a document in Documents
  2. Click the tag edit icon next to the existing tags
  3. Type a new tag name (e.g., “bosses”)
  4. Click Create “bosses” to add it

Creating a new tag inline

Assigning Tags to Documents

Each document can have multiple tags:

Document: "The Dragon War" Tags: history, dragons, military, thornhaven, riverwatch
Document: "Blacksmithing Techniques" Tags: blacksmithing, crafting, metalwork

Assigning Tags to Entity Minds

In Entity Minds, select which tags an NPC can access:

Innkeeper Garrick Knowledge Tags: village-life, rumors, local-history, tavern Grom the Blacksmith Knowledge Tags: blacksmithing, weapons, dragon-war, metalwork

How Tag Filtering Works

When a player asks a question:

  1. LoreMind searches documents with matching tags
  2. The most relevant chunks are selected
  3. NPC responds using that knowledge

Example:

Player asks blacksmith: “What do you know about the dragon war?”

  1. Blacksmith has tags: blacksmithing, weapons, dragon-war, metalwork
  2. Search finds “The Dragon War” document (has dragon-war tag)
  3. Blacksmith can discuss it: “Aye, I remember. My grandfather Grom forged the enchanted weapons that helped turn the tide.”

Player asks innkeeper same question:

  1. Innkeeper has tags: village-life, rumors, local-history, tavern
  2. Search doesn’t find the dragon war document (no matching tags)
  3. Innkeeper responds with general knowledge: “I’ve heard stories, of course. Everyone has. But I was just a child then.”

Tag Strategies

By Topic

Organize knowledge by subject area:

history, geography, magic, religion, politics, economy

Pros: Intuitive, easy to manage Cons: Generalist NPCs need many tags

By Location

Organize by where NPCs live:

capital-city, thornhaven, riverwatch, mountain-region

Pros: NPCs know their area well Cons: May need cross-references for travelers

By NPC Role

Create tags for specific NPC types:

merchant-knowledge, guard-knowledge, scholar-knowledge

Pros: Easy to assign, consistent knowledge per role Cons: Less granular control

Combine strategies:

# Location capital-city, thornhaven, riverwatch # Topic blacksmithing, magic, history # Role merchant-common, guard-common # Quest-specific quest-missing-merchant, quest-dragon-slayer

Best Practices

Write for NPCs, Not Players

Good: “Thornhaven was destroyed by dragon fire in year 847. Few survived.” Avoid: “Thornhaven is a quest location where players find the first clue.”

Include NPC Perspectives

Good: “The merchant guild considers the new taxes unfair. Many have raised prices.” Better: Different documents for different factions’ perspectives.

Keep Documents Focused

One topic per document makes retrieval more accurate.

Instead of:

Document: "Everything About Thornhaven" (2000 words covering history, geography, people, economy...)

Use:

Document: "Thornhaven - Overview" (200 words) Document: "Thornhaven - The Fire of 847" (300 words) Document: "Thornhaven - Notable Residents" (250 words) Document: "Thornhaven - Economy and Trade" (200 words)

Use Descriptive Titles

Titles help you organize and help the AI understand context:

Good: “The Dragon War (847-852)” Avoid: “History 1”

Avoid Spoilers for Quest NPCs

Use quest-specific tags and only assign them to relevant NPCs:

Document: "The Missing Merchant - Truth" Tags: quest-missing-merchant-spoilers (Only assign to NPCs who should know the resolution)

Updating Lore

Editing Documents

  1. Click on a document in Documents
  2. Make changes
  3. Click Save

Changes take effect for new conversations immediately.

Document Versions

LoreMind doesn’t track versions, but you can:

  • Keep old versions with “(deprecated)” in title
  • Use external version control for your lore content
  • Export/import via API for backup

Bulk Import

For large lore collections, use the API to import programmatically:

curl -X POST https://loremind.peekgames.dev/api/loremind/v1/lore/documents \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "title": "Thornhaven History", "content": "...", "tags": ["history", "thornhaven"] }'

Troubleshooting

NPC doesn’t know something it should

  1. Check if a document with that information exists
  2. Verify the document has appropriate tags
  3. Verify the Entity Mind has those tags assigned
  4. Test in Playground with verbose logging

NPC knows too much

  1. Remove broad tags from the Entity Mind
  2. Use more specific tags on sensitive documents
  3. Add restrictions to the Entity Mind (“Never reveals the treasure location”)

Retrieval seems wrong

The system finds the most relevant chunks based on semantic similarity. If results seem off:

  • Make sure document titles are descriptive
  • Break large documents into focused sections
  • Use consistent terminology

Next Steps

Last updated on