E
Back to projects
Prototype notesAgents for Narrative

Branching Storytelling Agent

A narrative runtime for long-form AI storytelling, using structured scenes, goals, branches, and player-driven state transitions.

Branching Storytelling Agent system architecture diagram
Branching Storytelling Agent system architecture diagram

Keeping a story coherent while players keep changing the path. That is the problem this project is built around.

Long-form story generation is a runtime problem: scenes, goals, player choices, constraints, and state transitions. The challenge is not generating the next paragraph. It is knowing what must stay true across scenes, what can change, and what to do when the player takes an unexpected path.

What we're building

Design notes

Longer context windows help, but they do not solve the structural problem. A story still needs to know what matters, what can change, what must stay true, and how to recover when the player wanders off-script.

Here is a concrete case: a player decides mid-scene to betray an ally they were supposed to protect. The model can generate a reaction. But should the ally remember this next scene? Does it change what the player is allowed to do later? Does the story's ending branch from here, or was this a throwaway choice? Those questions cannot be answered by the context window alone. They require explicit state: what persists, what expires, and what triggers a branch.

We are exploring a scene graph structure where each node carries its own state requirements: what must be true for the scene to activate, what changes when the player passes through it, and what the system needs to carry forward. The goal is not to constrain the player. It is to make the story's memory reliable enough that freedom feels meaningful.

System diagram

The current architecture separates script structuring from runtime game mastering. The first stage turns raw narrative material into hierarchical script representation and structured knowledge. The second stage uses player input, branching decisions, retrieval, context construction, game mechanics, response generation, and persistent state updates to keep the story coherent.

Demo screen

This demo screen shows the player-facing flow: choosing a table, setting the scene, creating an investigator, and entering the case. It is the visible side of the runtime system, where structured narrative state has to become an interaction the player can actually move through.

Branching Storytelling Agent demo screen

The second screen shows the in-session interaction layer: player input, generated story response, and the game-master flow that has to stay grounded in the current narrative state.

Branching Storytelling Agent in-session demo screen

Open questions