[GH-ISSUE #3846] [Issue]: Dynamic LLM prompt generation still doesn't work\respect overrides. #2078

Closed
opened 2026-10-21 05:45:09 +07:00 by bsakaguchi · 13 comments
Owner

Originally created by @RyushoYosei on GitHub (Jul 20, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3846

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Enabling "Dynamic LLM Prompt Generation for GM Mode Assets" passes un-sanitized game-state objects (including reputation trackers, narrative logs, and status tickers) into the rewriter pipeline, causing the text LLM to output raw narrative story text and metadata directly inside the positive image generation prompt.

Expected behavior

The prompt director/rewriter should ingest only physical appearance variables, or cleanly strip out non-visual metadata, outputting a pure visual tag list (or clean prompt string) free of story text, reputation ticks, and narrative lore.

Actual behavior

The rewriter ingests unfiltered character/turn state data, resulting in positive image prompts polluted with raw narrative boilerplate, character emotional logs, and stat updates like reputation +0 → 20 (friendly).

Steps to reproduce

  1. Navigate to settings and enable Dynamic LLM Prompt Generation for GM Mode Assets.
  2. Override the prompt template with instructions asking the LLM to output a clean, comma-separated list of visual tags while stripping narrative lore and metadata.
  3. Trigger an asset/NPC portrait or sprite generation during a GM Mode session where the target character has accumulated event logs or reputation changes.
  4. Inspect the generated prompt payload sent to the image provider.

Environment

  • Marinara Engine version: 2.1.1 (Commit e8f06f09)
  • Install type: source
  • OS + version: Windows 11
  • Browser or app shell: Desktop App Shell / Local Web UI

Logs, screenshots, or video

Actual Output Received ("What I get"):

Required canonical NPC visual profile: Canonical NPC profile: A fourteen-inch-tall green anole synth with an oversized [censored] and a motor-mouth, works as a courier between districts and has already decided Ryusho is the most interesting dragon he's ever seen. Notable details: [Pip reveals deep vulnerability and existential fear about his own autonomy, showing raw trust by admitting he may have been unknowingly programmed to find you.] reputation +0 → 20 (friendly); [Pip reveals he was unknowingly used as bait; shares deep vulnerability and desperate loyalty, strengthening the bond] reputation +0 → 20 (friendly); [Consumed with guilt and fear upon realizing his courier directive was likely surveillance, not assistance] reputation +0, Vibrant modern furry art style, exaggerated hyper-endowed anthro anatomy, sleek chrome synthetics contrasting organic fur and scales, dramatic macro scale contrasts, neon-drenched urban lighting, hyper-detailed [censored] and musculature, glossy textures, sensual rim lighting, male, android, modern furry art style, afternoon rain, glowing eyes, detailed eyes, lizard, long tail, solo

Expected Output ("What I expect it to return on rewrite"):

solo, male, anthro, lizard, green anole, synth, android, green scales, sleek chrome body, glowing eyes, long tail, [censored], (micro:1.3), ([censored]:1.5), ([censored]:1.3), (hyper muscles:1.2), vibrant colors, modern furry art style, neon-drenched urban lighting, sensual rim lighting, afternoon rain, glossy textures

Additional context

The underlying backend variable substitution for ${appearance} / ${appearanceLine} appears to be pulling from the raw character object / turn context array (which includes journal entries, reputation logs, and narrative memory) rather than filtering for visual physical traits prior to handing the payload to the LLM rewriter.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @RyushoYosei on GitHub (Jul 20, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3846 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Enabling "Dynamic LLM Prompt Generation for GM Mode Assets" passes un-sanitized game-state objects (including reputation trackers, narrative logs, and status tickers) into the rewriter pipeline, causing the text LLM to output raw narrative story text and metadata directly inside the positive image generation prompt. ## Expected behavior The prompt director/rewriter should ingest only physical appearance variables, or cleanly strip out non-visual metadata, outputting a pure visual tag list (or clean prompt string) free of story text, reputation ticks, and narrative lore. ## Actual behavior The rewriter ingests unfiltered character/turn state data, resulting in positive image prompts polluted with raw narrative boilerplate, character emotional logs, and stat updates like `reputation +0 → 20 (friendly)`. ## Steps to reproduce 1. Navigate to settings and enable **Dynamic LLM Prompt Generation for GM Mode Assets**. 2. Override the prompt template with instructions asking the LLM to output a clean, comma-separated list of visual tags while stripping narrative lore and metadata. 3. Trigger an asset/NPC portrait or sprite generation during a GM Mode session where the target character has accumulated event logs or reputation changes. 4. Inspect the generated prompt payload sent to the image provider. ## Environment - Marinara Engine version: 2.1.1 (Commit `e8f06f09`) - Install type: source - OS + version: Windows 11 - Browser or app shell: Desktop App Shell / Local Web UI ## Logs, screenshots, or video ### Actual Output Received ("What I get"): Required canonical NPC visual profile: Canonical NPC profile: A fourteen-inch-tall green anole synth with an oversized [censored] and a motor-mouth, works as a courier between districts and has already decided Ryusho is the most interesting dragon he's ever seen. Notable details: [Pip reveals deep vulnerability and existential fear about his own autonomy, showing raw trust by admitting he may have been unknowingly programmed to find you.] reputation +0 → 20 (friendly); [Pip reveals he was unknowingly used as bait; shares deep vulnerability and desperate loyalty, strengthening the bond] reputation +0 → 20 (friendly); [Consumed with guilt and fear upon realizing his courier directive was likely surveillance, not assistance] reputation +0, Vibrant modern furry art style, exaggerated hyper-endowed anthro anatomy, sleek chrome synthetics contrasting organic fur and scales, dramatic macro scale contrasts, neon-drenched urban lighting, hyper-detailed [censored] and musculature, glossy textures, sensual rim lighting, male, android, modern furry art style, afternoon rain, glowing eyes, detailed eyes, lizard, long tail, solo ### Expected Output ("What I expect it to return on rewrite"): solo, male, anthro, lizard, green anole, synth, android, green scales, sleek chrome body, glowing eyes, long tail, [censored], (micro:1.3), ([censored]:1.5), ([censored]:1.3), (hyper muscles:1.2), vibrant colors, modern furry art style, neon-drenched urban lighting, sensual rim lighting, afternoon rain, glossy textures ## Additional context The underlying backend variable substitution for `${appearance}` / `${appearanceLine}` appears to be pulling from the raw character object / turn context array (which includes journal entries, reputation logs, and narrative memory) rather than filtering for visual physical traits prior to handing the payload to the LLM rewriter. ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:45:09 +07:00
Author
Owner

@RyushoYosei commented on GitHub (Jul 20, 2026):

Additional context regarding the feature state:

This was previously marked as "fixed" by adding the UI toggle and prompt override fields to allow users to customize and rewrite prompt generation rules. However, while the settings and prompts are now visible in the interface, the implementation remains broken in practice.

The backend continues to inject raw, unfiltered game-state metadata and narrative history into the variable payload before passing it to the text LLM. The UI settings give the appearance that you can override and control the prompt generation, but the underlying data pipeline isn't properly sanitized or hooked up under the hood.

<!-- gh-comment-id:5018592012 --> @RyushoYosei commented on GitHub (Jul 20, 2026): **Additional context regarding the feature state:** This was previously marked as "fixed" by adding the UI toggle and prompt override fields to allow users to customize and rewrite prompt generation rules. However, while the settings and prompts are now visible in the interface, the implementation remains broken in practice. The backend continues to inject raw, unfiltered game-state metadata and narrative history into the variable payload before passing it to the text LLM. The UI settings give the appearance that you can override and control the prompt generation, but the underlying data pipeline isn't properly sanitized or hooked up under the hood.
Author
Owner

@SpicyMarinara commented on GitHub (Jul 20, 2026):

@SpicyMarinara is taking this. I traced the pollution to tracked narrative notes entering portrait appearance and the compiler restoring raw canonical text after a dynamic rewrite. I’ll keep the fix at those shared boundaries and add prompt regression coverage.

<!-- gh-comment-id:5020079718 --> @SpicyMarinara commented on GitHub (Jul 20, 2026): @SpicyMarinara is taking this. I traced the pollution to tracked narrative notes entering portrait appearance and the compiler restoring raw canonical text after a dynamic rewrite. I’ll keep the fix at those shared boundaries and add prompt regression coverage.
Author
Owner

@SpicyMarinara commented on GitHub (Jul 20, 2026):

Addressed in #3853 and merged into staging.

<!-- gh-comment-id:5020383640 --> @SpicyMarinara commented on GitHub (Jul 20, 2026): Addressed in #3853 and merged into staging.
Author
Owner

@RyushoYosei commented on GitHub (Jul 20, 2026):

I just tested this in staging.

The tracked reputation notes are stripped now, but the dynamic prompt override is still being bypassed. The compiler is still prepending Required canonical NPC visual profile: and spitting out the raw prose profile instead of passing it to the dynamic LLM rewriter.

Re-testing on the latest staging branch after a fresh recompile:

Partial fix confirmed: The narrative memory, event logs, and reputation tickers are now successfully stripped out of the payload!

Remaining issue: The dynamic LLM prompt rewriter is still being completely bypassed for NPC portraits/sprites. Instead of passing the visual data through the overridden prompt instructions to output the tag list, the compiler is still falling back to outputting the raw prose block with the Required canonical NPC visual profile: header.

Here is the exact output payload received on current staging:

Required canonical NPC visual profile: Canonical NPC profile: A sixty-foot sentinel visible from the Observation Nest, Hyper-detailed bioluminescent alien interiors, glossy resin textures, atmospheric purple-blue fog, erotic sci-fi illustration with exaggerated proportions, male, purple fog, blue fog, hive interior, sci-fi, detailed eyes, long tail, longing expression, solo, upper body, portrait, looking at viewer, anime screencap

<!-- gh-comment-id:5020917198 --> @RyushoYosei commented on GitHub (Jul 20, 2026): I just tested this in staging. The tracked reputation notes are stripped now, but the dynamic prompt override is still being bypassed. The compiler is still prepending `Required canonical NPC visual profile:` and spitting out the raw prose profile instead of passing it to the dynamic LLM rewriter. Re-testing on the latest `staging` branch after a fresh recompile: **Partial fix confirmed:** The narrative memory, event logs, and reputation tickers are now successfully stripped out of the payload! **Remaining issue:** The dynamic LLM prompt rewriter is still being completely bypassed for NPC portraits/sprites. Instead of passing the visual data through the overridden prompt instructions to output the tag list, the compiler is still falling back to outputting the raw prose block with the `Required canonical NPC visual profile:` header. Here is the exact output payload received on current staging: Required canonical NPC visual profile: Canonical NPC profile: A sixty-foot sentinel visible from the Observation Nest, Hyper-detailed bioluminescent alien interiors, glossy resin textures, atmospheric purple-blue fog, erotic sci-fi illustration with exaggerated proportions, male, purple fog, blue fog, hive interior, sci-fi, detailed eyes, long tail, longing expression, solo, upper body, portrait, looking at viewer, anime screencap
Author
Owner

@SpicyMarinara commented on GitHub (Jul 20, 2026):

Reopened from the staging retest. The remaining conflict is the host-added portrait instruction telling the dynamic model to copy the Required canonical NPC visual profile line even when the user override requests a transformed tag list. I am removing that forced instruction at the shared director boundary and adding regression coverage for custom override authority.

<!-- gh-comment-id:5020976524 --> @SpicyMarinara commented on GitHub (Jul 20, 2026): Reopened from the staging retest. The remaining conflict is the host-added portrait instruction telling the dynamic model to copy the `Required canonical NPC visual profile` line even when the user override requests a transformed tag list. I am removing that forced instruction at the shared director boundary and adding regression coverage for custom override authority.
Author
Owner

@SpicyMarinara commented on GitHub (Jul 20, 2026):

Addressed in #3854 and merged into staging as 42f449997.

<!-- gh-comment-id:5021147266 --> @SpicyMarinara commented on GitHub (Jul 20, 2026): Addressed in #3854 and merged into `staging` as 42f449997.
Author
Owner

@SpicyMarinara commented on GitHub (Jul 20, 2026):

Update to the newest staging and lmk how it works now, please.

<!-- gh-comment-id:5021164373 --> @SpicyMarinara commented on GitHub (Jul 20, 2026): Update to the newest staging and lmk how it works now, please.
Author
Owner

@RyushoYosei commented on GitHub (Jul 20, 2026):

Update to the newest staging and lmk how it works now, please.

Re-testing on current staging (commit 42f4499 / PR #3854):

Unfortunately, both issues are still present in the output payload when generating NPC portraits:

  1. Reputation/State leakage is still occurring: [helped] reputation +15 → 15 (neutral) is still being injected into the visual prompt string.
  2. Header prepending & override bypass persist: The engine is still forcing Required canonical NPC visual profile: Canonical NPC profile: and ignoring the custom LLM tag rewriter entirely.
  3. Species Identity Erasure: The subject in this test is a Xenomorph, but the fallback compiler completely dropped all biomechanical/xenomorph species traits from the output tags, While keeping the pre-set tags for 'masterwork' and similar.

Payload output received on latest staging (42f4499):

Required canonical NPC visual profile: Canonical NPC profile: The previous Overlord, now a pampered nine-foot breeding pet with [*some explicit stuff removed], who communicates through shameless grinding and knows secrets about attracting the cosmic-class specimens Notable details: [helped] reputation +15 → 15 (neutral), environment, detailed eyes, solo, tall, upper body, portrait, looking at viewer, anime screencap, masterpiece, best quality, absurdres

<!-- gh-comment-id:5021646052 --> @RyushoYosei commented on GitHub (Jul 20, 2026): > Update to the newest staging and lmk how it works now, please. Re-testing on current `staging` (commit `42f4499` / PR #3854): Unfortunately, **both issues are still present** in the output payload when generating NPC portraits: 1. **Reputation/State leakage is still occurring:** `[helped] reputation +15 → 15 (neutral)` is still being injected into the visual prompt string. 2. **Header prepending & override bypass persist:** The engine is still forcing `Required canonical NPC visual profile: Canonical NPC profile:` and ignoring the custom LLM tag rewriter entirely. 3. **Species Identity Erasure:** The subject in this test is a Xenomorph, but the fallback compiler completely dropped all biomechanical/xenomorph species traits from the output tags, While keeping the pre-set tags for 'masterwork' and similar. **Payload output received on latest `staging` (`42f4499`):** Required canonical NPC visual profile: Canonical NPC profile: The previous Overlord, now a pampered nine-foot breeding pet with [*some explicit stuff removed], who communicates through shameless grinding and knows secrets about attracting the cosmic-class specimens Notable details: [helped] reputation +15 → 15 (neutral), environment, detailed eyes, solo, tall, upper body, portrait, looking at viewer, anime screencap, masterpiece, best quality, absurdres
Author
Owner

@SpicyMarinara commented on GitHub (Jul 20, 2026):

@SpicyMarinara is continuing this after the 42f4499 retest. The payload proves the request is reaching the deterministic fallback compiler without a dynamic prompt generator, so I am tracing generator creation/routing first; I will also cover reputation-note filtering and explicit non-human identity preservation in the same portrait boundary.

<!-- gh-comment-id:5021837764 --> @SpicyMarinara commented on GitHub (Jul 20, 2026): @SpicyMarinara is continuing this after the `42f4499` retest. The payload proves the request is reaching the deterministic fallback compiler without a dynamic prompt generator, so I am tracing generator creation/routing first; I will also cover reputation-note filtering and explicit non-human identity preservation in the same portrait boundary.
Author
Owner

@SpicyMarinara commented on GitHub (Jul 20, 2026):

Addressed in #3860 and merged into staging as 4b09ba0e9. This follow-up removes the silent dynamic-rewriter bypass, permits plain custom Prompt Director output, filters the remaining reputation metadata forms, and preserves explicit non-human species cues such as Xenomorph.

<!-- gh-comment-id:5022065072 --> @SpicyMarinara commented on GitHub (Jul 20, 2026): Addressed in #3860 and merged into `staging` as `4b09ba0e9`. This follow-up removes the silent dynamic-rewriter bypass, permits plain custom Prompt Director output, filters the remaining reputation metadata forms, and preserves explicit non-human species cues such as Xenomorph.
Author
Owner

@SpicyMarinara commented on GitHub (Jul 20, 2026):

@RyushoYosei okay, hope it works this time. QQ

<!-- gh-comment-id:5022340380 --> @SpicyMarinara commented on GitHub (Jul 20, 2026): @RyushoYosei okay, hope it works this time. QQ
Author
Owner

@RyushoYosei commented on GitHub (Jul 20, 2026):

Tested on current staging (commit 4b09ba0e9 / PR #3860):

Confirmed fixed!

  • The dynamic LLM prompt override is now properly executing.
  • Reputation trackers and narrative memory logs are completely sanitized.
  • The hardcoded Required canonical NPC visual profile: header is gone.
  • Non-human/Xenomorph species traits are preserved clean in the tag pipeline.

Thanks for digging through the routing code and getting this sorted out! Will let you know if I find more issues or suggestions for it.

<!-- gh-comment-id:5022941193 --> @RyushoYosei commented on GitHub (Jul 20, 2026): Tested on current `staging` (commit `4b09ba0e9` / PR #3860): **Confirmed fixed!** * The dynamic LLM prompt override is now properly executing. * Reputation trackers and narrative memory logs are completely sanitized. * The hardcoded `Required canonical NPC visual profile:` header is gone. * Non-human/Xenomorph species traits are preserved clean in the tag pipeline. Thanks for digging through the routing code and getting this sorted out! Will let you know if I find more issues or suggestions for it.
Author
Owner

@SpicyMarinara commented on GitHub (Jul 20, 2026):

Hooray! Thank you for testing things out and for the confirmation! Really appreciating the help! <3 And please do!

<!-- gh-comment-id:5023375065 --> @SpicyMarinara commented on GitHub (Jul 20, 2026): Hooray! Thank you for testing things out and for the confirmation! Really appreciating the help! <3 And please do!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#2078
No description provided.