molroomolroo

Overview

Psychology-grounded emotion middleware for AI characters — as a service.

molroo API

molroo API is an emotion middleware that gives AI characters psychologically grounded, evolving emotional states. Instead of prompt-hacking emotions or relying on memory tricks, molroo computes emotions using established psychological models — and returns LLM-ready prompts you can inject directly.

What It Does

Your App  →  molroo API  →  Your LLM
   ↓              ↓              ↓
Messages     5-Stage       prompt_data
             Pipeline      (system + context
             Computation    + instruction)
  1. Pick a preset or define a custom persona with Big Five personality traits
  2. Send messages through the simplified turn API
  3. Get back computed emotional state + prompt_data with structured prompts ready for your LLM

Key Features

FeatureDescription
Persona Presets5 built-in personality templates — start in seconds
Simplified TurnJust send { sessionId, message } — no event wrappers needed
prompt_dataLLM-ready structured prompts (system, context, instruction) in every response
WebSocketReal-time emotion updates via Durable Objects with hibernation
Relationship TrackingTrust, attachment style, and unhealthy pattern detection
Proactive BehaviorCharacters that initiate — attachment seeking, emotional overflow, need deficits
Appraisal VectorsDirect appraisal input for game events and non-text interactions
WebhooksHMAC-SHA256 signed push notifications for proactive actions and stage transitions

API Endpoints

MethodPathDescription
POST/v1/personaCreate a session (supports presets)
GET/v1/personaList sessions (cursor-based pagination)
GET/v1/persona/:idGet session metadata
DELETE/v1/persona/:idDelete a session
GET/v1/presetsList 5 persona presets
POST/v1/turnProcess a conversation turn
POST/v1/turn/appraisalProcess from appraisal vector
GET/v1/state/:idGet full emotional state snapshot
GET/v1/proactive/:idCheck pending proactive actions
PUT/v1/proactive/:id/preferencesConfigure proactive behavior
GET/v1/relationship/:idGet relationship state
POST/v1/webhook/:idRegister webhook
GET/v1/webhook/:idList webhooks
DELETE/v1/webhook/:id/:webhookIdDelete webhook
GET/v1/ws/:idWebSocket upgrade (real-time)
GET/v1/healthHealth check (no auth)

Psychology Engine

Every interaction flows through a 5-stage computation pipeline:

  1. Appraisal (Scherer CPM) — Evaluate emotional significance across 6 cognitive dimensions
  2. Dynamics (Sprott ODE) — Physics-based inertia, decay, and personality-driven response
  3. Resources (SDT + Energy) — Track psychological energy and core needs
  4. Regulation (Gross Model) — Apply personality-appropriate coping strategies
  5. Transition (Cusp Catastrophe) — Detect nonlinear state changes with hysteresis

Built on 9 peer-reviewed psychological theories. Zero external dependencies. Deterministic and explainable.

Next Steps

On this page