Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat: editorial check for storyboard appearance/prop continuity (LLM diff) (#1467)
Adam Eivy8c2ca04e2467
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex f0e59a2380..2063d5ded0 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -9,6 +9,7 @@- **[issue-1455] Mood board cross-surface integration — "Pin to mood board" everywhere media appears, plus a reference strip in creation flows.** Follow-up to the Mood Boards core canvas (#911), wiring boards into the rest of the Create suite. **(1) Pin affordance** — every generated image/video card and the media lightbox now carries a **Pin to mood board** button (the grid-icon sibling of "Add to collection"), so you can pin from Image Gen, Video Gen, Media History, Catalog media, and inside a collection through one shared control. The popover lists your boards, toggles membership (pin/unpin), and creates-and-pins a new board inline — pinning stores the asset's `<kind>:<ref>` media-key plus its preview thumbnail as the board item's `imageUrl`, so a *video* pin renders a frame even though a `video:` key has no derivable thumbnail path. **(2) Creation-flow reference strip** — a collapsible **Mood board reference** strip now appears in the New Series form (Series Pipeline) and the Universe Builder's Starter-idea panel: pick one of your boards and its pinned reference images show inline, so collected inspiration is visible at the moment you're describing a new universe / series (it remembers the last board per flow). The pin popover reuses the existing collection-picker shell (generalized to accept an injectable data source rather than duplicating the positioning/search/create plumbing), and the board-item image resolver is now a shared `moodBoardItemSrc` helper. (`client/src/components/media/{PinToMoodBoardMenu,CollectionPickerShell,MediaCard,MediaLightbox}.jsx`, `client/src/components/moodBoard/MoodBoardReferenceStrip.jsx`, `client/src/lib/moodBoardItemSrc.js`, `client/src/pages/{Pipeline,UniverseBuilder,MoodBoardDetail}.jsx`, #1455)- **[issue-1408] LoRA training quality-of-life: vision-assisted reference-sheet slicing, caption with Claude/Codex CLI providers, and a richer training queue.** Three improvements to building character LoRAs (Create → LoRA Training). **(1) Smarter sheet slicing** — "Slice reference sheet" now offers *Auto-detect figures with a vision model*, which asks a vision model to draw a tight box around each figure on the turnaround and crops those instead of a rigid grid; it falls back to the columns×rows grid automatically when no vision model is installed or detection finds nothing, so you still get crops to prune either way. **(2) Caption with a CLI model** — the caption-model picker now also lists vision-capable CLI providers (Codex / Claude Code), so you can auto-caption a dataset with `codex` or `claude` (vision) rather than only a local LM Studio / Ollama vision model. **(3) Training queue at a glance** — the new Training queue on the LoRA Training page shows each run's loss curve (a sparkline over its checkpoints) and sample thumbnails right in the row, so you can watch a run learn — and spot a divergence — without opening it. (Part of #1227, #1408)- **[issue-1466] Editorial check flags storyboard eyeline-match breaks — the LLM-assisted sibling of the deterministic shot-continuity check.** A new **Storyboard eyeline match (gaze continuity)** LLM check (Create → Editorial Checks) reads a scene's per-issue storyboard shots and flags the eyeline mistakes a deterministic scan can't compute: two characters in conversation whose **gaze directions don't reciprocate** across the cut (both look the same way instead of toward each other), a **described eyeline that contradicts the shot's tagged screen direction** (the storyboard's own two signals disagree), and a **reverse-angle that doesn't flip the eyeline**. Where the deterministic **Storyboard shot continuity** check (#1315) reasons over the structured `shotType`/`screenDirection`/continuity-link fields for 180°-rule axis reversals and shot-type monotony, an eyeline match needs *semantic* reading of the free-text shot descriptions — so this one runs an LLM over a compact per-scene shot block (id, framing, direction, continuity link, description), built only from scenes that have two-or-more described shots to compare. Findings render as `Continuity` notes anchored to the offending shot pair + issue. Gaze is read from the free-text shot description (the `screen direction` field records where a subject *faces or moves*, which isn't always where they look), and the pass is bounded four ways (scene count, shots-per-scene, a hard total-character ceiling, and per-shot description length) with non-silent omission/truncation markers so a very large storyboard — wide, deep, or with one pathological scene — can't overflow the model context. The check skips the model call entirely when no scene qualifies. Ships a new stage prompt (`pipeline-editorial-eyeline-match`) that migrates for existing installs (117). (`server/lib/editorial/shotContinuity.js`, `server/lib/editorial/checkRegistry.js`, `data.reference/prompts/stages/pipeline-editorial-eyeline-match.md`, `scripts/migrations/117-editorial-eyeline-match-stage.js`, Part of #1283, #1466)+- **[issue-1467] Editorial check flags storyboard appearance / prop continuity — the LLM diff the name-matching shot parser can't do.** A new **Storyboard appearance / prop continuity** LLM check (Create → Editorial Checks) reads a scene's per-issue storyboard shots and diffs the *descriptions* of the same entity across shots, catching the continuity errors a vocabulary scan can't: the same named character described with **conflicting wardrobe / hair / physical state** (a "red jacket" in shot 1, a "grey coat" in shot 3, with no costume change described), a **prop that appears, vanishes, or transforms** with no action removing it (a coffee cup that pops in and out; a "mug" that becomes a "glass"), and a **setting whose weather / time-of-day / layout contradicts** across shots with no transition. Where the deterministic **Storyboard shot continuity** check (#1315) reasons over structured framing/direction fields and its eyeline sibling (#1466) judges gaze reciprocity, this one needs *semantic* comparison of two free-text descriptions — the shot parser matches characters by name but never diffs what they look like — so it runs an LLM over the same compact per-scene shot block (shared `summarizeStoryboardShots`, built only from scenes with two-or-more described shots, bounded four ways with non-silent truncation markers). Findings render as `Continuity` notes anchored to the offending shot pair + issue; deliberate changes the description justifies, single-shot details, and pure framing differences are explicitly not flagged. The check skips the model call entirely when no scene qualifies. Ships a new stage prompt (`pipeline-editorial-appearance-continuity`) that migrates for existing installs (118). (`server/lib/editorial/checkRegistry.js`, `data.reference/prompts/stages/pipeline-editorial-appearance-continuity.md`, `scripts/migrations/118-editorial-appearance-continuity-stage.js`, Part of #1283, #1467)- **[issue-1412] Editorial check classifies unmodeled proper nouns used as character names — the LLM-assisted half of roster economy.** A new **Unmodeled proper nouns used as character names** LLM check (Create → Editorial Checks) closes the gap the deterministic **roster economy** check (#1292) deliberately left open: that scan only sees canon names + aliases, so a proper noun used as an *apparent* character name that was never added to the story bible is invisible to it. This check surfaces those — and **classifies** each one, because a keyword scan can't tell a person from a place, organization, brand, or honorific. It reads the stitched manuscript plus your canon roster (names + aliases) as an exclusion list, flags capitalized proper nouns used as character names that are **absent from canon**, and calls out **throwaway one-appearance names** the reader is told to remember but who never recur — suggesting either adding them to canon or recasting them as an unnamed description. Unlike roster economy it runs even on an **empty bible** (then every named proper noun is a candidate). The LLM does only the judgment it alone can — surface a name and confirm it's a *person* — while a **deterministic pass counts each surfaced name's appearances across the whole manuscript and authors the verdict** (one-appearance throwaway vs recurring), so a long book reviewed in chunks never mislabels a name that appears in chapters 1 and 12 as a throwaway (and the same name surfaced from two chunks collapses to one finding). Findings render as `Casting` notes anchored to the issue + a verbatim quote. Ships a new stage prompt (`pipeline-editorial-unmodeled-names`) that migrates for existing installs (116). (`server/lib/editorial/checkRegistry.js`, `data.reference/prompts/stages/pipeline-editorial-unmodeled-names.md`, `scripts/migrations/116-editorial-unmodeled-names-stage.js`, Part of #1283, #1412)- **The Local LLM Playground now shows which Ollama models are warm in memory (and which one is processing).** The models sidebar reads Ollama's `/api/ps` (the same loaded-model probe the Memory Management panel uses) and flags each resident model with a green **In memory** badge carrying its VRAM footprint, plus a relative **"frees in Nm"** countdown until Ollama auto-evicts it. While a run is in flight, the model(s) it's driving show a **Processing** badge with a live spinner — derived from the playground's own in-flight run since `/api/ps` reports residency but not which model is mid-generation. A header chip summarizes **"N in memory"** at a glance. The loaded list polls every 6s (2s while busy) and refreshes on the manual refresh button. (`client/src/pages/LocalLlmPlayground.jsx`)diff --git a/data.reference/prompts/stage-config.json b/data.reference/prompts/stage-config.jsonindex f597ca9c28..a85fd91492 100644--- a/data.reference/prompts/stage-config.json+++ b/data.reference/prompts/stage-config.json@@ -652,6 +652,13 @@"model": "default","returnsJson": true,"variables": []+ },+ "pipeline-editorial-appearance-continuity": {+ "name": "Pipeline — Editorial Check: Storyboard appearance / prop continuity",+ "description": "Editorial check (#1467): LLM diff of a scene's storyboard shot descriptions for appearance/prop continuity breaks — the same character described with conflicting wardrobe/hair/state, a prop that appears/vanishes/transforms, or a setting whose weather/time/layout contradicts across shots, with no action justifying the change. The semantic sibling of the deterministic visual.shot-continuity check (the shot parser matches characters by name but never diffs their descriptions); reads the per-issue storyboard shots (storyboard.shots). Returns issue-anchored findings.",+ "model": "default",+ "returnsJson": true,+ "variables": []}}}diff --git a/data.reference/prompts/stages/pipeline-editorial-appearance-continuity.md b/data.reference/prompts/stages/pipeline-editorial-appearance-continuity.mdnew file mode 100644index 0000000000..479658c0ea--- /dev/null+++ b/data.reference/prompts/stages/pipeline-editorial-appearance-continuity.md@@ -0,0 +1,77 @@+# Pipeline — Editorial Check: Storyboard appearance / prop continuity++You are a continuity editor doing a single focused pass over a comic/film+storyboard for ONE problem: **appearance and prop continuity** within a scene.++Within a single scene/sequence the same character, prop, or setting must be+described CONSISTENTLY from shot to shot. A character wearing a "red jacket" in+shot 1 who appears in a "grey coat" in shot 3, a coffee cup that is present in+one shot and gone the next with no action removing it, a hairstyle or wound or+weather that silently changes — these are continuity errors the reader notices.+The shot parser matches characters by name across shots but never diffs their+DESCRIPTIONS, so this pass exists to catch a description that contradicts an+earlier one for the same entity.++Flag ONLY these appearance/prop continuity problems:++- **Wardrobe / appearance contradiction.** The same named character is described+ with conflicting clothing, hair, color, age, or physical state across two shots+ in the same scene, with nothing in between explaining the change (no costume+ change, no injury described).+- **Prop appears, vanishes, or transforms.** An object held, worn, or placed in+ one shot is gone in a later shot of the same scene with no action removing it —+ or it changes into something else (a "mug" becomes a "glass", a "pistol"+ becomes a "rifle").+- **Setting / environment contradiction.** The same location is described with+ conflicting weather, time of day, furniture, or spatial layout across shots in+ the same scene, with no transition justifying it.++## Shots to check++Each scene lists its shots in order. A shot line carries its id, its framing and+tagged screen direction in brackets, an optional "continues from" continuity+link, and the free-text description (the authority for what each character, prop,+and setting looks like):++```+{{shots}}+```++## Task++For each continuity break, name the offending shot pair by id, quote the+conflicting detail from each side, identify the entity (character / prop /+setting) that changed, and suggest the smallest fix (align one description to the+other, or add the action that justifies the change).++Use the scene/issue label and the two shot ids as the `location` (e.g.+`Issue 4 — INT. KITCHEN: shots shot-01 ↔ shot-03`). Set `issueNumber` to the+issue number shown in that scene's header when present (omit it otherwise).++Do NOT flag: a deliberate change the description explains (a character who "pulls+on a coat", a prop someone "sets down and walks away from"), a difference that is+just a closer or wider framing of the same thing, a detail mentioned in only one+shot (absence is not a contradiction), or framing/eyeline/shot-type issues (other+checks cover those). Only a genuine contradiction for the SAME entity across two+shots of the SAME scene is a break. If nothing breaks appearance/prop continuity,+return an empty `findings` array — do not invent issues.++## Output contract++Return ONLY valid JSON matching this shape — no prose, no markdown fence, no+commentary:++```json+{+ "findings": [+ {+ "severity": "high|medium|low",+ "issueNumber": 4,+ "location": "Issue <n> — <scene>: shots <idA> ↔ <idB>",+ "problem": "1–3 sentences naming the entity and the contradiction, quoting the detail from each shot",+ "suggestion": "1–3 sentences on the smallest fix (align a description or add the justifying action)",+ "anchorQuote": "short verbatim quote from one of the conflicting shot descriptions"+ }+ ]+}+```diff --git a/scripts/migrations/118-editorial-appearance-continuity-stage.js b/scripts/migrations/118-editorial-appearance-continuity-stage.jsnew file mode 100644index 0000000000..968a85a550--- /dev/null+++ b/scripts/migrations/118-editorial-appearance-continuity-stage.js@@ -0,0 +1,75 @@+/**+ * Seed the `pipeline-editorial-appearance-continuity` stage into existing installs (#1467).+ *+ * Mirrors `117-editorial-eyeline-match-stage.js`: copies the `.md` template+ * from `data.reference/prompts/stages/` and merges the stage-config entry into+ * `data/prompts/stage-config.json`. Boot runs migrations (server/index.js) but+ * NOT `setup-data.js`, so an upgrade that pulls + `pm2 restart`s (rather than+ * running `update.sh`) would otherwise leave the new appearance-continuity stage+ * unseeded and the `visual.appearance-continuity` editorial check would throw+ * "Stage not found" the first time it runs.+ */++import { access, copyFile, mkdir, readFile, writeFile, constants } from 'fs/promises';+import { dirname, join } from 'path';++const FILENAME = 'pipeline-editorial-appearance-continuity.md';+const STAGE_KEY = 'pipeline-editorial-appearance-continuity';++export default {+ async up({ rootDir }) {+ const stagesDir = join(rootDir, 'data', 'prompts', 'stages');+ await mkdir(stagesDir, { recursive: true });++ const dataPath = join(stagesDir, FILENAME);+ const samplePath = join(rootDir, 'data.reference', 'prompts', 'stages', FILENAME);++ const exists = await access(dataPath, constants.F_OK).then(() => true, () => false);+ if (exists) {+ console.log(`📝 pipeline-editorial-appearance-continuity prompt: already present`);+ } else {+ const sampleExists = await access(samplePath, constants.F_OK).then(() => true, () => false);+ if (!sampleExists) {+ console.warn(`⚠️ pipeline-editorial-appearance-continuity: sample missing for ${FILENAME} — skipping copy`);+ } else {+ try {+ await copyFile(samplePath, dataPath);+ console.log(`✅ seeded ${FILENAME}`);+ } catch (err) {+ console.warn(`⚠️ pipeline-editorial-appearance-continuity: copy failed for ${FILENAME}: ${err.message}`);+ }+ }+ }++ const installedConfigPath = join(rootDir, 'data', 'prompts', 'stage-config.json');+ const sampleConfigPath = join(rootDir, 'data.reference', 'prompts', 'stage-config.json');+ const sampleConfigExists = await access(sampleConfigPath, constants.F_OK).then(() => true, () => false);+ if (!sampleConfigExists) {+ console.warn('⚠️ pipeline-editorial-appearance-continuity: data.reference stage-config.json missing — cannot resolve entry; skipping config write');+ return;+ }+ try {+ const sample = JSON.parse(await readFile(sampleConfigPath, 'utf8'));+ const installedExists = await access(installedConfigPath, constants.F_OK).then(() => true, () => false);+ const installed = installedExists+ ? JSON.parse(await readFile(installedConfigPath, 'utf8'))+ : { stages: {} };+ installed.stages = installed.stages || {};+ if (installed.stages[STAGE_KEY]) {+ console.log(`📝 pipeline-editorial-appearance-continuity stage-config: already present`);+ return;+ }+ if (!sample?.stages?.[STAGE_KEY]) {+ console.warn(`⚠️ pipeline-editorial-appearance-continuity: sample stage-config missing ${STAGE_KEY} — skipping`);+ return;+ }+ installed.stages[STAGE_KEY] = sample.stages[STAGE_KEY];+ await mkdir(dirname(installedConfigPath), { recursive: true });+ await writeFile(installedConfigPath, JSON.stringify(installed, null, 2) + '\n', 'utf8');+ const action = installedExists ? 'merged' : 'created';+ console.log(`📝 pipeline-editorial-appearance-continuity stage-config (${action}): 1 added`);+ } catch (err) {+ console.warn(`⚠️ pipeline-editorial-appearance-continuity: stage-config merge failed: ${err.message}`);+ }+ },+};diff --git a/scripts/migrations/118-editorial-appearance-continuity-stage.test.js b/scripts/migrations/118-editorial-appearance-continuity-stage.test.jsnew file mode 100644index 0000000000..d483759b81--- /dev/null+++ b/scripts/migrations/118-editorial-appearance-continuity-stage.test.js@@ -0,0 +1,86 @@+import { describe, it, expect, beforeEach, afterEach } from 'vitest';+import { mkdtempSync, rmSync, mkdirSync, writeFileSync, readFileSync, existsSync } from 'fs';+import { tmpdir } from 'os';+import { join, dirname } from 'path';+import { fileURLToPath } from 'url';++import migration from './118-editorial-appearance-continuity-stage.js';++// scripts/migrations/<this> → ../.. is the repo root (matches _testHelpers.js).+const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..');++// First-shipment seed migration (mirrors 117) — no MD5 bookkeeping, so the+// seed / no-clobber behavior is asserted directly.++const FILENAME = 'pipeline-editorial-appearance-continuity.md';+const STAGE_KEY = 'pipeline-editorial-appearance-continuity';+const BODY = '# Pipeline — Editorial Check: Storyboard appearance / prop continuity\n\nshipped body\n';++describe('migration 118 — seed editorial-appearance-continuity stage', () => {+ let rootDir;+ let stagesDir;+ let refStagesDir;+ let installedConfigPath;++ const seedReference = ({ withConfig = true } = {}) => {+ writeFileSync(join(refStagesDir, FILENAME), BODY);+ if (withConfig) {+ const refConfigPath = join(rootDir, 'data.reference', 'prompts', 'stage-config.json');+ writeFileSync(+ refConfigPath,+ JSON.stringify({ stages: { [STAGE_KEY]: { name: STAGE_KEY, description: 'desc', model: 'default', returnsJson: true, variables: [] } } }, null, 2) + '\n',+ );+ }+ };++ beforeEach(() => {+ rootDir = mkdtempSync(join(tmpdir(), 'migration-118-'));+ stagesDir = join(rootDir, 'data', 'prompts', 'stages');+ refStagesDir = join(rootDir, 'data.reference', 'prompts', 'stages');+ installedConfigPath = join(rootDir, 'data', 'prompts', 'stage-config.json');+ mkdirSync(stagesDir, { recursive: true });+ mkdirSync(refStagesDir, { recursive: true });+ });++ afterEach(() => {+ rmSync(rootDir, { recursive: true, force: true });+ });++ it('seeds the .md template and merges the stage-config entry on a fresh install', async () => {+ seedReference();+ await expect(migration.up({ rootDir })).resolves.not.toThrow();+ expect(readFileSync(join(stagesDir, FILENAME), 'utf8')).toBe(BODY);+ const installed = JSON.parse(readFileSync(installedConfigPath, 'utf8'));+ expect(installed.stages[STAGE_KEY]).toMatchObject({ returnsJson: true });+ });++ it('is idempotent and never clobbers a customized .md or an existing stage-config entry', async () => {+ seedReference();+ const customBody = '# CUSTOMIZED — do not overwrite\n';+ writeFileSync(join(stagesDir, FILENAME), customBody);+ writeFileSync(+ installedConfigPath,+ JSON.stringify({ stages: { [STAGE_KEY]: { name: 'user-tuned', model: 'custom' } } }, null, 2) + '\n',+ );++ await migration.up({ rootDir });++ expect(readFileSync(join(stagesDir, FILENAME), 'utf8')).toBe(customBody);+ const installed = JSON.parse(readFileSync(installedConfigPath, 'utf8'));+ expect(installed.stages[STAGE_KEY]).toEqual({ name: 'user-tuned', model: 'custom' });+ });++ it('does not throw when the data.reference samples are missing', async () => {+ await expect(migration.up({ rootDir })).resolves.not.toThrow();+ expect(existsSync(join(stagesDir, FILENAME))).toBe(false);+ });++ it('matches the live shipped stage-config key + prompt file (drift catch)', () => {+ const refConfig = JSON.parse(+ readFileSync(join(repoRoot, 'data.reference', 'prompts', 'stage-config.json'), 'utf8'),+ );+ expect(refConfig.stages[STAGE_KEY], `stage-config missing ${STAGE_KEY}`).toBeTruthy();+ expect(refConfig.stages[STAGE_KEY].returnsJson).toBe(true);+ expect(existsSync(join(repoRoot, 'data.reference', 'prompts', 'stages', FILENAME))).toBe(true);+ });+});diff --git a/server/lib/editorial/README.md b/server/lib/editorial/README.mdindex b0bf4ef612..2dd6a84940 100644--- a/server/lib/editorial/README.md+++ b/server/lib/editorial/README.md@@ -112,7 +112,9 @@ against. `storyboard.shots` (#1315) is built off the already-loaded issues (noextra I/O) and injects `ctx.storyboardScenes` (a flat `{ issueNumber, scene }`list for every issue with storyboard scenes), which the deterministic`visual.shot-continuity` check reads for 180°-rule axis reversals + shot-type-monotony. `comicScript` (#1313) fingerprints every issue's AUTHORITATIVE comic content,+monotony and the LLM siblings `visual.eyeline-match` (#1466) and+`visual.appearance-continuity` (#1467) read for gaze reciprocity and+appearance/prop continuity respectively. `comicScript` (#1313) fingerprints every issue's AUTHORITATIVE comic content,keyed by issue number — the edited comic-pages split (`stages.comicPages.pages[]`)when present, else the generated `stages.comicScript.output` (derived from thealready-loaded `ctx.issues`, no extra fetch). The `comic.lettering-density` check@@ -145,7 +147,7 @@ runner-injected `ctx.callInlineLLM` (an inline-prompt sibling of| `italicThoughts.js` | Pure, dependency-free italic-thought primitive for `prose.italic-thoughts` (#1300): `findItalicThoughts` (multi-word markdown `*…*` / `_…_` italic runs, dedup + word-count threshold so single-word emphasis, bold, and `snake_case` are skipped). The LLM siblings (`opening.wrong-start`, `prose.mirror-description`, `dialogue.pleasantries`, `prose.kill-your-darlings`) handle the judgment cases in the #1300 anti-pattern bundle. || `proseTics.js` | Pure, dependency-free copy-edit prose-tic primitives for the #1306 line-edit group: `tokenizeWords` / `splitSentences` (shared tokenization), `findFilterWords` (`prose.filter-words`), `findCrutchWords` (`prose.crutch-words`), `findAdverbs` (`prose.adverbs` — `-ly` adverbs + dialogue-tag adverbs), `findPassiveVoice` (`prose.passive-voice` — be-verb + past-participle heuristic), `findGestures` (`prose.repeated-gestures` — gesture tally + body-part autonomy), plus the seed `FILTER_WORDS` / `CRUTCH_WORDS` / `GESTURE_WORDS` lists. The LLM sibling `prose.telling-emotion` handles the named-emotion judgment case. || `repetition.js` | Pure, dependency-free word-echo & rhythm primitives for #1306: `findWordEchoes` (`prose.word-echoes` — distinctive word repeated within a window), `findRepeatedOpeners` (runs of sentences sharing an opener, "He… He… He…"), and `measureSentenceRhythm` (`prose.sentence-rhythm` — sentence-length variation). Reuses `tokenizeWords` / `splitSentences` from `proseTics.js`. |-| `shotContinuity.js` | Pure, dependency-free storyboard shot-continuity primitives for the deterministic `visual.shot-continuity` check (#1315): `findAxisReversals` (180°-rule axis flips across a continuity-linked shot pair using `screenDirection`) and `findShotTypeMonotony` (a scene whose classified shots all share one `shotType`). Also `summarizeStoryboardShots` (#1466) — renders the collected `{ issueNumber, scene }` storyboard list into a compact per-scene shot block for the LLM `visual.eyeline-match` sibling (gaze reciprocity / eyeline-vs-screen-direction). Reads the shot-grammar fields from `server/lib/shotGrammar.js`. The remaining judgment case (appearance/prop continuity) is an LLM-sibling follow-up. |+| `shotContinuity.js` | Pure, dependency-free storyboard shot-continuity primitives for the deterministic `visual.shot-continuity` check (#1315): `findAxisReversals` (180°-rule axis flips across a continuity-linked shot pair using `screenDirection`) and `findShotTypeMonotony` (a scene whose classified shots all share one `shotType`). Also `summarizeStoryboardShots` (#1466) — renders the collected `{ issueNumber, scene }` storyboard list into a compact per-scene shot block shared by the LLM siblings `visual.eyeline-match` (gaze reciprocity / eyeline-vs-screen-direction) and `visual.appearance-continuity` (#1467 — diffs the same entity's wardrobe/prop/setting descriptions across shots for contradictions). Reads the shot-grammar fields from `server/lib/shotGrammar.js`. || `dialogue.js` | Pure, dependency-free dialogue-tag primitives for the #1307 dialogue-craft group: `findSaidBookisms` (`dialogue.said-bookisms` — ornate speech tags like *expostulated*/*opined* and non-speech tags like "she smiled", matched only when adjacent to a double-quote span) and `findUnattributedDialogueRuns` (`dialogue.attribution-clarity` — runs of consecutive untagged/unbeated dialogue lines where the speaker can't be tracked), plus `attributeDialogueByOwner` (the coarse per-character dialogue-line tally behind `cast.representation-balance`'s dialogue-share signal, #1312 — credits each quoted paragraph to the first owner named in its beat) and the seed `SAID_BOOKISMS` / `NON_SPEECH_TAGS` lists. The LLM siblings `dialogue.on-the-nose` (subtext-free / "as you know, Bob" dialogue) and `dialogue.voice-distinctiveness` (per-character voice against canon `speechPattern`/`speechAccent`) handle the judgment cases. || `letteringDensity.js` | Pure, dependency-free comic lettering-density primitives for `comic.lettering-density` (#1313): `countWords`, `panelLetteringMetrics` (per-panel balloon/caption/SFX word + balloon tally over the `comicScriptParser` output), `analyzeComicLettering` (flags balloons/panels/pages over the configurable thresholds in `DEFAULT_LETTERING_THRESHOLDS`), `overflowSeverity` (severity scaled by how far over the limit), and `sanitizeLetteringThresholds`. Mirrored to `client/src/lib/letteringDensity.js` for the comic-script stage's inline warnings — keep the two in sync. || `index.js` | Barrel re-export of the above. |diff --git a/server/lib/editorial/checkRegistry.js b/server/lib/editorial/checkRegistry.jsindex cf1683e793..c264afe352 100644--- a/server/lib/editorial/checkRegistry.js+++ b/server/lib/editorial/checkRegistry.js@@ -359,6 +359,19 @@ export const UNMODELED_NAMES_STAGE = 'pipeline-editorial-unmodeled-names';// 180°/shot-type scan deliberately leaves to an LLM (see shotContinuity.js).export const EYELINE_MATCH_STAGE = 'pipeline-editorial-eyeline-match';+// Stage name for the appearance/prop-continuity LLM check (#1467). Ships in+// data.reference/prompts/stages/ + stage-config.json (fresh installs via+// setup-data.js) and migrates to existing installs via migration 118 (boot runs+// migrations but NOT setup-data, so the migration is required). Reads the same+// per-issue storyboard shots (`ctx.storyboardScenes`, wired by #1315) the eyeline+// sibling reads and asks the model to DIFF descriptions of the same entity across+// shots WITHIN a scene: a character's wardrobe/appearance that contradicts an+// earlier shot, a prop that appears/vanishes/transforms with nothing removing it,+// or a setting whose weather/time/layout flips with no transition. The semantic+// sibling the deterministic 180°/shot-type scan can't catch (the shot parser+// matches characters by name but never diffs their free-text descriptions).+export const APPEARANCE_CONTINUITY_STAGE = 'pipeline-editorial-appearance-continuity';+// Render the canon roster's names + aliases (#1412) into a compact text block the// unmodeled-names check passes alongside the manuscript, so the model knows which// proper nouns are ALREADY modeled (and therefore must NOT be flagged) and only@@ -2415,6 +2428,54 @@ export const EDITORIAL_CHECKS = [});},},+ {+ id: 'visual.appearance-continuity',+ sources: ['storyboard.shots'],+ label: 'Storyboard appearance / prop continuity',+ description:+ 'LLM diff of a scene\'s storyboard shot descriptions for appearance/prop continuity breaks — the same named character described with conflicting wardrobe/hair/state across shots, a prop that appears, vanishes, or transforms with no action removing it, or a setting whose weather/time/layout contradicts across shots. The semantic sibling of the deterministic visual.shot-continuity check: the shot parser matches characters by name but never diffs their free-text descriptions, so detecting an inconsistency needs an LLM, not a vocabulary scan. Reads the per-issue storyboard shots and anchors each finding to the offending shot pair.',+ scope: 'scene',+ kind: 'llm',+ category: 'continuity',+ severityDefault: 'medium',+ defaultEnabled: true,+ configSchema: z.object({+ // Cap findings per run so a long storyboard can't flood the review.+ maxFindings: z.number().int().min(1).max(50).default(12),+ }),+ configFields: [+ {+ key: 'maxFindings',+ label: 'Max findings per run',+ type: 'number',+ min: 1,+ max: 50,+ step: 1,+ help: 'Cap findings so a long storyboard can not flood the review.',+ },+ ],+ // Same gate as the eyeline sibling: skip the LLM call entirely unless at least+ // one scene has two-or-more described shots to diff an appearance across+ // (summarizeStoryboardShots returns '' when nothing qualifies).+ gate: (ctx) => !!summarizeStoryboardShots(ctx.storyboardScenes),+ run: async (ctx) => {+ const shots = summarizeStoryboardShots(ctx.storyboardScenes);+ if (!shots) return [];+ const { content } = await ctx.callStagedLLM(+ APPEARANCE_CONTINUITY_STAGE,+ { shots },+ { returnsJson: true, source: APPEARANCE_CONTINUITY_STAGE },+ );+ return mapLlmFindings(content?.findings, {+ severityDefault: ctx.severityDefault,+ category: 'continuity',+ max: ctx.config?.maxFindings ?? 12,+ // Storyboard scenes carry their source issue number (rendered into the+ // block header), so a finding keeps the model-supplied issue anchor.+ withIssueNumber: true,+ });+ },+ },{id: 'sensory.balance',sources: ['manuscript', 'reverseOutline'],diff --git a/server/lib/editorial/checkRegistry.test.js b/server/lib/editorial/checkRegistry.test.jsindex b8e5432910..fcd590a6fe 100644--- a/server/lib/editorial/checkRegistry.test.js+++ b/server/lib/editorial/checkRegistry.test.js@@ -2651,6 +2651,68 @@ describe('visual.eyeline-match — LLM check (#1466)', () => {});});+describe('visual.appearance-continuity — LLM check (#1467)', () => {+ const sceneEntry = (issueNumber, scene) => ({ issueNumber, scene });+ // A comparable scene: the same character described with conflicting wardrobe+ // across two shots, so there is an appearance to diff.+ const comparableScenes = () => [+ sceneEntry(4, {+ heading: 'INT. KITCHEN',+ shots: [+ { id: 'shot-01', shotType: 'medium', screenDirection: 'right', description: 'Anna in a bright red jacket pours coffee' },+ { id: 'shot-03', shotType: 'medium', screenDirection: 'right', continuityFromShotId: 'shot-01', description: 'Anna, now in a grey coat, sets the mug down' },+ ],+ }),+ ];++ it('gates on whether any scene has two-or-more described shots to diff', () => {+ const check = getCheck('visual.appearance-continuity');+ expect(check.gate({ storyboardScenes: comparableScenes() })).toBe(true);+ // A single described shot → nothing to diff an appearance across.+ expect(check.gate({ storyboardScenes: [sceneEntry(1, { heading: 'A', shots: [{ id: 's1', description: 'alone' }] })] })).toBe(false);+ expect(check.gate({ storyboardScenes: [] })).toBe(false);+ expect(check.gate({ storyboardScenes: null })).toBe(false);+ });++ it('feeds the rendered shot block to the model and shapes findings (issue-anchored)', async () => {+ let vars = null;+ const findings = await getCheck('visual.appearance-continuity').run({+ storyboardScenes: comparableScenes(),+ config: { maxFindings: 12 },+ severityDefault: 'medium',+ callStagedLLM: async (_stage, v) => {+ vars = v;+ return { content: { findings: [{+ severity: 'high',+ issueNumber: 4,+ location: 'Issue 4 — INT. KITCHEN: shots shot-01 ↔ shot-03',+ problem: 'Anna wears a red jacket in shot-01 but a grey coat in shot-03 with no costume change described.',+ suggestion: 'Align shot-03 to the red jacket, or describe the wardrobe change between shots.',+ anchorQuote: 'now in a grey coat',+ }] } };+ },+ });+ expect(vars.shots).toContain('Scene 1 (Issue 4): INT. KITCHEN');+ expect(vars.shots).toContain('shot-01');+ expect(findings).toHaveLength(1);+ expect(findings[0].category).toBe('continuity');+ expect(findings[0].issueNumber).toBe(4);+ expect(findings[0].severity).toBe('high');+ });++ it('returns no findings (and never calls the model) when no scene qualifies', async () => {+ let called = false;+ const findings = await getCheck('visual.appearance-continuity').run({+ storyboardScenes: [sceneEntry(1, { heading: 'A', shots: [{ id: 's1', description: 'alone' }] })],+ config: {},+ severityDefault: 'medium',+ callStagedLLM: async () => { called = true; return { content: { findings: [] } }; },+ });+ expect(findings).toEqual([]);+ expect(called).toBe(false);+ });+});+describe('style.reading-level — deterministic check (#1303)', () => {const check = getCheck('style.reading-level');const run = (styleGuide, manuscript, config = {}) =>