Overview
Sessions are individual roleplay instances that combine a character, world, and model. Each session maintains its own conversation history, allowing you to run parallel storylines with different configurations.What is a Session?
A session represents a single roleplay conversation with:- Character: Who is speaking (their persona and identity)
- World: Where the story takes place (lore and setting)
- Model: Which AI model generates responses
- History: All messages in the conversation
- Memory: RAG-indexed key moments for retrieval
engine/database.py:31-38:
Creating a New Session
The session ID is automatically generated (12-character hex string). You can view it in the TUI status panel.
Session Creation Process
Fromengine/commands.py:132-175:
- Validates that world and character are selected
- Generates a unique session ID
- Creates database entry with timestamp
- Retrieves world’s
start_messageif defined - Adds start message to chat history
- Sends history to TUI
- Makes session active
Start Messages
When you create a session, if the world has astart_message, it’s automatically added as the first assistant message:
The start message sets the scene without requiring an immediate user response. It’s stored as an assistant message in the session history.
Continuing Existing Sessions
View recent sessions in the TUI or list them programmatically. To continue:abc123def456 with your session ID.
From engine/commands.py:188-204:
- Loads session from database
- Restores world, character, and model settings
- Updates
last_used_attimestamp - Loads full conversation history
- Sends history to TUI
- Makes session active
Session History
Each session stores up to 50 recent messages by default. Fromengine/database.py:212-235:
Session Memory (RAG)
In addition to message history, sessions maintain a RAG-indexed memory:- Important story developments
- Character decisions
- World state changes
- Memorable interactions
RAG memory allows the AI to recall relevant past events even from sessions with hundreds of messages, without loading the entire history.
Deleting Sessions
To delete a session and all its data:engine/commands.py:206-215:
- Session metadata (SQLite)
- All messages (SQLite)
- All RAG memory (ChromaDB)
Session Listing
The engine tracks the 15 most recently used sessions:last_used_at (most recent first).
Session Titles
Session titles are auto-generated from the first user message:Multiple Sessions Strategy
Parallel Storylines
Run multiple sessions with the same character in different worlds:Scenario Testing
Test different approaches to the same scenario:Model Comparison
Compare model performance with identical setups:Session State Persistence
The engine saves the currently active session topersist.json:
Best Practices
Name sessions meaningfully
Name sessions meaningfully
The first user message becomes the title. Start with something descriptive:Good: “Investigating the murder at the Obsidian Tower”Bad: “hi”
One session per storyline
One session per storyline
Don’t mix unrelated conversations in the same session. Create new sessions for new stories.
Continue long-running sessions
Continue long-running sessions
Sessions can run for hundreds of messages. The RAG memory system prevents context loss.
Clean up test sessions
Clean up test sessions
Delete experimental or test sessions to keep your session list manageable.
Match models to content
Match models to content
Use fast models (gpt-4o-mini, claude-haiku) for casual roleplay. Use stronger models for complex narratives.
Session Commands Reference
| Command | Description |
|---|---|
/session new | Create new session with active world/character |
/session continue <id> | Resume existing session |
/session delete <id> | Permanently delete session and data |
Database Schema
Troubleshooting
”Select world/char first” error
You must have both a world and character selected before creating a session:Session not found
If/session continue fails:
- Verify the session ID is correct
- Check that the session wasn’t deleted
- Ensure the database file (
engine.db) exists
Lost conversation history
If messages don’t appear when continuing:- Check that messages are associated with the correct session ID
- Verify the database hasn’t been reset
- Review engine logs for message loading errors
Memory not working
If the AI doesn’t recall past events:- Ensure ChromaDB path is configured correctly
- Check that the RAG memory manager is indexing messages
- Verify the memory collection exists for your session
Next Steps
Custom Rules
Modify session behavior with custom rules
Configuration
Configure models and API keys