AI Integration Guide

Build AI context and use intelligent features.

Grimoire is built for AI-assisted worldbuilding. This guide covers how to build context for AI assistants and use the intelligent features.

The Knowledge Context System

When you use AI tools with Grimoire, the AI needs to understand your campaign. The Knowledge Context system controls what information is available.

The Four Layers

  1. Layer 1 - Constitution: Core world truths that never change
  2. Layer 2 - Knowledge Graphs: Structural relationships (political, geographic)
  3. Layer 3 - Attention Filter: Entities marked for current relevance
  4. Layer 4 - Full Database: Complete campaign data

Why Layers Matter

AI context windows have limits. By organizing information into layers, Grimoire ensures the most relevant information is always available while keeping the full database searchable.

Building Your Constitution

The Constitution defines your world's fundamental truths.

What to Include

  • World Name & Setting: "A dark fantasy world called Vaeloria"
  • Core Themes: "Moral ambiguity, religious conflict, survival"
  • Magic System: "Magic comes from blood sacrifice"
  • Key History: "The Sundering split the world 1000 years ago"
  • Current Situation: "Five kingdoms vie for control of the Throne"

Writing Tips

  1. Be concise: Each fact should be one clear sentence
  2. Focus on impact: Include things that affect play
  3. Update rarely: This is your foundation, not current events
  4. Use the Campaign Bible: Generate a formatted summary

Knowledge Graphs

Graphs show relationships between entities.

Built-in Graphs

Political Graph:

  • Tracks faction relationships
  • Shows alliances, rivalries, conflicts
  • Helps AI understand power dynamics

Geographic Graph:

  • Shows location containment (city > district > building)
  • Tracks routes and connections
  • Helps AI understand spatial relationships

Custom Entity Graphs

Create your own relationship maps:

  1. Go to Knowledge > Graphs
  2. Click "Create Graph"
  3. Choose which entity types to include
  4. Define relationship types (ally, enemy, controls, knows, etc.)
  5. Add entities and connect them

The Attention System

Not every entity needs to be in AI context. The attention system marks what's currently relevant.

Marking Attention

  1. Open any entity
  2. Click the "eye" icon to toggle attention
  3. Entities with attention are included in AI context

When to Use Attention

Mark these with attention:

  • NPCs the party is currently interacting with
  • Locations they're in or heading to
  • Active quests
  • Recently discovered information

Remove attention from:

  • Completed quests
  • NPCs they've left behind
  • Locations they've moved past

Session Window

The Session Window automatically includes:

  • Recent sessions (configurable, default 5)
  • All entities referenced in those sessions
  • This creates "rolling" context that follows the campaign

Claude Desktop Setup

See the MCP Integration Guide for detailed setup instructions.

Quick Start

  1. Install Node.js from nodejs.org
  2. Run: npm install -g mcp-remote
  3. Get your MCP token from Campaign Settings > MCP Configuration
  4. Configure Claude Desktop (Settings > Developer > Edit Config)

Available MCP Tools

Once connected, Claude has access to these tools:

Reading Your Campaign

  • search_campaign - Find anything by keyword
  • get_entity - Get full details of an entity
  • list_entities - Browse entities by category
  • get_constitution - Get world foundations
  • get_knowledge_graph - Get relationship data
  • get_wiki_page - Read wiki content

Modifying Content (GM only)

  • create_entity - Add new entries
  • update_entity - Make changes
  • delete_entity - Remove entries
  • add_relationship - Link things together
  • create_wiki_page - Add wiki pages
  • create_wiki_block - Add wiki content

Example Prompts

World Building

  • "Create 5 NPCs for the Thieves' Guild faction"
  • "Generate a backstory for Millbrook that connects to the Sundering"
  • "What factions would be interested in the artifact the party found?"

Session Prep

  • "Help me plan an encounter at the Broken Crown tavern"
  • "What loose threads from recent sessions should I address?"
  • "Create a side quest involving the Merchant's Guild"

During Play

  • "What does Lord Blackwood know about the Sundering?"
  • "Who in the city might have information about the missing shipments?"
  • "Generate a random encounter appropriate for the Darkwood Forest"

Best Practices

  1. Keep Constitution current: Update it when major world changes happen
  2. Use attention wisely: More attention = more context = better AI
  3. Create graphs early: Relationship data powers intelligent queries
  4. Reference sessions: The more you log, the smarter queries become
  5. Trust visibility: AI respects DM Secret - players can't query it