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
address review (codex): screen-direction is facing/motion not gaze; bound eyeline pass with non-silent cap (#1466)
Adam Eivy2b6dbec95fbc
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex e8e80f0fe8..9286aa07fb 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -7,7 +7,7 @@## Added- **[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. 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-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 with a non-silent omission marker so a very large storyboard 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-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/stages/pipeline-editorial-eyeline-match.md b/data.reference/prompts/stages/pipeline-editorial-eyeline-match.mdindex db8548f6a5..cb5236d649 100644--- a/data.reference/prompts/stages/pipeline-editorial-eyeline-match.md+++ b/data.reference/prompts/stages/pipeline-editorial-eyeline-match.md@@ -6,19 +6,26 @@ storyboard for ONE problem: **eyeline-match breaks** within a scene.An eyeline match is the rule that when the camera cuts between two characters inthe same exchange, their gaze directions must RECIPROCATE — if character A looksscreen-right at B, then B (filmed in the answering shot) should look screen-left-back at A. When both look the same way, or a character's described gaze-contradicts the shot's tagged screen direction, the audience loses the sense of-who is looking at whom across the cut.+back at A. When both look the same way, the audience loses the sense of who is+looking at whom across the cut.++**Read gaze from the free-text shot DESCRIPTION, not from the bracketed `screen+direction` tag.** That tag records the side the subject *faces or moves* — which+is NOT always where they look (a character can walk screen-left while looking+back screen-right). Use the tag only as a weak corroborating hint; the+description is the authority for where a character's eyes are directed.Flag ONLY these eyeline problems:- **Non-reciprocating gaze across a conversation cut.** Two characters talking to(or looking at) each other across consecutive/continuity-linked shots whose- gaze directions are the SAME (both screen-left, or both screen-right) instead- of opposite — so they appear to look past each other, not at each other.-- **Gaze contradicts the tagged screen direction.** A shot whose free-text- description says a character looks one way while the shot's recorded screen- direction is the opposite — the storyboard's own two signals disagree.+ described gaze directions are the SAME (both screen-left, or both screen-right)+ instead of opposite — so they appear to look past each other, not at each other.+- **Gaze clearly contradicts the screen direction.** A shot whose description+ states the character LOOKS one way while the recorded screen direction is the+ opposite AND nothing in the description explains the split (e.g. it isn't a+ deliberate "walks left, glances back right") — only then are the two signals in+ genuine conflict.- **A reverse-angle that doesn't flip the eyeline.** A clear shot/reverse-shotpair (the answering angle on the second character) where the second character'sgaze isn't mirrored, so the cut reads as both facing the same off-screen point.@@ -27,7 +34,7 @@ Flag ONLY these eyeline problems:Each scene lists its shots in order. A shot line carries its id, its framing andtagged screen direction in brackets, an optional "continues from" continuity-link, and the free-text description (where the gaze/eyeline lives):+link, and the free-text description (the authority for where the eyes look):```{{shots}}diff --git a/server/lib/editorial/shotContinuity.js b/server/lib/editorial/shotContinuity.jsindex b11d77649b..51ebefc569 100644--- a/server/lib/editorial/shotContinuity.js+++ b/server/lib/editorial/shotContinuity.js@@ -89,14 +89,28 @@ export function findAxisReversals(scene) {}// Human-readable label for a shot's screen direction, used when rendering shots-// for the LLM eyeline/appearance continuity passes (#1466). `neutral` is head-on;-// an unset direction is named so the model knows the signal is absent, not "left".+// for the LLM eyeline/appearance continuity passes (#1466). The field records the+// side the subject "faces / moves" (shotGrammar.js) — NOT specifically gaze — so+// the label stays neutral ("screen direction: left") rather than asserting the+// subject is LOOKING that way; conflating motion with gaze would induce false+// eyeline contradictions for a shot like "walks left while looking back right".+// `neutral` is head-on; an unset direction is named so the model knows the signal+// is absent, not "left".const DIRECTION_PROMPT_LABEL = {- left: 'faces screen-left',- right: 'faces screen-right',- neutral: 'faces head-on',+ left: 'screen direction: left',+ right: 'screen direction: right',+ neutral: 'screen direction: neutral (head-on)',};+// Cap on how many qualifying scenes a single eyeline pass renders, so a series+// with a very large storyboard can't overflow the provider context in one+// unchunked LLM call. An eyeline match is a WITHIN-scene judgment (no cross-scene+// context is lost by splitting the corpus), so the cap simply bounds one pass;+// the omission is surfaced in the block (NOT silent — see the trailing marker) so+// the model and any reader know coverage stopped. Generous enough that a normal+// series renders whole. (A future iteration could page across the overflow.)+export const EYELINE_MAX_SCENES = 60;+/*** Render the collected storyboard scenes into a compact, ordered text block for* an LLM continuity pass (eyeline match — #1466 — and, later, appearance/prop@@ -112,16 +126,25 @@ const DIRECTION_PROMPT_LABEL = {* `continuityFromShotId` reference still resolves to a visible line; an* undescribed shot renders its description as `(no description)`.*+ * At most `maxScenes` qualifying scenes are rendered (bounds one unchunked LLM+ * call); when more qualify, a trailing marker names how many were omitted so the+ * truncation is never silent (eyeline is a within-scene judgment, so omitting a+ * scene loses no cross-scene context).+ ** Returns '' when no scene qualifies, so the caller can gate the LLM call on a* non-empty block (mirrors the object-backstory check's row gate).** @param {Array<{ issueNumber: number|null, scene: object }>} storyboardScenes+ * @param {{ maxScenes?: number }} [opts]* @returns {string}*/-export function summarizeStoryboardShots(storyboardScenes) {+export function summarizeStoryboardShots(storyboardScenes, opts = {}) {+ const maxScenes = Number.isInteger(opts.maxScenes) && opts.maxScenes > 0+ ? opts.maxScenes+ : EYELINE_MAX_SCENES;const entries = Array.isArray(storyboardScenes) ? storyboardScenes : [];const blocks = [];- let sceneIndex = 0;+ let qualifying = 0;for (const entry of entries) {const scene = entry?.scene;if (!scene || typeof scene !== 'object') continue;@@ -131,14 +154,15 @@ export function summarizeStoryboardShots(storyboardScenes) {).length;// Need at least two described shots to compare an eyeline / appearance across.if (describedCount < 2) continue;- sceneIndex += 1;+ qualifying += 1;+ if (blocks.length >= maxScenes) continue; // keep counting (for the marker) but stop renderingconst issueNumber = Number.isInteger(entry.issueNumber) ? entry.issueNumber : null;const sceneName = typeof scene.heading === 'string' && scene.heading.trim()? scene.heading.trim(): (typeof scene.slugline === 'string' && scene.slugline.trim() ? scene.slugline.trim() : 'scene');const header = issueNumber != null- ? `Scene ${sceneIndex} (Issue ${issueNumber}): ${sceneName}`- : `Scene ${sceneIndex}: ${sceneName}`;+ ? `Scene ${blocks.length + 1} (Issue ${issueNumber}): ${sceneName}`+ : `Scene ${blocks.length + 1}: ${sceneName}`;const lines = [];for (const s of shots) {if (!s || typeof s !== 'object') continue;@@ -155,6 +179,11 @@ export function summarizeStoryboardShots(storyboardScenes) {}blocks.push(`${header}\n${lines.join('\n')}`);}+ if (!blocks.length) return '';+ const omitted = qualifying - blocks.length;+ if (omitted > 0) {+ blocks.push(`(${omitted} additional scene${omitted === 1 ? '' : 's'} omitted from this eyeline pass to fit the model context — review them in a later pass.)`);+ }return blocks.join('\n\n');}diff --git a/server/lib/editorial/shotContinuity.test.js b/server/lib/editorial/shotContinuity.test.jsindex 89e0700345..4e6a444735 100644--- a/server/lib/editorial/shotContinuity.test.js+++ b/server/lib/editorial/shotContinuity.test.js@@ -1,5 +1,5 @@import { describe, it, expect } from 'vitest';-import { findAxisReversals, findShotTypeMonotony, summarizeStoryboardShots } from './shotContinuity.js';+import { findAxisReversals, findShotTypeMonotony, summarizeStoryboardShots, EYELINE_MAX_SCENES } from './shotContinuity.js';describe('findAxisReversals', () => {it('flags an axis reversal across a continuity-linked left↔right pair', () => {@@ -141,8 +141,8 @@ describe('summarizeStoryboardShots (#1466)', () => {}),]);expect(block).toContain('Scene 1 (Issue 4): INT. KITCHEN');- expect(block).toContain('shot-01 [medium, faces screen-right]: Anna looks toward the doorway');- expect(block).toContain('shot-02 [medium, faces screen-right] (continues from shot-01): Ben answers, also looking right');+ expect(block).toContain('shot-01 [medium, screen direction: right]: Anna looks toward the doorway');+ expect(block).toContain('shot-02 [medium, screen direction: right] (continues from shot-01): Ben answers, also looking right');});it('skips a scene with fewer than two described shots (nothing to compare)', () => {@@ -169,6 +169,7 @@ describe('summarizeStoryboardShots (#1466)', () => {]);expect(block).toContain('Scene 1: EXT. ROAD'); // no issue number → no "(Issue n)"expect(block).toContain('s3 [unspecified framing, screen direction unspecified]: (no description)');+ expect(block).toContain('screen direction unspecified'); // motion/facing tag, not asserted gaze});it('numbers only qualifying scenes sequentially and joins multiple with a blank line', () => {@@ -190,4 +191,20 @@ describe('summarizeStoryboardShots (#1466)', () => {expect(() => summarizeStoryboardShots([{ scene: null }, { scene: { shots: 'x' } }, {}])).not.toThrow();expect(summarizeStoryboardShots([{ scene: { shots: [1, 2] } }])).toBe(''); // non-object shots → no descriptions});++ it('caps rendered scenes and surfaces a non-silent omission marker when more qualify', () => {+ const comparable = (n) => sceneEntry(n, { heading: `S${n}`, shots: [{ id: `${n}a`, description: 'one' }, { id: `${n}b`, description: 'two' }] });+ const scenes = Array.from({ length: 5 }, (_, i) => comparable(i + 1));+ const block = summarizeStoryboardShots(scenes, { maxScenes: 2 });+ // Only the first two render; their headers renumber 1..2 sequentially.+ expect(block).toContain('Scene 1 (Issue 1): S1');+ expect(block).toContain('Scene 2 (Issue 2): S2');+ expect(block).not.toContain('S3');+ // The remaining 3 are reported, not silently dropped.+ expect(block).toContain('3 additional scenes omitted');+ });++ it('exposes a sane default cap', () => {+ expect(EYELINE_MAX_SCENES).toBeGreaterThan(0);+ });});