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

fix: flag empty comic dialogue balloons

[._.]/ Adam Eivy5d619df5a01e
diff --git a/data.reference/prompts/stages/pipeline-comic-script.md b/data.reference/prompts/stages/pipeline-comic-script.md
index 8a1625c473..0ab31e2fb2 100644
--- a/data.reference/prompts/stages/pipeline-comic-script.md
+++ b/data.reference/prompts/stages/pipeline-comic-script.md
@@ -94,6 +94,7 @@ Panel 2
- **Cliffhanger / lead-in ending:** the final page (and ideally the final panel) must do one of: (a) reveal something that flips what we thought we knew, (b) deliver a cliffhanger — character in peril, decision unmade, antagonist arriving — or (c) plant the seed for the next issue with a clear "to be continued" pull. Never end on resolution alone.
- Panel descriptions stay in **present tense** and describe only what's on the page.
- Dialogue is short — comic balloons hold about 25 words max. Break long speeches across panels.
+- **Never emit empty quoted dialogue** (`NAME: ""`, `NAME: " "`, etc.). If a character reacts silently, put the reaction in `Description:`; if the beat is a nonverbal sound, use a specific `SFX:` value instead.
- Use **CAPS for character names** in dialogue attributions (`LINA:`), and call out **emphasis** with bold.
- **Balloon contents = quoted text only.** The CAPS speaker name and any parenthetical modifier (`(EARPIECE)`, `(WHISPERED)`, `(THOUGHT)`, `(OFF-PANEL)`, etc.) are *attribution* — they tell the artist whose mouth/earpiece the balloon points to and what shape to draw (jagged for radio, dashed for whisper, cloud for thought). **Never repeat the speaker name or modifier inside the quoted line** (write `ETTA (EARPIECE): "Stall forty-one is the buy."`, NOT `ETTA (EARPIECE): "ETTA (EARPIECE): Stall forty-one is the buy."` — and never inline speaker tags like `"— Etta"` inside the quoted text either). Downstream image-gen leaks any text it sees into the lettered balloon.
- Captions for time/place jumps (`CAPTION: THREE HOURS LATER`) or interiority that can't be drawn.
diff --git a/data.reference/prompts/stages/pipeline-script-verify.md b/data.reference/prompts/stages/pipeline-script-verify.md
index 6dac8ccec9..a32c93f014 100644
--- a/data.reference/prompts/stages/pipeline-script-verify.md
+++ b/data.reference/prompts/stages/pipeline-script-verify.md
@@ -19,7 +19,7 @@ You are a comics script editor doing a craft pass on ONE issue's comic script **
Read the script page by page, panel by panel. Flag only concrete, fixable problems:
1. **Un-renderable panels.** A panel whose description gives the artist nothing to draw (pure interiority with no visual — "she realizes she was wrong"), or that crams multiple distinct moments into one panel that can't be a single image.
-2. **Missing or malformed structure.** A page with no panels, a panel with no description, dialogue attributed to no one, or a page that's actually prose paragraphs rather than panel breakdowns.
+2. **Missing or malformed structure.** A page with no panels, a panel with no description, dialogue attributed to no one, an empty quoted dialogue line (`NAME: ""`) that would create a blank balloon, or a page that's actually prose paragraphs rather than panel breakdowns.
3. **Panel-to-panel flow breaks.** A jump where the reader loses the thread between panels (an action with no establishing panel, a reaction with no cause shown, a location change with no re-establish).
4. **Dialogue/art imbalance.** A panel buried under more dialogue/caption than a single image can carry (wall-of-text balloons), or a key beat with no dialogue *and* no clear visual.
5. **Continuity within the issue.** A character/prop/setting that appears, changes, or vanishes between panels without explanation (a gun drawn in panel 2 gone in panel 3 with no beat).
diff --git a/server/services/pipeline/scriptVerify.js b/server/services/pipeline/scriptVerify.js
index 1b1a5d8ae5..ccf8bda37a 100644
--- a/server/services/pipeline/scriptVerify.js
+++ b/server/services/pipeline/scriptVerify.js
@@ -23,6 +23,80 @@ import { shapeVerifyIssues } from './arcPlanner.js';
const STAGE = 'pipeline-script-verify';
const CONTENT_MAX = 48_000;
const OUTPUT_RESERVE_TOKENS = 2_000;
+const VERIFY_PAGE_RE = /^##\s+Page\s+([\dIVX]+)\b/i;
+const VERIFY_PANEL_RE = /^(?:###\s+)?Panel\s+([\dIVX]+)\s*(?:\([^)]+\))?\s*:?\s*$/i;
+const VERIFY_FIELD_RE = /^(?:\*\*)?(Description|Caption(?:\s+\d+)?|Dialogue|SFX)\s*:(?:\*\*)?\s*(.*)$/i;
+const EMPTY_DIALOGUE_RE = /^[-*]?\s*([A-Z][A-Z0-9 '"&./()\-]*?):\s*(?:"\s*"|'\s*'|“\s*”|‘\s*’)\s*$/;
+
+function emptyDialogueIssue(speaker, pageNumber, panelNumber) {
+ const who = speaker.trim();
+ return {
+ severity: 'high',
+ location: `page ${pageNumber || '?'} / panel ${panelNumber || '?'}`,
+ problem: `The dialogue entry is malformed: ${who} is given an empty quoted line, leaving the letterer with an empty balloon to place.`,
+ suggestion: 'Delete the empty dialogue line or replace it with a specific nonverbal SFX if the character is meant to react silently.',
+ };
+}
+
+function findEmptyDialogueIssues(script) {
+ if (typeof script !== 'string' || !script.trim()) return [];
+ const issues = [];
+ let pageNumber = '';
+ let panelNumber = '';
+ let activeField = null;
+
+ const checkDialogueText = (text) => {
+ const t = (text || '').trim();
+ if (!t) return;
+ const match = t.match(EMPTY_DIALOGUE_RE);
+ if (match) {
+ issues.push(emptyDialogueIssue(match[1], pageNumber, panelNumber));
+ }
+ };
+
+ for (const raw of script.split(/\r?\n/)) {
+ const line = raw || '';
+ const pageMatch = line.match(VERIFY_PAGE_RE);
+ if (pageMatch) {
+ pageNumber = pageMatch[1];
+ panelNumber = '';
+ activeField = null;
+ continue;
+ }
+ const panelMatch = line.match(VERIFY_PANEL_RE);
+ if (panelMatch) {
+ panelNumber = panelMatch[1];
+ activeField = null;
+ continue;
+ }
+ const fieldMatch = line.match(VERIFY_FIELD_RE);
+ if (fieldMatch) {
+ const label = fieldMatch[1].toLowerCase().replace(/\s+\d+$/, '').trim();
+ activeField = label;
+ if (label === 'dialogue') checkDialogueText(fieldMatch[2]);
+ continue;
+ }
+ if (activeField === 'dialogue') checkDialogueText(line);
+ }
+
+ return shapeVerifyIssues(issues);
+}
+
+function issueKey(issue) {
+ return `${issue.severity}|${issue.location}|${issue.problem}`;
+}
+
+function mergeVerifyIssues(first, second) {
+ const out = [];
+ const seen = new Set();
+ for (const issue of [...(first || []), ...(second || [])]) {
+ const key = issueKey(issue);
+ if (seen.has(key)) continue;
+ seen.add(key);
+ out.push(issue);
+ }
+ return out;
+}
/**
* Verify the comic script of one issue. Returns
@@ -33,6 +107,7 @@ export async function verifyComicScript(issueId, { providerId, model } = {}) {
const issue = await getIssue(issueId);
const script = (issue.stages?.comicScript?.output || '').trim();
if (!script) return { issues: [], skipped: 'no-comic-script' };
+ const deterministicIssues = findEmptyDialogueIssues(script);
const series = await getSeries(issue.seriesId).catch(() => null);
@@ -64,5 +139,16 @@ export async function verifyComicScript(issueId, { providerId, model } = {}) {
source: 'pipeline-script-verify',
});
- return { issues: shapeVerifyIssues(parsed?.issues), raw: parsed, runId, providerId: pid, model: m };
+ return {
+ issues: mergeVerifyIssues(deterministicIssues, shapeVerifyIssues(parsed?.issues)),
+ raw: parsed,
+ runId,
+ providerId: pid,
+ model: m,
+ };
}
+
+export const __testing = {
+ findEmptyDialogueIssues,
+ mergeVerifyIssues,
+};
diff --git a/server/services/pipeline/scriptVerify.test.js b/server/services/pipeline/scriptVerify.test.js
new file mode 100644
index 0000000000..38f0546af8
--- /dev/null
+++ b/server/services/pipeline/scriptVerify.test.js
@@ -0,0 +1,61 @@
+import { describe, expect, it } from 'vitest';
+import { __testing } from './scriptVerify.js';
+
+const { findEmptyDialogueIssues, mergeVerifyIssues } = __testing;
+
+describe('scriptVerify deterministic checks', () => {
+ it('flags an empty quoted dialogue line with page and panel location', () => {
+ const script = [
+ '## Page 17',
+ '',
+ 'Panel 4',
+ 'Description: ASTER-9 CHANDELIER hangs motionless above the room.',
+ 'Caption: (none)',
+ 'Dialogue:',
+ '- ASTER-9 CHANDELIER: ""',
+ 'SFX: (none)',
+ ].join('\n');
+
+ expect(findEmptyDialogueIssues(script)).toEqual([
+ expect.objectContaining({
+ severity: 'high',
+ location: 'page 17 / panel 4',
+ problem: expect.stringContaining('ASTER-9 CHANDELIER is given an empty quoted line'),
+ suggestion: expect.stringContaining('Delete the empty dialogue line'),
+ }),
+ ]);
+ });
+
+ it('flags inline empty dialogue values on the Dialogue field', () => {
+ const script = [
+ '## Page 1',
+ '### Panel 2',
+ 'Description: A face in close-up.',
+ '**Dialogue:** KESSA: " "',
+ ].join('\n');
+
+ expect(findEmptyDialogueIssues(script)).toHaveLength(1);
+ expect(findEmptyDialogueIssues(script)[0]).toMatchObject({
+ location: 'page 1 / panel 2',
+ });
+ });
+
+ it('ignores non-empty dialogue and dedupes merged findings', () => {
+ const script = [
+ '## Page 1',
+ 'Panel 1',
+ 'Description: A face in close-up.',
+ 'Dialogue:',
+ '- KESSA: "No."',
+ ].join('\n');
+ const existing = [{
+ severity: 'high',
+ location: 'page 1 / panel 1',
+ problem: 'same',
+ suggestion: 'same',
+ }];
+
+ expect(findEmptyDialogueIssues(script)).toEqual([]);
+ expect(mergeVerifyIssues(existing, existing)).toEqual(existing);
+ });
+});