diff --git a/PLAN.md b/PLAN.md index 1a11fc2..8ab7b8f 100644 --- a/PLAN.md +++ b/PLAN.md @@ -469,51 +469,115 @@ The plan for Phase 1, as first written: 5. Scheduling queue, an approval inbox for drafts from all modules, and UTM tags on every link so Metrics can attribute visits. -### Phase 2: Prospects → EspoCRM +### 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`. Decisions (the user's): -discovery starts with **Claude with web search** (the shared Anthropic key; -sources cited per company), and enrichment starts with **Hunter.io**. Parts, -in order, a commit after each: (1) the CRM bridge: queue, Hermes job, -read sync, CRM queue page, proved with one test Lead; (2) prospects and -the review screen, dedupe, suppression list, provenance; (3) discovery; -(4) enrichment with Hunter; (5) outside lead sources (CSV, then -origami.chat / explee.com); (6) intent signals on X (Reddit after API -approval). Part 1 is -committed (1dc5476); its live test waits on the Core's MCP hub, which -connects to EspoCRM at a stale LAN address. Part 2 is built: the -`prospects` package (companies, contacts, merged by domain and email), -Prospects → Review (accept a company → Account, a person → Lead, both with -provenance in the description; set aside; reconsider; CRM-duplicate -warnings from the last sync), adding prospects by hand, the suppression -list (emails and domains, checked on add and before queueing), and -prospects in Search. +were merged into `main` and tagged `v0.1.0`. -1. Discovery from the profile's targets, from these sources: - - company search (enrichment provider, Brave Search API) - - technographics (companies using a competitor's product) - - intent signals on Reddit and X -2. Enrichment through the `enrich` providers: people by role at a target - company, work email, LinkedIn profile URL, and email verification. - LinkedIn itself isn't scraped. -3. Review screen: why each prospect fits, where each contact came from, - verification status, dedupe against the cached CRM data, then accept → the - CRM queue → Hermes → an EspoCRM Lead with source and campaign set. -4. Compliance: the source and date are recorded for every contact, plus a - suppression list that is checked before anything is queued. -5. Inbound: the lead-form component (Phase 5) queues a Lead the same way. -6. **To do (asked 2026-11-21): connect to outside marketing services to - collect leads.** Examples the user gave: origami.chat and explee.com. Each - service is a lead source: Supermarket connects with the user's own account - (API key or OAuth, under Settings), pulls the leads it found, and puts them - through the same review screen, dedupe, suppression list and - source/date record as the leads it finds itself, so nothing reaches - EspoCRM unreviewed. Before building, check each service: whether it has an - API, webhooks or only a CSV export (a CSV import is the fallback for any - service), what a lead holds, and its terms on storing and reusing the - data. Build it as a `leadsource` interface, one adapter per service, like - the `enrich` providers. +**Reframed 2026-11-21 (the user's direction).** Phase 2 is built around +**buying signals**: hypotheses about why a company buys now, which are +defined, found, and then *tested* through direct action (email, LinkedIn) +and indirect action (social posts, blog posts, website and landing pages), +with results measured through the whole funnel to payment in Stripe. +Content is tested against signals and signals against content. Later, the +Hugo sites (Phase 5) create, duplicate and delete pages from this +feedback loop. origami.chat and explee.com, where signals and prospects +are already being tested, feed their results in. + +**A signal** has: a name; the hypothesis ("teams complaining about the +Microsoft 365 price rise will switch within a quarter"); how to spot it +(Claude web search queries, social keywords, origami.chat / explee.com +criteria); the angle (pain and promise) for messages and content; a status +(idea, testing, proven, retired); and a slug used as `utm_campaign`. + +**Everything is tagged with a signal and recorded in one funnel-event +log** (signal, channel, prospect/contact/content, stage, date, value), so +the scorecard is one query and new sources drop in without rework. +Stages, each of which counts as a success where it happens: + +``` +found → contacted/reached → replied → clicked the scheduling link / booked + → visited the website or a landing page → signed up (trial, free tier) → paid + (then expanded or churned) +``` + +Channels: email, LinkedIn, social posts, blog posts, website pages, +origami.chat, explee.com. The **scorecard** shows, per signal and per +channel, the count at each stage and the conversion between them, revenue, +cost (AI, Hunter, origami.chat and explee.com fees) and CAC; and per piece +of content, which signal it serves and how it did. Numbers will be small: +it shows counts plainly, and a signal is "proven" only past a threshold +the user sets. + +**How each stage is measured.** Supermarket runs on localhost and nothing +on the internet can reach it, so it can't use tracking pixels or its own +link redirects. Instead: +- *Replied*: IMAP on the Core's mail server reads replies to Supermarket's + emails (matched by Message-ID / thread). "STOP"-style replies go on the + suppression list. +- *Scheduling link*: the link carries UTM tags and goes through the website + or Cal.com on the Core; bookings come from Cal.com (stronger than a + click), visits from Plausible. +- *Website / landing page*: Plausible, by `utm_campaign` (the signal) and + `utm_content` (the piece of content or message). Measured per signal in + aggregate, not per person: following individuals around the website + would cut against Federated's privacy positioning. +- *Signed up / paid*: Stripe (read-only restricted key). A payment is tied + to a signal through the CRM (Stripe customer email/domain → EspoCRM + Account → prospect → signal), and, for self-serve sign-ups, through the + UTM campaign saved in Stripe metadata at sign-up. Customers buy through + Federated's shopping cart, which uses Stripe, so the cart has to pass the + visitor's UTM tags into the Stripe Checkout session's metadata. +- *origami.chat / explee.com*: their APIs. + +**Sending email (the user's decision):** Supermarket sends through +mail.federated.computer on the Core (SMTP, with IMAP for replies). Every +email is drafted from the signal's angle, reviewed, and sent one by one at +a low daily limit, with a plain opt-out line; the suppression list is +checked before sending. Recommended: a dedicated mailbox, and SPF, DKIM +and DMARC checked first, so outreach can't hurt the domain's normal mail. +**LinkedIn** can't be automated (its API doesn't allow messaging, and +automation risks the account): Supermarket drafts the message and opens +the profile, the user sends it and marks it sent, as with Reddit posts. + +**origami.chat and explee.com have APIs** (checked 2026-11-21, not yet +tried with a key): origami.chat has a typed API at +`https://origami.chat/api/v3` (Leads, Send, Account; long-running Jobs; +webhooks; an MCP server); explee.com has a public API at +`https://api.explee.com` (company search with natural-language queries and +`criteria` scoring; API key from Organization Settings; OpenAPI schema at +`/public/api/openapi.json`). Before building: what each returns for a +campaign's results (replies, meetings), and their terms on storing the +data. Each becomes an adapter behind a `leadsource` interface. + +**Parts, in order, a commit after each:** +1. **The CRM bridge** (done, 1dc5476): the queue, the Hermes job, the read + sync, the CRM queue page. Its live test waits on the Core's MCP hub, + which connects to EspoCRM at a stale LAN address. +2. **Prospects and review** (done, 7633697): companies and contacts with + provenance, Review (accept → Account / Lead), adding by hand, CRM + duplicate warnings, the suppression list, search. +3. **Signals and the funnel**: the signal library, tagging prospects with + a signal, the funnel-event log, the scorecard (with what exists so far), + and importing origami.chat and explee.com results through their APIs, + so the scorecard starts with real data. +4. **Discovery per signal**: saved Claude web searches belonging to a + signal, run on a schedule, each prospect with its citation; explee.com + company search as a second source. +5. **Enrichment with Hunter**: the right people and verified emails at + accepted companies. +6. **Direct outreach**: email through the Core's mail server (drafted, + reviewed, sent, replies read over IMAP) and LinkedIn by hand; each + outcome recorded in the funnel. +7. **Indirect and the end of the funnel**: content drafts tagged with a + signal (UTM per signal), Plausible results per signal, Cal.com bookings, + and Stripe sign-ups and payments (pulled forward from Phase 4's Stripe + sync). +8. **Later, with Phase 5 (sites)**: Hugo pages per signal, created, + duplicated or deleted from the scorecard, through Gitea PRs. + +Inbound: the lead-form component (Phase 5) queues a Lead the same way, +tagged with the signal from its UTM campaign. ### Phase 3: SEO, for all of the company's websites 1. Audit each website: titles, meta descriptions, headings, canonical URLs, @@ -534,6 +598,10 @@ prospects in Search. Phase 3 starts. ### Phase 4: Metrics, with Stripe + +Phase 2 (part 7) brings in the Stripe sync and ties payments to buying +signals; this phase builds the full metrics on top of it. + 1. **Stripe sync**: a restricted, read-only key; customers, subscriptions, invoices, credit notes and refunds; a full backfill, then incremental updates through the Events API. @@ -623,7 +691,8 @@ brings their own API keys, and the app logs credits used as spend for CAC. ``` Phase 0 (incl. Hermes bridge test) ──► Phase 1 (content) │ - ├──► Phase 2 (prospects) ── needs: Hermes bridge, mcphub EspoCRM tools + ├──► Phase 2 (signals, prospects, funnel) ── needs: Hermes bridge, mcphub EspoCRM tools, + │ mail on the Core, Plausible, Stripe key ├──► Phase 3 (SEO) ──────── needs: Gitea token ├──► Phase 4 (metrics) ──── needs: Stripe key; CRM reads for pipeline └──► Phase 5 (sites) ────── needs: Gitea token