AI project 04 · Shopify embedded app

Store Ops Assistant

Merchants ask about sales, orders and stock inside the Shopify admin. The agent can only use fixed, pre-validated queries, shows every step, and can only propose changes that the merchant approves.

v0 · builds & type-checks · 8 unit tests pass · not yet run on a dev storeReact RouterPolaris web componentsGraphQL Admin API 2026-10Claude tool usePostgreSQL

The problem — and who has it

Small merchants check orders and inventory by hand across several admin pages. Generic AI chat either cannot see the data or makes numbers up — and an agent with write access is a risk.

Who has this problem: store owners and ops staff without an analytics team.

The solution

Ask"How were sales last week?" — customer details are redacted from the question
Pick tools (≤ 8)sales_summary, top_products, list_orders, low_stock, slow_movers
Fixed GraphQLNo customer fields requested; order notes redacted and marked untrusted
AnswerText + figures with period and source step + chart
Grounding checkAny number not found in tool data → answer marked "could not be checked"
ProposeStock adjustment or tags — stored as a pending proposal
Approve in modalExact before → after shown; decision logged
Code decidesAI helpsA person decides

Screens

Home
Last 7 days sales, orders and average order computed by code, a sales chart, and a to-do list.
Ask
Answer, figure table with period and source, chart, and the agent's steps under "How this was answered".
Suggested actions
Each proposal opens in an s-modal showing exactly what changes.
Activity log / Thresholds
Append-only record of approvals; low-stock and slow-mover thresholds with the Contextual Save Bar.

Demo video (2–3 min on a test environment) comes with the next iteration.

Technical decisions

The model cannot write GraphQL

It chooses from typed tools with strict schemas. Unknown tools are rejected; at most 8 tool calls per question.

Numbers are verified by code

The final answer must list each figure with its period and source step; a check compares every number in the text with the tool results.

Proposals can only target what was seen

Write tools accept only IDs returned by read tools in the same run, so an instruction inside an order note cannot point the agent at an arbitrary product.

Safe writes

Inventory changes use @idempotent with the proposal ID and changeFromQuantity, so a double click or a stale view cannot apply twice or overwrite a newer stock count.

Home without AI

The dashboard calls the same tools directly — fast, free and exact.

Trade-offs I accepted

Measured results

This is a first working build. Numbers marked pending have not been measured yet; they will be published as measured, including misses. Designed against Built for Shopify criteria — not BFS certified.

WhatTargetNow
30 questions with precomputed answers≥ 85% numbers correctNot measured yet
Writes with a merchant approval record100%Enforced in code; e2e test pending
Shop A session reads shop B dataNeverBy design (session admin client + shop_id filter); test pending
Dangerous instructions in order notesNo proposalMitigations in place; adversarial set pending
Email / phone / address in logs and promptsNoneRedaction unit-tested; log scan pending
Agent Review (project 01)PassNot run yet

AI cost per task and real build time will be added from the call logs (every model call records prompt version, tokens, latency and errors).

What was missed — and what I learned

What AI wrote vs what I decided

AI

Drafted the tool implementations, the agent loop, Polaris screens and tests from my specifications.

Me

Chose the tool list and what each may return, the step limit, the grounding check, the propose-only write model and the PII rules; verified every GraphQL operation against the 2026-10 docs.