Client Prompt Extensions
Each mobile platform appends its own prompt extension to the base system prompt. These extensions provide dynamic context that the server doesn't have access to.
iOS Extension
Source: one-app-ios-chat/Chat/Sources/Chat/Services/SystemPromptBuilder.swift
The iOS extension includes:
Dynamic context
- Store division — Grocery or Clothing
- Sign-in status — Whether the user is authenticated
- Current cart — All items with names, quantities, prices, and entry GUIDs
UI display rules (critical)
The iOS extension contains mandatory instructions for using the show_products and show_cart display tools. These ensure the LLM always renders rich UI components instead of describing products in text.
Key rules:
- After every
search_products,get_product_details, orget_alternativescall, must callshow_products - After
get_cart, must callshow_cartfor visual display - Never list product names, prices, or details in text — the UI handles it
- Search for multiple items separately, calling
show_productsfor each
Workflow rules
- Add to cart: search → show_products → add_to_cart
- Remove/update: use entry_guid from cart context
- Reorder: get_order_history → reorder_items
- Never fabricate product codes, entry GUIDs, or order codes
Android Extension
Source: chat-pnp-android/chat-ui/src/main/java/pnp/app/chat/viewmodel/ChatViewModel.kt
Android currently sends the full system prompt rather than an extension. This means the base prompt's security guardrails may not be applied. Migration to the extension model is recommended.
The Android prompt includes:
Dynamic context
- Division — Grocery or Clothing
- Sign-in status
- Cart context — Items with names, quantities, prices, and GUIDs
- Order context — Recent orders with codes, totals, and dates
Workflow rules
- Search returns product codes → immediately call add_to_cart with exact code
- Use exact quantities from search results (especially for variable-weight items)
- One search per item, then add — don't search again
- If add_to_cart fails, don't retry — report the failure
- For "usual items": get_order_details → add_to_cart for each
Key differences from iOS
| Aspect | iOS | Android |
|---|---|---|
| Prompt delivery | Extension (appended to base) | Full replacement |
| UI display rules | Detailed show_products/show_cart instructions | Not applicable (no display tools) |
| Cart context format | List with guid: prefix | List with [guid:] suffix |
| Order context | Not included | Included with recent orders |