Story Skills: a continuity compiler for AI-written fiction
My open-source Agent Skills bundle gives coding agents a shared story bible format — and a deterministic CLI that catches dead characters walking, payoffs before setups, and unfired Chekhov guns.
Language models write good prose now. What they can’t do is remember it. Ask an agent to draft chapter twelve of your novel and it will happily resurrect a character who died in chapter three, pay off a setup you never planted, and forget the magic system rules it invented last week. The prose sings; the story doesn’t hold together.
This is the problem Story Skills exists to solve. It’s my open-source bundle of Agent Skills for planning, tracking, and drafting fiction in markdown, packaged as Codex and Claude Code plugins, plus a deterministic CLI that treats your story bible as a checkable contract. The pitch in one sentence: prose is the model’s job; continuity is the compiler’s job.
Why prompts can’t fix this
Long-range consistency is the thing language models are worst at, and it’s not a prompting problem. You can stuff the entire manuscript into context, add “be consistent” to the system prompt, and still get a dead character walking into a scene. The failure mode is structural: consistency across 80,000 words is a constraint-satisfaction problem, and models do constraint satisfaction approximately. Compilers do it exactly.
Story Skills splits the work along that line. The skills teach the agent how to write fiction — scaffolding a story bible, building characters, planning arcs, drafting chapters. The CLI checks the facts deterministically, the way a type checker catches type errors: deaths, promises, payoffs, open questions, scene casts, object state. The agent writes; the machine verifies.
The story bible
Everything is plain markdown with YAML frontmatter. Running story-init (or saying “start a new story”) scaffolds a standard project layout:
my-story/
├── story.md # Story bible — title, genre, themes, POV, tense
├── characters/ # Character profiles with relationships and arcs
├── worldbuilding/ # Locations, systems, factions, artifacts
├── plot/ # Arcs, timeline
├── scenes/ # Machine-readable scene registry
├── continuity/
│ ├── state.md # Character, object, and knowledge state
│ ├── questions/ # Open questions (mysteries to resolve)
│ └── promises/ # Setups and their payoffs
├── glossary/
└── chapters/ # Chapter draftsEvery entity gets a kebab-case identifier (sera-voss, chapter-01), each domain has an _index.md registry, and references are maintained bidirectionally. The format is the contract: any agent that can read markdown and YAML can work with it, which is why the same skills install into Codex, Claude Code, Copilot, Cursor, Windsurf, Gemini CLI, and OpenCode.
The continuity engine
The companion story CLI is where the interesting bit lives. story continuity checks deterministic contracts: who died when, which promises paid off where, which questions are still open, who’s in each scene, what objects exist and in what state. Contradictions come back exact and file-addressed.
The repo ships a deliberately broken mystery, examples/the-unraveled-thread, to show the full range. Every file is well-formed — it passes story validate and story links cleanly — but the story doesn’t hold together:
$ story continuity examples/the-unraveled-thread
Continuity check failed: 4 errors, 3 warnings
error: chapters/chapter-04.md lists edran-vale, who died in chapter-02; move posthumous appearances to mentions
error: continuity/promises/the-broken-compass.md pays off in chapter-02 before it is planted in chapter-03
error: continuity/questions/who-burned-the-mill.md resolves in chapter-02 before it is introduced in chapter-03
error: continuity/state.md knowledge-state[0] references missing chapter chapter-05
warning: chapters/chapter-03.md POV character nessa-thorn is not listed in characters
warning: continuity/promises/the-sealed-letter.md was planted in chapter-01, 3 chapters ago, and has no payoff yet
warning: continuity/state.md object-state[0] status active conflicts with worldbuilding/artifacts/vales-compass.md status destroyedThese findings are reproducible. CI asserts them on every commit. Intentional flashbacks and posthumous appearances stay legal through the chapter mentions field, so the system models authorial intent instead of fighting it. story doctor and story next fold the same checks into prioritized repair actions.
The full command set covers the boring-but-essential maintenance: validate, reindex, wordcount, links, rename (updates kebab-case references across frontmatter and link targets without touching prose), series (chronology and shared-canon checks across sequels and prequels), export (single-manuscript markdown), and build (EPUB/DOCX artifacts).
One design rule: the CLI never writes prose. Agents write story content directly to markdown files. The CLI maintains the contract around it. This keeps the boundary clean — nondeterministic creativity on one side, deterministic verification on the other.
The eight skills
| Skill | What it does |
|---|---|
| story-init | Scaffolds the story bible, folders, and registries |
| character-management | Character profiles with relationships, traits, arcs, family trees |
| worldbuilding | Locations and systems: magic, politics, technology, religion |
| plot-structure | Arc planning — three-act, hero’s journey, Save the Cat, kishotenketsu |
| chapter-writing | Outline-first chapter drafting that pulls from story context |
| revision-continuity | Revises drafts, audits continuity, keeps state consistent |
| series-continuity | Sequels and prequels as linked projects with shared canon checks |
| story-maintenance | Runs the deterministic CLI checks, reports, and exports |
For stronger prose, pair chapter-writing with the better-writing skill — voice calibration, anti-generic-writing checks, and a final prose pass. It installs the same way.
Write a book via pull requests
A story project with deterministic checks is a story project an agent can advance unattended. The templates/github/ workflows turn a story repo into a self-drafting book:
- story-checks.yml runs
validate,links,continuity, andreport --actionableon every push and PR, so a chapter PR can’t merge with a continuity contradiction. - draft-next-chapter.yml runs Claude Code on a schedule: it asks
story nextfor the next deterministic action, drafts the chapter with the chapter-writing skill, updates scene records and continuity state, runs the maintenance checks, and opens a PR for review.
Copy both files into .github/workflows/, add an ANTHROPIC_API_KEY secret, and review one chapter PR per morning. The human’s job becomes editorial: approve the chapter, fix the prose, merge.
Most writers don’t start from a blank page, so story import reverse-engineers a project from an existing manuscript — splitting on chapter headings, building registries and word counts, and suggesting entity candidates for the bible.
Proof it works
- The Cormorant Tide — a full story project generated with Story Skills.
- Pippa and the Borrowed Star — a complete children’s Christmas story: 6 chapters, 2,183 words.
examples/the-last-ember/— fantasy example with characters, a magic system, a foreshadowed arc, and a drafted first chapter.examples/the-fall-of-the-citadel/— a linked prequel sharing canon with The Last Ember;story serieschecks the chronology.
The repo also has an evals/ harness that regression-tests the writing skills themselves: fixtures seed a drafting brief with known canon and known traps, and a dependency-free checker verifies drafts keep the canon and spring none of the traps.
Install
# Codex
codex plugin marketplace add danjdewhurst/story-skills
codex plugin add story-skills@story-skills
# Claude Code (inside a session)
/plugin marketplace add danjdewhurst/story-skills
/plugin install story-skills@story-skills
# Any SKILL.md-compatible agent
npx skills add danjdewhurst/story-skillsThen say “start a new story.”
The takeaway
The agent-coding world learned this lesson years ago: you don’t get reliability from better prompts, you get it from better tooling around the model — linters, type checkers, test suites, CI. Fiction is just late to the same insight. Story Skills applies the software playbook to storytelling: the model drafts like a brilliant, forgetful novelist, and the toolchain remembers everything. It’s MIT licensed: github.com/danjdewhurst/story-skills.