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
Merge remote-tracking branch 'origin/main' into next/issue-1307
Adam Eivy4def97a7d8bf
diff --cc .changelog/NEXT.mdindex 784a0db221,92c698fa1f..aec7130f4b--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@@ -2,10 -2,10 +2,12 @@@## Added+ - **[issue-1310] Editorial check flags plot-structure & momentum problems — passive protagonist, deus ex machina, idiot plot, flat stakes, sagging middle, dropped subplots.** A new **Plot structure & momentum** check (Create → Editorial Checks) reads your drafted manuscript and surfaces the macro pathologies a developmental editor flags at the arc level: a **passive protagonist** (events happen *to* them instead of being driven by their choices), a **deus ex machina / convenient coincidence** that resolves a problem by luck rather than setup, an **idiot plot** that only holds together because someone won't say the obvious, **flat or unclear stakes** that never escalate, a **sagging middle** with no try-fail rhythm, and **dropped subplots** — threads that open and then fizzle. It reconciles dropped threads against your reverse-outline plotline tags and your authored reader-map hooks/payoffs, and defers whole-arc judgments (a sagging middle, a never-resolved thread) until it has seen the whole manuscript so a long book reviewed in chunks isn't false-flagged. Findings render as `Plot structure` notes in the manuscript editor, anchored to the issue and (where one exists) a verbatim quote. Ships a new stage prompt (`pipeline-editorial-plot-structure`) that migrates for existing installs (111). (#1310)+- **[issue-1306] Line-edit / copy-edit pass — eight prose-tic editorial checks.** A bundle of deterministic copy-edit checks (Create → Editorial Checks) that catch the most common reader pet peeves and editorial red ink, each independently toggleable + configurable: **Filter words** (distancing verbs — saw/felt/noticed/began-to), **Crutch / filler words** (just/really/very/suddenly/"in order to"; bare "that" behind a toggle so grammatical "that" doesn't swamp the count), **Adverb overuse** (`-ly` adverbs, with adverb-laden dialogue tags — "said angrily" — flagged at higher severity), **Passive voice** (be-verb + past-participle heuristic, advisory), **Repeated gestures / body-part autonomy** (a gesture tally across the manuscript — nodded/smiled/shrugged — plus detached body parts that act on their own, "her eyes followed him across the room"), **Word repetition / echoes** (a distinctive word repeated within a window, plus repeated sentence openers — "He… He… He…"), and **Sentence rhythm & variety** (monotonous, uniform-length sentences). All are density-scaled — one "just" is fine, forty is a tic — with house-style allow/extra word lists and per-check thresholds, and ship sensible defaults so they don't drown the author. A ninth, LLM-judged sibling — **Telling-not-showing emotion** ("she was sad" → dramatize) — handles the false-positive-prone case a keyword scan can't, via a new stage prompt (`pipeline-editorial-telling-emotion`) that migrates for existing installs (110). The pure scanners live in `server/lib/editorial/proseTics.js` + `repetition.js` (no new deps). Reading-grade level is already covered by the existing `style.reading-level` check. (`server/lib/editorial/{proseTics,repetition,checkRegistry}.js`, `scripts/migrations/110-editorial-telling-emotion-stage.js`, #1306)+- **[issue-1307] Dialogue-craft editorial checks — said-bookisms, attribution clarity, on-the-nose dialogue, and per-character voice distinctiveness.** Four new checks (Create → Editorial Checks) for dialogue. Two are deterministic: **Said-bookisms & non-speech tags** flags ornate speech tags ("expostulated", "opined", "interjected") and non-speech actions misused as tags ("'Yes,' she smiled" — you cannot smile a line), matching only verbs adjacent to a quoted span so narrated uses ("the engine growled") are left alone; **Dialogue attribution clarity** flags long runs of consecutive dialogue lines with no speech tag or grounding action beat, where the reader loses track of who is speaking. Two are LLM-judged: **On-the-nose / subtext-free dialogue** flags lines that state feeling/meaning outright and "maid-and-butler" exchanges where characters tell each other what they both already know (complements the #1297 info-dumping check); **Character voice distinctiveness** samples each character's lines to flag (a) interchangeable voices — everyone sounding like one narrator — and (b) drafted lines that contradict the character's canon `speechPattern` / `speechAccent`, producing a per-character voice fingerprint and naming concrete differentiating tics. The voice check closes the gap where those canon fields fed *generation* only and nothing validated the drafted dialogue against them; it rolls a per-character voice-sample digest across chunks (`crossChunkSetup`) so a later chunk judges against the full sample, and degrades gracefully (no voice fields ⇒ a pure interchangeability scan). The pure scanners live in `server/lib/editorial/dialogue.js` (no new deps); the two LLM stage prompts (`pipeline-editorial-on-the-nose`, `pipeline-editorial-voice-distinctiveness`) migrate for existing installs (111, 112). (`server/lib/editorial/{dialogue,checkRegistry}.js`, `scripts/migrations/{111-editorial-on-the-nose-stage,112-editorial-voice-distinctiveness-stage}.js`, #1307)+- **[issue-1293] Per-character story arcs + an editorial check that finds the beats where characters actually change.** Series now carry an authored **`characterArcs[]`** model — each cast member's *want* / *need*, *start → end* transformation, and explicit **transition beats** (a decision, realization, point-of-no-return, relapse, or sacrifice, each anchorable to an issue). Edit them inline in the Series Bible (a new **Character arcs** section, alongside the style guide); the field is local-only-additive and wire-gated (`pipelineSeries` schema v6) so a not-yet-upgraded peer can't strip-then-LWW the arcs back. A new **Character-arc transitions** editorial check (Create → Editorial Checks) reads the drafted manuscript plus the reverse-outline scene map and these authored arcs to (1) detect genuine change moments and propose them as anchored transition beats, (2) reconcile detected vs authored transitions — flagging an undocumented change the prose delivers or an authored transition the prose never pays off — and (3) flag **flat arcs**: a character who carries the story but never changes. Findings render as `Character arc` notes in the manuscript editor, highlighting the transition scenes. Ships a new stage prompt (`pipeline-editorial-arc-transitions`) that migrates for existing installs (109). (`server/lib/seriesCharacterArc.js`, `server/lib/editorial/checkRegistry.js`, `server/services/pipeline/{series,editorial/checkRunner}.js`, `client/src/pages/PipelineSeries.jsx`, #1293)- **[issue-911] Mood Boards — an inspiration canvas that feeds the Create suite.** A new **Mood Boards** page (Create → Mood Boards, deep-linkable at `/mood-boards` and `/mood-boards/:id`, reachable via ⌘K / voice as "mood board" / "inspiration" / "references") for collecting visual + textual references, distinct from raw Media History. Create named boards with a description, then pin items: an **image** (external/pinned URL, or an app path like `/data/images/…`) or a **text note**, each with an optional caption and source backref. Items live inline in the board record; the canvas renders an image grid with inline-editable captions and an inline-confirm delete. Boards are **db-primary and local-only** — one row per board in the new `mood_boards` Postgres table (full record in `data` JSONB, modeled on `creative_director_projects`: no sync cursor/tombstone in v1), provisioned by both the boot-time `ensureSchema()` upgrade and `init-db.sql` with an audit trigger, registered via migration 108. Every write locks the board row (`SELECT … FOR UPDATE`) so concurrent add/edit affordances can't clobber each other. Cross-surface "Pin to mood board" affordances and a board picker in the universe/scene/treatment creation flows are tracked as a follow-up. (`server/services/moodBoard/`, `server/routes/moodBoard.js`, `server/lib/moodBoardValidation.js`, `client/src/pages/{MoodBoards,MoodBoardDetail}.jsx`, `client/src/services/apiMoodBoard.js`, #911)diff --cc data.reference/prompts/stage-config.jsonindex ce5939fe26,77f2d6ee6f..6e34730935--- a/data.reference/prompts/stage-config.json+++ b/data.reference/prompts/stage-config.json@@@ -604,19 -604,12 +604,26 @@@"returnsJson": true,"variables": []},+ "pipeline-editorial-on-the-nose": {+ "name": "Pipeline — Editorial Check: On-the-nose / subtext-free dialogue",+ "description": "Editorial check (#1307): the judgment layer for dialogue that states feeling/meaning outright with no subtext and \"maid-and-butler\" exchanges where characters tell each other what they both already know. Reads the stitched manuscript; severity is advisory; skips earned directness, functional exchanges, and dialogue whose subtext already works. Returns issue-anchored findings.",+ "model": "default",+ "returnsJson": true,+ "variables": []+ },+ "pipeline-editorial-voice-distinctiveness": {+ "name": "Pipeline — Editorial Check: Character voice distinctiveness",+ "description": "Editorial check (#1307): samples each character dialogue and flags interchangeable voices (everyone sounds like one narrator) plus drafted lines that contradict the canon speechPattern/speechAccent. Reads the stitched manuscript + authored voice profiles; rolls a per-character voice-sample digest across chunks. Returns issue-anchored findings naming differentiating tics.",+ "model": "default",+ "returnsJson": true,+ "variables": []++ },+ "pipeline-editorial-plot-structure": {+ "name": "Pipeline — Editorial Check: Plot structure & momentum",+ "description": "Editorial check (#1310): the macro pathologies editors flag at the manuscript/arc level — a passive protagonist, deus ex machina / convenient coincidence, idiot plot, flat or unclear stakes that never escalate, a sagging middle with no try-fail rhythm, and dropped subplots. Reads the stitched manuscript plus the reverse-outline scene map + plotline coverage (reconciling fizzled threads against tagged plotlines) and the authored reader-map hooks/payoffs; degrades to a whole-manuscript scan when no outline exists. Returns issue-anchored findings.",+ "model": "default",+ "returnsJson": true,+ "variables": []}}}diff --cc scripts/migrations/112-editorial-on-the-nose-stage.jsindex 483b526421,0000000000..483b526421mode 100644,000000..100644--- a/scripts/migrations/112-editorial-on-the-nose-stage.js+++ b/scripts/migrations/112-editorial-on-the-nose-stage.jsdiff --cc scripts/migrations/112-editorial-on-the-nose-stage.test.jsindex b085abd0df,0000000000..c737f9fd2cmode 100644,000000..100644--- a/scripts/migrations/112-editorial-on-the-nose-stage.test.js+++ b/scripts/migrations/112-editorial-on-the-nose-stage.test.js@@@ -1,86 -1,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 './111-editorial-on-the-nose-stage.js';++import migration from './112-editorial-on-the-nose-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 110) — no MD5 bookkeeping, so the+// seed / no-clobber behavior is asserted directly.++const FILENAME = 'pipeline-editorial-on-the-nose.md';+const STAGE_KEY = 'pipeline-editorial-on-the-nose';+const BODY = '# On-the-nose dialogue\n\nshipped body\n';+- describe('migration 111 — seed editorial-on-the-nose stage', () => {++describe('migration 112 — seed editorial-on-the-nose 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-111-'));+ 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 --cc scripts/migrations/113-editorial-voice-distinctiveness-stage.jsindex 45e5c6d61a,0000000000..15016723d3mode 100644,000000..100644--- a/scripts/migrations/113-editorial-voice-distinctiveness-stage.js+++ b/scripts/migrations/113-editorial-voice-distinctiveness-stage.js@@@ -1,76 -1,0 +1,76 @@@+/**+ * Seed the `pipeline-editorial-voice-distinctiveness` stage into existing+ * installs (#1307).+ *- * Mirrors `111-editorial-on-the-nose-stage.js`: copies the `.md` template from++ * Mirrors `112-editorial-on-the-nose-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 voice-distinctiveness stage+ * unseeded and the `dialogue.voice-distinctiveness` 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-voice-distinctiveness.md';+const STAGE_KEY = 'pipeline-editorial-voice-distinctiveness';++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-voice-distinctiveness prompt: already present`);+ } else {+ const sampleExists = await access(samplePath, constants.F_OK).then(() => true, () => false);+ if (!sampleExists) {+ console.warn(`⚠️ pipeline-editorial-voice-distinctiveness: sample missing for ${FILENAME} — skipping copy`);+ } else {+ try {+ await copyFile(samplePath, dataPath);+ console.log(`✅ seeded ${FILENAME}`);+ } catch (err) {+ console.warn(`⚠️ pipeline-editorial-voice-distinctiveness: 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-voice-distinctiveness: 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-voice-distinctiveness stage-config: already present`);+ return;+ }+ if (!sample?.stages?.[STAGE_KEY]) {+ console.warn(`⚠️ pipeline-editorial-voice-distinctiveness: 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-voice-distinctiveness stage-config (${action}): 1 added`);+ } catch (err) {+ console.warn(`⚠️ pipeline-editorial-voice-distinctiveness: stage-config merge failed: ${err.message}`);+ }+ },+};diff --cc scripts/migrations/113-editorial-voice-distinctiveness-stage.test.jsindex 85d4a4d582,0000000000..884cbda079mode 100644,000000..100644--- a/scripts/migrations/113-editorial-voice-distinctiveness-stage.test.js+++ b/scripts/migrations/113-editorial-voice-distinctiveness-stage.test.js@@@ -1,86 -1,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 './112-editorial-voice-distinctiveness-stage.js';++import migration from './113-editorial-voice-distinctiveness-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 110/111) — no MD5 bookkeeping, so the+// seed / no-clobber behavior is asserted directly.++const FILENAME = 'pipeline-editorial-voice-distinctiveness.md';+const STAGE_KEY = 'pipeline-editorial-voice-distinctiveness';+const BODY = '# Voice distinctiveness\n\nshipped body\n';+- describe('migration 112 — seed editorial-voice-distinctiveness stage', () => {++describe('migration 113 — seed editorial-voice-distinctiveness 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-112-'));+ 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 --cc server/lib/editorial/checkRegistry.jsindex eb5dae4ebd,afd065f3dd..1fcfcca05f--- a/server/lib/editorial/checkRegistry.js+++ b/server/lib/editorial/checkRegistry.js@@@ -218,44 -225,16 +226,54 @@@ export const ARC_TRANSITIONS_STAGE = 'p// prose.sentence-rhythm) need no stage.export const TELLING_EMOTION_STAGE = 'pipeline-editorial-telling-emotion';+// Stage names for the two dialogue-craft LLM checks (#1307): on-the-nose /+// subtext-free dialogue, and per-character voice distinctiveness. Each prompt+// ships in data.reference/prompts/stages/ + stage-config.json (fresh installs via- // setup-data.js) and migrates to existing installs via migrations 111–112 (boot++// setup-data.js) and migrates to existing installs via migrations 112–113 (boot+// runs migrations but NOT setup-data, so the migration is required). The+// deterministic siblings (dialogue.said-bookisms, dialogue.attribution-clarity)+// need no stage.+export const ON_THE_NOSE_STAGE = 'pipeline-editorial-on-the-nose';+export const VOICE_DISTINCTIVENESS_STAGE = 'pipeline-editorial-voice-distinctiveness';++// Render each canon character's authored voice fields into a compact text block+// the voice-distinctiveness LLM check passes alongside the manuscript, so the+// model can flag lines that contradict a character's recorded speechPattern /+// speechAccent (closing the "voice fields feed generation only" gap, #1307) and+// reason about whether characters sound distinct from one another. Pure ++// deterministic so it's unit-testable and its token cost can be counted into the+// per-chunk overhead. Returns '' when no character carries a voice field (the+// prompt's {{#voiceProfiles}} section then renders nothing and the check+// degrades to a pure interchangeability scan).+export function characterVoiceProfiles(canon) {+ const chars = Array.isArray(canon?.characters) ? canon.characters : [];+ const lines = [];+ for (const c of chars) {+ if (!c || typeof c !== 'object') continue;+ const name = typeof c.name === 'string' ? c.name.trim() : '';+ if (!name) continue;+ const pattern = typeof c.speechPattern === 'string' ? c.speechPattern.trim() : '';+ const accent = typeof c.speechAccent === 'string' ? c.speechAccent.trim() : '';+ if (!pattern && !accent) continue;+ const parts = [`- ${name}`];+ if (pattern) parts.push(`speech pattern: ${pattern}`);+ if (accent) parts.push(`accent/dialect: ${accent}`);+ lines.push(parts.join(' — '));+ }+ if (!lines.length) return '';+ return `Authored character voices (canon speechPattern / speechAccent):\n${lines.join('\n')}`;+}++ // Stage name for the plot-structure & momentum LLM check (#1310). Ships in+ // data.reference/prompts/stages/ + stage-config.json (fresh installs via+ // setup-data.js) and migrates to existing installs via migration 111 (boot runs+ // migrations but NOT setup-data, so the migration is required). Reads the+ // stitched manuscript plus the reverse-outline scene map + plotline coverage and+ // the authored reader-map/arc to surface macro pathologies — passive protagonist,+ // deus ex machina, idiot plot, flat/unclear stakes, sagging middle, and dropped+ // subplots reconciled against the tagged plotlines.+ export const PLOT_STRUCTURE_STAGE = 'pipeline-editorial-plot-structure';+// Render the authored reader-map cliffhangers (#1298) into a compact text block// the chapter-ending check passes alongside the manuscript so the model// reconciles its DETECTED endings against the issue-boundary tugs the writerdiff --cc server/lib/editorial/checkRegistry.test.jsindex 64292ccd76,7256c60a7b..99a80148ff--- a/server/lib/editorial/checkRegistry.test.js+++ b/server/lib/editorial/checkRegistry.test.js@@@ -30,7 -30,7 +30,8 @@@ importauthoredSetupPayoffSummary,authoredCliffhangerSummary,sceneGroundingSummary,+ characterVoiceProfiles,+ plotlineCoverageSummary,} from './checkRegistry.js';const NAMING = 'naming.dissimilar-names';