Core Concepts
Understand World, Persona, Entity, VAD, and Space.
Core Concepts
This guide explains the fundamental building blocks of molroo. Understanding these concepts is essential for designing expressive, emotionally authentic worlds.
World
A World is the top-level container that holds everything together: entities, spaces, rules, knowledge, and progression. Each world runs as an isolated instance on the server (backed by a Durable Object), so worlds never interfere with each other.
A world has:
- Identity -- name, genre, era, tone, lore
- Culture -- shared values, taboos, social norms
- Knowledge -- facts with visibility rules (public, secret, rumor)
- Progression -- phase system for story arcs with triggers
const world = await MolrooWorld.create(clientConfig, {
definition: {
identity: {
name: 'Moonlight Academy',
genre: 'fantasy',
era: 'modern',
tone: 'mysterious',
lore: 'A prestigious academy where students discover hidden magical talents.',
},
},
// ...entities, spaces, etc.
});Entity
An Entity is anything that exists in a world. There are three types:
| Type | Description | Has Emotion Engine |
|---|---|---|
persona | A character with full emotional simulation | Yes |
user | A player or human participant | No |
secondary | A non-emotional NPC or environmental element | No |
Every world needs at least one user entity (the default from for chat() calls) and one persona entity to interact with.
entities: [
{ name: 'user', type: 'user' },
{ name: 'Sera', type: 'persona' },
{ name: 'Townsperson', type: 'secondary' },
],A user entity named 'user' is required. The SDK's chat() method defaults from to 'user' -- if this entity is missing, you will get an ENTITY_NOT_FOUND error.
Persona
A Persona is an entity with a full emotion engine. It is the core unit of emotional simulation in molroo. Each persona has:
- Identity -- name, role, backstory, speaking style
- Personality -- HEXACO 6-factor model with 24 facets
- Soul Stages -- 15 levels tracking psychological resilience (higher = more volatility)
- Needs -- autonomy, competence, relatedness (self-determination theory)
- Goals -- active objectives that influence appraisal
- Relationships -- trust, familiarity, and affiliation with other entities
- Mood -- slow-moving emotional baseline
- Somatic Markers -- physiological signals tied to emotion (e.g., racing heart, sweaty palms)
personaConfigs: {
Sera: {
identity: {
name: 'Sera',
role: 'friendly barista',
backstory: 'Grew up in a small coastal town...',
speakingStyle: 'warm and casual, uses food metaphors',
},
personality: { O: 0.7, C: 0.6, E: 0.8, A: 0.9, N: 0.3, H: 0.8 },
},
},HEXACO personality model
molroo uses the HEXACO-PI-R 6-factor personality model. Each factor ranges from 0 to 1:
| Factor | Low (0) | High (1) |
|---|---|---|
| H -- Honesty-Humility | Manipulative, entitled | Sincere, modest |
| E -- Extraversion | Reserved, quiet | Sociable, energetic |
| O -- Openness | Conventional, practical | Creative, curious |
| A -- Agreeableness | Critical, stubborn | Cooperative, tolerant |
| C -- Conscientiousness | Impulsive, disorganized | Disciplined, thorough |
| N -- Neuroticism | Calm, resilient | Anxious, emotionally reactive |
All six factors must be provided. Omitting N (Neuroticism) will cause the emotion engine to produce invalid results.
VAD (Valence-Arousal-Dominance)
VAD is the 3-dimensional coordinate system that represents emotional state. Every emotion maps to a point in this space.
| Dimension | Range | Low | High |
|---|---|---|---|
| Valence | -1 to +1 | Negative (sad, angry) | Positive (happy, excited) |
| Arousal | 0 to 1 | Calm, relaxed | Activated, tense |
| Dominance | -1 to +1 | Submissive, helpless | Dominant, in control |
Examples of emotions in VAD space:
| Emotion | V | A | D |
|---|---|---|---|
| Joy | +0.8 | +0.6 | +0.5 |
| Anger | -0.6 | +0.8 | +0.6 |
| Sadness | -0.7 | -0.3 | -0.5 |
| Fear | -0.6 | +0.7 | -0.6 |
| Calm | +0.3 | -0.5 | +0.2 |
The emotion engine operates natively in VAD space. Discrete emotion labels (joy, anger, sadness, etc.) are derived from the VAD coordinates as a convenience.
Space
A Space is a location within a world. Entities exist in exactly one space at any given time. Spaces can connect to each other with distance and traversal properties.
Three types of spaces:
| Type | Description | Example |
|---|---|---|
physical | A tangible location | Cafe, park, library |
virtual | A digital or online space | Chat room, VR world |
abstract | A conceptual space | Dream, memory, emotion |
spaces: [
{
name: 'Main Hall',
type: 'physical',
description: 'The central gathering place.',
connections: [
{ target: 'Garden', distance: 50, traversalTime: 30 },
],
},
{
name: 'Garden',
type: 'physical',
description: 'A peaceful garden with a fountain.',
},
],Spaces influence emotional interactions: entities in the same space can observe each other's emotional states, and events can propagate spatially.
Appraisal
Appraisal is how a persona evaluates an incoming stimulus (message, event, or action). It is the entry point of the emotion pipeline. The appraisal is a 6-dimensional vector:
| Dimension | Range | Description |
|---|---|---|
goal_relevance | 0 to 1 | How relevant is this to the persona's goals? |
goal_congruence | -1 to 1 | Does this help (+) or hinder (-) goals? |
expectedness | 0 to 1 | How expected was this? (0 = surprise) |
controllability | 0 to 1 | Can the persona influence the outcome? |
agency | -1 to 1 | Who caused this? (-1 = other, 0 = circumstance, +1 = self) |
norm_compatibility | 0 to 1 | Does this align with the persona's values? |
In normal operation, the LLM generates appraisal values automatically based on the persona's context. You can also provide manual appraisal in emotion-only mode.
Knowledge
Knowledge represents facts that exist in a world. Each piece of knowledge has a visibility level:
| Visibility | Description |
|---|---|
public | All entities know this fact |
secret | Only specified entities know this |
rumor | Spreads between entities with decreasing confidence |
Knowledge influences how personas interpret events and generate responses. A persona who knows a secret will react differently than one who does not.
Progression
Progression is a phase system that enables story arcs. You define phases with triggers that advance the narrative:
| Trigger Type | Description |
|---|---|
event_count | Number of events that have occurred |
time_elapsed | In-world time that has passed |
relationship | Relationship level between entities reaches a threshold |
persona_emotion | A persona's emotional state matches a condition |
Phases can change world rules, unlock spaces, reveal knowledge, and alter persona behavior -- enabling dynamic, evolving narratives.