internal/jobs keeps named locks as leases in the database (schema 31:
locks, instances), taken with one conditional UPDATE on SQLite or Postgres,
renewed while the work runs and lapsing if its copy stops. Each background
loop's turn, sending an email, audits, discovery runs and imports run
under a lock; OAuth sign-ins under way are kept in the database. Copies
check in, and work marked running is recovered at start only when no
other copy is alive. Settings -> About lists the copies and work under
way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The MRR page adds churn, CLV, CAC and CLV:CAC. Eight tables download as
CSV (MRR, NRR and revenue cohorts, CAC by month and channel, spend,
products, customers). Metrics → Publish builds an open metrics page from
chosen totals only (never a customer) and opens a pull request that adds
or updates it on the site, checked with a Hugo build.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CLV = ARPA × revenue-weighted gross margin ÷ customer churn averaged over
up to 12 complete months, with lifetime and CLV:CAC (CAC over its own
12-month window). Revenue by cohort from money that came in: paid
invoices less refunds and post-payment credits not refunded, cumulative
per customer, with a gross profit view; months not reached are told
apart from negative amounts. Metrics → CLV and cohorts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Spend by month and channel (the funnel's channels and general), by hand
or from pasted CSV (all or nothing); origami.chat and explee.com campaign
spend added hourly as the difference since last seen. CAC per month and
over three months, and per channel over 12 months from each new
customer's first funnel step; unknown, not $0, without spend. Metrics →
Spend and CAC. Schema 21.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every customer with billing is matched to an Account copied from the
CRM: the user's choice, then an Account Hermes created from here, a
stored ID on either side, an email (the Account's or a Contact's), or
the email's domain (not free mail). Several candidates wait for a
choice. Metrics → Customers and the CRM fixes matches, marks customers
not in the CRM, and queues paying ones as new Accounts. Schema 20.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each customer's MRR at each month's end, from the recurring lines of paid
and open invoices: the amount after discounts over the billing interval,
prorations over their part-period. Moves are new, expansion, contraction,
churn and reactivation (sub-dollar noise ignored); NRR monthly and over
12 months; cohorts by first paid month. A start month, suggested when
most of the business appears at once (billing moved to Stripe), makes
those customers the base. Metrics page with a chart, the month table,
cohorts, and each month's customer moves.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Customers, invoices with all their lines (both of Stripe's line shapes),
credit notes, refunds (with their customer) and products: a backfill,
then the Events API every hour, and a new backfill when events have
expired. Metrics page with sync status. Gross margin per product: a
default (60%) and overrides, with names from Stripe's products or the
invoice lines. Schemas 18 and 19.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>