Revenue OS wins back abandoned checkouts for many stores at once, only with consent, and bills only for orders it caused.
How a cart moves through the system
Pick a scenario and play it, or step through it. Each step lights the parts of the system that act.
Illustration of the real flow, not a live run
- Uses a language model
- Holds authority
- Compliance gate
- Money
Step 1 of 6
Shopify sends “checkout created”. We check its signature on the raw body and store the event once in the inbox.
Guarantees, and the tests that prove them
Each card names the test that fails if the guarantee breaks.
The ledger always balances
Postgres itself rejects an unbalanced entry, an edit, a delete or a direct balance change.
- billing.test.ts “the database rejects unbalanced entries, edits, deletes and direct balance changes”
Tenants are isolated by the database
Row-level security stops cross-tenant reads and writes, even for a platform admin on normal tables.
- rls.test.ts “tenant A cannot update tenant B rows (silently 0 rows)”
- rls-orchestration.test.ts “ledger, credits, links, refunds and top-ups are tenant-isolated; queue_user and other tenants see nothing”
- platform.test.ts “RLS: platform_admin gets NO cross-tenant visibility on normal tables”
Each step is sent at most once
A journey step runs once even when the worker ticks it repeatedly or concurrently.
- journeys.test.ts “a step runs exactly once even if ticked repeatedly / concurrently”
Quiet hours: 9 am to 9 pm their time
A text due at 9:15 pm moves to 9:00 am, and a job that wakes up at night is rescheduled.
- journeys.test.ts “defers SMS1 due at 21:15 Berlin to 09:00 next morning”
- journeys.test.ts “a send job that wakes up outside the window is rescheduled to the next morning”
The demo can never reach real Twilio
Three layers: the app only creates simulated sends, Postgres refuses Twilio rows for a demo tenant, and the send step rewrites any that slipped through.
- seed.test.ts “creation layer: the app stores only simulated sends/calls for a demo tenant”
- seed.test.ts “DB layer: Postgres refuses to store a twilio message or call for a demo tenant”
- seed.test.ts “send-time layer: a twilio message queued before the tenant became a demo is rewritten to simulated”
The model never sees contact or card details
Phones and emails are masked in every message sent to the model; a card number ends the turn before the model is called.
- unit-voice.test.ts “LLM prompt never contains a phone or email, from the context, the history or this turn”
- unit-voice.test.ts “card numbers never reach the model; customer is told to use the texted link”
Tokens and personal data stay out of logs
No access token, refresh token, password, email or phone in logs, crash reports or stored error text.
- no-secrets-in-logs.test.ts “a full auth session (register, refresh, authorized call) logs no token, cookie, password or email”
- no-secrets-in-logs.test.ts “an unexpected 500 whose message holds an email, phone and Shopify token is logged masked”
- no-secrets-in-logs.test.ts “stored error text (inbox last_error, Shopify errors) never keeps an email, phone or token”
Implemented, simulated, planned
Taken from the ADRs, the decisions log and the pending list in the repo.
Shopify + generic webhook ingestion
ImplementedSigned, idempotent inbox; out-of-order events handled.
0016-idempotency-and-orderingTenant isolation with Postgres RLS
ImplementedCross-tenant access only through audited platform functions.
0008-rls-tenant-isolationConsent ledger, STOP, quiet hours
ImplementedChecked when a step is planned and again at send time.
0020-consent-ledgerAI voice agent
ImplementedTurn-based on Twilio speech, about 1.5–3 s per turn; not streaming yet.
0024-voice-turn-based-and-when-to-streamHuman closers
ImplementedCallback task after the AI call; no warm transfer yet.
0026-human-closersDouble-entry wallet ledger
ImplementedBalanced, append-only, enforced by database triggers.
0027-double-entry-wallet-ledgerHoldout incrementality
ImplementedRevenue lift is a point estimate, without a confidence interval.
0028-incrementality-methodExpiring Shopify offline tokens
ImplementedRefreshed under a per-shop lock.
decisions-logTexts and calls in the demo stores
SimulatedSame flows with a fake provider; real Twilio is blocked in three layers.
0012-simulated-provider-modeWallet top-ups for generic and demo stores
SimulatedAn audited simulated top-up posts a real balanced entry; live Shopify stores pay through Shopify billing.
0029-billing-credit-rules-topups-refundsStreaming voice
PlannedWaiting on measured per-turn latency.
pendingWarm transfer to a live closer
PlannedNeeds closer presence and availability.
pendingShared rate-limit store
PlannedIn-memory today: fine for one instance, not for scale-out.
pendingSeparate voice consent at checkout
PlannedToday: merchant attestation plus text consent.
pendingSender number per merchant
PlannedToday a shared trial number.
pendingLanguages other than English
PlannedEnglish only by decision.
pending
Measured numbers
Measured on 3 Dec 2026 at 572e5bd. Generated by pnpm arch:facts from the run’s own reports, never typed by hand.
API tests (real Postgres)
534 / 534
all passing
API line coverage
97.5%
85.7% branches · CI gate 80%
Web unit tests
79 / 79
all passing
Playwright, desktop + mobile
25 / 25
11 axe WCAG 2.1 AA checks in the specs
k6: Wallet race (top-ups + refunds on one wallet)
1,094 req/s
p95 133 ms · 0.00% errors · median of 3 runs
k6: Signed webhook ingestion
800 req/s
p95 88 ms · 0.00% errors · median of 3 runs
k6: Dashboard read mix
521 req/s
p95 134 ms · 0.00% errors · median of 3 runs
Wallet invariants after the race
Hold
0 unbalanced, 0 drift, 0 double postings
Dashboard p95 rose from ~50 ms (Phase 7) to ~130 ms after the redesign’s extra queries; measured, tracked in pending.md, not yet optimised.
Bugs found on a live Shopify store
Webhook registration failed with 403 on a new Shopify app.
Apps created from December 2026 need expiring offline tokens: we now request them and refresh under a per-shop lock. e1d618e
Every checkout event failed with “missing required field: id”.
Shopify removed the checkout id from webhooks in API 2026-04: checkouts are now keyed by token, and replaying the failed events reprocesses them with the fix. fc2e799
A 500 after deploy: a migration had run against localhost.
The migrate command now prints its target database, and the API refuses to start on a stale schema. 47e81bd
Where it runs
Free tiers only. The browser talks to one origin; the API and worker share one process.
Vercel
Next.js web app; rewrites /api/* so the browser stays same-origin
Render
Fastify API with the pg-boss worker in the same process
Neon
Postgres 16: pooled connection for the API, direct one for the queue
Twilio
Texts and calls; signed callbacks into the API
Shopify
OAuth, signed webhooks, billing for top-ups
UptimeRobot
Pings /health
Design decisions
Same-origin proxy ADR-0003
The refresh cookie can be SameSite=Strict, and there is no CORS for the browser.
Queue on Postgres, not Redis ADR-0005
One less service on free tiers; the ADR names the load at which to move.
Row-level security for tenants ADR-0008
Isolation holds even if a query forgets its tenant filter.
Inbox, then process ADR-0017
Webhooks are acknowledged fast; business logic runs in the worker with retries.
Double-entry ledger ADR-0027
Every cent moves as a balanced, append-only entry the database checks.
Holdout for incrementality ADR-0028
Merchants see what recovery adds, not just what it touched.