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

Keep mood board people out of Cast & sets plates

atomantic1ea7d2d3fb00
diff --git a/server/services/musicVideo/castAndSetsDirection.js b/server/services/musicVideo/castAndSetsDirection.js
index 68d16c952f..59a807c1af 100644
--- a/server/services/musicVideo/castAndSetsDirection.js
+++ b/server/services/musicVideo/castAndSetsDirection.js
@@ -42,6 +42,13 @@ import { CAST_SETS_DEFINITION_LIMITS, normalizeDefinitions } from './castAndSets
// shape the direction as words and are never image-generation inputs.
const MOOD_BOARD_TEXT_ONLY = 'The image generator never sees the mood board: carry what you take from it (light, color, texture, grain, wardrobe feel) into your own words in the descriptions, lighting and looks.';
+// The look line rides on every plate prompt, and a plate is shot empty: a person
+// in either (a mood board's composed style often describes one) lands in the plate.
+const LOOK_AND_SET_RULES = [
+ '- look: palette, light quality, film stock, grain and texture only. Never a person, place, object or pose: it is appended to every image, including the empty set plates.',
+ '- sets: describe the EMPTY place. No people, characters, figures or actions; the protagonist appears only in tests.',
+].join('\n');
+
export const CAST_SETS_LIMITS = Object.freeze({
looks: { min: 1, max: 4 },
sets: { min: 3, max: 8 },
@@ -135,6 +142,7 @@ export function moodBoardImageList(board, resolveItem) {
const OUTPUT_SHAPE = `{
"logline": "<one or two sentences: who, where, what happens>",
"interpretation": "<how the song's references and themes shape this world>",
+ "look": "<one line of photographic look: palette, light quality, film stock, grain, texture; no people, places, objects or poses>",
"protagonist": {
"name": "<a name or designation>",
"description": "<who they are in the song: age, vibe, attitude>",
@@ -145,7 +153,7 @@ const OUTPUT_SHAPE = `{
"rules": ["<continuity or safety rule>"]
},
"looks": [{ "name": "<SHORT NAME>", "description": "<the complete outfit>", "chapters": "<which parts of the song>" }],
- "sets": [{ "id": "<short-slug>", "name": "<set name>", "description": "<the empty location, concrete and visual>", "lighting": "<its one dominant light>", "sections": ["<section label it serves>"] }],
+ "sets": [{ "id": "<short-slug>", "name": "<set name>", "description": "<the empty location, concrete and visual, with nobody in it>", "lighting": "<its one dominant light>", "sections": ["<section label it serves>"] }],
"songMap": [{ "section": 0, "setId": "<short-slug>" }],
"tests": [{ "setId": "<short-slug>", "look": "<SHORT NAME>", "action": "<what the protagonist does in this frame>", "caption": "<the lyric or beat it serves>" }],
"overlayConcept": { "summary": "<one persistent graphic layer that ties every shot together>", "elements": [{ "name": "<element>", "description": "<what it shows and when it changes>" }] },
@@ -155,6 +163,7 @@ const OUTPUT_SHAPE = `{
const PROCEDURAL_OUTPUT_SHAPE = `{
"logline": "<one or two sentences: who, where, what happens>",
"interpretation": "<how the song's references and themes shape this world>",
+ "look": "<one line of photographic look: palette, light quality, film stock, grain, texture; no people, places, objects or poses>",
"protagonist": {
"name": "<a name or designation>",
"description": "<who or what they are in the song: vibe, attitude>",
@@ -257,6 +266,7 @@ export function buildCastAndSetsPrompt(project, { moodImages = [], board = null,
'- Never describe photographic people: no skin, pores, realistic hair, wardrobe photography or singing close-ups. A human or photo cutout is allowed ONLY as a set whose imageRole is "cutout", and only when the director guidance asks for one.',
'- imageRole says what each planned image is FOR: "background" (a full-bleed environment layer), "texture" (a seamless surface), "decoration" (an isolated ornament) or "cutout" (an isolated subject to composite). Default to "background".',
'- Give every set ONE dominant light color or quality so a cut tells the viewer where we are.',
+ LOOK_AND_SET_RULES,
'- songMap: one entry per song section index listed above, naming the set that section plays in.',
`- definitions: one reusable code definition per recurring character (at most ${CAST_SETS_DEFINITION_LIMITS.characters}). Draw it in a 200×200 box (origin top-left, y down) from at most ${CAST_SETS_DEFINITION_LIMITS.parts} simple parts; fills and strokes name a palette entry or a #hex. Expressions and poses are per-part overrides of the base parts; motion rules say what moves, by how much, over how many beats. Keep the definition consistent with the prose above.`,
'- questions: up to three things you need the director to decide.',
@@ -264,6 +274,7 @@ export function buildCastAndSetsPrompt(project, { moodImages = [], board = null,
const photographicRules = [
`- ${CAST_SETS_LIMITS.looks.min}–${CAST_SETS_LIMITS.looks.max} looks, ${CAST_SETS_LIMITS.sets.min}–${CAST_SETS_LIMITS.sets.max} sets, ${CAST_SETS_LIMITS.tests.min}–${CAST_SETS_LIMITS.tests.max} tests.`,
'- Give every set ONE dominant light color or quality so a cut tells the viewer where we are.',
+ LOOK_AND_SET_RULES,
'- songMap: one entry per song section index listed above, naming the set that section plays in.',
'- tests: in-set frames of the protagonist that prove the cast works in the world; each names a set id and a look name.',
'- Wet or revealing looks use opaque fabric so the video stays safe to post.',
@@ -369,6 +380,7 @@ const overlaySchema = z.union([
const FIELD_PARSERS = {
logline: text(TEXT),
interpretation: text(2000),
+ look: text(500),
protagonist: protagonistSchema,
world: worldSchema,
definitions: definitionsSchema,
@@ -511,6 +523,7 @@ export function mergeCastAndSetsDirection(previous, parsed, { sections = [], med
...(procedural ? { medium: 'procedural', world, definitions } : {}),
logline: pick('logline', ''),
interpretation: pick('interpretation', ''),
+ look: pick('look', ''),
protagonist,
looks,
sets,
diff --git a/server/services/musicVideo/castAndSetsPlan.js b/server/services/musicVideo/castAndSetsPlan.js
index 8464bdf04f..5cdb92e3cc 100644
--- a/server/services/musicVideo/castAndSetsPlan.js
+++ b/server/services/musicVideo/castAndSetsPlan.js
@@ -7,13 +7,13 @@
* The prompts generalize the hand-made check-in's templates:
* - `character` — the canonical five-view character sheet. First, and every
* image of the protagonist after it uses it as reference #1.
- * Its own references are the mood-board images the
- * direction picked.
+ * It has no image references: mood board images are
+ * outside inspiration and only reach it as text.
* - `expressions` — a 2×3 expression sheet including the signature gesture.
* - `looks` — the wardrobe lookbook, one panel per look.
- * - `set:<id>` — one EMPTY plate per set (no people), conditioned on the
- * mood board for look only; plates do not depend on the
- * character, so they render alongside it.
+ * - `set:<id>` — one EMPTY plate per set: any sentence of the description
+ * or look that puts a person in it is dropped. Plates do
+ * not depend on the character, so they render alongside it.
* - `test:<n>` — the protagonist in a set: conditioned on that set's plate,
* the character sheet and the looks sheet.
*
@@ -44,6 +44,17 @@ const sentence = (s) => {
};
const join = (...parts) => parts.map(sentence).filter(Boolean).join(' ');
+// A sentence naming a person or the protagonist puts someone in an empty plate.
+const PERSON = /\b(she|he|her|hers|him|his|they|them|their|woman|women|man|men|girl|boy|person|people|figure|figures|silhouette|someone|somebody|protagonist|character|singer|drummer|dancer)\b/i;
+
+/** `text` without the sentences that describe a person (or `name`). */
+function withoutPeople(text, name = '') {
+ const who = String(name || '').trim().toLowerCase();
+ return String(text || '').split(/(?<=[.!?])\s+/)
+ .filter((part) => part.trim() && !PERSON.test(part) && !(who.length >= 3 && part.toLowerCase().includes(who)))
+ .join(' ');
+}
+
function identity(p) {
return [p.face && `face: ${p.face}`, p.hair && `hair: ${p.hair}`].filter(Boolean).join('; ');
}
@@ -88,7 +99,7 @@ const PROCEDURAL_ROLE_PROMPTS = {
/** The procedural plan: one role-prompted plate per set, no photographic character work. */
function buildProceduralImagePlan(direction, { revisionNotes = {} } = {}) {
- const style = trimTo(direction.look, 500);
+ const style = withoutPeople(trimTo(direction.look, 500), direction.protagonist?.name);
const world = direction.world || {};
const plan = {};
for (const set of direction.sets || []) {
@@ -186,6 +197,7 @@ export function buildCastAndSetsImagePlan(project, direction, { revisionNotes =
),
};
+ const plateStyle = withoutPeople(style, p.name);
for (const set of direction.sets || []) {
const key = `set:${set.id}`;
plan[key] = {
@@ -197,9 +209,9 @@ export function buildCastAndSetsImagePlan(project, direction, { revisionNotes =
refKeys: [],
prompt: join(
'Empty set plate, no people',
- set.description,
+ withoutPeople(set.description, p.name) || set.name,
set.lighting && `Lighting: ${set.lighting}`,
- style && `Look: ${style}`,
+ plateStyle && `Look: ${plateStyle}`,
'Photorealistic music video location still',
note(key),
),
diff --git a/server/services/musicVideo/castAndSetsService.js b/server/services/musicVideo/castAndSetsService.js
index ca1e942e66..196c53f89d 100644
--- a/server/services/musicVideo/castAndSetsService.js
+++ b/server/services/musicVideo/castAndSetsService.js
@@ -204,18 +204,32 @@ async function runDirection(projectId, { providerId, model, effort, notes = [],
const sections = songSections(project);
const { direction, missing } = mergeCastAndSetsDirection(notes.length ? previous : null, parsed, { sections, medium });
if (missing.length) return fail(projectId, `The creative direction answer is missing: ${missing.join(', ')}`);
- // The photographic look every image prompt carries: the mood board's composed
- // style, else the project's visual style (never the board's literal places).
- direction.look = trimTo(board?.style?.prompt, 500) || trimTo(project.concept?.style, 500) || previous?.look || '';
+ // The look every image prompt carries: the director's palette/light/texture
+ // line, else the project's visual style. Never the board's composed style
+ // verbatim: it can describe a whole person and scene.
+ direction.look = direction.look || trimTo(project.concept?.style, 500) || '';
// Mood board images inform the direction as text only, never as image references.
return writePlan(projectId, { direction, forceKeys });
}
+/**
+ * A direction saved before the look was written by the director copied the
+ * mood board's composed style prompt verbatim (people and places included);
+ * such a look falls back to the project's visual style.
+ */
+async function withoutBoardLook(project, direction) {
+ const boardId = project?.visualSpec?.moodBoardId;
+ if (!direction?.look || !boardId) return direction;
+ const board = await deps.loadBoard(boardId).catch(() => null);
+ const boardLook = trimTo(board?.style?.prompt, 500);
+ return boardLook && direction.look === boardLook ? { ...direction, look: trimTo(project.concept?.style, 500) || '' } : direction;
+}
+
/** (Re)build the plan from the stage's direction + accumulated per-image notes, then dispatch. */
async function writePlan(projectId, { direction = null, forceKeys = [] } = {}) {
const project = await requireProject(projectId);
const stage = project.castAndSets;
- const nextDirection = direction || stage.direction;
+ const nextDirection = await withoutBoardLook(project, direction || stage.direction);
// A procedural project whose brief names no image tool is code-only: nothing
// is rendered, so no image backend is needed (or consulted).
const codeOnly = !musicVideoAllowsMedia(project, 'image') || nextDirection.medium === 'procedural' && !castAndSetsAllowsImages(project);
diff --git a/server/services/musicVideo/castAndSetsService.test.js b/server/services/musicVideo/castAndSetsService.test.js
index 500ad475a1..cb79efd30a 100644
--- a/server/services/musicVideo/castAndSetsService.test.js
+++ b/server/services/musicVideo/castAndSetsService.test.js
@@ -744,6 +744,35 @@ describe('Cast & Sets procedural check-in', () => {
});
+it('keeps people out of set plates: no mood board person in the look, no character action in a set', async () => {
+ const personBoard = { ...board, style: { prompt: 'An adult woman with tousled curls sits alone beside a rain-speckled window. Amber haze.' } };
+ service.__setCastAndSetsDepsForTests(testDeps({ loadBoard: async () => personBoard }));
+ runPrompt.mockResolvedValue({ text: JSON.stringify({ ...DIRECTION, look: 'amber haze, 35mm grain',
+ sets: DIRECTION.sets.map((set) => (set.id === 'harbor' ? { ...set, description: 'a wet stone quay. She sits on the edge of the quay. Keeper watches the tide.' } : set)) }) });
+ const project = await seed({ concept: { prompt: 'an escape', style: 'grainy 1980s film, soft glow', subjects: [] } });
+ await service.startCastAndSets(project.id);
+ await runTo(project.id, 'review');
+ const plate = (key) => jobs.findLast((j) => keyOf(j) === key).params.prompt;
+ expect(plate('set:harbor')).toContain('a wet stone quay. Lighting');
+ expect(plate('set:harbor')).not.toMatch(/She sits|Keeper watches/);
+ expect(plate('set:lab')).toContain('Look: amber haze, 35mm grain');
+ expect(jobs.some((j) => j.params.prompt.includes('tousled curls'))).toBe(false);
+
+ // A direction saved before the fix copied the board's style verbatim: a
+ // no-notes regenerate falls back to the director's visual style.
+ await projects.mutateProjectRecord(project.id, (current) => ({ project: { ...current,
+ castAndSets: { ...current.castAndSets, direction: { ...current.castAndSets.direction, look: personBoard.style.prompt } } } }));
+ const before = jobs.length;
+ await service.regenerateCastAndSets(project.id);
+ await runTo(project.id, 'review');
+ const replated = jobs.slice(before).filter((j) => keyOf(j).startsWith('set:'));
+ expect(replated).toHaveLength(3);
+ for (const job of replated) {
+ expect(job.params.prompt).toContain('Look: grainy 1980s film, soft glow');
+ expect(job.params.prompt).not.toContain('tousled curls');
+ }
+});
+
it('carries unresolved targeted production feedback into regeneration without resolving the human decision', async () => {
const project = await seed();
await service.startCastAndSets(project.id);