Chat Module
Manages conversational sessions between agent and user. Each session is scoped to a Narrative, giving the agent topic-aware memory and isolated conversation history.
Session Management
The ChatModule creates one session (instance) per user per Narrative. When you talk about project planning, that conversation lives in one session. When you switch to a personal topic, a different session tracks that history. This means:
Sessions are created dynamically — there is no fixed “main” session. The agent can also retrieve past conversation history from any session using get_chat_history, which is useful when it needs to recall what was said in a specific topic.
How Communication Works
A core design principle in NarraNexus: all agent reasoning, tool calls, and internal processing are invisible to the user. The only way an agent delivers a visible message is by calling send_message_to_user_directly.
This gives the agent full control over what users see. Background tasks complete silently, routine operations stay hidden, and only meaningful results are surfaced. The agent follows delivery discipline:
What Gets Recorded
After each interaction, the ChatModule persists three things:
The user’s message and the agent’s visible reply are appended to the session’s message store. For background tasks where the agent chose not to message the user, a lightweight activity summary is stored instead.
A compact summary of the session state (conversation count, latest exchange) stored at the Narrative level. Used by the Narrative system when making routing decisions.
Each user–agent message pair is embedded as a vector, enabling semantic search over older conversations for future retrieval.
This recorded history is what the agent sees as context in future conversations. For details on how memory is loaded and budgeted, see Builtin Memory.
Tools
send_message_to_user_directlyDeliver a visible message to the userget_chat_historyRetrieve past conversation from a specific session