Write interactive fiction as a graph of passages and choices.

Write passages yourself or have the next one drafted for you, add variables and conditions to choices, and check that every ending can be reached. Export a playable HTML page or a Twine file.

Version 2.0.0 · MIT license · github.com/dguywhoknows/branching-story-editor

The app itself, running inside this page. Anything you do here is saved in your browser.

Ask it to do things

Press Ctrl+K in the app (Cmd+K on a Mac) and describe what you want. The model chooses from the app's own functions, runs them in order and tells you what changed. Some examples:

Start a sci-fi story about a lighthouse on MarsWrites the opening and three choices.
Only show the secret door if the reader found the keyAdds a condition and an effect to the right choices.
Can every ending actually be reached?Runs the analysis and reports problems.

Instructions you save in the same box, such as "keep it short" or "I'm a beginner", are added to every AI request the app makes.

Features

Layered graph layout
BFS depth) with curved edges, pan/zoom, and '+' stubs for unwritten choices.
AI branch writing
With path-aware context; nudges toward endings as paths deepen.
Passage editor
Title, text, endings, choices wired to new or existing passages (merge branches).
AI suggest-choices
And rewrite-in-tone (more vivid, darker, funnier, shorter, more dialogue).
AI continuity check along the
Path to any passage.
Story stats
Passages, endings, open threads, longest path, unreachable nodes.
Gamebook play mode
With back navigation; Twee 3 (Twine 2/Harlowe) and JSON export/import.
Story variables
Choices can be shown only when a condition holds (trust >= 2 && hasKey) and can change variables when taken (trust += 1; hasKey = true); passages can show {variables} and {if …}…{/if} text. Expressions use a small tokenizer and recursive-descent parser, never eval.
Analysis page
Explores every reachable (passage, variables) state to report which endings can actually be reached and how often, unreachable passages, dead ends, choices whose conditions can never be met, unwritten choices and invalid logic.
Export a single self-contained HTML
File that plays the story in any browser, alongside JSON and Twee 3 for Twine 2 with variables translated to Harlowe (set:)/(if:) macros.

Runs in your browser

Graph model, layout, editing, statistics, play mode, Twee/JSON serialization. None of this needs a network connection or a model.

Uses a language model for

Opening + branch generation with rolling path context. Continuity auditing, choice suggestions and tone rewrites.

Notes

Cost
Free. Each account has a daily allowance of AI requests.
Your data
What you make stays in this browser on this device. Your account is only used for signing in and for the built-in AI. You can export a backup or clear everything from Settings.
AI access
Signed-in users get the built-in AI with nothing to set up. You can also use your own Groq or OpenRouter key under Settings.
Source
The code and tests are on GitHub under the MIT license. The tests also run in your browser.