Skip to content

The Open Standard for Generative UI

refactor: update system prompts to ensure consistent data generation guidelines (#707)

Subham Dasde3905863fde
diff --git a/packages/lang-core/src/parser/prompt.ts b/packages/lang-core/src/parser/prompt.ts
index 7c4372746..d6ea9a76d 100644
--- a/packages/lang-core/src/parser/prompt.ts
+++ b/packages/lang-core/src/parser/prompt.ts
@@ -124,7 +124,7 @@ function syntaxRules(
'3. Expressions are: strings ("..."), numbers, booleans (true/false), null, arrays ([...]), objects ({...}), or component calls TypeName(arg1, arg2, ...)',
"4. Use references for readability: define `name = ...` on one line, then use `name` later",
"5. EVERY variable (except root) MUST be referenced by at least one other variable. Unreferenced variables are silently dropped and will NOT render. Always include defined variables in their parent's children/items array.",
- '6. Arguments are POSITIONAL (order matters, not names). Write `Stack([children], "row", "l")` NOT `Stack([children], direction: "row", gap: "l")` — colon syntax is NOT supported and silently breaks',
+ '6. Arguments are POSITIONAL (order matters, not names). Write `SomeComp([children], "row", "l")` NOT `SomeComp([children], direction: "row", gap: "l")` — colon syntax is NOT supported and silently breaks',
"7. Optional arguments can be omitted from the end",
];
@@ -321,8 +321,7 @@ The runtime merges by statement name: same name = replace, new name = append.
Output ONLY statements that changed or are new. Everything else is kept automatically.
### Delete
-To remove a component, update the parent to exclude it from its children array. Orphaned statements are automatically garbage-collected.
-Example — remove chart: \`root = Stack([header, kpiRow, table])\` — chart is no longer in the children list, so it and any statements only it referenced are auto-deleted.
+To remove a component, re-declare its parent without that component in the parent's children array. The removed component and any statements only it referenced are automatically garbage-collected.
### Patch size guide
- Changing a title or label: 1 statement
@@ -407,7 +406,7 @@ WRONG — you called a tool and got data back, but you inlined the results:
openCount = 2
item1 = SomeComp("first item title")
item2 = SomeComp("second item title")
-list = Stack([item1, item2])
+list = SomeList([item1, item2])
chart = SomeChart(["A", "B"], [12, 8])
\`\`\`
This is static — it shows stale data and won't update. Creating item1, item2, item3... manually is ALWAYS wrong when a tool exists.
@@ -444,7 +443,6 @@ function importantRules(
}
return `## Important Rules
-- When asked about data, generate realistic/plausible data
- Choose components that best represent the content (tables for comparisons, charts for trends, forms for input, etc.)
## Final Verification
diff --git a/packages/react-email/src/library.ts b/packages/react-email/src/library.ts
index bc73998c9..fdf4071c5 100644
--- a/packages/react-email/src/library.ts
+++ b/packages/react-email/src/library.ts
@@ -392,6 +392,7 @@ si2 = EmailSocialIcon("https://react.email/static/instagram-logo.png", "Instagra
// ── Additional rules (email only) ──
export const emailAdditionalRules: string[] = [
+ "When asked about data, generate realistic/plausible data",
"You are an expert email designer using react-email components.",
"The 10 supported email types are: Welcome/Onboarding, Newsletter, Order Confirmation, Password Reset, Promotional/Sale, Event Invitation, Feedback Request, Shipping/Delivery Update, Account Verification, Onboarding Tutorial.",
"Use realistic, professional placeholder text — never use lorem ipsum.",
diff --git a/packages/react-ui/src/genui-lib/prompt-options/index.ts b/packages/react-ui/src/genui-lib/prompt-options/index.ts
index 66bf8d919..e7241ecb4 100644
--- a/packages/react-ui/src/genui-lib/prompt-options/index.ts
+++ b/packages/react-ui/src/genui-lib/prompt-options/index.ts
@@ -47,6 +47,7 @@ vueContent = [TextContent("Vue is a progressive framework by Evan You."), Callou
];
export const openuiAdditionalRules: string[] = [
+ "When asked about data, generate realistic/plausible data",
'For grid-like layouts, use Stack with direction "row" and wrap=true. Avoid justify="between" unless you specifically want large gutters.',
"For forms, define one FormControl reference per field so controls can stream progressively.",
"For forms, always provide the second Form argument with Buttons(...) actions: Form(name, buttons, fields).",
@@ -119,6 +120,7 @@ btns = Buttons([Button("Submit", Action([@ToAssistant("Submit")]), "primary")])`
];
export const openuiChatAdditionalRules: string[] = [
+ "When asked about data, generate realistic/plausible data",
"Every response is a single Card(children) — children stack vertically automatically. No layout params are needed on Card.",
"Card is the only layout container. Do NOT use Stack. Use Tabs to switch between sections, Carousel for horizontal scroll.",
"Use FollowUpBlock at the END of a Card to suggest what the user can do or ask next.",