From 07c4491f48731aeed6bdbfdfdd8aff171a530b8d Mon Sep 17 00:00:00 2001 From: David Young Date: Sun, 22 Nov 2026 09:24:32 -0700 Subject: [PATCH] PLAN: current status of Phases 1 to 3; Phase 4 in parts Phase 1 was tried for real; Phases 2 and 3 are merged into main; the Gitea question is answered. Phase 4 is planned in seven parts, with MRR from invoice lines and gross margin per product (default 60%). Co-Authored-By: Claude Opus 5.5 --- PLAN.md | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 94 insertions(+), 3 deletions(-) diff --git a/PLAN.md b/PLAN.md index 3623e89..d781246 100644 --- a/PLAN.md +++ b/PLAN.md @@ -407,7 +407,9 @@ Part 4, promoting our own products: invites feedback, and Posts warns that self-promotion is often restricted. -**Not yet tried for real (deferred on 2026-11-21 for the UI redesign below; run this checklist next).** Parts 1–4 are covered by tests with fake AI +**Tried for real on 2026-11-21:** publishing to X and LinkedIn worked (LinkedIn needed the "Sign In with LinkedIn using OpenID Connect" product; X's callback must use 127.0.0.1). Reddit refuses new API apps without approval, so Reddit drafts are posted by hand. The full hand-testing checklist is now TEST.md; the steps below were the first one. + +**Originally deferred on 2026-11-21 for the UI redesign below.** Parts 1–4 are covered by tests with fake AI and channel clients, and the rebuilt app runs (schema 3). But the installed app has no profile, AI key, inventory or social sign-ins yet, so no real fetch, generation or post has been made. Before relying on it: @@ -473,7 +475,11 @@ The plan for Phase 1, as first written: ### Phase 2: Buying signals, prospects and the funnel **Started 2026-11-21** on branch `phase2-prospects`, after Phase 0 and 1 -were merged into `main` and tagged `v0.1.0`. +were merged into `main` and tagged `v0.1.0`. **Parts 1 to 7 built, and +merged into `main` on 2026-11-22** (d23d5e2). Part 8 (Hugo pages per +signal) waits for Phase 5. Not yet tried against the live services: +discovery's web search, outreach's mailbox, Stripe and Plausible (no keys +saved yet), and the CRM bridge, which waits on the Core's MCP hub. **Reframed 2026-11-21 (the user's direction).** Phase 2 is built around **buying signals**: hypotheses about why a company buys now, which are @@ -660,7 +666,8 @@ tagged with the signal from its UTM campaign. ### Phase 3: SEO, for all of the company's websites **Started 2026-11-22** on branch `phase3-seo`, after Phase 2 was merged -into `main`. +into `main`. **All seven parts built, and merged into `main` on +2026-11-22** (2302fb0). **Decisions (the user, 2026-11-22).** - **chatseo.app:** borrow its ideas only, no subscription. It was reviewed @@ -993,6 +1000,86 @@ signals; this phase builds the full metrics on top of it. 5. A dashboard with CSV export. It can also be published as a page on one of the company's sites. +**Started 2026-11-22** on branch `phase4-metrics`, after Phase 3 was merged +into `main`. + +**Design decisions:** +- **MRR comes from invoice line items, not subscriptions.** A subscription + object only says how things stand today. An invoice line says what a + customer was billed for which period: monthly value = the line's amount, + after discounts, ÷ the months its period covers. Past months can then be + rebuilt exactly, and trials ($0), pauses (no invoice) and cancellations + (no next period) fall out naturally. +- **Every number is computed in code** from the synced data, like Phase 3. + No estimates; where data is missing, the dashboard says so. +- **One currency.** Amounts in another currency are counted apart, never + added. +- **Gross margin is per product** (the user, 2026-11-22). The default is + **60%**, and each Stripe product can have its own margin, set on + Metrics. CLV weighs each customer's revenue by the margin of what they + buy. Products come from the sync; if the key can't read Products, their + names come from the invoice lines' descriptions. + +**Parts, in order, a commit after each:** +1. **The full Stripe sync.** + - Read customers, invoices (with their lines), credit notes and refunds: + a full backfill, then the Events API every hour. + - Events are kept for 30 days, so an older watermark triggers a new + backfill. + - Use the same restricted, read-only key as Phase 2. The key also needs + read access to Customers, Credit notes, Events and Charges (for + refunds). + - **Built 2026-11-22** (schema 18: `stripe_objects`, + `stripe_invoice_lines`): + - `metrics.Sync` backfills customers, invoices (drafts skipped), + credit notes and refunds (with `expand[]=data.charge` for the + customer). + - It then applies the Events API for the followed types since the + watermark. `charge.refunded` reads its refunds, and + `customer.deleted` marks the customer deleted. + - Invoice lines are re-read in full when `has_more`. + `stripe.ParseLine` reads both the older line shape and the 2025 + one, and stores the amount after discounts. + - It syncs every hour, on Metrics, with *Sync now* and *Read + everything again*. + - Per-product margins came in with it (schema 19 adds the lines' + descriptions). Products are read on every sync; without Products + access, the sync says so and names come from the line + descriptions. `metrics.Products` lists each product's last 12 + months billed (paid and open invoices). Margins are a default plus + per-product overrides, under Metrics → Gross margin by product. + `WeightedMargin` gives the revenue-weighted margin. + - On the live account, the first full sync read 857 customers, + 2,894 invoices, 21 credit notes, 346 refunds and 63 products, all + in USD. +2. **The MRR model and NRR.** + - MRR per customer per month, from invoice lines. + - Each month's movements: new, expansion, contraction, churn, + reactivation. + - NRR monthly and over the trailing 12 months, by signup cohort. +3. **Matching Stripe customers to EspoCRM Accounts** (from the cached CRM + records), by stored ID, email or email domain, with a screen to fix + wrong matches. Customers already tied to prospects (Phase 2) keep that + tie. +4. **The spend log and CAC.** + - Spend by channel and month, entered by hand or imported from CSV. + - Outside tools' spend comes in automatically (origami.chat and + explee.com campaigns already report it). + - CAC = spend ÷ new paying customers, per month and per channel, with + the channel taken from the customer's first funnel touch. +5. **CLV and cohorts.** + - CLV = ARPA × gross margin ÷ monthly churn rate, with the margin + weighted by each product's share of the revenue. + - Each signup cohort's actual cumulative revenue, net of refunds and + credit notes. +6. **The dashboard.** + - MRR over time with its movements, NRR, CAC, CLV and CLV:CAC. + - CSV export of every table. + - Optionally published as a page on one of the sites, through a pull + request. +7. **Pipeline influence**, once the CRM bridge works: the value of open and + won EspoCRM opportunities with at least one marketing touch, by channel. + ### Phase 5: Sites and components 1. **Component library**: a Hugo theme module with section partials (hero, features, cards, steps, pricing, stats, FAQ, comparison table, testimonial, @@ -1134,3 +1221,7 @@ Phases 1, 3, 5 and the Stripe half of 4 depend only on Phase 0. 3. **Gitea**: which Gitea do sites live on (the Core's, at `gitea.`?), and should the app get its token from the user or from Gitea's OAuth? + *2026-11-22:* resolved. Sites live on the Core's Gitea + (gitea.federated.computer, with Federated_Computer/federated-website for + the main site). The user gives the app an access token with the + `write:repository` scope, under Settings → Search engines.