Brings back posting, which Phase 0 removed with the terminal interface. - Content page: per inventory entry, fetch its X account, X hashtag search, YouTube channel and RSS/Atom feeds (new), then select, dismiss or restore the fetched items, which are kept in the database. - Writing: one AI call returns a draft per channel (X and LinkedIn), prompted from the company profile, the entry's relationship, talking points and mention policy, and each channel's rules. Fetched text is quoted as untrusted. An over-long X draft gets one request to shorten. - Drafts page: edit with a live length counter that counts like X, then publish each draft on its own. A draft is claimed before posting so it can't go out twice; failures are kept on the draft for a retry; X tokens are refreshed and saved. - Migration 2 adds content_items and drafts, and turns queued posts into drafts for the platforms they hadn't reached. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
481 lines
26 KiB
Markdown
481 lines
26 KiB
Markdown
# Supermarket transformation plan
|
||
|
||
From a single-purpose "Social Curator" TUI for Federated Computer to a
|
||
general marketing suite: a local web app, run in Docker, that any company
|
||
running a Federated Core can install as a CoreDesktop sibling.
|
||
|
||
## 1. Decisions so far
|
||
|
||
| Topic | Decision |
|
||
|-------|----------|
|
||
| Name | **Supermarket** (renamed from Coremarketing on 2026-11-19; the old TUI's data path `~/.local/state/coremarketing` keeps its name) |
|
||
| Distribution | A CoreDesktop sibling: `sibling add <url>` installs it, `update` keeps it current |
|
||
| Interface | A **local web app in Docker** at `http://localhost:8470`, on this machine only |
|
||
| Scope | **One company** per install. A company can have **several websites** |
|
||
| Core MCP / EspoCRM | Reached through the **local Hermes agent**, which gets an `mcp_servers` entry for the Core's MCP hub |
|
||
| Billing data | **Stripe** first, for CAC, CLV and NRR |
|
||
| Existing content work | **Kept.** The hard-coded app list becomes the **Inventory** of partners and competitors |
|
||
| Websites and components | The suite builds the company's **websites** from a reusable **component library** |
|
||
| Publishing | Sites are pushed to a **Gitea repository**. The user sets up the hooks that publish it to the Hugo server |
|
||
| Contact enrichment | Third-party services allowed, behind a pluggable interface (section 6) |
|
||
| Suite shape | One repo, one app with modules (Content, Prospects, SEO, Metrics, Sites), plus an MCP endpoint for agents |
|
||
|
||
## 2. Requirements from the notes
|
||
|
||
| Note | Where it lands |
|
||
|------|----------------|
|
||
| Coredesktop sibling | Phase 0: `install.sh` / `update.sh` run Docker Compose and set up Hermes |
|
||
| Generalize for any company | Phase 0: the company profile replaces everything Federated-specific |
|
||
| Company description and targets | Company profile: products, ideal customer profile, voice, websites, accounts |
|
||
| Connect to AI provider | Phase 0: Anthropic, or any OpenAI-compatible server (Ollama, LM Studio, …) |
|
||
| Create and send content to X, LinkedIn, Reddit | Phase 1: Content module, built on today's pipeline, + Reddit |
|
||
| Find prospects → EspoCRM via Core MCP | Phase 2: Prospects module; CRM writes go through Hermes |
|
||
| SEO suggestions, change the Hugo repo | Phase 3: SEO module, with changes opened as PRs on Gitea |
|
||
| SEO for Google, Brave, DuckDuckGo | Phase 3: Search Console, Bing Webmaster + IndexNow (DuckDuckGo results come mostly from Bing), Brave Search API for rank tracking |
|
||
| Top-of-funnel lead generation | Content + SEO + prospecting + landing-page forms that create EspoCRM Leads |
|
||
| Pipeline influence, CAC, CLV, NRR | Phase 4: Metrics module (Stripe + EspoCRM via Hermes + Plausible) |
|
||
| Website, components | Phase 5: Sites module and component library |
|
||
| Static file hosting on Core | Phase 5: push to a Gitea repo; the user's hooks deploy it |
|
||
|
||
## 3. Architecture
|
||
|
||
### Runtime
|
||
|
||
```
|
||
Browser / GNOME app-grid launcher (CoreDesktop `webapp add`)
|
||
│ http://localhost:8470
|
||
▼
|
||
┌──────────────── supermarket container ────────────────┐
|
||
│ Go server: web UI (HTML + htmx) · JSON API · /mcp │
|
||
│ Background jobs: fetch, generate, publish, Stripe sync, │
|
||
│ SEO crawls, scheduled posts │
|
||
│ Tools in the image: git, hugo │
|
||
└───────┬───────────────────────────────▲─────────────────┘
|
||
│ bind mount │ /mcp (bearer token)
|
||
▼ │
|
||
~/.local/share/supermarket/ ┌──────┴─────── Hermes (sandboxed) ──┐
|
||
app.db (SQLite) · secrets │ mcp_servers: │
|
||
sites/ · logs/ │ supermarket → localhost:8470 │
|
||
~/.config/coredesktop/core.conf │ mcphub → Core MCP hub ───────────┼──► EspoCRM
|
||
(read-only: domain, email) │ cron job: run the CRM queue │ (and other
|
||
└────────────────────────────────────┘ Core apps)
|
||
```
|
||
|
||
- **Go stays.** The fetchers, AI client, X/LinkedIn clients, OAuth flows, X
|
||
weighted-length counting and the atomic store all carry over. The Bubble Tea
|
||
UI is replaced by server-rendered pages with htmx: no Node build step, a
|
||
single small image, and the existing code is reused nearly as is.
|
||
- **Localhost only.** The port is published as `127.0.0.1:8470:8080`, so other
|
||
machines can't reach it (it doesn't depend on ufw-docker), and the app needs
|
||
no login of its own. The `/mcp` endpoint requires a bearer token.
|
||
- **OAuth** for X, LinkedIn, Reddit, Google and Bing redirects back to
|
||
`http://localhost:8470/auth/<provider>/callback`. This replaces today's
|
||
`supermarket auth` command on `localhost:8080`. Developer apps need the
|
||
new redirect URI registered.
|
||
- **Local AI servers.** The container reaches a server on this machine through
|
||
`host.docker.internal` (`extra_hosts: host-gateway`), and LAN or tailnet
|
||
servers through the host's routing. The app offers the servers that
|
||
CoreDesktop's `configure ai-servers` set up.
|
||
- **Secrets.** The container can't reach GNOME's keyring, so the app's own
|
||
tokens live in `/data/secrets` (mode 0600, never in the repo or the image).
|
||
The Core MCP hub credential is **not** held by the app; it lives in Hermes'
|
||
`~/.hermes/.env`.
|
||
- **No inbound webhooks.** Nothing on the internet can reach the app, so Stripe
|
||
and the social platforms are polled. Stripe's Events API makes this cheap.
|
||
- **Data in SQLite.** That means one file to back up. The existing
|
||
`posts.json`, `dismissed.json` and `state.json` are imported on first start.
|
||
|
||
### The Hermes bridge (Core MCP → EspoCRM)
|
||
|
||
Hermes is the only thing that talks to the Core's MCP hub. The app and Hermes
|
||
meet through the app's own MCP endpoint, so Hermes is configured with **two**
|
||
MCP servers.
|
||
|
||
**The block `install.sh` adds to `~/.hermes/config.yaml`.** The hub URL comes
|
||
from `core.conf` and the user confirms it. Each `${…}` reference is resolved
|
||
from `~/.hermes/.env`, so `config.yaml` holds no secret:
|
||
|
||
```yaml
|
||
mcp_servers:
|
||
mcphub:
|
||
url: "https://mcphub.<CORE_DOMAIN>/sse?as_user=<CORE_USER>"
|
||
transport: sse
|
||
headers:
|
||
Authorization: "Basic ${MCPHUB_AUTH}"
|
||
supermarket:
|
||
command: socat
|
||
args: ["STDIO", "UNIX-CONNECT:<data folder>/mcp.sock"]
|
||
```
|
||
|
||
**Why a socket, not `http://127.0.0.1:8470/mcp`** (found 2026-11-19).
|
||
CoreDesktop runs Hermes under srt, in its own network namespace. Hermes
|
||
always dials loopback directly, never through the proxy, and finds nothing
|
||
there. srt's proxy, in turn, refuses any name that resolves to loopback.
|
||
Unix sockets are allowed in Hermes' sandbox, so the app serves stdio-style
|
||
MCP on `/data/mcp.sock`, and Hermes runs `socat` as a stdio MCP server. The
|
||
socket is 0600, which is the same protection as the token file beside it.
|
||
The HTTP endpoint with its bearer token stays for unsandboxed agents
|
||
(Claude Code).
|
||
|
||
**`~/.hermes/.env`**:
|
||
|
||
```
|
||
MCPHUB_AUTH=<the user's own hub token from the Core (the part after "Basic "), from a hidden prompt>
|
||
```
|
||
|
||
How `install.sh` does it, safely and idempotently:
|
||
1. It uses `unsandboxed hermes config set mcp_servers.<name>.…`, the way
|
||
CoreDesktop's `configure hermes` calls Hermes. Hermes edits its YAML
|
||
with comment-preserving ruamel, so we never hand-edit its 2,400-line config.
|
||
If an `mcphub` entry already exists, it's left alone.
|
||
2. It asks whether Hermes may reach `mcphub.<CORE_DOMAIN>`. On yes, it adds
|
||
it to `network.allowedDomains` in
|
||
`~/.config/coredesktop/sandbox/hermes.json`. Hermes' sandbox blocks it
|
||
by default, and that file is the one no sandbox can write.
|
||
3. It stops the gateway (`hermes gateway stop`; Hermes starts it on demand) so the
|
||
servers load, then checks that Hermes lists the hub's tools.
|
||
4. The README documents the same block, with placeholders, for anyone setting
|
||
it up by hand.
|
||
|
||
How work flows through Hermes:
|
||
- **Writes (the CRM queue).** The app never calls EspoCRM itself. Approved
|
||
actions (create Lead, update Lead, add note, link Account) wait in a queue
|
||
with their exact payloads and an idempotency key. A Hermes cron job
|
||
installed by `install.sh` runs every 15 minutes. It calls
|
||
`supermarket.crm_pending_actions`, searches EspoCRM for duplicates, runs
|
||
each action through `mcphub`'s EspoCRM tools, and reports back with
|
||
`supermarket.crm_report_result(id, espo_id | error)`. You can also trigger
|
||
a run by asking Hermes, in its terminal or over Matrix.
|
||
- **Reads (for dedupe and metrics).** The same job pulls Leads, Accounts and
|
||
Opportunities changed since the last sync and hands them to
|
||
`supermarket.crm_ingest`. The app keeps a cached copy in SQLite.
|
||
- **Guardrails.** Hermes only carries out actions the app has queued; it
|
||
doesn't decide what goes into the CRM. Every result is checked against the
|
||
next read sync, and failures show in the app's CRM queue page with a retry
|
||
button.
|
||
- **Fallback.** The `crm` package has an interface. If having an LLM in the
|
||
loop proves too slow or unreliable for bulk writes, a direct MCP client in
|
||
the app can replace Hermes without changing the modules.
|
||
|
||
### Repo layout
|
||
|
||
```
|
||
cmd/supermarket/ server entry point
|
||
internal/
|
||
profile/ company, products, ICP, voice, websites
|
||
inventory/ partners & competitors (was config `applications:`)
|
||
ai/ provider interface: anthropic, openai-compatible
|
||
core/ core.conf, Core service URLs (Gitea, Plausible, MCP hub)
|
||
crm/ CRM queue + cached CRM data; executed by Hermes via mcphub
|
||
enrich/ contact-enrichment providers (Hunter, Apollo, …)
|
||
channels/ Publisher interface: x, linkedin, reddit
|
||
sources/ fetchers: x, youtube, rss/blog, reddit, (instagram)
|
||
content/ generation, drafts, approval, schedule, history ← today's pipeline
|
||
prospects/ discovery, enrichment, review, queue to CRM
|
||
seo/ crawler, checks, search-engine APIs, Hugo change sets
|
||
gitea/ clone, branch, PR, repo creation (SEO + Sites)
|
||
billing/ Stripe sync, MRR model, customer↔account matching
|
||
metrics/ pipeline influence, CAC, CLV, NRR
|
||
sites/ component library, page generation, publishing
|
||
mcp/ MCP tools over the modules (incl. the CRM bridge tools)
|
||
web/ handlers, templates, static assets
|
||
store/ SQLite + migrations
|
||
hermes/ cron job prompt + skill for the CRM bridge
|
||
Dockerfile · compose.yaml · install.sh · update.sh
|
||
```
|
||
|
||
### Sibling scripts
|
||
|
||
- `install.sh` (safe to re-run; it may prompt):
|
||
1. Checks that Docker is running and that the user is in the `docker` group.
|
||
2. Creates `~/.local/share/supermarket` and migrates
|
||
`~/.local/state/coremarketing/config.yaml` if it's there.
|
||
3. Runs `docker compose up -d --build`.
|
||
4. Adds the app-grid launcher with
|
||
`webapp add Supermarket http://localhost:8470`.
|
||
5. Sets up the Hermes bridge as described above, or explains how to run
|
||
`configure hermes` first if Hermes has no model provider yet.
|
||
6. Registers `/mcp` with Claude Code (`claude mcp add --transport http …`) so
|
||
it can drive the suite too.
|
||
- `update.sh` (doesn't prompt): runs `docker compose up -d --build`, which only
|
||
rebuilds when the source changed, and refreshes the Hermes cron job and skill
|
||
if they changed. It never touches the Hermes credentials. Schema migrations
|
||
run when the app starts.
|
||
- `restart: unless-stopped` keeps the app running across reboots, so scheduled
|
||
posts and syncs run without the browser open.
|
||
|
||
## 4. Domain model
|
||
|
||
### Company profile (one per install)
|
||
- Name, description, positioning, voice and tone, words to avoid
|
||
- **Products**: name, description, URL, pricing summary, key benefits
|
||
- **Ideal customer profile / targets**: industries, company size, roles,
|
||
regions, problems, buying signals, technologies they use
|
||
- **Websites** (many): URL, Gitea repo and branch, Plausible site, Search
|
||
Console property, Bing site
|
||
- **Accounts**: X handle, LinkedIn org/author, Reddit user, subreddits
|
||
- Keywords to rank for
|
||
|
||
The first time it runs, a wizard drafts the profile from the company's main
|
||
website with the AI, and the user edits it.
|
||
|
||
### Inventory (partners and competitors)
|
||
|
||
The current `applications:` list becomes the Inventory. Each entry has the same
|
||
fields as today (name, description, X handle, YouTube channel, Instagram,
|
||
hashtags) plus:
|
||
|
||
| Field | Purpose |
|
||
|-------|---------|
|
||
| `relationship` | `partner`, `competitor` or `watch` |
|
||
| `websites`, `linkedin`, `subreddits`, `rss` | More places to watch |
|
||
| `keywords` | Terms they own or compete on |
|
||
| `talking_points` | **Partners:** how we work together. **Competitors:** how we differ, where we win, what not to claim |
|
||
| `mention_policy` | Competitors: name them, or speak about the category without naming them |
|
||
|
||
What each relationship drives:
|
||
- **Partner**: today's behavior. Their news is fetched, and posts that
|
||
amplify it in our voice (co-promotion) are drafted for review.
|
||
- **Competitor: counter-programming.** Their launches, price changes, outages
|
||
and announcements trigger drafts that position our product, under the
|
||
entry's `mention_policy`. Also: "<competitor> alternative" landing-page
|
||
ideas, keyword-gap analysis against their sites, and prospects: companies
|
||
that use the competitor's product (technographics), and people asking for
|
||
alternatives on Reddit and X.
|
||
- **Watch**: only ecosystem news to curate, with no promotion either way.
|
||
|
||
Migration: entries from the old config are imported as `partner` (they are
|
||
the apps on a Federated Core), and the user re-labels them. The Federated list
|
||
ships as an example import file, `examples/federated-inventory.yaml`, not as a
|
||
default.
|
||
|
||
## 5. Phases
|
||
|
||
Each phase ends usable and with a release tag (`v0.x.0`).
|
||
|
||
### Phase 0: Foundation: web app, sibling, profile, Hermes bridge
|
||
|
||
**Status (2026-11-18): built on branch `phase0-foundation`.** Items 1–7 are
|
||
done, and so is the tooling for item 8. What changed from the plan:
|
||
- **No Hermes cron job yet.** Until Phase 2 there's no queued work, and every
|
||
run of the job is an LLM call. The bridge is tested by asking Hermes the
|
||
check-in question shown on the app's "Core & Hermes" page. The cron job
|
||
arrives with the CRM queue.
|
||
- **AI per task:** each task can use its own model, on the same provider.
|
||
- **The old TUI is gone.** Its post queue, dismissed items and last-checked
|
||
times are imported into SQLite, and its X/LinkedIn/YouTube clients and
|
||
fetcher are kept for Phase 1. Until Phase 1 lands, there's no way to post.
|
||
|
||
**Status (2026-11-20): Phase 0 is done, on `phase0-foundation`.** Item 8
|
||
works end to end: Hermes loads the hub's tools and checks in with the app.
|
||
|
||
What item 8 turned up:
|
||
- Sandboxed Hermes **can't** reach `127.0.0.1:8470` (see "Why a socket" in
|
||
the Hermes bridge section), so it reaches the app through `/data/mcp.sock`
|
||
with `socat`.
|
||
- `hermes config set` writes nested `mcp_servers.*` keys correctly, lists
|
||
(`args`) included.
|
||
- The hub rejected the shared admin token (401 at Traefik). The Core moved
|
||
to per-user tokens, still sent as `Authorization: "Basic <token>"`, with
|
||
`as_user=<user>` kept. The setup asks for the token, checks it with the
|
||
hub, and `supermarket hermes --reconfigure` re-enters it.
|
||
- The hub (FastMCP "mcpserver-hub" 3.2.0) speaks only SSE: a POST to `/sse`
|
||
gets 405. Hermes tries Streamable HTTP first, and that try ran out of its
|
||
60-second connect time, so setup.sh sets `transport: sse`. `tools/list`
|
||
takes about 10 seconds.
|
||
- A running Hermes gateway keeps its old servers, and `gateway stop` from
|
||
outside the sandbox didn't always stop it. setup.sh now checks the pid
|
||
file and says so when the gateway is still running.
|
||
- The hub offers 213 tools: Nextcloud 155, Listmonk 29, Superpanel 9,
|
||
Baserow 8, Plausible 6 and EspoCRM 6 (`espocrm_search_records`,
|
||
`espocrm_get_record`, `espocrm_get_related_records`,
|
||
`espocrm_create_record`, `espocrm_update_record`,
|
||
`espocrm_delete_record`). Hermes reports them with its own `mcp__mcphub__`
|
||
prefix, and the app stores the hub's names. Phase 2 builds on the generic
|
||
EspoCRM record tools.
|
||
- The per-user token also sees `nextcloud_admin_list_users` and
|
||
`nextcloud_admin_get_contacts`, both described as admin-only. To raise with
|
||
the Core's developer: it isn't known yet whether the hub blocks them for
|
||
non-admins.
|
||
|
||
Next: start Phase 1.
|
||
|
||
Supermarket's half can be checked before the token arrives: ask Hermes the
|
||
check-in question now. It should reach `bridge_checkin` and note that
|
||
mcphub failed.
|
||
|
||
1. Restructure into the layout above. Port config and the JSON stores to
|
||
SQLite, with import from the old files.
|
||
2. Dockerfile (multi-stage: Go build → slim runtime with git and hugo) and
|
||
`compose.yaml`.
|
||
3. `install.sh` / `update.sh` as above, following
|
||
`coredesktop/skills/sibling-project-format.md`.
|
||
4. Web shell: navigation between the modules, a settings page, a credentials
|
||
page with OAuth "Connect" buttons, and a Core status page (whether
|
||
`core.conf` was found, whether Gitea and Plausible answer, and when the
|
||
Hermes bridge last ran).
|
||
5. Company profile + the wizard that drafts it from the website.
|
||
6. AI provider layer: choose the provider and model per task, and test the
|
||
connection.
|
||
7. Inventory module: list, edit, import (from the old config and from YAML),
|
||
and relationship labels.
|
||
8. **Hermes bridge test** (do this early, since Phases 2 and 4 depend on it):
|
||
- ~~Can sandboxed Hermes reach `127.0.0.1:8470` once it's in
|
||
`hermes.json`?~~ No. Answered 2026-11-19: it uses the MCP socket instead.
|
||
- ~~Does `hermes config set` write nested `mcp_servers.*.headers` keys
|
||
correctly?~~ Yes.
|
||
- What EspoCRM tools does the hub expose?
|
||
- Can Hermes cron jobs call MCP tools?
|
||
- How reliable is a run of 50 queued actions?
|
||
|
||
### Phase 1: Content (today's pipeline, generalized) + Reddit
|
||
|
||
**Status (2026-11-20): part 1 of 4 built on `phase0-foundation`.** Phase 1 is
|
||
built in four parts, each committed on its own: (1) the pipeline, items 1–2
|
||
below, for X and LinkedIn; (2) the approval inbox, schedule and UTM tags,
|
||
item 5; (3) Reddit, item 4; (4) promoting our own products, the rest of
|
||
item 3. Part 1:
|
||
- One generation writes **one draft per channel** (a short X post, a longer
|
||
LinkedIn post), each edited, published and retried on its own. The old
|
||
`posts` table became the `drafts` table (migration 2), one row per
|
||
platform a queued post hadn't reached.
|
||
- Fetching reads the entry's X account, X hashtag search, YouTube and RSS
|
||
feeds (new). Items are stored in `content_items`. A fetch only moves the
|
||
entry's start time on if every source answered.
|
||
- Prompts come from the profile, the entry's relationship, talking points
|
||
and mention policy, and the channel. Fetched text is marked as untrusted
|
||
quotes. An X draft over the limit gets one request to shorten it.
|
||
- Publishing claims the draft first (`publishing`), so it can't post twice;
|
||
a draft left `publishing` by a restart is marked failed for review.
|
||
1. Port fetch → browse → select → generate → approve → publish into the web
|
||
UI, keeping the dismiss feature, tracking of what was posted where, partial
|
||
posting, and X length handling.
|
||
2. Generation prompts are built from the profile, the inventory entry's
|
||
relationship and talking points, and the target channel.
|
||
3. Content types: partner amplification, competitor counter-programming,
|
||
promotion of our own products (from the product list, site pages, blog RSS,
|
||
and releases).
|
||
4. Reddit: OAuth, subreddit list, each subreddit's rules shown with the draft,
|
||
approval always required, warnings about posting too often.
|
||
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
|
||
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.
|
||
|
||
### Phase 3: SEO, for all of the company's websites
|
||
1. Audit each website: titles, meta descriptions, headings, canonical URLs,
|
||
sitemap, robots.txt, JSON-LD, Open Graph, broken links, alt text, Core Web
|
||
Vitals (PageSpeed Insights API).
|
||
2. Content gaps: the profile's keywords and the competitors' sites from the
|
||
Inventory, compared with ours.
|
||
3. Search engines: Google Search Console API, Bing Webmaster API, IndexNow on
|
||
publish, and Brave Search API rank tracking.
|
||
4. Apply fixes: clone the site's Gitea repo into `/data/sites/`, make the
|
||
changes on a branch, check that `hugo` still builds, show the diff in the
|
||
UI, and open a PR on Gitea. Nothing is pushed to the default branch.
|
||
Merging the PR is the user's decision, and their hooks publish it.
|
||
5. Before/after tracking for each change.
|
||
|
||
### Phase 4: Metrics, with Stripe
|
||
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.
|
||
2. **MRR model**: MRR per customer per month, normalized from subscription items
|
||
(annual ÷ 12, with discounts, trials and pauses handled), classified as new,
|
||
expansion, contraction, churn or reactivation.
|
||
3. **Matching** Stripe customers to EspoCRM Accounts (from the cached CRM data)
|
||
by email domain or stored ID, with a screen to fix the matches it gets wrong.
|
||
4. **Spend log** for CAC: entered by hand or imported from CSV, by channel and
|
||
month (Stripe has no marketing spend). Enrichment provider costs can be
|
||
logged automatically.
|
||
|
||
| Metric | Definition | Sources |
|
||
|--------|-----------|---------|
|
||
| Pipeline influence | Value of open and won opportunities with at least one marketing touch (UTM visit, form, prospect push, engagement with a post), by channel | EspoCRM (via Hermes), Plausible, the app's own history |
|
||
| CAC | Spend ÷ new paying customers, per month and per channel | Spend log, Stripe (first paid invoice) |
|
||
| CLV | ARPA × gross margin ÷ monthly churn rate, plus actual cumulative revenue per cohort | Stripe; gross margin set in settings |
|
||
| NRR | (Starting MRR + expansion − contraction − churn) ÷ starting MRR, monthly and trailing-12-month, by cohort | Stripe MRR model |
|
||
|
||
5. A dashboard with CSV export. It can also be published as a page on one of
|
||
the company's sites.
|
||
|
||
### 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,
|
||
lead form, final CTA) on the `sections:` front-matter pattern from
|
||
`webcoredesktop`, themed from the profile (colors, fonts, logo). It lives
|
||
in its own Gitea repo and is versioned, so the company's sites can pull
|
||
updates.
|
||
2. **Site builder**: create a new site from the library (which creates its
|
||
Gitea repo through the API), or add pages to an existing one (landing,
|
||
product, "<competitor> alternative" and comparison pages, blog posts) from
|
||
the profile, the Inventory and SEO findings. Changes are always PRs.
|
||
Preview runs `hugo server` inside the container.
|
||
3. **Publishing** = merging into the site repo's publish branch on Gitea. The
|
||
user's Gitea hooks deploy it to their Hugo server. The app shows the last
|
||
merge, and checks the live site afterwards to confirm it changed.
|
||
|
||
## 6. Contact enrichment: suggested services
|
||
|
||
"Enrichment" means: given a target company (or a person's name), find the
|
||
people in the roles you sell to, their work email and LinkedIn URL, and check
|
||
that the email is deliverable. These are good candidates; check current pricing
|
||
before choosing:
|
||
|
||
| Service | What it's good for | Notes |
|
||
|---------|-------------------|-------|
|
||
| **Hunter.io** | Emails at a company's domain, email finder by name, verification | Simple API, small free tier, cheap paid plans. A good first provider |
|
||
| **Apollo.io** | Searching people by title, seniority, industry and company size; returns email and LinkedIn URL | Largest database here. API access requires a paid plan. A strong second |
|
||
| **People Data Labs** | Person and company enrichment API for developers, paid per record | Good for bulk; little UI, which suits us |
|
||
| **Snov.io / Prospeo** | Finder + verifier, lower cost | Alternatives to Hunter |
|
||
| **BuiltWith or Wappalyzer** | Technographics: which companies use a given product | Feeds competitor counter-programming |
|
||
| **ZeroBounce / NeverBounce** | Verification only | Use if the finder's own verification isn't enough |
|
||
|
||
Recommendation: build the `enrich` interface with **Hunter** first (company
|
||
domain → people → verified email). Add **Apollo** for searching people by role,
|
||
and **BuiltWith/Wappalyzer** to find companies that use a competitor. Each user
|
||
brings their own API keys, and the app logs credits used as spend for CAC.
|
||
|
||
## 7. Order and dependencies
|
||
|
||
```
|
||
Phase 0 (incl. Hermes bridge test) ──► Phase 1 (content)
|
||
│
|
||
├──► Phase 2 (prospects) ── needs: Hermes bridge, mcphub EspoCRM tools
|
||
├──► Phase 3 (SEO) ──────── needs: Gitea token
|
||
├──► Phase 4 (metrics) ──── needs: Stripe key; CRM reads for pipeline
|
||
└──► Phase 5 (sites) ────── needs: Gitea token
|
||
```
|
||
|
||
Phases 1, 3, 5 and the Stripe half of 4 depend only on Phase 0.
|
||
|
||
## 8. Open questions
|
||
|
||
1. **MCP hub credentials**: the example authenticates as an admin and uses
|
||
`as_user=` to act as the user. Can the hub issue per-user credentials or
|
||
tokens instead? An admin password in each desktop's Hermes `.env` gives an
|
||
agent that reads untrusted web content admin access to the Core.
|
||
*2026-11-19:* the Core's developer confirmed it's always the admin token
|
||
today. After the admin token failed with a 401, they said the hub will
|
||
likely move to per-user tokens.
|
||
*2026-11-20:* resolved. The hub now issues per-user tokens, still sent as
|
||
`Authorization: "Basic <token>"`, with `as_user=<user>` kept in the URL.
|
||
2. **MCP hub URL**: is it always `mcphub.<CORE_DOMAIN>`, so it can be worked out
|
||
from `core.conf`?
|
||
3. **Gitea**: which Gitea do sites live on (the Core's, at
|
||
`gitea.<CORE_DOMAIN>`?), and should the app get its token from the user or
|
||
from Gitea's OAuth?
|