The Lab

The chat experience on this site is built with the gecx-chat SDK. The Lab is where you extend it. Open Claude Code at the repo root, load the headless-chat-vibe-coding skill, then copy one of the prompts below to drop in an extension or tweak.

Open the vibe-coding skillBack to the storefront

Curated prompts

Each prompt is scoped to a single, observable change. Copy it into Claude Code at the repo root, then run pnpm exec gecx verify to typecheck, test, and doctor the result.

Add a sustainability badge part type

Teaches: extending the message part schema and adding a renderer. The agent updates ChatMessagePart, adds a builder, registers a default renderer, and writes a mock scenario that emits one.

In packages/gecx-chat, add a new part type `sustainability-badge` that carries `{ label: string, carbonOffsetCents: number }`. Update the types union, the predicates, the builders, and the JSON schema. Add a default renderer in MessagePart.tsx that shows a leaf glyph and the offset cost. Wire it into apps/applied-ai-retail/src/lib/retailTransport.ts so it streams when the user asks "is this sustainable?". Verify with `pnpm exec gecx verify`.
pnpm exec gecx verifydocs/agent/llms-full.txt §4 (rich content), §5 (renderers)

Add a gift-wrap client tool

Teaches: defining a tool with approval, JSON-Schema input validation, fail-closed behavior, and a mock scenario that exercises it.

Add a `gift_wrap` client tool in apps/applied-ai-retail/src/lib/appliedTools.ts. It takes `{ orderId: string, note?: string }`, requires user approval, has a 5s timeout, and returns `{ giftWrapId, addedCharge }`. Add a route branch in apps/applied-ai-retail/src/lib/retailTransport.ts triggered by /gift wrap|wrap.+gift/i that calls the tool. Add a Playwright spec asserting the approval surface renders. Verify with `pnpm exec gecx verify`.
pnpm exec gecx verifydocs/agent/llms-full.txt §3 (client tools)

Swap the product carousel renderer for a 2-column grid on wider chats

Teaches: overriding a renderer in the host app without forking the SDK. The agent edits the RendererMap in components/chat/renderers and runs Playwright.

Update apps/applied-ai-retail/src/components/chat/renderers/index.tsx so the product-carousel renderer breaks into 2 columns on the chat panel (it currently uses 2 columns already — change the breakpoint to 1 column under 320px and 2 above; add a container query if helpful). Add a Playwright assertion that the carousel renders at least one card with role=link. Verify with `pnpm exec gecx verify`.
pnpm exec gecx verifydocs/agent/llms-full.txt §5 (renderers)

Add a typing indicator while the assistant streams

Teaches: using `chat.isStreaming` from useChatSession and inserting a transient UI part. The agent edits ChatSurfaceApplied.tsx.

In apps/applied-ai-retail/src/components/chat/ChatSurfaceApplied.tsx, when `chat.isStreaming` is true and the last message is from the assistant, render a small three-dot animation right after the message list. Use only CSS, no external libs. Add a Playwright assertion that the indicator appears mid-stream and disappears after `response.completed`. Verify with `pnpm exec gecx verify`.
pnpm exec gecx verifydocs/agent/llms-full.txt §2 (streaming UX)

Add a toast that links to the error-code doc when the inspector catches one

Teaches: subscribing to chat error events and using ChatSdkError codes. The agent reads docs/reference/error-codes.md and wires a one-shot toast.

In apps/applied-ai-retail, add a small toast component that appears for 6s whenever `chat.error` transitions from null to an Error. The toast should extract the error code (if present) and link to the matching anchor in docs/reference/error-codes.md. Triggered by the "broken" mock scenario already in place. Verify with `pnpm exec gecx verify`.
pnpm exec gecx verifydocs/agent/llms-full.txt §12-13 (debugging, errors)

Available recipes

Pulled live from recipes/registry.json at build time. Drop one in with pnpm exec gecx add <id> — files are copied into your app, agent-owned and editable.

ux

Streaming indicators

Typing, progress, and stop affordances for streaming chat.

pnpm exec gecx add streaming-indicators
ux

Tool call cards

Inline status cards for tool execution and approval states.

pnpm exec gecx add tool-call-cards
rich-content

Citation previews

Accessible citation preview renderer.

pnpm exec gecx add citation-previews
rich-content

Product carousel

Swipe-friendly product carousel renderer for commerce chats.

pnpm exec gecx add product-carousel
ux

Suggestion chips

Tappable follow-up suggestion chips.

pnpm exec gecx add suggestion-chips
behavior

Accessibility controls

Focus return, reduced-motion, and keyboard control helpers.

pnpm exec gecx add accessibility-controls
transport

Openai transport

Reference ChatTransport adapter for openai.

pnpm exec gecx add transport-openai
transport

Anthropic transport

Reference ChatTransport adapter for anthropic.

pnpm exec gecx add transport-anthropic
transport

Gemini transport

Reference ChatTransport adapter for gemini.

pnpm exec gecx add transport-gemini
transport

Ollama transport

Reference ChatTransport adapter for ollama.

pnpm exec gecx add transport-ollama
ux

Voice composer

Push-to-talk and open-mic composer wired against a VoiceSession with a customizable mode toggle and transcript display.

pnpm exec gecx add voice-composer
commerce

Cart summary

Typed renderer for a custom-payload `cart-summary` part. Renders line items, subtotal, tax, shipping, total. PCI-safe payload contract.

pnpm exec gecx add cart-summary
commerce

Order status card

Typed renderer for order tracking + RMA (return) status. Renders milestones, ETA, and refund estimate.

pnpm exec gecx add order-status-card
analytics

Commerce funnel aggregator

Maps ProductAnalyticsEvents to commerce funnel stages (impression → click → add_to_cart → checkout → purchase → return) with conversion rates, AOV, and cart abandonment.

pnpm exec gecx add commerce-funnel
ux

Conversation history

Conversation list with resume, delete, and new-conversation actions backed by ConversationRegistry.

pnpm exec gecx add conversation-history
a2ui-catalog

Address confirmation

Verified address with edit affordance and a confirm action.

pnpm exec gecx add ui:address-confirmation
a2ui-catalog

Appointment picker

Date selector + time-slot grid + confirm action for booking appointments.

pnpm exec gecx add ui:appointment-picker
a2ui-catalog

Comparison table

Agent-driven dynamic table for arbitrary attribute comparisons. v1 ships a host React renderer; basicCatalog has no Table primitive.

pnpm exec gecx add ui:comparison-table
a2ui-catalog

Confirmation receipt

Post-action summary: order/return/refund confirmation with line items, totals, and a primary follow-up action.

pnpm exec gecx add ui:confirmation-receipt
a2ui-catalog

Consent form

Multi-checkbox consent form with an audit-trail confirm action.

pnpm exec gecx add ui:consent-form
a2ui-catalog

Coupon applier

Coupon code entry with applied state, validation message, and remove action.

pnpm exec gecx add ui:coupon-applier
a2ui-catalog

Data export confirm

Format + delivery method picker for a personal data export request.

pnpm exec gecx add ui:data-export-confirm
a2ui-catalog

Escalation card

Talk-to-a-person card with conversation context preview and a confirmed handoff action.

pnpm exec gecx add ui:escalation-card
a2ui-catalog

ETA promise

Agent-promised arrival time with countdown and an optional cancel action.

pnpm exec gecx add ui:eta-promise
a2ui-catalog

Quick feedback

Thumbs up/down or emoji rating with optional open-text comment.

pnpm exec gecx add ui:feedback-quick
a2ui-catalog

Image annotator

Point/select annotations on an uploaded image. v1 ships a host React renderer (basicCatalog has no canvas primitive).

pnpm exec gecx add ui:image-annotator
a2ui-catalog

Inventory status

Per-variant in-stock / low / out indicator with optional notify-me action.

pnpm exec gecx add ui:inventory-status
a2ui-catalog

Language picker

Locale switcher: list of supported languages with selected state and a confirm action.

pnpm exec gecx add ui:language-picker
a2ui-catalog

Multi-step form

Wizard form with progress indicator and a back/next/submit flow across N steps.

pnpm exec gecx add ui:multi-step-form
a2ui-catalog

Payment method picker

Saved-card selector plus 'add new' affordance. Card details never traverse the A2UI dataModel.

pnpm exec gecx add ui:payment-method-picker
a2ui-catalog

Price compare

Side-by-side comparison of 2–3 products: pricing, key specs, and an 'add to cart' action per product.

pnpm exec gecx add ui:price-compare
a2ui-catalog

Quantity stepper

Integer quantity stepper with min/max bounds and a recalculated unit price summary.

pnpm exec gecx add ui:quantity-stepper
a2ui-catalog

Shipping tracker

Order shipment timeline. v1 ships a host React renderer (no map view); the A2UI envelope carries waypoints + status only.

pnpm exec gecx add ui:shipping-tracker
a2ui-catalog

Subscription manager

Pause / resume / cancel a recurring subscription with current billing summary.

pnpm exec gecx add ui:subscription-manager
a2ui-catalog

Troubleshooter

Branching diagnostic tree: agent walks the user through yes/no questions to isolate the issue. v1 caps tree depth at 3.

pnpm exec gecx add ui:troubleshooter

How this demo works

A quick architectural read so you know where to point the agent.

  • Chat client: src/lib/chatClient.ts picks createMockChatClient or a real proxy transport based on whether you've connected GECX in the UI. No env vars.
  • Mock transport: src/lib/retailTransport.ts — route branches covering the full retail journey (browse → recommend → cart → checkout → track → return) plus the deliberate tool-error path.
  • Tools: src/lib/appliedTools.ts — five client tools, mutations require user approval and fail closed when denied.
  • Inspector: src/components/chat/SdkInspector.tsx wraps the SDK's DebugDrawer and renders createDebugBundle() live, so the SDK internals are visible alongside the storefront.
  • Auth: src/app/api/gecx-chat/* + src/lib/gecxSession.ts — credentials live in an httpOnly cookie scoped to the session. Disconnect scrubs them with Clear-Site-Data.