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: add narration.summary-not-scene editorial check (#3591)
[._.]/ Adam Eivy1991828b23a9
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 3e4ed5eacf..9c780aa623 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -199,3 +199,4 @@- **[issue-3569] The Writers Room library's header buttons are now big enough to hit on a phone.** "New folder", "New work" and "Hide library" each wrapped a 14px icon in nothing but `p-1`, giving them roughly 22x22px of tappable area sitting side by side in a 260px sidebar — close enough together that a thumb aiming for "New work" landed on "New folder" instead, which is the one control the whole pane exists to reach. All three now clear the 44px floor the rest of the app uses, as do the create-folder and create-work forms they open: the name/title inputs, the kind dropdown, and the Add/Create/Cancel buttons were all ~24px tall, so getting past the header only landed you on a second row of targets just as easy to miss. Unlike the bible and snapshot rows in #3565, the header row has no padding of its own for the extra height to bleed back into, so it grows to 44px rather than clawing it back with a negative margin that would collide with the pane's top edge. "Hide library" stays desktop-only and is centred with `inline-flex` rather than `flex`, since the two are the same Tailwind layer and a bare `flex` would race the `md:` variant that hides it.- **[issue-3590] Lengthening a perpetual task's recheck cadence no longer delays a recheck that was already due.** When the recheck cadence changes, the schedule re-derives the park timestamp of every currently-parked execution record from the new cadence, so the edit takes effect on the next slot instead of waiting out the old timestamp. The guard was "does this record carry a park at all" — but an elapsed park is never cleared when it expires (the task simply reports itself as due for a recheck, and the dispatch gate clears the park when it actually runs), so a record that was ready to run right now was matched by that guard too and stamped with a fresh future timestamp. Shortening the cadence was harmless, since the new timestamp was sooner; lengthening it pushed the pending recheck back out by the new interval, and the drain the user was waiting on silently went quiet again. Only parks still in the future are re-derived now — a record whose park has already elapsed is left exactly as it is, so it rechecks on the very next tick.- **[issue-3594] The drafting prompt now teaches how to write a scene, not just how much scene to write.** The craft doctrine injected into both drafting stages — the prose pipeline and Writers Room live continuation — was entirely negative: eleven "avoid X" rules plus the Stability Trap countermeasures. One of those rules carries a measurable target with no technique attached ("at least 70% in-scene, not summary"), and a model told to dramatize more with no construction recipe reaches for longer description, which is exactly the white-room, zero-interiority draft the editorial checks then have to catch. A new "Zoom into the moment" section — the first positive-instruction block in the partial, placed right after the rule it operationalizes — gives it the recipe in five elements: name the location with one concrete noun rather than an inventory, say what the character is doing in present-moment verbs, render thoughts raw in the character's own diction instead of essay register, show emotion on the body rather than naming the feeling, and quote dialogue that is worth quoting instead of narrating that someone spoke. Each element ships with the failure mode that makes it a rule rather than a suggestion. Because the partial is a file on disk that existing installs already have, and both `setup-data.js` and the original seed migration only ever copy it when it is *missing*, the section arrives through a hash-gated migration: an install still running the shipped version is upgraded in place, and a hand-edited partial is left exactly as it is and told what to merge.+- **[issue-3591] Editorial checks now catch a pivotal moment that got narrated instead of played out.** The drafting prompts have long carried the rule that a draft should be at least 70% in-scene, not summary — but nothing on the review side ever checked it, so the most common structural failure in a draft went unflagged: a decision, confrontation or reveal delivered from helicopter altitude ("Over the next week they argued about it, and eventually she agreed to go") where the scene would have landed. The new **Narrated summary where a scene belongs** check reads your drafted manuscript and names four modes of it — a compressed-away turning point, reported action the reader never physically enters, habitual mode ("every night she would…") wrapped around what was really a single decisive event, and result-first narration that states the outcome and skips the scene. Each finding quotes a verbatim anchor and, rather than just saying "dramatize this", names the concrete moment to zoom into. It reads the reverse-outline scene segmentation as context so honest between-scene compression is left alone — the target is a beat that never became a scene at all, which is invisible to the existing scene checks precisely because they only judge scenes that exist. Deliberate montages, brief time-skips, backstory summary (that belongs to info-dumping) and beats too minor to be worth the words are explicitly out of scope. Enabled by default at medium severity under Create → Editorial Checks; the new `pipeline-editorial-summary-not-scene` stage prompt ships and migrates for existing installs. (#3591)diff --git a/data.reference/prompts/stage-config.json b/data.reference/prompts/stage-config.jsonindex 4f033e1a70..9873b9c2bf 100644--- a/data.reference/prompts/stage-config.json+++ b/data.reference/prompts/stage-config.json@@ -709,6 +709,13 @@"returnsJson": true,"variables": []},+ "pipeline-editorial-summary-not-scene": {+ "name": "Pipeline — Editorial Check: Narrated summary where a scene belongs",+ "description": "Editorial check (#3591): flags dramatizable beats narrated at helicopter level instead of played out in-scene — compressed-away turning points, reported action, habitual/iterative mode wrapped around a single decisive event, and result-first narration. The reviewer half of the drafting rule \"at least 70% in-scene, not summary\". Reads the stitched manuscript plus the reverse-outline scene segmentation (degrading to a whole-issue scan when absent). Each finding names the summarized beat and where to zoom in. Returns issue-anchored findings.",+ "model": "default",+ "returnsJson": true,+ "variables": []+ },"pipeline-editorial-interiority-balance": {"name": "Pipeline — Editorial Check: Interiority balance (description vs. POV reaction)","description": "Editorial check (#1623): flags visually dense but emotionally empty scenes — prose heavy on setting, blocking, and physical detail yet light on the viewpoint character's reaction, emotion, or thought, so description swamps interiority. Judges the description-to-interiority ratio within each scene. Reads the stitched manuscript plus the reverse-outline scene segmentation (degrading to a whole-issue scan when absent). Distinct from sensory.balance (the senses) and interiority.protagonist (whole-issue interiority absence). Returns issue-anchored findings.",diff --git a/data.reference/prompts/stages/pipeline-editorial-summary-not-scene.md b/data.reference/prompts/stages/pipeline-editorial-summary-not-scene.mdnew file mode 100644index 0000000000..52d0b68120--- /dev/null+++ b/data.reference/prompts/stages/pipeline-editorial-summary-not-scene.md@@ -0,0 +1,96 @@+# Pipeline — Editorial Check: Narrated summary where a scene belongs++You are a developmental editor doing a single focused pass for ONE problem:+**summary standing in for a scene** — a dramatizable moment delivered as+narration at helicopter level instead of played out beat by beat. The draft+should be majority in-scene; summary is compression *between* scenes, not the+default mode. When a turning point is summarized, the reader is told the story+happened instead of living through it.++Flag passages that summarize a moment the scene would land harder played out:++- **Compressed-away turning point** — a decision, confrontation, reveal, or+ reversal delivered as narration ("Over the next week they argued about it, and+ eventually she agreed to go") instead of the moment it actually turned.+- **Reported action** — a sequence of events told at a distance ("He spent the+ morning tracking down the address, and by noon he had it") where the reader+ never enters the physical moment.+- **Habitual / iterative mode over a beat that happened once** — "every night she+ would…", "they used to…" wrapped around what is really a single decisive event.+- **Result-first narration** — the outcome stated and the scene skipped ("The+ meeting went badly", "The negotiation failed").++This is distinct from `prose.info-dumping` (backstory exposition dropped in a+block), from `opening.wrong-start` (where an *issue* begins), and from+`scene.component-balance` (the narrative/action/dialogue mix *inside* a scene the+reverse outline already segmented) — a beat that was summarized never became a+scene in the outline at all, so it is invisible to that check. The gap here is+narrative *distance*: a moment worth standing inside, described from above.++Do NOT flag: deliberate transitional compression between scenes (this is what+summary is for); a montage or time-skip that is clearly intentional and brief;+backstory summary (that belongs to info-dumping); a summarized beat that is+genuinely minor and would bloat the draft if dramatized. The bar is a beat whose+dramatization would materially improve the story.++{{#sceneMap}}+## Scene segmentation++The reverse outline below segments the manuscript into scenes. Use it to tell+compression *between* scenes (fine) from a dramatizable beat that never became a+scene at all (the target). A long stretch of manuscript with no corresponding+scene is a strong candidate — confirm it against the prose. Judge distance from+the prose itself, not from this list alone.++```+{{sceneMap}}+```+{{/sceneMap}}++## Manuscript++The manuscript is stitched from the drafted issues. Section headers attribute+each chunk to an issue (e.g. `# Issue 3 — Title (prose)`). Use the issue number+in each header to attribute every finding to its `issueNumber`. If no scene+segmentation is provided above, scan the manuscript issue by issue instead.++```+{{manuscript}}+```++## Task++Find the beats that are narrated where they should be dramatized. For each, quote+a short verbatim anchor from the text (≤ 200 characters) so the editor can jump+to it, name the issue number it appears in, classify the mode in the `location`+(e.g. `Issue 3 — compressed turning point`, `Issue 4 — reported action`,+`Issue 2 — habitual mode`, `Issue 5 — result-first`), explain in `problem` which+dramatizable beat got summarized away, and in `suggestion` name **where to zoom+in** — the concrete moment the summary is standing in for (who is in the room,+what is said or done, where it turns). Set severity by how central the+compressed beat is — a summarized climax or decision is more serious than a+summarized errand.++Be specific and cite the text. If the draft is already majority dramatized and+its summary is doing honest between-scene work, 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 summary mode + where (e.g. 'Issue 3 — compressed turning point')",+ "problem": "1–3 sentences naming the dramatizable beat that got summarized away",+ "suggestion": "1–3 sentences naming the concrete moment to zoom into and play out",+ "anchorQuote": "short verbatim quote from the manuscript (≤ 200 chars)"+ }+ ]+}+```diff --git a/scripts/migrations/227-editorial-summary-not-scene-stage.js b/scripts/migrations/227-editorial-summary-not-scene-stage.jsnew file mode 100644index 0000000000..b3e17b7733--- /dev/null+++ b/scripts/migrations/227-editorial-summary-not-scene-stage.js@@ -0,0 +1,18 @@+/**+ * Seed the summary-vs-scene editorial-check stage into existing installs (#3591).+ *+ * Mirrors `142-editorial-interiority-balance-stage.js`: copies the `.md` template+ * from `data.reference/prompts/stages/` and merges its 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 stage unseeded and the+ * `narration.summary-not-scene` editorial check would throw "Stage not found"+ * the first time it runs.+ *+ * Customization-safe + idempotent per `_seedStageHelpers.js` — the template is+ * copied only when missing and the config entry merged only when absent.+ */++import { makeSeedMigration } from './_seedStageHelpers.js';++export default makeSeedMigration('pipeline-editorial-summary-not-scene');diff --git a/scripts/migrations/227-editorial-summary-not-scene-stage.test.js b/scripts/migrations/227-editorial-summary-not-scene-stage.test.jsnew file mode 100644index 0000000000..4d6503fe86--- /dev/null+++ b/scripts/migrations/227-editorial-summary-not-scene-stage.test.js@@ -0,0 +1,16 @@+import { describe } from 'vitest';++import migration from './227-editorial-summary-not-scene-stage.js';+import { runSeedStageMigrationTests } from './_seedStageTestHelpers.js';++// The summary-vs-scene editorial check's stage (#3591). The drift catch is the+// point: if the reference template or its stage-config entry ever stops+// shipping, the `narration.summary-not-scene` check would throw "Stage not+// found" at runtime on a fresh install with nothing failing here first.+describe('migration 227 — seed the summary-not-scene editorial stage', () => {+ runSeedStageMigrationTests({+ migration,+ stages: ['pipeline-editorial-summary-not-scene'],+ prefix: 'migration-227-',+ });+});diff --git a/server/lib/editorial/checkInfra/craftStages.js b/server/lib/editorial/checkInfra/craftStages.jsindex c4016985de..b31b4136ca 100644--- a/server/lib/editorial/checkInfra/craftStages.js+++ b/server/lib/editorial/checkInfra/craftStages.js@@ -54,6 +54,18 @@ export const SAFE_CUT_TYPES = Object.freeze(['OVER-EXPLAIN', 'REDUNDANT']);export const SENSORY_BALANCE_STAGE = 'pipeline-editorial-sensory-balance';export const WHITE_ROOM_STAGE = 'pipeline-editorial-white-room';+// Stage name for the summary-vs-scene LLM check (#3591): dramatizable beats+// narrated at helicopter level ("Over the next week, they argued about it, and+// eventually she agreed") instead of played out in-scene. Ships in+// data.reference/prompts/stages/ + stage-config.json (fresh installs via+// setup-data.js) and migrates to existing installs via migration 227 (boot runs+// migrations but NOT setup-data, so the migration is required). The reviewer+// half of the drafting rule already encoded in the craft-anti-patterns partial+// ("at least 70% in-scene, not summary"). Like the scene-grounding checks above+// it consumes the reverse-outline scene segmentation as context and degrades to+// a whole-issue manuscript scan when no outline exists.+export const SUMMARY_NOT_SCENE_STAGE = 'pipeline-editorial-summary-not-scene';+// Stage name for the interiority-balance LLM check (#1623): visually dense but// emotionally empty scenes — heavy on description, light on POV reaction. Ships// in data.reference/prompts/stages/ + stage-config.json (fresh installs viadiff --git a/server/lib/editorial/checkRegistry.js b/server/lib/editorial/checkRegistry.jsindex c865fac7b5..f45f8cdf8d 100644--- a/server/lib/editorial/checkRegistry.js+++ b/server/lib/editorial/checkRegistry.js@@ -85,6 +85,7 @@ export {SECONDARY_ARC_STAGE,SENSORY_BALANCE_STAGE,STYLE_CONFORMANCE_STAGE,+ SUMMARY_NOT_SCENE_STAGE,TELLING_EMOTION_STAGE,THEME_COHERENCE_STAGE,TIMELINE_CONTRADICTION_STAGE,@@ -171,6 +172,7 @@ const CHECK_ORDER = Object.freeze(['visual.appearance-continuity','sensory.balance','scene.white-room',+ 'narration.summary-not-scene','scene.interiority-balance','pov.justified','pov.economy',diff --git a/server/lib/editorial/checkRegistry.test.js b/server/lib/editorial/checkRegistry.test.jsindex b2ca97ea1a..a284024de5 100644--- a/server/lib/editorial/checkRegistry.test.js+++ b/server/lib/editorial/checkRegistry.test.js@@ -63,6 +63,7 @@ const POV_SWITCH = 'endings.pov-switch';const SENSORY_BALANCE = 'sensory.balance';const WHITE_ROOM = 'scene.white-room';const INTERIORITY_BALANCE = 'scene.interiority-balance';+const SUMMARY_NOT_SCENE = 'narration.summary-not-scene';const PLOT_STRUCTURE = 'plot.structure-momentum';const PACING_ESCALATION = 'pacing.escalation-curve';const HEAD_HOPPING = 'pov.head-hopping';@@ -728,6 +729,97 @@ describe.each([});});+describe('narration.summary-not-scene — summary-vs-scene LLM check (#3591)', () => {+ const MANUSCRIPT = '# Issue 1\n\nOver the next week they argued about it, and eventually she agreed to go.';+ const wholeCtx = (overrides = {}) => ({+ manuscript: MANUSCRIPT,+ reverseOutline: [{ sequence: 0, issueNumber: 1, heading: 'The void', setting: '', charactersPresent: ['Mara'] }],+ config: { maxFindings: 12 },+ severityDefault: 'medium',+ planManuscriptChunks: async () => [overrides.manuscript ?? MANUSCRIPT],+ callStagedLLM: async () => ({ content: { findings: [] } }),+ ...overrides,+ });++ it('is registered as an issue-scoped manuscript+reverseOutline LLM check in the pacing category', () => {+ const check = getCheck(SUMMARY_NOT_SCENE);+ expect(check.kind).toBe('llm');+ expect(check.scope).toBe('issue');+ expect(check.category).toBe('pacing');+ expect(check.severityDefault).toBe('medium');+ expect(check.defaultEnabled).toBe(true);+ expect(check.needsManuscript).toBe(true);+ expect(check.sources).toEqual(expect.arrayContaining(['manuscript', 'reverseOutline']));+ });++ it('gates on a non-empty manuscript', () => {+ const check = getCheck(SUMMARY_NOT_SCENE);+ expect(check.gate({ manuscript: '' })).toBe(false);+ expect(check.gate({ manuscript: MANUSCRIPT })).toBeTruthy();+ });++ it('injects the scene map into the prompt vars and stamps findings with the pacing category', async () => {+ let seenVars = null;+ const ctx = wholeCtx({+ planManuscriptChunks: async (_stage, opts) => {+ expect(opts.context).toHaveProperty('sceneMap');+ return [MANUSCRIPT];+ },+ callStagedLLM: async (_stage, vars) => {+ seenVars = vars;+ return {+ content: {+ findings: [{+ severity: 'medium',+ issueNumber: 1,+ location: 'Issue 1 — compressed turning point',+ problem: 'The decision to go is narrated instead of played out.',+ suggestion: 'Zoom into the argument where she changes her mind.',+ anchorQuote: 'Over the next week they argued about it',+ }],+ },+ };+ },+ });+ const findings = await getCheck(SUMMARY_NOT_SCENE).run(ctx);+ expect(seenVars.sceneMap).toContain('Issue 1: The void');+ expect(seenVars.manuscript).toBe(MANUSCRIPT);+ expect(findings).toHaveLength(1);+ expect(findings[0].category).toBe('pacing');+ expect(findings[0].issueNumber).toBe(1);+ // The anchor is a verbatim slice of the manuscript so the editor can jump to it.+ expect(MANUSCRIPT).toContain(findings[0].anchorQuote);+ });++ it('degrades to a whole-issue scan (empty scene map) when no reverse outline exists', async () => {+ let seenVars = null;+ const ctx = wholeCtx({+ reverseOutline: undefined,+ callStagedLLM: async (_stage, vars) => {+ seenVars = vars;+ return { content: { findings: [] } };+ },+ });+ await getCheck(SUMMARY_NOT_SCENE).run(ctx);+ expect(seenVars.sceneMap).toBe('');+ });++ it('returns no findings for an already-dramatized manuscript', async () => {+ const findings = await getCheck(SUMMARY_NOT_SCENE).run(wholeCtx());+ expect(findings).toEqual([]);+ });++ it('respects maxFindings as a whole-run cap', async () => {+ const many = Array.from({ length: 30 }, (_, i) => ({ severity: 'medium', problem: `p${i}`, anchorQuote: `a${i}` }));+ const ctx = wholeCtx({+ config: { maxFindings: 4 },+ callStagedLLM: async () => ({ content: { findings: many } }),+ });+ const findings = await getCheck(SUMMARY_NOT_SCENE).run(ctx);+ expect(findings).toHaveLength(4);+ });+});+describe('interiority.protagonist — LLM check (#1294)', () => {const wholeCtx = (overrides = {}) => ({manuscript: '# Issue 1\n\nShe walked into the room and sat down.',diff --git a/server/lib/editorial/checks/scene.js b/server/lib/editorial/checks/scene.jsindex 5f80ce8c81..c7c9d2ed53 100644--- a/server/lib/editorial/checks/scene.js+++ b/server/lib/editorial/checks/scene.js@@ -9,6 +9,7 @@ import {PLOT_STRUCTURE_STAGE,REACTION_PROPORTIONALITY_STAGE,SENSORY_BALANCE_STAGE,+ SUMMARY_NOT_SCENE_STAGE,WHITE_ROOM_STAGE,authoredCliffhangerSummary,authoredSetupPayoffSummary,@@ -172,6 +173,50 @@ export const sceneChecks = [});},},+ {+ id: 'narration.summary-not-scene',+ sources: ['manuscript', 'reverseOutline'],+ label: 'Narrated summary where a scene belongs',+ description:+ 'Flags dramatizable beats narrated at helicopter level instead of played out in-scene — a compressed-away turning point ("Over the next week they argued, and eventually she agreed"), reported action the reader never physically enters, habitual/iterative mode ("every night she would…") wrapped around a single decisive event, and result-first narration that states the outcome and skips the scene. The reviewer half of the drafting rule "at least 70% in-scene, not summary". Reads the stitched manuscript plus the reverse-outline scene segmentation, degrading to a whole-issue scan when no outline exists. Distinct from prose.info-dumping (backstory exposition) and scene.component-balance (the mode mix inside a scene that already exists) — a beat that was summarized never became a scene at all.',+ scope: 'issue',+ kind: 'llm',+ category: 'pacing',+ 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,+ run: (ctx) => {+ // The scene map is fixed per-call overhead (re-sent on each chunk). Here it+ // separates legitimate BETWEEN-scene compression from a dramatizable beat+ // that never became a scene at all; the check degrades to a whole-issue+ // scan when no outline exists (the prompt's {{#sceneMap}} renders nothing).+ const sceneMap = sceneGroundingSummary(ctx.reverseOutline);+ return runManuscriptLlmCheck(ctx, {+ stage: SUMMARY_NOT_SCENE_STAGE,+ category: 'pacing',+ context: { sceneMap },+ buildVars: (manuscript, _meta, c) => ({ manuscript, sceneMap: c.sceneMap }),+ });+ },+ },{id: 'scene.interiority-balance',sources: ['manuscript', 'reverseOutline'],diff --git a/server/lib/promptStageCallSites.generated.json b/server/lib/promptStageCallSites.generated.jsonindex d5a55a9d2d..0bc7cb3216 100644--- a/server/lib/promptStageCallSites.generated.json+++ b/server/lib/promptStageCallSites.generated.json@@ -198,6 +198,9 @@"pipeline-editorial-style-conformance": ["server/lib/editorial/checkInfra/revealForeshadowing.js"],+ "pipeline-editorial-summary-not-scene": [+ "server/lib/editorial/checkInfra/craftStages.js"+ ],"pipeline-editorial-telling-emotion": ["server/lib/editorial/checkInfra/craftStages.js"],