Assistant — discovery

The FoodBridge Assistant: a distributor sets up his store in a WhatsApp-style chat, one question at a time — products read from any file, the store summed up, then the request goes to the FoodBridge team. assistant-v6 — for review

The assistant ↗Its own page, opens on “hi”. On a computer: WhatsApp Web: chats, the conversation, your store setup. As on a phone ↗The contacts card is the address book. Best in a phone-sized window. In the Control Tower ↗The same chat as the tower's panel, over the Vasu Foods board. What reached FoodBridge ↗The builds from Create my store.

Serve over HTTP (a service worker stands in for the bridge and for Claude; it does not run from file://): python3 -m http.server 8790 --directory modules/assistant/discovery. Nothing leaves the browser. ?vasu=<url> points the tower at another copy of mock-platform v7 (default: the published one). Start fresh: the chat's ⋯ → Start again.

The question tree (screens/chat/onboard.js)

One question at a time. v6 changes marked ●. Every answer lands in the store's state (screens/store/model.js), so the Excel the team receives carries exactly what he said.

#NodeAsksAnswered byWrites
0(welcome)Namaste 🙏 I'm your FoodBridge Assistant.Set up my store ●—
1mobile ●Let's set up your store. Your mobile number?typing (tel keypad); 10 digits, 6–9store.mobile → GET /api/draft
1async ●A store saved under it: “Sharma Agencies — is this you?”Yes (its answers fill in) / Nothe whole saved state
2shop ●Your shop or business name? (not asked when the saved store has it)typingstore.name
3contactsAdd your customers, suppliers and staff.phone: the address book; computer: QR → the phone page; any: 📎 a list or .vcf, or pasted rowspeople, order
4sortWho is who? (guessed from names)Looks right / Change (a radio per person)people[].type
5peopleNote ●Anything else about your contacts?typing, or Nonotes.people
6type ● (+ typeOther)What is your business? — as many as apply (+ Supplier ●)ticks + Done, or typedstore.types (first → store.type)
7warehousesHow many warehouses?dropdownstore.warehouses
8gstGST number?typing (checked), or Laterstore.gst
9–11routes, selfOrder, partPayFixed route days? Customers order on their own? Pay in parts?Yes / Norules.*
12payMethods (+ Other)How do customers pay?ticksrules.payMethods
13–14returns ●, morning ● (+ Other)Damaged goods come back. You… / What do you check each morning? — as many as applyticksrules.returns, rules.morning (lists)
15noteAnything else about your day?typing, or Norules.note
16productsSend your product list.📎 → POST /api/extract (Claude; stand-in here) → shown back → Add all / Checkitems, customItems; the file kept as raw/
17productsNote ●Anything else about your products?typing, or Nonotes.products
18filesAny papers to share? Khata, bills, route chart.📎, or photos from the phone (QR on a computer)papers
19endNote ●Anything else?typing, or Nonotes.end
20summaryYour store (a card + the facts)Create my store / Change—
21done ●✅ Done! We'll set up your store and send you a login link.— it stops here ●the build (POST /api/stores)

● v6 (addendum-013). Gone in v6: the owner's name, the next actions (order, tomorrow's order, collection) and the campaign — they belong to the assistant inside his store, after he logs in from a link.

Transition map (proto-FSM → SSOT-1, SSOT-5)

idle ──hi──▶ welcome ──Set up my store──▶ mobile ─[draftLookup]─▶ (sync)? ─▶ (shop)? ─▶ contacts ⟲ (more) ─▶ sort ⟲ (sheet) ─▶ peopleNote
  ─▶ type ─▶ (typeOther)? ─▶ warehouses ─▶ gst ─▶ routes ─▶ selfOrder ─▶ partPay ─▶ payMethods ─▶ (payOther)?
  ─▶ returns ─▶ (returnsOther)? ─▶ morning ─▶ (morningOther)? ─▶ note ─▶ products ⟲ (extract | sample | check) ─▶ productsNote ─▶ files ⟲ ─▶ endNote
  ─▶ summary ──Change──▶ any section's first node ─(section done)─▶ summary
  summary ──Create my store─[build: POST /api/stores]─▶ done (end)
  any node ──"back"──▶ the previous node          any ──"menu"──▶ the menu (Continue · Start again)
  tower panel: idle ──tower intents (needs, deliveries … production, news)──▶ answers from the Vasu snapshot ── "Set up a new store" ──▶ mobile

Decisions

#Decision (owner, 5 Oct 2026)HereFeeds
D1Create my store still sends the build to the customer success team (v6: the next actions left the onboarding)build = Store Setup's (store/outbox.js); next actions → mock-platform v7SSOT-5, SSOT-7
D2A page of its own that opens on hi; the Control Tower's assistant is the same chat in a panelchat.html, tower.html — one engine, one conversationSSOT-3, SSOT-4
D3The Claude API key is tech debtTD-1 below; the contract is claude/extract-products.mdSSOT-7
D4A simple campaign (v5) — gone in v6: it belongs to the assistant inside his store——
D6v6: many answers where they suit; "anything else?" after contacts, products and at the end; mobile first, then the shop's name (no owner's name); it stops at the store request; no subtitles or descriptionsaddendum-013SSOT-1, -2, -3, -5
D5A new module in the module repo, not part of store-setup; discovery first, development after the freezemodules/assistant; Store Setup code is copied, never linkedparent addendum-009

Tech debt and open questions

#WhatNow
v2The desktop as WhatsApp Web (owner, 5 Oct 2026: “enterprise grade”)at 900 px and wider: the chat list (the Assistant; FoodBridge Team = his store as FoodBridge received it — only once his mobile has one), a light header, the conversation edge to edge, a flat message bar, centred dialogs, the store-setup drawer (ⓘ). v3: nothing without a job — no rail, search, filters or decorations. Narrower: the phone layout, unchanged
TD-1Claude is not called (no API key)spreadsheets are read by the stand-in for real; photos/PDFs come back “can't read yet — kept for the team” + a labelled sample read; the summary is a template
Q-1HindiStore Setup is bilingual; the chat is English in v1 (it understands typed Hinglish: haan, nahi, paisa, udhaar…). Ask the owner before adding हिंदी
Q-2Products and Warehouse stock are hidden in Store Setup (1 Oct 2026)the owner asked for products again, so they are asked here; warehouse stock stays out

Where things come from

FilesCopied fromChanged
screens/store/ (model, catalogue, export, import, outbox, icons, gcontacts, send/, vendor/qrcode)store-setup-v5 prototype (frozen)only outbox.js's IndexedDB names (fb-assistant-store*), so the two modules never share data
discovery-bridge.jsstore-setup-v5's stand-in bridgeown cache; the picker serves store/send/; + /api/extract
screens/chat/shell.css, mascot/mock-platform v7 Control Tower assistant @ 2a7ead3none (widgets.css adds to it)
screens/chat/tower-brain.jsmock-platform v7 assets/ct/chat.js @ 2a7ead3+ Production; local rupees(); hands unknown words back (marked in the file)
seed-data/tower-snapshot.jsonthe live v7 Control Tower (Vasu Foods), 5 Oct 20266 rows a tile, 8 events a day

New here: screens/chat/onboard.js (the tree), app.js (drawing and hooks), extract-standin.js, widgets.css, the screens. Tests: node --test tests/*.test.js from discovery/. Inputs and the decision log are in the module repo (discovery/instructions/).