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/client/src/main/java/pnp/app/chat/viewmodel/ChatViewModel.kt (buildSystemPrompt)
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
UI display rules (critical)
Android now has the show_products display tool, and the prompt makes its use mandatory — the app renders rich UI components, so the user cannot see raw text lists.
Key rules:
- After every
search_products(or detail lookup), must callshow_productsso results render as cards - Search for multiple items separately, calling
show_productsfor each — each call creates its own carousel - Always pass a
titleto label each carousel, andsearch_query(the exact query used) to enable the "see all results" chevron to the full search page (PLP) - Always call
search_productswithlimit: 20 - Never list product names, prices, or details in text — the UI handles it
show_cartis not available on Android (planned); cart is described from the injected cart context
Workflow rules
- Add to cart (explicit request): search → add_to_cart with the exact product_code
- Add to cart (browse): search → show_products → user adds from the carousel
- Use exact quantities from search results (especially for variable-weight items)
- If add_to_cart fails, don't retry — report the failure
- Only respond to the latest user message — don't re-search or aggregate earlier turns
- For "usual items" / reorder: get_order_details → add_to_cart for each (no show_products needed)
Key differences from iOS
| Aspect | iOS | Android |
|---|---|---|
| Prompt delivery | Extension (appended to base) | Full replacement |
| Display tools | show_products + show_cart | show_products only (show_cart planned) |
| Cart context format | List with guid: prefix | List with [guid:] suffix |
| Order context | Not included | Included with recent orders |