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(universe-builder): decouple style/negative prompts from embrace/avoid tags
[._.]/ Adam Eivy3cb77cb6f183
diff --git a/client/src/pages/UniverseBuilder.jsx b/client/src/pages/UniverseBuilder.jsxindex ef3e1e4591..f9383c812c 100644--- a/client/src/pages/UniverseBuilder.jsx+++ b/client/src/pages/UniverseBuilder.jsx@@ -169,7 +169,7 @@ function InfluencesEditor({ influences, onChange, locked, onToggleLock }) {<div><div className="mb-1"><label className="text-xs text-gray-400">- Influences <span className="text-gray-600">— prepended to render prompts deterministically; embrace + avoid lock independently</span>+ Influences <span className="text-gray-600">— appended to style/negative prompts at render time; embrace + avoid lock independently</span></label></div><div className="grid grid-cols-1 md:grid-cols-2 gap-3">diff --git a/server/services/universeBuilder.js b/server/services/universeBuilder.jsindex 9de7651098..e08f3d4801 100644--- a/server/services/universeBuilder.js+++ b/server/services/universeBuilder.js@@ -663,10 +663,10 @@ export async function listRuns(universeId = null) {*/export function composeInfluenceTokens(structured = [], prose = '') {const all = [];- if (Array.isArray(structured)) all.push(...structured);if (typeof prose === 'string' && prose.trim()) {all.push(...prose.split(',').map((s) => s.trim()).filter(Boolean));}+ if (Array.isArray(structured)) all.push(...structured);const seen = new Set();const out = [];for (const token of all) {diff --git a/server/services/universeBuilder.test.js b/server/services/universeBuilder.test.jsindex 69bc2a14f7..ad3caab618 100644--- a/server/services/universeBuilder.test.js+++ b/server/services/universeBuilder.test.js@@ -450,7 +450,7 @@ describe("universeBuilder service", () => {expect(patched.influences.avoid).toEqual([]);});- it("compilePrompts deterministically prepends embrace to prompt + avoid to negative, deduped", async () => {+ it("compilePrompts deterministically appends embrace to prompt + avoid to negative, deduped", async () => {const w = await seedWorld({// stylePrompt already mentions one of the embraces — dedupe should// ensure it doesn't appear twice in the rendered prompt.@@ -465,17 +465,17 @@ describe("universeBuilder service", () => {selection: { landscapes: ["Crystal Canyon"] },});expect(compiled).toHaveLength(1);- // Embrace tokens prefix the existing style tokens; the duplicate+ // Style prose comes first; embrace tokens are appended; duplicate// "cel-shading" only appears once.expect(compiled[0].prompt.startsWith(- "Moebius, cel-shading, ink, dust palette",+ "cel-shading, ink, dust palette, Moebius",),).toBe(true);expect((compiled[0].prompt.match(/cel-shading/g) || []).length).toBe(1);- // Negative: avoid tokens prefix existing negatives, deduped against "lowres".+ // Negative: existing negatives come first; avoid tokens are appended, deduped against "lowres".expect(- compiled[0].negativePrompt.startsWith("ghibli painterly, lowres"),+ compiled[0].negativePrompt.startsWith("lowres, ghibli painterly"),).toBe(true);expect((compiled[0].negativePrompt.match(/lowres/g) || []).length).toBe(1,diff --git a/server/services/universeBuilderExpand.js b/server/services/universeBuilderExpand.jsindex 025c5fd71e..c554b2e591 100644--- a/server/services/universeBuilderExpand.js+++ b/server/services/universeBuilderExpand.js@@ -69,7 +69,7 @@ function buildExpansionPrompt({const avoidTag = locked?.influencesAvoid ? ' [LOCKED]' : '';const influencesSection =embrace.length || avoid.length- ? `\n# Influences (canonical reference list — these MUST inform stylePrompt + styleNotes for embraces and negativePrompt for avoids)\nEmbrace${embraceTag}: ${embrace.join(", ") || "(none)"}\nAvoid${avoidTag}: ${avoid.join(", ") || "(none)"}\n`+ ? `\n# Influences (canonical reference list — appended to stylePrompt/negativePrompt at render time; keep them distinct from the prose fields)\nEmbrace${embraceTag}: ${embrace.join(", ") || "(none)"}\nAvoid${avoidTag}: ${avoid.join(", ") || "(none)"}\n`: "";// Locked entries are flagged and MUST be echoed verbatim; unlocked entries@@ -129,9 +129,9 @@ Return a SINGLE JSON object. NO markdown, NO commentary. The object MUST have th- logline: string. ONE sentence (≤500 chars) capturing the universe's central tension/hook — protagonist-agnostic if no protagonist is implied. Example: "A foundry city goes silent — and the only survivor is a child."- premise: string. 1-3 short paragraphs (≤4000 chars total) describing the setting, the central conflict or situation, the stakes, and the tone. Write it as the elevator pitch a showrunner would hand to a writers' room. No bullet points; prose only.- styleNotes: string. A prose paragraph (≤4000 chars) describing the visual + tonal style for the story bible — references (artists, films, comics, games), mood, palette, pacing, narrative voice. This is read by writers + creative directors, not the image model, so use full sentences instead of comma-separated tokens.-- influences: object { "embrace": [string], "avoid": [string] }. Short canonical reference labels (max 120 chars each, max 30 per list) — artists, comics, films, directors, palettes, materials, eras the universe EMBRACES; styles, tropes, palettes the universe AVOIDS. The renderer prepends these to stylePrompt/negativePrompt verbatim, so each entry should read as a clean prompt token (e.g. "Moebius", "cel-shading", "Ghibli painterly", "neon cyberpunk"). When influence input is provided above, preserve those entries unless the starter idea explicitly contradicts them.-- stylePrompt: string. A single comma-separated style fragment (lighting, color palette, render quality, artist references) that will be PREFIXED to every variation prompt. Keep under 400 characters. No subject nouns — those go in variations. Echo the embrace influences here so the renderer-side prompt is self-contained even before the structured prepend kicks in.-- negativePrompt: string. Comma-separated tokens to avoid (e.g. "blurry, lowres, watermark, extra fingers"). Tailor to the universe's aesthetic. Echo the avoid influences here.+- influences: object { "embrace": [string], "avoid": [string] }. Short canonical reference labels (max 120 chars each, max 30 per list) — artists, comics, films, directors, palettes, materials, eras the universe EMBRACES; styles, tropes, palettes the universe AVOIDS. The renderer appends these to stylePrompt/negativePrompt at render time, so each entry should read as a clean prompt token (e.g. "Moebius", "cel-shading", "Ghibli painterly", "neon cyberpunk"). When influence input is provided above, preserve those entries unless the starter idea explicitly contradicts them.+- stylePrompt: string. A single comma-separated style fragment (lighting, color palette, render quality, artist references) compiled from the style notes and starter idea. This is PREPENDED to every variation prompt. Keep under 400 characters. No subject nouns — those go in variations. Do NOT echo embrace tokens here — the renderer appends them at render time.+- negativePrompt: string. Comma-separated tokens to avoid (e.g. "blurry, lowres, watermark, extra fingers") compiled from the style notes and starter idea. Do NOT echo avoid tokens here — the renderer appends them at render time.- categories: object. Atomic reusable buckets. Use snake_case keys. Start from these common buckets when useful:${WORLD_CATEGORIES.map((c) => ` - ${c}`).join("\n")}Add, remove, or rename buckets to fit the user's actual universe-building task. Do not force every project into the starter buckets.diff --git a/server/services/universeBuilderRefine.js b/server/services/universeBuilderRefine.jsindex fdaee1bae5..f39ba2264b 100644--- a/server/services/universeBuilderRefine.js+++ b/server/services/universeBuilderRefine.js@@ -232,15 +232,15 @@ The user has seven top-level fields that define a "universe":- LOGLINE — one-sentence narrative hook.- PREMISE — 1-3 paragraph elevator pitch (setting, conflict, stakes, tone).- STYLE NOTES — narrative-side prose about references, mood, palette, pacing, voice.-- INFLUENCES — structured { embrace: [string], avoid: [string] } reference list. The renderer prepends embrace verbatim to the style prompt and avoid verbatim to the negative prompt, so this is the canonical record of "what direction is this universe pointing." Each entry is a short prompt-token-style label (e.g. "Moebius", "cel-shading", "Ghibli painterly"). Max 30 entries per list, max 120 chars each.+- INFLUENCES — structured { embrace: [string], avoid: [string] } reference list. The renderer appends embrace to the style prompt and avoid to the negative prompt at render time — they are separate from and complementary to the stylePrompt/negativePrompt prose. Each entry is a short prompt-token-style label (e.g. "Moebius", "cel-shading", "Ghibli painterly"). Max 30 entries per list, max 120 chars each.The user has given feedback about the story, mood, style, or design they want refined. Rewrite ALL seven fields so they more faithfully express the user's intention and stay internally consistent. Output the COMPLETE rewritten text/values for each — not a placeholder, not a summary, not a diff.${lockedSection}Return ONLY valid JSON in this schema (replace every <…> with real content; do NOT output the literal angle-bracket text):{"starterPrompt": "<full rewritten high-concept starter idea, 1-3 sentences. Stays a clean seed — do NOT append style direction prose here, that belongs in influences + styleNotes>",- "stylePrompt": "<full rewritten style fragment, comma-separated tokens, no subject nouns — palette, lighting, render quality, artist references; should echo the embrace influences>",- "negativePrompt": "<full rewritten negative prompt, comma-separated tokens to avoid; empty string if none; should echo the avoid influences>",+ "stylePrompt": "<full rewritten style fragment, comma-separated tokens, no subject nouns — palette, lighting, render quality, artist references; compiled from style notes, NOT echoing embrace tokens (those are appended at render time)>",+ "negativePrompt": "<full rewritten negative prompt, comma-separated tokens to avoid; empty string if none; compiled from style notes, NOT echoing avoid tokens (those are appended at render time)>","logline": "<full rewritten one-sentence narrative hook>","premise": "<full rewritten 1-3 paragraph elevator pitch>","styleNotes": "<full rewritten narrative-style prose about references, mood, palette, pacing, voice>",@@ -252,8 +252,8 @@ ${lockedSection}Return ONLY valid JSON in this schema (replace every <…> withRules:- Preserve story/character/universe DNA from the originals unless the user's feedback explicitly contradicts it.- The "starterPrompt" stays a clean high-concept seed — no category content (landscapes, factions, etc.) and no style-direction prose. The structured "influences" field carries that direction so re-expansions inherit it deterministically.-- The "stylePrompt" must be comma-separated visual-style tokens only. No subject nouns. No camera/aspect tokens. Under 400 characters. It SHOULD echo every "embrace" influence so the prompt is self-contained even before the structured prepend kicks in.-- The "negativePrompt" must be comma-separated tokens. It SHOULD echo every "avoid" influence. If the universe relies on text/typography (e.g. pitch posters), avoid putting "text" in negatives — prefer "watermark, logo, unreadable tiny text, text artifacts".+- The "stylePrompt" must be comma-separated visual-style tokens only. No subject nouns. No camera/aspect tokens. Under 400 characters. Compile from style notes — do NOT echo embrace tokens here; the renderer appends them at render time.+- The "negativePrompt" must be comma-separated tokens compiled from style notes. Do NOT echo avoid tokens here; the renderer appends them at render time. If the universe relies on text/typography (e.g. pitch posters), avoid putting "text" in negatives — prefer "watermark, logo, unreadable tiny text, text artifacts".- The "influences" lists are the canonical reference set. Add what the user's feedback embraces, drop what's no longer relevant, and add explicit avoids for things they're moving away from. Keep entries short (a name, a movement, a palette descriptor) — they're prepended verbatim to the renderer prompt.- The "logline", "premise", and "styleNotes" must stay narratively coherent with the refined influences and style prompts.- Apply the user's feedback decisively. If they ask for a different style/mood/era, move toward it in influences + style prompt + styleNotes, and name the things to avoid in negativePrompt + influences.avoid.