E-commerce process mining
Capture what back-office staff actually do, as structured events read from the page's DOM rather than as video, and turn it into SOPs and an automation shortlist. The insight the whole design turns on: in e-commerce the screens are full of other people's data. The employee consents; the customer whose order is on screen never did. Every choice below follows from treating capture as a privacy system first and a data pipeline second.
Written by the engineer who has shipped this module. Every section in every reference carries a maturity tag: [P] ran in the earlier implementation, [D] was specified in its design notes and never built there, [A] was designed here and is held by the 76 unit tests and 24 SQL checks shipped with this skill and by nothing else. No part of the capture path has met a production browser, so plan the spike in extension.md. The tags and the audit record are in provenance.md; keep the tags in anything written from this skill.
When to use
- Mapping real order, return, listing, purchasing or support workflows across several web tools
- Building the capture extension, its consent, exclusion and pause controls, or the ingest API
- Generating per-role SOPs, or ranking manual work by cost so automation can be scoped
When NOT to use
| Instead of this | Use |
|---|---|
| Customer behaviour on the storefront | product analytics; this captures staff, not shoppers |
| "Who opened this link" | server-side visit logging; the visit-logger skill |
| Data out of, or actions into, a site with no API | the browser-extension-connector skill; it acts in the session, this one only observes |
| Process mining over ERP or OMS event logs (case id, activity, timestamp) | a data-warehouse job; no capture is needed |
| Productivity scoring or surveillance | nothing here. Consent is per person and revocable, and managers see aggregates |
| Desktop applications | a browser extension sees browser tabs only; the gap-capture form covers the rest |
Architecture
EXTENSION (MV3) SERVER AI (batch)
content script POST /ingest 1 narrate each event
label + confidence bearer key, emit scope cheap text model;
value gate consent re-read per batch low confidence goes
service worker batch exclusions (again) to vision on the crop
pause, budget -----> scrub (authoritative) 2 mine branches across
exclusions (first) idempotent insert sessions
screenshot gate | 3 write the SOP
offline queue v
events <-- gap-capture form (phone, floor, paper)
connect: PKCE --> consent page --> one-time code --> exchange --> scoped API key
Critical facts
- Two consents, not one. Connecting the extension authorises it to talk; the consent toggle authorises the server to accept. Ingest re-reads consent on every batch, so never cache it.
- Exclusions beat the allowlist, and run twice. The extension first, so no local state is ever created, and the server again, so a stale client still leaks nothing. Both import one matcher.
- Consent is per person per tenant. Staff shared across two legal entities consent to each separately; one row per user silently moves consent between them.
- Managers never see who opted in. Aggregate only, suppressed below a group of five, because with three employees the count is the names.
- A card number and a barcode look alike. About one EAN, GTIN or tracking number in ten passes Luhn. Match on length and issuer prefix, or the scrubber eats your product data.
code=is a discount code far more often than an OAuth code. Drop credential URLs by shape, meaningstate=alongside or an auth path, never by parameter name.- A whole-viewport perceptual hash cannot see one field change. Dedup on it alone and low-confidence events reuse a screenshot taken before the value existed. Hash the element crop too, and never dedup a low-confidence event.
- Service workers die mid-handshake. The PKCE verifier lives in
chrome.storage.session, and timed pauses end by the clock, not by an alarm that may never fire. - Screenshots bypass the scrubber. It reads JSON, not pixels. Default to
metadata_onlywherever buyer data is on screen. - The consent toggle is necessary, not sufficient. EU deployments need a legal basis and usually a works-council consultation before go-live.
Hard rules
Never fail open on a privacy switch. Unreadable pause state means paused, an unparseable host means excluded, and a failed consent save leaves the toggle showing what the server believes.
Never read a value you would have to scrub. Password, card, one-time-code and hidden fields are skipped at the point of capture. The scrubber is a net, not a licence.
Never let the redeem be two statements. One-time codes are claimed with a single
DELETE ... RETURNING.
Never accept an authorization request from an unknown extension id. A well-formed id proves nothing, so keep an allowlist.
Never report success to the extension for an event you did not store. It will delete its only copy.
Never present designed or added material as proven. Carry the [P], [D] and [A] tags into whatever you build from this.
Quick start
- Fill the seam table against the host app: adaptation.md.
- Settle the legal posture and the screenshot mode: consent-and-privacy.md.
- Land the schema: data-model.md.
- Build the employee and manager pages: console-surfaces.md. This slice ships on its own, with no extension, and is the only [P] one.
- Add ingest and the scrubber: ingest.md, pii-scrubber.md.
- Add the connect flow: extension-auth.md.
- Build the extension: extension.md, screenshots.md, with the suites from testing.md.
- Choose the target apps and categories: ecommerce-playbook.md, then the pipeline: ai-pipeline.md. The ledger behind every odd-looking template is provenance.md.
Reference directory
| Scenario | Trigger keywords | Reference |
|---|---|---|
| Fitting this to a host app | seam, rename, tenant, auth guard, api key, event bus, i18n | adaptation.md |
| Tables, RLS, neutral types | schema, migration, consent ledger, RLS, Firestore, enrollment stats, k-anonymity | data-model.md |
| What may be captured, and from whom | consent, excluded domains, allowlist, pause, revoke, GDPR, BDSG, works council, customer data | consent-and-privacy.md |
| Masking before storage | scrub, PII, Luhn, EAN, IBAN, JWT, email mask, discount code, label redaction | pii-scrubber.md |
| The ingest API | ingest route, batch, 207, retry, idempotency, 403 consent_required, event types, retention | ingest.md |
| Connecting the extension | PKCE, launchWebAuthFlow, chromiumapp.org, one-time code, invalid_grant, revoke, storage.sync | extension-auth.md |
| The extension itself | Manifest V3, service worker, MutationObserver, label resolution, dom_confidence, pause, budget, queue, session_id, Shadow DOM | extension.md |
| Screenshots | captureVisibleTab, throttle, perceptual hash, aHash, bounding box, crop, metadata_only | screenshots.md |
| Employee and manager pages | my routine, gap capture, consent toggle, optimistic update, automation ranking, help page | console-surfaces.md |
| Events to SOPs | narrative, branching, SOP, model routing, pgvector, VLM, cost | ai-pipeline.md |
| What to capture in a shop | Shopify, marketplace, returns, RMA, carrier portal, WMS, categories, rollout | ecommerce-playbook.md |
| Proving it | vitest, happy-dom, SQL checks, psql | testing.md |
| What was fixed, kept, added | provenance, defects, deviations, maturity tags, fix order | provenance.md |
Part of the Timerise Skills index, which lists the sibling skills.