Context
buildImportantRules() in lang-core unconditionally appends the line:
- When asked about data, generate realistic/plausible data
This is correct for generative UI (the default consumer), but harmful for description-mode consumers that describe existing UI rather than generating new UI. In that context it instructs the model to invent data — image URLs, prices, copy — that is not in the source, producing artefacts that are locally well-formed but materially false.
Current workaround
We post-process the generated prompt to excise the line:
const prompt = library.prompt(options);
return prompt.split("\n").filter(line => !line.includes("When asked about data, generate realistic/plausible data")).join("\n");
This works but is coupled to the exact wording — if lang-core rewords the rule, the excision silently stops matching.
Proposal
Add a dataInvention?: boolean flag to PromptOptions, defaulting to true (preserving current behaviour). When false, skip the line in buildImportantRules().
This mirrors the existing pattern of editMode, inlineMode, bindings, and toolCalls — feature flags that control which sections of the prompt are emitted.
Use case
backpack-openui has two consumers:
- Runtime (generative UI) —
dataInvention: true (default)
- Description (describing existing prototypes) —
dataInvention: false
The description consumer is the one that needs this flag. Evidence: https://github.com/Skyscanner/backpack-openui/blob/main/docs/spike-findings.md
Context
buildImportantRules()inlang-coreunconditionally appends the line:- When asked about data, generate realistic/plausible dataThis is correct for generative UI (the default consumer), but harmful for description-mode consumers that describe existing UI rather than generating new UI. In that context it instructs the model to invent data — image URLs, prices, copy — that is not in the source, producing artefacts that are locally well-formed but materially false.
Current workaround
We post-process the generated prompt to excise the line:
This works but is coupled to the exact wording — if
lang-corerewords the rule, the excision silently stops matching.Proposal
Add a
dataInvention?: booleanflag toPromptOptions, defaulting totrue(preserving current behaviour). Whenfalse, skip the line inbuildImportantRules().This mirrors the existing pattern of
editMode,inlineMode,bindings, andtoolCalls— feature flags that control which sections of the prompt are emitted.Use case
backpack-openuihas two consumers:dataInvention: true(default)dataInvention: falseThe description consumer is the one that needs this flag. Evidence: https://github.com/Skyscanner/backpack-openui/blob/main/docs/spike-findings.md