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
fix: require visual character foundations
[._.]/ Adam Eivy8c2dba163803
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 0cc644ffe7..4a13da7f07 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -10,6 +10,7 @@- **Foundation structure repair retains shrinking corrective progress.** A broad structure rewrite whose specialized arc verification improved from many blockers to a smaller residual used to get one correction attempt and then roll the entire improvement back. The repair now continues a bounded correction sequence while the blocker count stays monotonic, still restoring the original checkpoint if the set grows or cannot clear within the cap.- **A late structure-repair regression no longer erases an independently verified improvement.** The bounded correction sequence could shrink nine arc blockers to one, then let its final attempt trade that residual for five and restore the entire pre-repair plan—discarding the proven one-blocker checkpoint. It now restores the best verified intermediate state, sends that partial improvement through the harsh foundation re-judge, and leaves the full arc gate dirty so the residual must still clear before beats. Model evidence follows the same transaction boundary: the retained repair runs remain provisional, while the regressive run is immediately scored as rejected; a fully reverted repair is also a rejection rather than a schema-invalid response.+- **Character-first planning now includes the cast's visual foundation.** The pre-arc character architect used to complete psychology and relationships while its response contract omitted physical description, silhouette, visual identity, and palette, so a graphic-novel series could settle its plot around characters the image pipeline still had to invent. Those identity-bearing fields now participate in completeness, prompt hashing, harsh foundation scoring, and repair; optional sheets such as props, expressions, gestures, and wardrobes are authored when the character's form supports them.- **Arc verification can now repair the per-character milestones it judges.** The verifier already read canonical per-character arcs, but its resolver could only edit the series arc, volumes, and issue synopses, so a contradiction in a character transition was impossible to close and repeated retries rewrote unrelated records instead. Finding-keyed character-arc patches now preserve character and transition IDs, merge only named fields, participate in regression rollback, and migrate existing prompt installations to the sparse contract.diff --git a/data.reference/prompts/stages/pipeline-character-foundation.md b/data.reference/prompts/stages/pipeline-character-foundation.mdindex 9fdc0f966c..62efd3f8f1 100644--- a/data.reference/prompts/stages/pipeline-character-foundation.md+++ b/data.reference/prompts/stages/pipeline-character-foundation.md@@ -6,7 +6,7 @@ You are the senior character architect for a long-form series. Build the human e{{phase}}-- In **pre-arc character foundation**, the plot spine does not exist yet. Establish characters whose Ghost → Wound → Lie → Want → Need chains create unavoidable choices and relationship tensions. Do not pre-write an arbitrary sequence of events and retrofit people to it.+- In **pre-arc character foundation**, the plot spine does not exist yet. Establish characters whose Ghost → Wound → Lie → Want → Need chains create unavoidable choices and relationship tensions. Also establish each core character's image-generation identity before the plot starts: body, apparent age/heritage cues where applicable, silhouette, palette, posture, props, and recurring design language. Do not pre-write an arbitrary sequence of events and retrofit people to it.- In **post-arc reconciliation**, preserve the established character foundation. Change an existing character only where the planned story genuinely tests or transforms them. Add a character only when the arc already requires a story function the current ensemble cannot carry. The synopsis-level plan owns event placement: preserve every existing transition beat exactly, and do not add, move, or rewrite an `atIssue` event. If the requested character change needs a scene the plan does not yet contain, deepen the Want / Need / start / end state without inventing that scene; the structure editor will stage it separately.## Editorial finding@@ -41,6 +41,8 @@ You are the senior character architect for a long-form series. Build the human e- Preserve the `id`, name, physical identity, and established history of every supplied character. Existing canon is a constraint, not raw material to replace.- Make Ghost → Wound → Lie → Want → Need causal and specific. The Want must create external action; the Need must demand a costly contradiction of the Lie.- Give each target character distinct values, contradictions, motivation, speech rhythm, secrets, and relationships that exert pressure in both directions.+- Treat visual identity as canon, not decoration. `physicalDescription` must be 50–100 words of concrete, image-generation-ready detail; never use the character's name inside it. Specify apparent age range, scale/build or non-human form, surface/skin, hair and eyes when applicable, distinguishing marks, and signature attire/materials. Make `visualNotes`, `silhouetteNotes`, `postureNotes`, `visualIdentity`, and `colorPalette` mutually reinforcing and visibly distinct from every peer.+- For the core cast, provide practical recurring `props`; provide `expressions`, `handGestures`, and `wardrobes` when the character's form supports them. Do not force human anatomy or clothing onto a non-human entity—use form-appropriate stats, poses, signal states, surface changes, or carried interfaces instead.- Return every supplied target whose framework is incomplete or whose existing engine needs the requested editorial repair. Never silently omit a target merely because the batch is large; later batches handle the rest of the roster.- A provisional character arc describes choices and state changes, not moods. Place transitions at concrete issue numbers within the series target when one is known.- During post-arc reconciliation, the supplied transition list is read-only evidence of what the plan already dramatizes. Never manufacture an early appearance, disclosure, refusal, or relationship turn to justify a character revision.@@ -68,6 +70,18 @@ Return ONLY one valid JSON object. Omit `newCharacters` when no new role is nece"coreTheme": "the thematic tension this character embodies","motivations": "specific competing motives","speechPattern": "distinct cadence and lexical habits",+ "physicalDescription": "50-100 words of concrete image-generation identity",+ "visualNotes": "at-a-glance silhouette, materials, and palette",+ "silhouetteNotes": "distinctive overall shape",+ "postureNotes": "habitual pose and movement cues",+ "specialTraits": "non-redundant identifying details",+ "visualIdentity": "coherent design-language axes",+ "colorPalette": [{"name": "swatch name", "hex": "#112233", "role": "design role"}],+ "stats": [{"label": "Height", "value": "specific value"}],+ "props": [{"name": "signature item", "purpose": "story use", "materials": "renderable materials", "notes": "optional"}],+ "expressions": [{"name": "determined", "description": "visible expression cue"}],+ "handGestures": [{"name": "shared stop", "description": "visible gesture cue"}],+ "wardrobes": [{"name": "default fieldwear", "description": "image-generation-ready outfit", "purpose": "default"}],"arcType": "positive","secrets": ["story-active secret"]}],@@ -85,6 +99,18 @@ Return ONLY one valid JSON object. Omit `newCharacters` when no new role is nece"coreTheme": "thematic tension","motivations": "competing motives","speechPattern": "distinct cadence and lexical habits",+ "physicalDescription": "50-100 words of concrete image-generation identity",+ "visualNotes": "at-a-glance silhouette, materials, and palette",+ "silhouetteNotes": "distinctive overall shape",+ "postureNotes": "habitual pose and movement cues",+ "specialTraits": "non-redundant identifying details",+ "visualIdentity": "coherent design-language axes",+ "colorPalette": [{"name": "swatch name", "hex": "#112233", "role": "design role"}],+ "stats": [{"label": "Height", "value": "specific value"}],+ "props": [{"name": "signature item", "purpose": "story use", "materials": "renderable materials"}],+ "expressions": [{"name": "neutral", "description": "visible expression cue"}],+ "handGestures": [{"name": "resting pose", "description": "visible gesture cue"}],+ "wardrobes": [{"name": "default look", "description": "image-generation-ready outfit", "purpose": "default"}],"arcType": "positive","secrets": ["story-active secret"]}],diff --git a/data.reference/prompts/stages/pipeline-judge-foundation.md b/data.reference/prompts/stages/pipeline-judge-foundation.mdindex c90498139c..0144d5972a 100644--- a/data.reference/prompts/stages/pipeline-judge-foundation.md+++ b/data.reference/prompts/stages/pipeline-judge-foundation.md@@ -43,7 +43,7 @@ the concrete fix restore the derived bible or plan to the protected intent.## Score these 4 weighted dimensions (each 1–10 per the calibration ladder)1. **worldbuilding** *(weight 40%)* — Does the derived universe preserve the protected author intent exactly in substance, without replacing its ontology, protagonists, or core story engine? Do the world's powers have clear LIMITATIONS (not just capabilities)? Is there iceberg depth (implied history/systems beneath the named surface)? Are the pieces interconnected (magic ↔ politics ↔ geography), or a disconnected props list? Is canon coverage broad enough to draft against without inventing on the fly?-2. **character** *(weight 30%)* — Are the leads' Wound → Lie → Want → Need chains complete and specific (not blank, not generic)? Are the characters distinct from one another? Do they carry secrets and a clear arc type? A cast of blank framework fields scores low no matter how many names exist.+2. **character** *(weight 30%)* — Are the leads' Wound → Lie → Want → Need chains complete and specific (not blank, not generic)? Are the characters distinct from one another? Do they carry secrets and a clear arc type? For a graphic-novel target, does every core character also have a concrete, mutually distinct visual foundation—physical description, silhouette, visual identity, and palette—so image generation will not invent them afresh from page to page? A psychologically rich cast with blank render identity is still an incomplete character foundation and cannot score above 5.3. **structure** *(weight 20%)* — Is the arc outline complete (logline, summary, protagonist arc, per-volume loglines + ending hooks)? Is foreshadowing balanced (setups that will pay off, not everything front-loaded or nothing planted)? Do the volume threads nest coherently toward the finale?4. **craft** *(weight 10%)* — Is the declared voice/style clear and specific enough to write to (tense, POV, tone, register), or vague boilerplate a drafter would ignore?@@ -54,7 +54,7 @@ For **each** dimension return `{ "score": <int 1-10>, "gap": "<the single weakesThe automation routes each dimension to a different owning editor. Put a gap in the dimension whose editor can actually apply its fix; otherwise the loop will spend work without changing the offending material.- **worldbuilding** repairs can revise only the universe bible's logline, premise, and style guidance. Use this dimension for missing, vague, or contradictory world rules in those fields. If the bible states a coherent rule but an episode or finale violates it, that is a **structure** gap and its fix must revise the synopsis-level plan.-- **character** repairs can revise the story-referenced character frameworks and authored character arcs. Missing framework, indistinct voices, secrets, relationships, and character transformations belong here. If the framework is sound but the episode plan fails to stage the character's opposition, concession, or choice, put that gap under **structure**.+- **character** repairs can revise the story-referenced character frameworks, visual foundations, and authored character arcs. Missing physical identity, silhouette, palette, framework, distinct voices, secrets, relationships, and character transformations belong here. If the framework is sound but the episode plan fails to stage the character's opposition, concession, or choice, put that gap under **structure**.- **structure** repairs can revise the series arc, volume plan, and episode synopses. Put broken rule applications, unearned coalitions, missing antagonist clashes, unsupported payoffs, and finale mechanics here when the underlying world/character bible is already specific.- **craft** repairs can revise the series prose style, style guide, voice exemplars, and anti-exemplars. Keep visual art-direction gaps out of this dimension.diff --git a/scripts/migrations/255-character-visual-foundation.js b/scripts/migrations/255-character-visual-foundation.jsnew file mode 100644index 0000000000..110e72cebf--- /dev/null+++ b/scripts/migrations/255-character-visual-foundation.js@@ -0,0 +1,35 @@+/**+ * Make render identity part of the pre-arc character foundation.+ *+ * The character architect previously completed the psychological engine while+ * its response contract omitted physicalDescription and every visual-design+ * field. Graphic-novel series could therefore settle their plots around a cast+ * whose bodies, silhouettes, and palettes were still blank. The judge now+ * treats that as an incomplete character foundation and the repair stage owns+ * those fields. Hash replacement preserves customized prompts and is+ * idempotent.+ */++import { makePromptReplaceMigration } from './_lib.js';++export const ACCEPTED_OLD_MD5 = {+ 'pipeline-character-foundation.md': ['d6c449c06de73a0868141c899b26e52c'],+ 'pipeline-judge-foundation.md': ['edf7850d0c724c63761bc9fb667227d9'],+};++export const NEW_SHIPPED_MD5 = {+ 'pipeline-character-foundation.md': '04419e382f3b46ed92bfaaa1d4f39e13',+ 'pipeline-judge-foundation.md': '02a8e9215ba534b333f3a29f11f3ac4f',+};++const { applyMigration, up } = makePromptReplaceMigration({+ accepted: ACCEPTED_OLD_MD5,+ current: NEW_SHIPPED_MD5,+ label: 'character visual foundation',+ customizedHint: (filename) =>+ ` To upgrade it manually, diff data.reference/prompts/stages/${filename}\n` ++ ` against data/prompts/stages/${filename} and adopt the render-identity foundation contract.`,+});++export { applyMigration };+export default { up };diff --git a/scripts/migrations/255-character-visual-foundation.test.js b/scripts/migrations/255-character-visual-foundation.test.jsnew file mode 100644index 0000000000..577fa07f08--- /dev/null+++ b/scripts/migrations/255-character-visual-foundation.test.js@@ -0,0 +1,34 @@+import { readFileSync } from 'fs';+import { describe, expect, it } from 'vitest';++import { repoRoot, runPromptMigrationTests } from './_testHelpers.js';+import migration, {+ ACCEPTED_OLD_MD5,+ NEW_SHIPPED_MD5,+ applyMigration,+} from './255-character-visual-foundation.js';++describe('migration 255 — character visual foundation', () => {+ runPromptMigrationTests({+ migration,+ applyMigration,+ ACCEPTED_OLD_MD5,+ NEW_SHIPPED_MD5,+ prefix: 'migration-255-character-visual-foundation-',+ });++ it('requires render identity before the character foundation can pass', () => {+ const architect = readFileSync(+ `${repoRoot}/data.reference/prompts/stages/pipeline-character-foundation.md`,+ 'utf8',+ );+ const judge = readFileSync(+ `${repoRoot}/data.reference/prompts/stages/pipeline-judge-foundation.md`,+ 'utf8',+ );+ expect(architect).toContain('physicalDescription` must be 50–100 words');+ expect(architect).toContain('"colorPalette"');+ expect(judge).toContain('blank render identity');+ expect(judge).toContain('cannot score above 5');+ });+});diff --git a/server/services/pipeline/foundationJudge.js b/server/services/pipeline/foundationJudge.jsindex e982a6d038..142a05844d 100644--- a/server/services/pipeline/foundationJudge.js+++ b/server/services/pipeline/foundationJudge.js@@ -163,6 +163,7 @@ export function foundationInputs(series, universe, issues = []) {name: c.name,role: c.role || '',...pickFrameworkFields(c),+ ...pickVisualFoundationFields(c),})),arc: series?.arc || null,seasons: Array.isArray(series?.seasons)@@ -188,6 +189,13 @@ export function foundationInputs(series, universe, issues = []) {// Lie → Want → Need chain + secrets + arc fields). Shared by the hash projection// and the "thinnest character" fix target so both read the SAME field set.const FRAMEWORK_STRING_FIELDS = Object.freeze(['ghost', 'wound', 'lie', 'want', 'need', 'coreTheme', 'motivations', 'speechPattern']);+// Identity-bearing visual axes a graphic-novel lead needs before the plot is+// allowed to grow around them. This intentionally stops short of requiring a+// human facial-expression or wardrobe sheet from non-human characters.+const VISUAL_FOUNDATION_STRING_FIELDS = Object.freeze([+ 'physicalDescription', 'visualNotes', 'silhouetteNotes', 'visualIdentity',+]);+const VISUAL_FOUNDATION_LIST_FIELDS = Object.freeze(['colorPalette']);function pickFrameworkFields(c) {const out = {};for (const f of FRAMEWORK_STRING_FIELDS) out[f] = c?.[f] || '';@@ -196,6 +204,13 @@ function pickFrameworkFields(c) {return out;}+function pickVisualFoundationFields(c) {+ const out = {};+ for (const field of VISUAL_FOUNDATION_STRING_FIELDS) out[field] = c?.[field] || '';+ for (const field of VISUAL_FOUNDATION_LIST_FIELDS) out[field] = Array.isArray(c?.[field]) ? c[field] : [];+ return out;+}+const contentHash = (value) => createHash('sha256').update(JSON.stringify(value ?? null)).digest('hex');export const foundationInputsHash = (series, universe, issues = []) => contentHash(foundationInputs(series, universe, issues));@@ -384,7 +399,11 @@ function renderCharacterLine(c, { core = false } = {}) {.map(concise).slice(0, 3).join('; ');- return `- ${core ? '[CORE] ' : ''}**${c?.name || 'Unnamed'}**${role} — ${framework} | arcType: ${c?.arcType || '—'} | secrets: ${secrets || '—'}`;+ const visual = [+ ...VISUAL_FOUNDATION_STRING_FIELDS.map((field) => `${field}: ${isBlankString(c?.[field]) ? 'BLANK' : 'ready'}`),+ ...VISUAL_FOUNDATION_LIST_FIELDS.map((field) => `${field}: ${isBlankArray(c?.[field]) ? 'BLANK' : 'ready'}`),+ ].join(' | ');+ return `- ${core ? '[CORE] ' : ''}**${c?.name || 'Unnamed'}**${role} — ${framework} | arcType: ${c?.arcType || '—'} | secrets: ${secrets || '—'} | visual foundation: ${visual}`;}function countOccurrences(text, value) {@@ -423,7 +442,9 @@ export function rankFoundationCharacters(characters, series, issues = [], { incl.filter((character) => character && (includeLocked || character.locked !== true)).map((character, index) => {const blanks = FRAMEWORK_STRING_FIELDS.filter((field) => isBlankString(character[field])).length- + (isBlankArray(character.secrets) ? 1 : 0);+ + (isBlankArray(character.secrets) ? 1 : 0)+ + VISUAL_FOUNDATION_STRING_FIELDS.filter((field) => isBlankString(character[field])).length+ + VISUAL_FOUNDATION_LIST_FIELDS.filter((field) => isBlankArray(character[field])).length;const mentions = countOccurrences(storyText, character.name);const authoredArc = authoredArcKeys.has(character.id)|| authoredArcKeys.has(`name:${String(character.name || '').trim().toLowerCase()}`);@@ -798,7 +819,9 @@ export function thinnestCharacter(characters) {for (const c of list) {if (!c || c.locked === true) continue;const blanks = FRAMEWORK_STRING_FIELDS.filter((f) => isBlankString(c[f])).length- + (isBlankArray(c.secrets) ? 1 : 0);+ + (isBlankArray(c.secrets) ? 1 : 0)+ + VISUAL_FOUNDATION_STRING_FIELDS.filter((field) => isBlankString(c[field])).length+ + VISUAL_FOUNDATION_LIST_FIELDS.filter((field) => isBlankArray(c[field])).length;if (blanks === 0) continue;if (best === null || blanks > best.blanks) best = { id: c.id, blanks };}@@ -807,11 +830,20 @@ export function thinnestCharacter(characters) {const REPAIRABLE_CHARACTER_FIELDS = Object.freeze([...FRAMEWORK_STRING_FIELDS,+ ...VISUAL_FOUNDATION_STRING_FIELDS,+ ...VISUAL_FOUNDATION_LIST_FIELDS,'arcType','secrets','personality','background','relationships',+ 'postureNotes',+ 'specialTraits',+ 'stats',+ 'props',+ 'expressions',+ 'handGestures',+ 'wardrobes',]);const MAX_FOUNDATION_NEW_CHARACTERS = 3;@@ -932,15 +964,17 @@ function renderRepairSeriesJson(series, maxChars = REPAIR_SERIES_MAX_CHARS) {// The full-ensemble roster is the unbounded half of the character payload:// `CHARACTER_FOUNDATION_BATCH_SIZE` bounds `targetCharacters`, but// `fullSeriesRoster` carries every cast member with every framework field, so it-// grows with the series. Compact the roster to the differentiation spine before-// dropping members — the roster exists so the batch can differentiate and keep-// relationships straight, which a name/role/want/need line still supports.+// grows with the series. Compact the roster to the narrative and visual+// differentiation spine before dropping members — the roster exists so the+// batch can differentiate relationships, motives, and render identities.const compactRosterCharacter = (character) => ({id: character?.id,name: character?.name,role: character?.role,want: character?.want || '',need: character?.need || '',+ physicalDescription: character?.physicalDescription || '',+ visualIdentity: character?.visualIdentity || '',});// `CHARACTER_FOUNDATION_BATCH_SIZE` bounds how MANY characters a batch carries,@@ -999,14 +1033,14 @@ function renderRepairCharactersJson(payload, maxChars = REPAIR_CHARACTERS_MAX_CHconst roster = Array.isArray(payload?.fullSeriesRoster) ? payload.fullSeriesRoster : [];const compactRoster = roster.map(compactRosterCharacter);const rosterNote = (kept) => (kept === compactRoster.length- ? 'Roster compacted to name/role/want/need to fit the prompt budget.'+ ? 'Roster compacted to narrative and visual identity axes to fit the prompt budget.': `Roster compacted and limited to ${kept} of ${compactRoster.length} members to fit the prompt budget.`);const buildTargets = (cap, spine) => {const shaped = spine ? targets.map(compactRosterCharacter) : targets;return cap ? shaped.map((character) => capCharacterFields(character, cap)) : shaped;};const targetNote = (cap, spine) => {- if (spine) return `Batch compacted to name/role/want/need and truncated at ${cap} characters to fit the prompt budget.`;+ if (spine) return `Batch compacted to narrative and visual identity axes and truncated at ${cap} characters to fit the prompt budget.`;return cap ? `Character fields over ${cap} characters were truncated to fit the prompt budget.` : undefined;};const build = (kept, cap, spine = false) => render({@@ -1081,6 +1115,14 @@ async function runFoundationRepair(series, issues, dimension, finding, characterbackground: character.background,relationships: character.relationships,...pickFrameworkFields(character),+ ...pickVisualFoundationFields(character),+ postureNotes: character.postureNotes || '',+ specialTraits: character.specialTraits || '',+ stats: Array.isArray(character.stats) ? character.stats : [],+ props: Array.isArray(character.props) ? character.props : [],+ expressions: Array.isArray(character.expressions) ? character.expressions : [],+ handGestures: Array.isArray(character.handGestures) ? character.handGestures : [],+ wardrobes: Array.isArray(character.wardrobes) ? character.wardrobes : [],});const charactersPayload = dimension === 'character'? {@@ -1297,7 +1339,9 @@ async function repairCharacters(series, issues, universe, finding, options) {function hasCompleteFramework(character) {return FRAMEWORK_STRING_FIELDS.every((field) => !isBlankString(character?.[field]))&& !isBlankArray(character?.secrets)- && !isBlankString(character?.arcType);+ && !isBlankString(character?.arcType)+ && VISUAL_FOUNDATION_STRING_FIELDS.every((field) => !isBlankString(character?.[field]))+ && VISUAL_FOUNDATION_LIST_FIELDS.every((field) => !isBlankArray(character?.[field]));}/**@@ -1336,8 +1380,8 @@ export async function establishCharacterFoundation(seriesId, {return { applied: false, skipped: true, ran: false, reason: 'core character foundation is already complete' };}const result = await repairCharacters(series, [], universe, {- gap: 'The plot spine has not been generated yet, so the core cast must first have specific causal inner engines and relationship tensions.',- fix: 'Complete the core ensemble from the premise: Ghost to Wound to Lie to Want to Need, distinct voice and contradictions, active relationships, and a provisional whole-series change path. Add only a genuinely missing core role.',+ gap: 'The plot spine has not been generated yet, so the core cast must first have specific causal inner engines, relationship tensions, and stable render identities.',+ fix: 'Complete the core ensemble from the premise: Ghost to Wound to Lie to Want to Need, distinct voice and contradictions, active relationships, mutually distinct physical descriptions, silhouettes, visual identities and palettes, and a provisional whole-series change path. Add only a genuinely missing core role.',}, {providerId: providerDefault,model: modelDefault,diff --git a/server/services/pipeline/foundationJudge.test.js b/server/services/pipeline/foundationJudge.test.jsindex df41982e86..870768578c 100644--- a/server/services/pipeline/foundationJudge.test.js+++ b/server/services/pipeline/foundationJudge.test.js@@ -277,6 +277,21 @@ describe('foundationInputsHash + staleness — fast-pass pinning', () => {const uni2 = { characters: [{ id: 'c1', name: 'Ana', wound: 'abandoned as a child' }] };expect(foundationInputsHash({}, uni1)).not.toBe(foundationInputsHash({}, uni2));});+ it('changes when a core character visual foundation changes', () => {+ const series = { premise: 'Lead crosses the flooded city.' };+ const base = { characters: [{ id: 'c1', name: 'Lead', physicalDescription: '', visualIdentity: '' }] };+ const designed = {+ characters: [{+ ...base.characters[0],+ physicalDescription: 'A compact young surveyor with copper curls and a patched yellow pressure coat.',+ visualIdentity: 'round survey instruments against a narrow triangular silhouette',+ visualNotes: 'mustard and oxidized copper fieldwear',+ silhouetteNotes: 'compact torso, wide tool belt, tapered boots',+ colorPalette: [{ name: 'survey yellow', hex: '#d9a21b', role: 'coat' }],+ }],+ };+ expect(foundationInputsHash(series, base)).not.toBe(foundationInputsHash(series, designed));+ });it('changes when the protected author intent changes', () => {const base = { starterPrompt: 'A clockmaker discovers that dragons control the weather.' };const drifted = { starterPrompt: 'Train conductors regulate an intercity signal network.' };@@ -568,7 +583,15 @@ describe('foundation repair prompt — bounded series seed and cast', () => {expect(parsed.targetCharacters[0].background).toBe('b'.repeat(200));// The roster degrades to the differentiation spine.expect(parsed.fullSeriesRoster.length).toBeGreaterThan(0);- expect(parsed.fullSeriesRoster[0]).toEqual({ id: 'chr-0', name: 'Cast 0', role: 'lead', want: 'w'.repeat(60), need: 'n'.repeat(60) });+ expect(parsed.fullSeriesRoster[0]).toEqual({+ id: 'chr-0',+ name: 'Cast 0',+ role: 'lead',+ want: 'w'.repeat(60),+ need: 'n'.repeat(60),+ physicalDescription: '',+ visualIdentity: '',+ });expect(parsed.rosterNote).toMatch(/fit the prompt budget/);});@@ -1295,6 +1318,11 @@ describe('applyFoundationFix — dimension → owning-service routing table', ()lie: 'Trust creates casualties', want: 'Act alone', need: 'Choose interdependence',coreTheme: 'trust', motivations: 'Protect others while hiding fear',speechPattern: 'clipped observations', arcType: 'positive', secrets: ['Caused the failure'],+ physicalDescription: 'A compact young rescuer with close-cropped silver hair, a square jaw, and a patched ochre pressure coat.',+ visualNotes: 'ochre and charcoal rescue layers with round analog gauges',+ silhouetteNotes: 'compact torso, broad tool belt, tapered boots',+ visualIdentity: 'rounded rescue hardware against a compact triangular silhouette',+ colorPalette: [{ name: 'rescue ochre', hex: '#c88928', role: 'coat' }],}],characterArcs: [{characterId: 'chr-thin', characterName: 'Lead', want: 'Act alone', need: 'Choose interdependence',@@ -1304,6 +1332,9 @@ describe('applyFoundationFix — dimension → owning-service routing table', ()} });const r = await establishCharacterFoundation('ser-1', { providerDefault: 'codex', modelDefault: 'gpt-x', effortDefault: 'high' });expect(r).toMatchObject({ ran: true, applied: true });+ expect(r.updatedFields).toEqual(expect.arrayContaining([+ 'physicalDescription', 'visualNotes', 'silhouetteNotes', 'visualIdentity', 'colorPalette',+ ]));expect(stageRunner.runStagedLLM).toHaveBeenCalledWith('pipeline-character-foundation', expect.objectContaining({phase: 'pre-arc character foundation',}), expect.objectContaining({ providerDefault: 'codex', modelDefault: 'gpt-x', effortDefault: 'high' }));