Phase 3 part 1: Search Console and what already ranks

PLAN: Phase 3 rewritten around a weekly seven-job SEO loop (what ranks,
next keywords, brief, page, approval, morning check, Monday report),
with chatseo.app's ideas borrowed and rankings from Search Console only.

Google OAuth (PKCE, offline, read-only webmasters scope) from Settings →
Search engines, with each website's property. Search Console is synced
into SQLite by day (site, page, and page+query; 16 months, then twice a
day). SEO → What ranks shows the last 90 days: totals, the share of
clicks from hidden queries, best pages, queries shown but not clicked,
and the pages to protect and to push, each with its numbers. Schema 12.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 07:17:37 -07:00
co-authored by Claude Opus 5.5
parent d23d5e2a87
commit 5ea620a091
19 changed files with 1590 additions and 31 deletions
+157 -18
View File
@@ -32,7 +32,7 @@ running a Federated Core can install as a CoreDesktop sibling.
| 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 |
| SEO for Google, Brave, DuckDuckGo | Phase 3: Search Console, Bing Webmaster + IndexNow (DuckDuckGo results come mostly from Bing); rankings from Search Console (decided 2026-11-22) |
| 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 |
@@ -658,22 +658,161 @@ 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,
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.
6. **Reminder (asked 2026-11-21): review chatseo.app** before designing
this phase: what it does, what we could learn from it or connect to, and
whether it overlaps with the steps above. Raise it with the user when
Phase 3 starts.
**Started 2026-11-22** on branch `phase3-seo`, after Phase 2 was merged
into `main`.
**Decisions (the user, 2026-11-22).**
- **chatseo.app:** borrow its ideas only, no subscription. It was reviewed
as the reminder asked. It's a paid chat-based SEO agent (from €39 a
month; MCP and API from €59) built on Search Console, DataForSEO and its
own crawler. Two ideas are worth taking: rank every issue by its Search
Console impressions and clicks, and check whether AI assistants can read
and cite the site.
- **Rankings come from Search Console only**: Google's own position per
query and page, free. There is no keyword-volume or SERP data provider.
Where the live top results matter (a brief, a keyword's competition),
they're read with Claude's web search, which costs searches, only when
the user asks.
- **The workflow follows a "full lifecycle" post** (@thwlf67, 18 Nov 2026,
saved by the user as a PDF). SEO for a small site is seven jobs that
come back every week: find what already ranks, find the next keywords,
write a brief, write the page, approve and publish, check Search Console
every morning, and write the Monday report. Supermarket does six of them;
the user keeps the approval. Its rules become the module's rules:
- Every number comes from the data, and none is invented: when a source
returns nothing, the report says "no data", not zero.
- Every recommendation carries the number that justifies it.
- Thresholds decide what's worth reporting, and "nothing real moved" is a
one-line answer.
- One job at a time, each with its own definition of done.
- Nothing changes on a site without the user's yes, given one change at a
time, never in bulk; at most 3 recommendations a week.
- Pages never claim tests or experience that didn't happen. A brief ends
with the questions only the user can answer, and the draft is written
around their answers, with what wasn't tested said plainly.
- The weekly report has a fixed format, so this Monday compares with the
last in seconds.
- Numbers are computed in code, from Search Console. The AI writes words
around them (titles, briefs, pages, the reasons in a report) and never
produces a number itself.
**Parts, in order, a commit after each:**
1. **Search Console and "what already ranks" (job 1).**
- Connect Google with OAuth (read-only `webmasters.readonly`), from
Settings. Choose the property for each website in the profile.
- Sync daily rows by page and query (and page alone, since Google hides
some queries) into SQLite. Start with 16 months of history, then the
latest final days. Search Console data is 2 to 3 days late, and the
app says so.
- An SEO page per site, showing:
- The 90-day totals and click rate.
- The best pages by clicks.
- The queries Google shows most where almost nobody clicks.
- The pages to **protect** (they carry the clicks) and to **push**
(they rank on page one and don't get clicked), each with the number
that justifies it.
- The share of clicks from queries Google doesn't name.
- **Built 2026-11-22** (schema 12):
- `oauth.GoogleStart` (PKCE, offline access) and `internal/api/gsc`
(sites and search analytics, paged at 25,000 rows).
- `internal/seo`: `Sync` reads 30-day chunks of date, date+page and
date+page+query rows. Position is stored × impressions. The last 4
days are re-read each time.
- `WhatRanks` computes job 1 over 90 days. *Protect* is the top 3
pages by clicks. *Push* is page-one pages (position ≤ 10.5) with at
least 100 impressions and under 1% click rate, each with its main
query and that query's share.
- Settings → Search engines: keys, the redirect URI, Connect, and the
property for each website, saved in the profile.
- SEO → What ranks, with a sync twice a day.
2. **Morning check and Monday report (jobs 6 and 7)**, computed in code.
- **Morning check:** the last 7 final days against the 7 before, by
page and by query. It reports only moves past the thresholds (default:
more than 5 clicks, or more than 3 positions on at least 300
impressions; both editable). Otherwise it says one line.
- Each move is explained where the data allows. The key case is "the
page didn't lose its ranking, Google showed its big query less, so
the average moved", found by splitting a page's position change by
query. A query that vanished is "no data", not a drop to zero.
- **Monday report**, on one page and the same every week:
1. Clicks, impressions and position, against the week before, with a
sentence on where the change came from: visibility, or rank and
click rate.
2. The 3 pages that moved most.
3. A list called "Waiting for your yes", with at most 3 changes.
- Kept as history, so reports can be compared. Optionally emailed to
the user through the Core's mail server.
3. **Technical audit, weighted by traffic, plus AI visibility.**
- A crawler (within the site's sitemap and links, polite, robots.txt
honoured) checks each page's:
- title and meta description (length in characters and pixels)
- H1 and heading order
- canonical, hreflang and noindex
- status, redirects and broken links
- images without alt text
- Open Graph and JSON-LD
- sitemap and robots.txt coverage
- Optionally, Core Web Vitals from the PageSpeed Insights API.
- Every issue is ranked by the page's Search Console impressions and
clicks, so a fix list starts with the pages that bring traffic.
- **AI visibility:** whether robots.txt lets AI crawlers in (GPTBot,
ClaudeBot, PerplexityBot, Google-Extended…), an `llms.txt`,
structured data, and pages readable without JavaScript.
- One more check, from job 3: a page's biggest query compared with its
title. When they don't say the same thing, that's the cheapest fix
there is.
4. **Changes, approval and pull requests (job 5), with before/after.**
- The AI proposes the exact change: a title, a meta description or an
H1. Each one comes with the number that pays for it and the title's
length in characters and pixels.
- The user says yes or no, one change at a time.
- A yes clones the site's Gitea repository into `/data/sites/` and
edits the page's front matter or content on a branch. It checks that
`hugo` still builds, shows the diff, and opens a pull request.
Nothing is pushed to the default branch, and merging is the user's
decision.
- Once merged and live, the change is checked on the site and pinged
with IndexNow. Its page's clicks, impressions and position are then
compared over the weeks before and after (PLAN item "before/after
tracking"). The morning check notices when a yes changed something.
5. **The next keywords (job 2).**
- Candidates come from four places:
- Search Console queries with impressions and no page that answers
them.
- The profile's keywords and targets.
- The signals' "How to spot it" lines.
- Content gaps against competitors' sites in the Inventory, from
their sitemaps and titles.
- Each candidate is checked against our own pages ("no page" must
really mean no page).
- On request, Claude's web search reads who holds the live top 3. A
keyword is ranked by who has to be beaten, not by volume; volume and
difficulty aren't available and say "not available".
- Pick one a month.
6. **Briefs and pages (jobs 3 and 4).**
- A brief starts from what the page is really shown for in Search
Console, then the live top 5 (read with web search, and "couldn't
read" said where a fetch failed).
- It gives the title, meta description, H1, the sections in order, the
questions the page must answer, and 3 internal links to existing
pages.
- It ends with questions only the user can answer.
- From the brief and the user's answers, a draft page or rewrite is
written into the Hugo site as a pull request. The draft goes through
a check that underlines every sentence claiming an experience ("we
tried", "in our test") for the user to confirm.
- Pages can be tagged with a buying signal (Phase 2's campaign tags), so
landing pages count on its scorecard.
7. **Bing and IndexNow:**
- Bing Webmaster's API, for Bing's queries and crawl problems.
- IndexNow on every merge.
- The Search Console sitemap status.
Before the first part: a Google Cloud project with the Search Console API
turned on and an OAuth client (redirect
`http://localhost:8470/auth/google/callback`), and a Gitea token with access
to each site's repository (needed from part 4).
### Phase 4: Metrics, with Stripe
@@ -820,7 +959,7 @@ Phase 0 (incl. Hermes bridge test) ──► Phase 1 (content)
│
├──► 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 3 (SEO) ──────── needs: Google OAuth (Search Console), Gitea token
├──► Phase 4 (metrics) ──── needs: Stripe key; CRM reads for pipeline
└──► Phase 5 (sites) ────── needs: Gitea token
```