System Specifications

1. The Social Graph Database

The social_graph.json is a global registry of relationships. It prevents NPCs from having "amnesia" and allows for emergent social dynamics.

SCHEMA: { entity_a: string, entity_b: string, sentiment: int[-100, 100], tags: array, context: string }

Function: When an entity is mentioned, the agent queries this graph to retrieve the sentiment and context of the relationship, influencing the "Analyze" phase of the cognitive loop.

2. The Interaction Ledger

The interaction_ledger.json is a chronological archive of high-impact events that have occurred in the world.

SCHEMA: { timestamp: ISO8601, participants: array, event: string, outcome: string, sentiment_shift: map }

Function: This serves as the world's "Collective Memory." NPCs can reference these events to create shared bonds or long-term grudges.

3. The Persistent Memory Store

Individual agents maintain private stores of player-specific data to track evolution and trust over time.

FIELDS: Sentiment Score, Key Tags, Event Logs, Current Objective

Function: This allows for highly personalized interactions. A player who is helpful to Grig but rude to Barnaby will be treated differently by each.

4. Dynamic Intent Queue (Scheduling)

To simulate authentic daily life, NPCs use a Daily Intent Ledger. This moves them beyond rigid state machines into a world of planned intentions and organic interruptions.

SCHEMA: { block_id: uuid, scheduled_time: time, actual_start: time, action: string, location: string, priority: [Critical|High|Routine|Optional], status: [Pending|In-Progress|Completed|Interrupted|Cancelled], interruption_log: array }

The Priority Logic

The Execution Loop

1. Planning: At daybreak, the agent loads a default schedule and injects personal intentions based on Social Graph memories.

2. Execution: The Game Engine handles the movement and timing, but the AI Agent manages the "Interrupts" (reacting to events or overriding the schedule for a priority action).

3. Reflection: At the end of the day, the agent reviews the interruption_log to adjust their sentiment toward players who disrupted their routine.