Skip to content

System Prompt

wireai-rn automatically builds a system prompt from your component registry. You never write the JSON schema documentation manually. The SDK generates it from Zod schemas at runtime.

What gets generated

The auto-generated system prompt contains:

  1. 1Role declaration: "You are an AI assistant embedded in a mobile app. You respond ONLY with valid JSON."
  2. 2Component documentation: For each registered component: name, description, and all props with .describe() text
  3. 3Response format: render vs ask JSON shapes with examples
  4. 4Conversation flow rules: 7 critical rules preventing dead ends and ensuring the conversation keeps moving
  5. 5Component selection guide: Decision table mapping use cases to the right components
  6. 6continueLabel guidance: How to write good CTA text (specific vs generic)
  7. 7Your systemPromptSuffix: Appended verbatim at the end

App-specific instructions with systemPromptSuffix

Use the systemPromptSuffix prop on WireAIProvider to add:

  • An AI persona ("You are a warm, empathetic mental coach...")
  • A specific conversation flow (step-by-step sequence the LLM must follow)
  • Domain-specific rules ("Never skip steps", "Always start at Step 1")
  • Additional context the LLM needs to perform its role
Tsx
1const MENTAL_COACH_PROMPT = `
2You are a warm, empathetic mental coach. Your goal is to guide the user
3through a complete, structured daily check-in.
4
5## Check-in Flow (execute EXACTLY in this order)
6
7When the user says "start my check-in", begin at Step 1 immediately.
8
9### Step 1 · Mood (MoodTracker)
10{"action":"render","component":"MoodTracker","props":{"question":"How are you feeling right now?"}}
11
12### Step 2 · Focus areas (ChipSelectCard)
13{"action":"render","component":"ChipSelectCard","props":{"title":"What areas do you want to focus on?","chips":["Work","Health","Relationships","Sleep","Stress"],"multiSelect":true,"maxSelections":3}}
14
15### Step 3 · Main challenge (SelectionCard)
16...continue with all steps...
17
18## Rules
19- Start at Step 1 immediately. No preamble
20- After EVERY interaction, render the NEXT step right away
21`;
22
23<WireAIProvider
24  llm={config}
25  components={components}
26  systemPromptSuffix={MENTAL_COACH_PROMPT}
27>

7 critical flow rules

These rules are baked into every generated prompt. They prevent the most common LLM failure modes in conversational UI:

1

Never end with just an acknowledgment

If the user completes a step, always render the NEXT component. Never just say 'Great!' and stop.

2

Keep the conversation moving

After 'I selected: ...', process the input and immediately render the next component.

3

MessageBubble is a transition, not a final response

If you use MessageBubble, follow it immediately with another render, or use the 'message' field on a render response instead.

4

Prefer 'render' over 'ask'

Use 'ask' only when you genuinely need free-text clarification with no suitable component.

5

Display-only components must have ctaLabel

StepList, InfoList, and StatusCard have no buttons. Always set ctaLabel or the conversation dies.

6

'Continue.' always means ActionCard

Never use StatusCard or ask a question when the user says 'Continue.' Render ActionCard with 2–3 options.

7

StatusCard is for real outcomes only

Not for 'you just viewed something'. Only for confirmed bookings, saved data, completed actions.

Advanced: access buildSystemPrompt directly

For debugging or building your own adapter, you can call buildSystemPrompt directly:

Ts
1import { buildSystemPrompt, createComponentRegistry } from "wireai-rn";
2import { defaultComponents } from "wireai-rn/components";
3
4const registry = createComponentRegistry(defaultComponents);
5const prompt = buildSystemPrompt(registry, "You are a travel assistant...");
6
7console.log(prompt);
8// → Full system prompt string with all component docs