Early access
LLM-driven choose-your-own-adventure
Exo's CYOA is an LLM-driven choose-your-own-adventure that adapts to you. You describe your next move, and the game responds with new narration. Guide a party through dangerous places, talk to characters, inspect the world, collect gear, craft solutions and make choices that reshape the narrative. Behind the chat flow, a structured simulation — locations, entities, items, quests — grounds every action and remembers what you did.
Stack overview
Exo's CYOA is split into a Spring Boot server and a desktop client. Both modules communicate via an OpenAPI using a local socket (loopback).
Public repositories
The game engine and the language model library were released as open-source libraries on GitHub. The game-specific client and server modules build on top of those shared libraries.
Memory
The adventure needs to remember context across long sessions without overwhelming the model. A three-tier memory system balances recency, importance, and semantic retrieval.
MemorySummaryAgent distills the narrative into a concise summary, then ImportanceClassifierAgent scores it. High-importance summaries persist longer, low-importance ones evict first. Boundaries and sliding windows keep the tier bounded as sessions grow.TagDecompositionAgent breaks new content into tag groups with aliases, each scored for importance. Content is stored as MemoryTier3ContentRef leaves within importance buckets quantized to a configurable step size (e.g. floors of 10), so similar-importance summaries share a bucket. The system supports both story-narrative branches (grouped by tag) and entity-anchored branches (NPC, item, location, quest, character, connection), linked by UUID to domain objects.Retrieval scores candidates using recency (newer boundaries first), importance (higher floors score more), and tag overlap with fuzzy matching via Levenshtein similarity. A token budget ensures only the most relevant summaries are returned, rendered as grouped prose with tag headers and location context.
When an importance bucket grows beyond a configured threshold and contains enough references, MemoryTier3Service automatically compacts the content using the LLM — similar summaries are merged into a single dense summary, preserving tag relevance. Compaction groups content by tag overlap into buckets first, so only semantically coherent sets are merged. Entity descriptions are always kept at maximum importance (100) and are exempt from narrative compaction.
Change tracking via MemoryTier3ChangeRef records which boundary, tag branch, or importance level was modified at what timestamp, enabling incremental diffing instead of full re-scans.
Memory budgets per tier are configured by MemoryConfigService, letting users trade token cost and available context size for recall depth.
Actions
A player's instruction is classified into one or more actions from a taxonomy of roughly twenty action types. Each type has a dedicated flow agent that reasons about the decision, updates game state, and queues a narration request, separating the “what happens” from the “how it sounds.”
GoToLocationFlowActionAgent) makes structured decisions, parsing targets, validating feasibility, computing outcomes. Then a narration agent (e.g. StoryGenerationAgent) renders the result into prose. Deferred narration lets the system batch multiple actions into a single cohesive paragraph.OrchestrationAgent enqueues actions in a work queue and walks them one by one. An agent can enqueue derived actions mid-flow (e.g. travel triggers a carryover decision), or clear the queue (e.g. combat interrupts other pending actions). The game master phase replays the same pattern with a GM classifier and GM narration agent.UserConfirmationRequired update. The orchestration pauses, waits for the player's decision, then routes to the confirmed agent or to a decline-rewriting agent.EntityRefAgent and EntityCreationAgent, which create the entities on the fly. Removals are gated by EntityRemovalConfirmationAgent, so the player is asked before something disappears.Graph-Based Architecture
Exo's CYOA is built around an implicit agent graph where each node is a narrow-purpose agent and edges are determined at runtime. This design is intentional: smaller models on edge devices need focused prompts and strict harnesses to produce reliable results. Instead of asking one model to do everything, the system delegates each task to a specialist with a minimal, well-structured prompt.
AgentExecutorService in lm-lib performs a recursive walk. Each agent's chooseNextAgent() returns an AgentNext that names the downstream agent, the routing is data-driven, not hardcoded. The OrchestrationAgent in the server acts as the graph controller, driving a phase-based state machine (CLASSIFICATION → ACTIONS → STORY → MEMORY → DONE) and enqueuing specialized flow agents as pending work.AgentType.COMPLETION (single-turn, no history) or a lightweight conversation, keeping prompts short and models predictable.[[key]] spawns parallel splits, one per list element, executed concurrently on separate virtual threads. After completion, merge() combines the results. This is used for entity reference resolution and tag decomposition where independent items can be processed in parallel.ToolDefinition. The model selects tools rather than producing structured text, reducing parsing failures on smaller models. Tool-calling classifiers support parallel tool invocations via ToolCallData.required().JsonAgentResponseHandler, CsvAgentResponseHandler, AccumulateTextAgentResponseHandler) parse LLM output into typed data. A retry loop with reformulation prompts ensures reliability, if parsing fails, the agent re-asks rather than crashing the flow.AnswerGrader2 pattern routes an agent's output through a binary quality check. If the grader's score falls below threshold, the context loops back to the source agent with feedback, up to two retries. The AgentNext.gradingPassed flag lets downstream agents react to grading outcomes.Adventure flow
This diagram summarizes how a player instruction becomes classified actions, state updates, memory work, narration, optional game-master follow-up, and streamed client updates.