Symmetry-Aware LLM-Driven Generation and Repair of Interactive Fiction Graphs in Twine/Twee

We present a hybrid system that combines large language models (LLMs) with formal graph-analytic methods to generate and automatically repair interactive fiction (IF) stories written in the Twine/Twee format. We chronologically describe the practical challenges encountered when attempting to produce fully playable branching narratives using contemporary state-of-the-art LLMs, including missing passages, trap-like cycles without exits, dead-end passages, narrative discontinuities, incorrect use of Twine macro commands, and inconsistent handling of story variables. To address these limitations, we deliberately abandon all macro- and variable-based logic and instead encode story state directly within passage names through structured, token-based naming. We formalize symmetry and asymmetry in the resulting narrative graphs: symmetrical convergence occurs when multiple branches with compatible states merge into a common passage, whereas asymmetry reveals incorrect or logically inconsistent merging of divergent states (for example, entering a scene in which an item or companion is present via paths where they were never acquired or met). We propose algorithms to detect naming-based asymmetries, cycles, unreachable endings, and structurally defective branches, and we integrate these diagnostics into a repair loop that prompts the LLM to rewrite missing or inconsistent parts of the story. Experiments with several LLM backends indicate that this approach can yield structurally robust and locally coherent interactive stories by reducing state inconsistencies and structural defects. Beyond the specific case of Twine, we argue that symmetry/asymmetry analysis offers a powerful lens for evaluating and correcting AI-generated narrative graphs in general.

Authors

Institutions

Publication Details

Journal
Symmetry
Published
2026-01-07
DOI
https://doi.org/10.3390/sym18010113
Primary Topic
Artificial Intelligence in Games
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Symmetry-Aware LLM-Driven Generation and Repair of Interactive Fiction Graphs in Twine/Twee

Bożena Woźna-Szcześniak, Marcin Puchalski
Symmetry
Artificial Intelligence in Games
article

Symmetry-Aware LLM-Driven Generation and Repair of Interactive Fiction Graphs in Twine/Twee

Bożena Woźna-Szcześniak, Marcin Puchalski
article en

Abstract

We present a hybrid system that combines large language models (LLMs) with formal graph-analytic methods to generate and automatically repair interactive fiction (IF) stories written in the Twine/Twee format. We chronologically describe the practical challenges encountered when attempting to produce fully playable branching narratives using contemporary state-of-the-art LLMs, including missing passages, trap-like cycles without exits, dead-end passages, narrative discontinuities, incorrect use of Twine macro commands, and inconsistent handling of story variables. To address these limitations, we deliberately abandon all macro- and variable-based logic and instead encode story state directly within passage names through structured, token-based naming. We formalize symmetry and asymmetry in the resulting narrative graphs: symmetrical convergence occurs when multiple branches with compatible states merge into a common passage, whereas asymmetry reveals incorrect or logically inconsistent merging of divergent states (for example, entering a scene in which an item or companion is present via paths where they were never acquired or met). We propose algorithms to detect naming-based asymmetries, cycles, unreachable endings, and structurally defective branches, and we integrate these diagnostics into a repair loop that prompts the LLM to rewrite missing or inconsistent parts of the story. Experiments with several LLM backends indicate that this approach can yield structurally robust and locally coherent interactive stories by reducing state inconsistencies and structural defects. Beyond the specific case of Twine, we argue that symmetry/asymmetry analysis offers a powerful lens for evaluating and correcting AI-generated narrative graphs in general.

SymmetryVol. 18(1)
Jan Długosz University (PL)
Openalex Percentile: Top 95%
Artificial Intelligence in Games
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.