Skip to content

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

feat: editorial check for protagonist interiority across mind/objective/emotion/decision (#1294)

[._.]/ Adam Eivyc2ad13543c38
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 19406b92ea..6736e1398b 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -2,6 +2,8 @@
## Added
+- **[issue-1294] Editorial check flags POV scenes with thin protagonist interiority.** A new **Protagonist interiority** editorial check (Create → Editorial Checks) reads your drafted manuscript and flags POV scenes that move a viewpoint character through events without ever getting us inside their head. It scores each POV scene across four distinct dimensions — **mind** (their thoughts and feelings in the moment), **objective** (what they want here and *why*), **emotional response** (to twists, betrayals, shocks), and **decision** (the reasoning behind their choices) — and surfaces the gaps: "we're in X's POV but never learn what they want," "a betrayal lands with no emotional response," "X decides but we don't see the reasoning." Each finding names which dimension is missing in its location so you can group gaps by kind, anchors a verbatim quote + issue number so you can jump straight to the spot, and scales severity by how POV-central the scene is. POV is read from the prose, so the check works even before scenes are explicitly POV-tagged. Runs on demand or as part of Series Autopilot's editorial pass; one new stage prompt (`pipeline-editorial-interiority`) ships + migrates for existing installs. (#1294)
+
- **[issue-1292] Editorial check flags throwaway names, crowded openings, and an oversized cast.** A new **Character roster economy** editorial check (Create → Editorial Checks) reads your cast against the drafted manuscript and surfaces three reader-economy problems: **named characters who appear in only one issue** (a named body the reader is told to remember but who never recurs — cut them, merge them, or leave them unnamed), **too many named characters crowded into the opening issue** (which makes it hard to tell who matters), and an **oversized roster relative to the story's length** (advisory). It counts appearances by name *and* alias, leaves never-appearing canon characters alone (they may simply be undrafted), and scales severity with story length. All three thresholds are configurable, and findings anchor to the issue where each name is introduced so you can jump straight there. (#1292)
- **[issue-1356] Your series' ticking clock now steers the beat sheets.** If a series has a ticking clock / countdown the reader is anticipating (the deadline, the bomb, the failing life-support), the idea / beat-sheet stage now folds that countdown into its prompt — so generated beats plant it early, keep it present through the middle, escalate the pressure toward its due point, and don't resolve it prematurely or forget it. The arc-level prompts already used the clock; this extends it to the per-issue beats that the prose draft hangs from, so the anticipation carries all the way down. It only kicks in when the clock is toggled on; a draft clock you've switched off never steers generation. (#1356)
diff --git a/data.reference/prompts/stage-config.json b/data.reference/prompts/stage-config.json
index 8f6e900026..f727a359bf 100644
--- a/data.reference/prompts/stage-config.json
+++ b/data.reference/prompts/stage-config.json
@@ -485,6 +485,13 @@
"returnsJson": true,
"variables": []
},
+ "pipeline-editorial-interiority": {
+ "name": "Pipeline — Editorial Check: Protagonist interiority",
+ "description": "Editorial check (#1294): flags POV scenes that move a viewpoint character through events without developing their interiority across four dimensions — mind, objective, emotional response, and decision-making. Reads the stitched manuscript, infers POV when untagged, and names the missing dimension per finding. Returns issue-anchored findings.",
+ "model": "default",
+ "returnsJson": true,
+ "variables": []
+ },
"pipeline-editorial-object-motivation": {
"name": "Pipeline — Editorial Check: Unmotivated object interaction",
"description": "Editorial check (#1288): flags moments where a character treats an object as significant without earned motivation — no recorded attachment and no on-page setup. Reads the stitched manuscript plus the canon object↔character attachments. Returns issue-anchored findings.",
diff --git a/data.reference/prompts/stages/pipeline-editorial-interiority.md b/data.reference/prompts/stages/pipeline-editorial-interiority.md
new file mode 100644
index 0000000000..d478efa6b9
--- /dev/null
+++ b/data.reference/prompts/stages/pipeline-editorial-interiority.md
@@ -0,0 +1,85 @@
+# Pipeline — Editorial Check: Protagonist interiority
+
+You are a developmental editor doing a single focused pass for ONE problem:
+**thin protagonist interiority** — POV scenes that move a viewpoint character
+through events without ever letting us inside their head. Strong POV prose
+develops the character's mind across four distinct dimensions:
+
+- **Mind / interiority** — how they think; what they are thinking and feeling in
+ the moment.
+- **Objective** — what they want here and *why*; the desire that drives the
+ conflict.
+- **Emotional response** — how they react to twists, betrayals, shocks, and
+ reversals.
+- **Decision** — how their choices are reasoned, and how that reasoning ladders
+ up to their objective.
+
+For each POV scene, judge whether the prose gives us the viewpoint character's
+interiority across those four dimensions, and flag the gaps. Typical gaps:
+
+- "We're in X's POV but never learn what they want in this scene."
+- "A betrayal lands but we get no emotional response from X."
+- "X makes a decision but we don't see the reasoning that connects it to their
+ objective."
+- "We follow X's actions for a full scene but never their thoughts or feelings."
+
+Treat each of the four dimensions as a **distinct finding type**: name which
+dimension a gap belongs to in the finding's `location` (e.g.
+`Issue 3 — Mind`, `Issue 3 — Objective`, `Issue 3 — Emotional response`,
+`Issue 3 — Decision`) so the editor can group gaps by kind.
+
+Do NOT flag: a deliberately external/cinematic POV that is consistent on
+purpose, a minor non-POV character whose interiority we are not meant to share,
+or a brief beat where withholding interiority is clearly intentional (a reveal
+being set up). The bar is a real POV scene that leaves a dimension absent where
+the moment plainly calls for it.
+
+## Identifying POV
+
+Section headers attribute each chunk to an issue (e.g. `# Issue 3 — Title
+(prose)`). Determine each scene's viewpoint character from the prose itself —
+whose perceptions, thoughts, and feelings the narration follows. If POV is not
+explicitly tagged, infer it from the scene and proceed; do not flag a scene
+whose POV character you cannot determine.
+
+## Manuscript
+
+The manuscript is stitched from the drafted issues. Use the issue number in each
+section header to attribute every finding to its `issueNumber`.
+
+```
+{{manuscript}}
+```
+
+## Task
+
+Find the scenes where a POV character's interiority is thinnest across the four
+dimensions above. For each gap, quote a short verbatim anchor from the text
+(≤ 200 characters) so the editor can jump to it, name the issue number it
+appears in, name which dimension is missing in the `location`, explain the gap,
+and suggest where to add interiority. Set severity by how POV-central the scene
+is — a gap in a pivotal viewpoint scene is more serious than one in a brief
+transitional beat.
+
+Be specific and cite the text. If the manuscript gives its POV characters strong
+interiority throughout, 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": 3,
+ "location": "string — the dimension + where (e.g. 'Issue 3 — Objective')",
+ "problem": "1–3 sentences naming which interiority dimension is missing and why the scene needs it",
+ "suggestion": "1–3 sentences on where/how to add the missing interiority",
+ "anchorQuote": "short verbatim quote from the manuscript (≤ 200 chars)"
+ }
+ ]
+}
+```
diff --git a/scripts/migrations/099-editorial-interiority-stage.js b/scripts/migrations/099-editorial-interiority-stage.js
new file mode 100644
index 0000000000..0d4da6eab9
--- /dev/null
+++ b/scripts/migrations/099-editorial-interiority-stage.js
@@ -0,0 +1,75 @@
+/**
+ * Seed the `pipeline-editorial-interiority` stage into existing installs (#1294).
+ *
+ * Mirrors `096-editorial-style-conformance-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 protagonist-interiority
+ * stage unseeded and the `interiority.protagonist` 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-interiority.md';
+const STAGE_KEY = 'pipeline-editorial-interiority';
+
+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-interiority prompt: already present`);
+ } else {
+ const sampleExists = await access(samplePath, constants.F_OK).then(() => true, () => false);
+ if (!sampleExists) {
+ console.warn(`⚠️ pipeline-editorial-interiority: sample missing for ${FILENAME} — skipping copy`);
+ } else {
+ try {
+ await copyFile(samplePath, dataPath);
+ console.log(`✅ seeded ${FILENAME}`);
+ } catch (err) {
+ console.warn(`⚠️ pipeline-editorial-interiority: 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-interiority: 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-interiority stage-config: already present`);
+ return;
+ }
+ if (!sample?.stages?.[STAGE_KEY]) {
+ console.warn(`⚠️ pipeline-editorial-interiority: 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-interiority stage-config (${action}): 1 added`);
+ } catch (err) {
+ console.warn(`⚠️ pipeline-editorial-interiority: stage-config merge failed: ${err.message}`);
+ }
+ },
+};
diff --git a/scripts/migrations/099-editorial-interiority-stage.test.js b/scripts/migrations/099-editorial-interiority-stage.test.js
new file mode 100644
index 0000000000..ba70d51266
--- /dev/null
+++ b/scripts/migrations/099-editorial-interiority-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 './099-editorial-interiority-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 096/097) — no MD5 bookkeeping, so the
+// seed / no-clobber behavior is asserted directly.
+
+const FILENAME = 'pipeline-editorial-interiority.md';
+const STAGE_KEY = 'pipeline-editorial-interiority';
+const BODY = '# Protagonist interiority\n\nshipped body\n';
+
+describe('migration 099 — seed editorial-interiority 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-099-'));
+ 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/checkRegistry.js b/server/lib/editorial/checkRegistry.js
index 66948e5669..035a5fa337 100644
--- a/server/lib/editorial/checkRegistry.js
+++ b/server/lib/editorial/checkRegistry.js
@@ -87,6 +87,12 @@ export const OBJECT_BACKSTORY_STAGE = 'pipeline-editorial-object-backstory';
// migrations but NOT setup-data, so the migration is required).
export const STYLE_CONFORMANCE_STAGE = 'pipeline-editorial-style-conformance';
+// Stage name for the protagonist-interiority LLM check (#1294). Ships in
+// data.reference/prompts/stages/ + stage-config.json (fresh installs via
+// setup-data.js) and migrates to existing installs via migration 099 (boot runs
+// migrations but NOT setup-data, so the migration is required).
+export const INTERIORITY_STAGE = 'pipeline-editorial-interiority';
+
// ---------------------------------------------------------------------------
// Character-name dissimilarity (#1291) reads cast names + aliases and respects
// locked entries. The pure similarity primitives live in ./nameSimilarity.js;
@@ -1418,6 +1424,46 @@ export const EDITORIAL_CHECKS = [
buildVars: (manuscript) => ({ manuscript }),
}),
},
+ {
+ id: 'interiority.protagonist',
+ sources: ['manuscript'],
+ label: 'Protagonist interiority (mind / objective / emotion / decision)',
+ description:
+ 'Flags POV scenes that move a viewpoint character through events without developing their interiority — their thoughts and feelings, what they want and why, their emotional response to twists, and the reasoning behind their decisions. Infers POV from the prose when it is not explicitly tagged.',
+ scope: 'issue',
+ kind: 'llm',
+ category: 'character',
+ severityDefault: 'medium',
+ defaultEnabled: true,
+ // Reads the stitched manuscript corpus — so the runner only pays the
+ // section-collection I/O when a manuscript-consuming check is enabled.
+ needsManuscript: true,
+ configSchema: z.object({
+ // Cap findings per run so a long manuscript 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 manuscript can not flood the review.',
+ },
+ ],
+ gate: (ctx) => (ctx.manuscript || '').trim().length > 0,
+ // Per-scene, localized findings (one interiority gap = one scene), so this
+ // stays a plain per-chunk run with no cross-chunk digest — mirrors
+ // prose.info-dumping.
+ run: (ctx) => runManuscriptLlmCheck(ctx, {
+ stage: INTERIORITY_STAGE,
+ category: 'character',
+ overheadTokens: EDITORIAL_PROMPT_OVERHEAD_TOKENS,
+ buildVars: (manuscript) => ({ manuscript }),
+ }),
+ },
{
id: 'style.reading-level',
sources: ['manuscript', 'series.styleGuide'],
diff --git a/server/lib/editorial/checkRegistry.test.js b/server/lib/editorial/checkRegistry.test.js
index c041837cb7..799ac57713 100644
--- a/server/lib/editorial/checkRegistry.test.js
+++ b/server/lib/editorial/checkRegistry.test.js
@@ -31,6 +31,7 @@ import {
const NAMING = 'naming.dissimilar-names';
const INFODUMP = 'prose.info-dumping';
+const INTERIORITY = 'interiority.protagonist';
// A minimal valid stored custom-check definition.
const customDef = (over = {}) => ({
@@ -273,6 +274,64 @@ describe('prose.info-dumping — LLM check', () => {
});
});
+describe('interiority.protagonist — LLM check (#1294)', () => {
+ const wholeCtx = (overrides = {}) => ({
+ manuscript: '# Issue 1\n\nShe walked into the room and sat down.',
+ config: { maxFindings: 12 },
+ severityDefault: 'medium',
+ planManuscriptChunks: async () => [overrides.manuscript ?? '# Issue 1\n\nShe walked into the room and sat down.'],
+ callStagedLLM: async () => ({ content: { findings: [] } }),
+ ...overrides,
+ });
+
+ it('is registered as a manuscript-scoped LLM check', () => {
+ const check = getCheck(INTERIORITY);
+ expect(check.kind).toBe('llm');
+ expect(check.category).toBe('character');
+ expect(check.sources).toEqual(['manuscript']);
+ expect(check.needsManuscript).toBe(true);
+ });
+
+ it('only runs when there is drafted prose to scan', () => {
+ const check = getCheck(INTERIORITY);
+ expect(check.gate({ manuscript: '' })).toBe(false);
+ expect(check.gate({ manuscript: '# Issue 1\n\nprose' })).toBeTruthy();
+ });
+
+ it('passes the planned manuscript chunk to the model and forces the character category', async () => {
+ let seen = null;
+ const ctx = wholeCtx({
+ planManuscriptChunks: async (_stage, opts) => {
+ // The check reserves prompt-overhead budget so the chunker leaves room for the template.
+ expect(opts.overheadTokens).toBeGreaterThan(0);
+ return ['# Issue 2\n\nHe nodded and left.'];
+ },
+ callStagedLLM: async (_stage, vars) => {
+ seen = vars.manuscript;
+ return { content: { findings: [{ severity: 'high', issueNumber: 2, location: 'Issue 2 — Objective', problem: 'No want', anchorQuote: 'He nodded' }] } };
+ },
+ });
+ const findings = await getCheck(INTERIORITY).run(ctx);
+ expect(seen).toBe('# Issue 2\n\nHe nodded and left.');
+ expect(findings).toHaveLength(1);
+ expect(findings[0].category).toBe('character');
+ expect(findings[0].issueNumber).toBe(2);
+ expect(findings[0].location).toBe('Issue 2 — Objective');
+ });
+
+ it('merges findings across chunks and respects maxFindings as a whole-run cap', async () => {
+ const many = (tag) => Array.from({ length: 30 }, (_, i) => ({ severity: 'low', problem: `${tag}-p${i}`, anchorQuote: `${tag}-a${i}` }));
+ let call = 0;
+ const ctx = wholeCtx({
+ config: { maxFindings: 4 },
+ planManuscriptChunks: async () => ['c1', 'c2'],
+ callStagedLLM: async () => ({ content: { findings: many(call++ === 0 ? 'x' : 'y') } }),
+ });
+ const findings = await getCheck(INTERIORITY).run(ctx);
+ expect(findings).toHaveLength(4);
+ });
+});
+
describe('naming.dissimilar-names — deterministic check', () => {
const run = (characters, config = { minSharedSignals: 2 }) =>
getCheck(NAMING).run({ canon: { characters }, config, severityDefault: 'low' });