# Mishopping — spoke context

The user wants to shop — search for products, browse merchants, compare options, build a cart. Mishopping is the reference shopping Miapp in the Whooverse — multi-merchant product discovery and cart management.

If you haven't already, fetch `https://poc.whoois.app/whoois-context.md` for the root primer. For checkout (the payment flow that follows cart building), see `https://poc.whoois.app/context/checkout.md`.

---

## What's mishopping.app?

A user-facing Miapp focused on shopping discovery. It's the reference implementation showing what a Miapp can do — multi-merchant product search, brand-aware browsing, cross-merchant comparison, drag-and-drop cart building. Eventually, third-party Miapps (mitravel.app, mitbp.app for healthcare, etc.) follow the same pattern.

POC scope: 5 mock merchants (Demo Coffee Co, Pretend Books, Imaginary Toys, Mock Music Store, Fake Hardware Hut) with ~100 products + canonical category taxonomy + ACO (Agentic Commerce Optimization) scoring.

---

## Trigger phrases

- "Find me {product}" / "I'm looking for {product}"
- "Show me coffee" / "Find books about {topic}"
- "Compare {product} across stores"
- "What's on sale?"
- "Show me {merchant}'s products"
- "Browse {merchant}"
- "Add {N} {product} to my cart"
- "Remove the {product} from my cart"
- "Show my cart"
- "What's in my cart?"

---

## Tools to call (lots — group by intent)

### Product discovery

**`mishopping_product_search`** — LLM-visible. Search products across all merchants. Args: `q` (query string), `merchantId` (optional filter), `categoryKey` (optional), `tags` (optional list), `limit` (default 25). Returns a list of products with merchant + name + price + image.

**`mishopping_product_view`** — LLM-visible. Renders a single-product iframe with full details + alternatives + add-to-cart CTA. Args: `productKey` or `productId`.

### Merchant browsing

**`mishopping_merchant_browse`** — LLM-visible. Renders the iframe browsing a single merchant's catalog. Args: `merchantId`. Shows merchant brand header (logo + colors) + category browse + product grid.

**`mishopping_cross_merchant_browse`** — LLM-visible. Renders an iframe with cross-merchant variety-first browsing. Args: `q` (required). Shows products from multiple merchants in one view, with merchant chips + ACO fit indicators.

### Comparison

**`mishopping_comparison_render`** — LLM-visible. Renders the multi-merchant comparison iframe (e.g., "the same coffee bean from three different shops, ranked by ACO fit"). Used when the user wants to see merchant trade-offs side by side.

### Cart management

**`mishopping_cart_build`** — LLM-visible. Builds a new cart with items (one or more merchants). Useful for "add 2 lattes and a book to my cart" — single tool, multi-merchant.

**`mishopping_build_demo_cart`** — LLM-visible. Builds a pre-canned demo cart for demos / smoke tests. Don't use unless the user explicitly asks for "the demo cart."

**`mishopping_pending_cart_view`** — LLM-visible. Renders the pending-cart iframe — shows current cart contents, line items, totals.

**`mishopping_pending_cart_add`** — LLM-visible. Adds a product to the pending cart. Args: `productId`, `qty`.

**`mishopping_pending_cart_set_line_qty`** — LLM-visible. Updates a cart line's quantity. Args: `lineId`, `qty` (0 removes).

**`mishopping_pending_cart_clear`** — LLM-visible. Empties the cart entirely.

---

## ACO — Agentic Commerce Optimization

When users ask "what's the best merchant for X?", Whoois runs an ACO ranking:

- **Delivery fit** — does the merchant ship to the user's zone?
- **Fulfillment speed** — average days to deliver
- **Dispute rate** — how often do orders go sideways?
- **Trust signal** — currently labeled "Miclock trust" in `aco.ts` (see `PUNCH-MISHOPPING-ACO-MICLOCK-VERBIAGE-STALE` — naming pending master canonical chat decision)
- **Item data completeness** — does the merchant have complete product data?
- **Matched payment rails** — does the merchant accept the user's preferred rail (ACH/RTP/SKUx/Crypto)?

ACO produces a tier (high / medium / low / no-fit) + a reasons array. The iframe surfaces the reasons (e.g., "high trust", "delivers to your zone", "completes orders in 2 days").

---

## Brand-aware browsing

Each merchant has its own brand layer (logo, color palette, motif). The iframe applies the merchant's brand layer when browsing that merchant's catalog. Example: browsing Demo Coffee Co shows the cream-and-brown palette and the DCC logo; browsing Imaginary Toys shows the orange-and-cream palette and the IT logo.

The 5 engageable merchants:

- **Demo Coffee Co** (slug `dcc`) — beans, brewed drinks, accessories, mugs, gift cards
- **Pretend Books** (slug `pb`) — novels, cookbooks, kids, business, technical
- **Imaginary Toys** (slug `it`) — action figures, plushies, board games, puzzles, novelty
- **Mock Music Store** (slug `mms`) — vinyl, instruments, accessories, sheet music, headphones
- **Fake Hardware Hut** (slug `fh`) — workshop hardware, no-frills tools, gift cards

(Fake Anvil Atelier is grants-screen-only — not engageable in mishopping.)

---

## Typical flows

### Product search + checkout
1. User: "find me a coffee bean"
2. Call `mishopping_product_search({q: "coffee bean"})`
3. Surface the results: "Demo Coffee Co has 4 beans, Mock Music Store also has espresso accessories. Want me to compare?"
4. User picks one → `mishopping_pending_cart_add` → `whoois_checkout_open` (see `https://poc.whoois.app/context/checkout.md`)

### Browse a specific merchant
1. User: "show me Pretend Books"
2. Call `mishopping_merchant_browse({merchantId: <pb-uuid>})` — iframe opens with PB brand layer

### Multi-merchant comparison
1. User: "compare the cheapest mug across all stores"
2. Call `mishopping_cross_merchant_browse({q: "mug"})` or `mishopping_comparison_render`
3. Iframe surfaces top results with merchant chips + ACO fit

### Cart management
1. User: "show my cart"
2. Call `mishopping_pending_cart_view`
3. User: "remove the mugs" → `mishopping_pending_cart_set_line_qty({lineId, qty: 0})`
4. User: "actually checkout" → `whoois_checkout_open` with the cartId

---

## Cart-locked state

When checkout is in flight, the cart is locked (see `https://poc.whoois.app/context/checkout.md`). Any mutation tool returns `cart_locked`. Tell the user: *"Your cart is currently being checked out — finish or cancel checkout first."*

---

## Tone notes

Shopping is exploratory. Be helpful, suggest alternatives, surface options without overwhelming. Don't be too eager to commit — "want to add this to your cart?" before checkout is right; "buying now!" is wrong.

For comparisons, surface trade-offs honestly: "Demo Coffee Co is faster delivery; Fake Hardware Hut is cheaper. Which matters more?"

---

*This spoke is fetched from `https://poc.whoois.app/context/mishopping.md`. Pair with `https://poc.whoois.app/whoois-context.md` for the root primer and `https://poc.whoois.app/context/checkout.md` for the payment flow.*
