Story Maintenance
Overview
Run deterministic maintenance for Story Skills projects. Use the CLI for structure validation, registry rebuilds, word counts, link checks, continuity checks, project reports, next-action reports, pacing, clue, voice, and name checks, revision-pass tracking, Mermaid diagrams, schema migration, entity helpers, manuscript import, and manuscript export and builds. The creative skills still own story decisions; this skill handles mechanical consistency.
CLI Access
Prefer the first available command:
story <command>- when the package bin is installedbun run story -- <command>- when working from this repositorynode scripts/story.js <command>- bundled fallback, resolvingscripts/story.jsrelative to this skill folder
If none of these are available, perform the requested maintenance manually using the conventions in story-init.
Run the installed or bundled CLI in place. Do not copy scripts/story.js into the user's story project, and do not create project-local build scripts, generator scripts, or bulk writer scripts to generate story content. Story projects should remain markdown-first, plus explicitly requested exports such as manuscript.md.
Commands
Run commands from the story project root, or pass the story path explicitly.
story validate .
story reindex .
story wordcount . --write
story links .
story continuity .
story prose .
story voices .
story pacing .
story clues .
story timeline .
story passes .
story passes . --init
story passes . --start structure
story passes . --done structure
story names "Mira" "Kelvos"
story diagram relationships
story diagram locations --out dist/locations.mmd
story diagram timeline
story diagram clues
story diagram arcs
story progress . --log
story compare . --ref draft-1
story compare . --against ../book-draft-1
story series .
story import draft.md --title "Title"
story report .
story report . --actionable
story next .
story doctor .
story migrate .
story add character "Name"
story add matter "Dedication"
story add research "Tidal bore timing" --source "Tide tables 2024" --used-in chapter-03
story add research "Night shift on a cardiac ward" --method interview --accuracy must-be-accurate --confidence medium --risk medical
story add matter "Acknowledgments" --placement back
story rename character old-id "New Name"
story remove promise old-promise
story export . --out manuscript.md
story build . --format markdown
story build . --format epub
story build . --format docx
story build . --format shunn
story build . --format docx --shunn
story build . --format html
story build . --format print --trim 6x9
story build . --format narration
story build . --format metadata
story knowledge sera-voss --at chapter-04
story add clue "The silver locket" --planted chapter-02 --payoff chapter-05
story synopsis --pages 1
story synopsis --pages 3 --out synopsis.md
Use:
validateafter initialization and at the end of any multi-file editreindexafter adding, removing, or renaming any entity file. It rebuilds the character, location, system, faction, artifact, arc, chapter, scene, question, promise, clue, and glossary registries.story addreindexes itself; a hand-written file does notwordcount --writeafter writing or revising chapterslinksafter changing character relationships, notable locations, arc participants, or chapter referencescontinuityafter drafting or revising a chapter, and whenever the user asks about contradictions, dead characters appearing, unfired setups, or stale state; it deterministically checksdied-inordering, promise/question chapter ordering, Chekhov gaps, POV/cast consistency, andcontinuity/state.mdreferences. It reuses the promise-ordering machinery for the clue ledger (continuity/clues/): payoff before plant is an error, and a completed story with planned or planted clues is an error. The Chekhov warning (a clue or promise planted three or more chapters ago) requiresstatus: planted.story add clue --plantedrecords the chapter and leavesstatus: planned, so setstatus: plantedwhen the clue is on the page. A recorded payoff chapter that is still ahead of the latest chapter suppresses the "no payoff yet" warning. It also checks prop custody — artifacts withdestroyedorloststatus must not be referenced after their destruction chapter (recorded in object-statesince: chapter-NN; later scenes referencing them instate-changesormentionsare errors) — and clock/time plausibility when scenes or chapters carrydate: YYYY-MM-DD/time: HH:MMfrontmatter (time may bedawn,morning,midday,afternoon,evening, ornight; scenetravel-hours: Nasserts the minimum time since the previous dated scene in chapter order; a character, by scenecharactersorpov, in two dated scenes at locations linked by locationroutes, with less story time between them than the fastest route, is an error. The route check reads scenedate,time, andlocationonly, not chapter dates; a named time is a span such asmorning05:00-11:59, an untimed scene spans its whole day, and only journeys impossible on every reading are reported). No dates means no time findings. Intentional exceptions go incontinuity/exemptions.md(frontmattertype: exemption-log, entries withpattern+reason); exempted findings are reported as dismissed, not errorscompareafter a revision pass, or when the user asks what changed since a draft:--refreads chapters at a git branch, tag, or commit withgit show(it never writes to the repository), and--againstreads another copy of the project. It reports per-chapter word changes, added and removed chapters, and the share of paragraphs unchanged. See Draft Snapshots in therevision-continuityskill for taking the snapshotprogresswhen the user asks how far along the book is, whether they will make a deadline, or after a writing session: it reports words againststory.mdtarget-words, days left todeadlineand words a day needed, chaptertarget-words, and pace fromprogress.md.--logrecords today's total there (--date YYYY-MM-DDto backfill); only log when the user keeps a log or asks for itpacingwhen the user asks about pacing, sagging middles, or chapter endings, and after drafting or restructuring chapters: per chapter it shows words, scene and sequel counts, sceneoutcomes (yes,no,yes-but,no-and), and the chapterhook(cliffhanger,question,revelation,reversal,decision,emotional,resolution). It warns about three or more consecutiveyesoutcomes, four or more scene units with no sequel, chapter length outliers (over 2x or under 0.5x the median once three chapters have prose), three or more consecutive chapters ending onresolution, and drafted chapters with nohook. See theplot-structureandscene-craftskillscluesfor mysteries and any story with a clue ledger: prints a clue-by-chapter matrix (Pplanted,Rpayoff,xboth,.none;~after a clue name marks a red herring) and warns about a payoff with no plant, a late plant (same chapter as the payoff, or the one before), a clue with nocharacters, three or more genuine live clues (not red herrings) with nonesignificance-delayed, and ared-herring: trueclue with nopayoff. See thegenre-craftskillvoiceswhen dialogue voices may blur or during a line pass: attributes quoted lines (straight, curly, or British single quotes) to the character the narration names next to a speech verb ("...," Mara said,said Mara,Mara asked, aliases included; a name before the verb wins), or else to the only character the paragraph names (an action beat). Pronoun tags (she said) are never attributed, so a close-third POV character is often under-counted. It reports lines, words, mean sentence length, contraction, question, and exclamation rates, and signature words. It warns when a character says avoice-avoidword, when two characters with five or more lines have near-identical fingerprints ("X and Y may sound alike: ..."), and when avoice-wordsentry is never said. See thevoice-styleandline-editingskillspassesto track named revision passes instory.mdrevision-passes({pass, status}, statuspending,in-progress, ordone).--initwrites the default ladder (structure,character,theme,continuity,pacing,line,copyedit,proof) and keeps existing entries;--start <pass>and--done <pass>update one; with no flag it prints the checklist and the checks each default pass runs. When the storystatusisrevising,nextrecommends the next unfinished pass. See therevision-continuityskillnamesbefore naming a character, place, faction, artifact, system, or glossary term:story names <name...>checks candidates against every existing name and alias. A candidate's given name (first word that is not a title or article such asthe,lord, orcaptain) is compared with each character's given name, and everything else as a whole name; an exact match with either is a clash, an error (exit 1). Look-alikes (the same first four letters, or the same initial within edit distance 1, or 2 when both words have five letters or more) and a given name sharing an initial with a protagonist, antagonist, deuteragonist, or narrator are warnings. Multi-word names are only checked for exact clashes, so pass a multi-word name's distinctive words separately. Pass--path <project>when not in the project rootdiagramwhen the user wants a picture of the story's structure:story diagram <kind>prints Mermaid source generated from frontmatter, or writes it with--out <file>(--path <project>sets the project). Kinds:relationships(character graph, family edges styled distinctly: the family tree),locations(map-graph from locationroutes, edges labelled with hours),timeline(dated scenes and chapters in story-time order),clues(clue plant to reveal flow per chapter), andarcs(arcs to the chapters that advance them). GitHub, many editors, and mermaid.live render it; regenerate rather than hand-edittimelinewhen the user asks what happens when, how flashbacks sit against the main line, whose POV dominates, or where a character drops out: it orders dated scenes (and chapters without scene records) bydateandtime, marks entries told after later events, lists undated scenes in reading order, totals chapters and words per POV, and reports each character's chapter presence, longest absence, and absence from the final chapters. It is read-only;continuityowns clock errorsprosewhen the user asks for a prose check or before sharing a draft: per chapter it counts sentence length and spread, filter words and -ly adverbs per 1,000 narration words, plain and said-bookism dialogue tags, echoed words, watch words, and avoided spellings fromstyle-sheet.md(dialect,preferred,watch-words,allow-words); across the manuscript it lists repeated 4-word phrases and similar character first names. Findings are advisory warnings and the command exits 0. See thevoice-styleskill for acting on themserieswhenstory.mdhasfollowsorprecedeslinks to other books; it orders the linked sequels and prequels by chronology and checks shared canon (characters deceased in an earlier book, cast listings, facts relearned across books, name drift, destroyed artifacts). Useinit --follows <path>orinit --precedes <path>to start a linked book, and see theseries-continuityskill for carrying canon acrossimportwhen the user has an existing manuscript or chapter drafts and wants a Story Skills project built from them; follow up by creating character and location files from the printed entity candidates. Directory sources import in natural file-name order (chapter-2beforechapter-10).import --forceinto an existing directory deletes everychapter-NN.mdinchapters/before writing the imported chapters, so confirm with the user before forcing an import over a project with drafted chaptersreportwhen the user asks for project status, inventory, progress, or a quick health summarynextbefore a drafting session to identify the next deterministic actiondoctorwhen the user asks what is stale, broken, or inconsistentmigratewhen a project has an older schema version or missing v2 pathsadd,rename, andremovefor deterministic entity file operations when they fit the requested changeinit --form <form>recordsforminstory.md(novel,novella,novelette,short-story,flash,serial,picture-book,chapter-book) and sets a defaulttarget-wordswhen none is given;validatewarns whentarget-wordsis outside the form's usual range andreportshows the formadd matterwhen the user wants a dedication, epigraph, copyright page, acknowledgments, author's note, about-the-author, or also-by page. Pages live inmatter/(indexed inmatter/_index.mdby reindex) withtitle,placement(frontorback),order, andheading(setheading: falsefor a dedication or epigraph). Write the page text directly in the file; unwritten pages are left out of builds andvalidatewarns about them. Never invent acknowledgments, biographical facts, or copyright details: ask the user for them. Matter pages that quote others' work (an epigraph, song lyrics) may recordpermission(not-needed,pending,granted,public-domain),rights-holder, andcredit;validatewarns whenpermission: pendingremains on a complete story and whengrantedhas norights-holder. See theeditorial-reviewskilladd researchwhen the story relies on a real-world fact: notes live inresearch/withstatus(open,verified,disputed), whole-citationsources, andused-inchapter ids, plus optional--accuracy(must-be-accurate,blended,invented),--confidence(high,medium,low),--method(fact,interview,site-visit,expert-review,reading), and repeatable--risk(legal,medical,weapons,safety,cultural,defamation,technical).validatewarns when a final chapter relies on open or disputed research (invented notes never trigger this), and when a note with ariskis used in a final or complete chapter with noreviewed-by. See theresearchskillexportonly when the user asks for a combined manuscript at a specific path; it includes front and back matterbuildwhen the user asks to build the book artifact; supports markdown, EPUB, DOCX, Shunn, HTML, print, narration, and metadata outputs indist/, with front and back matter. For EPUB, setcover: path/to/cover.jpg(inside the project) andauthorinstory.mdto embed a cover image and creatorbuild --format htmlwhen the user wants a review or reading copy for people who never open a terminal: a single HTML file with a table of contents and a stable paragraph anchor on every paragraph, shown faintly in the margin as a link labelledch03-p12(chapter 3, paragraph 12), that reviewers cite in notes.templates/github/review-copy.ymlpublishes it to GitHub Pages; see thefeedback-triageskillbuild --format printfor a print-ready interior: HTML with CSS paged media, trim size from--trim(5x8,5.25x8,5.5x8.5,6x9,a5; default5.5x8.5), mirrored margins with gutter, running heads (author on verso, chapter title on recto, blank on chapter openings), page numbers at the foot of chapter and back-matter pages, chapters on recto, a raised initial at each chapter opening, widow and orphan control, and a copyright page. Render it to PDF with a paged-media engine the user installs (Paged.js CLIpagedjs-cli, WeasyPrint, or Prince); the CLI does not bundle one. See thepublishingskillbuild --format narrationfor an audiobook narration script: a pronunciation guide table from everypronunciationfield, each chapter with an estimated finished runtime at 155 words per minute, scene breaks as[pause], and a total runtime. See theadaptationskillbuild --format metadatafor a retailer metadata sheet fromstory.md: title, series, authors, ISBN, publisher, date, language, description with its character count against common limits (KDP 4,000), keywords, BISAC subjects, word count, estimated page count, AI disclosure, and a readiness checklist of missing fields. See thepublishingskillbuild --format epubalso writes EPUB 3 accessibility metadata, language, semantic chapter and matter markup, and a landmarks nav, and uses the optionalstory.mdpublishing fields (cover-alt,isbn,publisher,publication-date,description,subjects,language, andcopyright, which generates a copyright page when no copyright matter page exists)build --format shunnwhen the user wants Shunn manuscript-format markdown: title page, contact block, word count, chapter breaks, and double-spaced prose;story build . --format docx --shunnapplies the same Shunn formatting to the DOCX outputknowledgewhen the user asks what a character knew at a given chapter:story knowledge <character-id> --at <chapter-id>lists knowledge-state entries whoselearned-inchapter is at or before that chapter, plus entries withoutlearned-inas pre-existing knowledgeadd cluewhen the user plants a new clue:story add clue "Name" --planted chapter-02 --payoff chapter-05creates the clue ledger entity incontinuity/clues/withstatus: planned; omit--payoffwhen the payoff is not yet known, pass--red-herringfor a clue meant to mislead, and setstatus: plantedwhen the clue is on the pagesynopsiswhen the user wants a mechanical synopsis: the first sentence ofstory.md's## Synopsissection, then each arc's Setup, Rising Action, Climax, and Resolution. One page is 500 words and three pages is 1500.story synopsis [--pages 1|3] [--out file]. The output is a scaffold; thesubmissionskill rewrites it into an agent-ready synopsis
Failure Handling
- Treat CLI errors as actionable maintenance findings.
- Fix broken references, missing required files, stale registries, or incorrect word counts when the requested task implies doing so.
- Do not overwrite creative prose or story content merely to satisfy a mechanical check.
- If a validation warning reflects intentional user data, report it rather than silently changing it.
- If
story reindexfails on a corruptplot/_index.md, do not hand-edit story content to work around it: restore the index frontmatter from git, or deleteplot/_index.mdso reindex rebuilds it, then rerun.