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
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.
| # | Node | Asks | Answered by | Writes |
|---|---|---|---|---|
| 0 | (welcome) | Namaste 🙏 I'm your FoodBridge Assistant. | Set up my store ● | — |
| 1 | mobile ● | Let's set up your store. Your mobile number? | typing (tel keypad); 10 digits, 6–9 | store.mobile → GET /api/draft |
| 1a | sync ● | A store saved under it: “Sharma Agencies — is this you?” | Yes (its answers fill in) / No | the whole saved state |
| 2 | shop ● | Your shop or business name? (not asked when the saved store has it) | typing | store.name |
| 3 | contacts | Add your customers, suppliers and staff. | phone: the address book; computer: QR → the phone page; any: 📎 a list or .vcf, or pasted rows | people, order |
| 4 | sort | Who is who? (guessed from names) | Looks right / Change (a radio per person) | people[].type |
| 5 | peopleNote ● | Anything else about your contacts? | typing, or No | notes.people |
| 6 | type ● (+ typeOther) | What is your business? — as many as apply (+ Supplier ●) | ticks + Done, or typed | store.types (first → store.type) |
| 7 | warehouses | How many warehouses? | dropdown | store.warehouses |
| 8 | gst | GST number? | typing (checked), or Later | store.gst |
| 9–11 | routes, selfOrder, partPay | Fixed route days? Customers order on their own? Pay in parts? | Yes / No | rules.* |
| 12 | payMethods (+ Other) | How do customers pay? | ticks | rules.payMethods |
| 13–14 | returns ●, morning ● (+ Other) | Damaged goods come back. You… / What do you check each morning? — as many as apply | ticks | rules.returns, rules.morning (lists) |
| 15 | note | Anything else about your day? | typing, or No | rules.note |
| 16 | products | Send your product list. | 📎 → POST /api/extract (Claude; stand-in here) → shown back → Add all / Check | items, customItems; the file kept as raw/ |
| 17 | productsNote ● | Anything else about your products? | typing, or No | notes.products |
| 18 | files | Any papers to share? Khata, bills, route chart. | 📎, or photos from the phone (QR on a computer) | papers |
| 19 | endNote ● | Anything else? | typing, or No | notes.end |
| 20 | summary | Your store (a card + the facts) | Create my store / Change | — |
| 21 | done ● | ✅ 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) | Here | Feeds |
|---|---|---|---|
| D1 | Create 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 v7 | SSOT-5, SSOT-7 |
| D2 | A page of its own that opens on hi; the Control Tower's assistant is the same chat in a panel | chat.html, tower.html — one engine, one conversation | SSOT-3, SSOT-4 |
| D3 | The Claude API key is tech debt | TD-1 below; the contract is claude/extract-products.md | SSOT-7 |
| D4 | A simple campaign (v5) — gone in v6: it belongs to the assistant inside his store | — | — |
| D6 | v6: 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 descriptions | addendum-013 | SSOT-1, -2, -3, -5 |
| D5 | A new module in the module repo, not part of store-setup; discovery first, development after the freeze | modules/assistant; Store Setup code is copied, never linked | parent addendum-009 |
Tech debt and open questions
| # | What | Now |
|---|---|---|
| v2 | The 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-1 | Claude 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-1 | Hindi | Store Setup is bilingual; the chat is English in v1 (it understands typed Hinglish: haan, nahi, paisa, udhaar…). Ask the owner before adding हिंदी |
| Q-2 | Products 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
| Files | Copied from | Changed |
|---|---|---|
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.js | store-setup-v5's stand-in bridge | own cache; the picker serves store/send/; + /api/extract |
screens/chat/shell.css, mascot/ | mock-platform v7 Control Tower assistant @ 2a7ead3 | none (widgets.css adds to it) |
screens/chat/tower-brain.js | mock-platform v7 assets/ct/chat.js @ 2a7ead3 | + Production; local rupees(); hands unknown words back (marked in the file) |
seed-data/tower-snapshot.json | the live v7 Control Tower (Vasu Foods), 5 Oct 2026 | 6 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/).