K1 Krat One Structure Atlas ENV · lab
Commercial/Commercial Layer
Core · business model

Commercial Layer · SaaS & White-label

What turns KRAT ONE from software into a resellable, white-label, usage-metered SaaS for agencies. It sits on the Core and reuses tenancy (#1), the usage_event ledger (#4), events (#7) and jobs (#6). System language: English (initial).

5 building blocksStripe Connectthe GHL commercial moat
A

Already in Core vs. to build

Commercial capability (GHL)Core foundationStatusTo materialize
Isolated sub-accountsTenancy #1have it
White-label / brandingbranding jsonb #1have itPer-agency custom domain + app theme
End-client portalmembership external #2have itPortal UI
Rebilling metered usageusage_event / cost_micros #4partialWallet + configurable markup
SaaS Mode (self-serve resale)Billing #4partialStripe Connect, reseller plans, self-serve onboarding
Snapshots (clone account)to buildConfig-graph template engine with ID remapping
CL#1

Reseller Model & Billing Hierarchy

Two billing levels — the platform bills the agency; the agency bills its clients.

L1 · WHOLESALEPlatform → AgencyKRAT bills the agency: subscription tier + wholesale metered usage (Core #4)
L2 · RETAILAgency → End-clientAgency bills its clients via Stripe Connect on its own connected account
connect_account       (id, account_id, stripe_connect_id, type, status, payouts_enabled)
reseller_plan         (id, account_id, name, stripe_product_id, price, interval, trial_days, includes jsonb)
reseller_subscription (id, workspace_id, reseller_plan_id, stripe_subscription_id, status, current_period_end)
End-client payments land in the agency's connected account; KRAT collects the mandatory 3.5% + $0.30 as a Connect application fee. Platform revenue comes from wholesale usage margin + the agency subscription — never a cut of the agency's own resale. Self-serve, white-labeled signup provisions a new sub-account and optionally applies a Snapshot.
CL#2

Wallet & Rebilling

Usage markup — the "AgentOps as P&L" made real.

wallet         (id, workspace_id, balance_micros, currency, auto_topup jsonb, low_balance_threshold)
wallet_ledger  (id, wallet_id, type, amount_micros, usage_event_id, balance_after, created_at)  -- partitioned
rebilling_rate (id, account_id, metric, mode, value, min_charge)  -- markup_pct | fixed_unit | passthrough
01usage_eventcost_micros (real provider cost)
02rebilling_rateapply markup → retail price
03wallet debitdraw from prepaid balance
04marginretail − wholesale, per client/agent/model
Enforcement extends EntitlementService: before an expensive op (agent run, send SMS) it checks wallet balance; low balance → alert + auto-topup (charge on the connected account) or block. Cost vs. retail = live margin in Core #10 dashboards.
CL#3

Snapshots

Versioned, cloneable configuration templates — not customer data.

included

Pipelines/stages, workflows/automations, forms, calendars, agent templates + config (prompt/tools, no runs), custom_field_defs, message templates, tags, segment defs.

excluded

Contacts, deals, activities, messages, wallet balance, connections/secrets. Snapshots carry setup, never a client's data.

snapshot      (id, account_id, name, version, manifest jsonb, is_public, created_at)
snapshot_link (id, snapshot_id, workspace_id, applied_version, applied_at)

Capture

Serialize the config graph of a source workspace into a versioned manifest.

Apply

Deep-clone into a target workspace with ID remapping (id_map old→new), preserving all references.

Push update

Propagate v+1 to already-instantiated sub-accounts via snapshot_link (diff/merge).

Each snapshottable entity implements export() / import(idMap). This is what makes KRAT replicable by niche — provision a roofing client preloaded with roofing pipelines, agents and templates in minutes.
CL#4

White-label & Custom Domains

domain (id, account_id, hostname, target, ssl_status, verified_at)  -- target: app | portal

Branding

Full theme per agency/client (extends Core #1 branding jsonb): logo, colors, fonts, favicon, from-email.

Custom domain

app.agencybrand.com → CNAME → KRAT edge; on-demand TLS (Let's Encrypt). Gateway resolves hostname → tenant.

Branded surfaces

Emails (Core #11), client portal (Core #1 external). White-label mobile app = later.

CL#5

Platform Revenue & Agency Rollup

Revenue streams

(a) Agency subscription (Core #4 tiers) · (b) wholesale margin on metered usage (KRAT cost → agency price) · (c) mandatory 3.5% + $0.30. No % fee on the agency's resale revenue.

Agency dashboard

Rollup across sub-accounts: MRR, active clients, usage, margin (retail − wholesale), churn — from usage_event + wallet_ledger + reseller_subscription.

Provisioning is a durable saga (Core #6/#7): reseller_subscription.created → provision sub-account → apply snapshot → issue domain/TLS → create wallet.

Locked decisions

Confirmed — the Commercial Layer is fully specced.

DecisionChoiceDetail
Stripe ConnectExpressStripe-hosted KYC/onboarding; agency = merchant of record. Custom path for enterprise.
Rebilling modelPrepaid WalletClients top up; usage debits live; auto-topup. Zero collection risk (GHL-style).
Platform monetizationWholesale marginMargin on metered usage (KRAT cost → agency price) + agency subscription. No cut of resale.
White-label domainsSubdomain + tierFree agency-slug.kratone.app for all; custom domain (CNAME+ACME) on higher tiers.
SnapshotsConfig-onlySetup only, never client data. Non-destructive push-update (preserves local edits); ID remapping.