Skip to content

feat(prompts): label Similar Topics, Prompt Suggestions and the prompt page's AI volume as estimates - #1362

Merged
gkhngyk merged 6 commits into
ansvisor:mainfrom
cihan-gyk:feature/estimate-volume-pages
Oct 22, 2026
Merged

gkhngyk merged 6 commits into
ansvisor:mainfrom
cihan-gyk:feature/estimate-volume-pages

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

PROMPT-013, part 2 of 3: the estimate label reaches Similar Topics, Prompt Suggestions and the prompt detail page.

Stacked on #1361 (part 1, feature/estimate-volume-label). This PR's own change is 3b84ff0.

Two kinds of estimate join the prompt-level one from #1361 (lib/volume-estimate.ts). Each is marked with a basis, and the method note words each kind its own way.

One keyword's AI share (keywordVolumeEstimate, Similar Topics rows)

  • The keyword's Google volume is measured, and only the adoption rate is assumed.
  • Confidence is Medium, with a ±25% range. It is low when the keyword has no volume or the data is over 183 days old.
  • The note: "This keyword's monthly Google searches × the share of searches that now happen in AI assistants (45%). Its Google volume is measured; the AI share is an estimate, so the range is ±25%."

An AI's guess (guessedVolumeEstimate, Prompt Suggestions)

  • prompt_suggestions.est_volume is an LLM figure scaled to the brand's tracked prompts. No keyword behind it is measured.
  • It is always Low: ½× to 2×, and grey.
  • The note:
    • says it is an AI's estimate, and that tracking the prompt gets one from its keywords' Google searches;
    • gives the source as "Ansvisor's AI, from your tracked prompts' estimates";
    • is dated by the suggestion ("Confidence: Low · suggested Oct 22, 2026").

Where

  • Similar Topics (prompts/similar-topics/page.tsx):
    • The Est. AI Volume card shows the prompts' summed estimate as a range with the Estimate badge, as on Insights.
    • Each row's Est. AI Vol. is the keyword's range.
    • PromptVolumeCluster now carries the aiVolumeMultiplier behind its estimate and the latest fetchedAt among its prompts.
  • Prompt Suggestions (_suggestions-card.tsx): the "~1,200/mo" badge becomes a grey "600–2.4k/mo" with the note. Search Console and Analytics rows keep their measured figures, as before.
  • Prompt detail (prompts/[id]/page.tsx): a fourth card, "AI searches a month", shows the prompt's range and Estimate badge (mockup screen 2). It appears only when the prompt has a volume.
    • prompt_volumes is server-only, so the new getPromptVolume(promptId) action (lib/actions/prompt-volume.ts, its own module so volumes.ts stays free of the admin client) first reads the prompt with the signed-in user's client (RLS). Only for a prompt they can see does it read the volume with the admin client, as readPromptDemand does.
    • A failed read leaves the card out and logs, and the rest of the page loads.

Strings: prompts.similarTopics.aiTitle/aiSub, prompts.volumeInsights.detailTitle, and the new volumeEstimate note keys. perMonth now reads "/mo".

Related issue

ROADMAP plan item 03 (PROMPT-013), queued by the user on 2026-10-22. No issue.

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. Prompts › Similar Topics: the Est. AI Volume card shows a range and the Estimate badge, and each row a range. Hovering a row explains the keyword-level estimate.
  2. Prompts › Prompt Suggestions: an AI-sourced suggestion shows a grey range "/mo". Hovering it explains it is an AI's guess.
  3. A prompt's detail page (from Tracked Prompts): with a volume, a fourth card "AI searches a month" shows the range and the Estimate badge. A prompt without a volume keeps the three cards.

Checked locally on the demo brand at 1024 px, in light and dark:

  • the detail card's range fits its card (it overflowed with "/mo", so the unit moved to the title);
  • two temporary LLM suggestions (1,200 and 350) showed "600–2.4k/mo" and "170–700/mo". They have been deleted.

Tests:

  • lib/volume-estimate.test.ts (+3): the keyword estimate, its stale or empty case, and the guess.
  • components/prompts/volume-estimate.test.tsx (+2): the notes for a keyword and a guess.
  • prompt-volume-clusters.test.ts (+1): rate and latest fetch.
  • lib/actions/prompt-volume.test.ts (2, new): reads only a prompt the caller can see; null without a volume.
  • _suggestions-card.test.tsx (+1): the grey range instead of "~1,200".

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/) (0 errors; the 6 warnings are in untouched files, as on main)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Also run: web yarn test (2,746 tests) and yarn build.

🤖 Generated with Claude Code

cihan-gyk and others added 2 commits October 22, 2026 19:51
…adge and method note

PROMPT-013, part 1. A prompt's AI volume is the median Google volume of
its keywords x the AI adoption rate; how far to trust it follows from how
many keywords have data and how closely they agree. lib/volume-estimate.ts
turns each stored estimate into a range and a confidence (high, medium,
low; a level less when over six months old), and adds them up for the
Insights cards. The Prompts page shows ranges with a dashed Estimate badge
and a method note (sources, month, confidence, date), greys low-confidence
estimates, leaves them out of High Opportunity on their own and sorts them
after the confident ones by Volume. The Tracked Prompts CSV gains
volume_type, volume_confidence, the range and volume_date.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t page's AI volume as estimates

PROMPT-013, part 2. Two more kinds of estimate: one keyword's AI share
(its Google volume is measured, only the adoption rate assumed: medium,
±25%) for Similar Topics' rows, and an AI's guess (always low, half to
twice) for Prompt Suggestions' volume badge. The method note words each.
Similar Topics' Est. AI Volume card shows the prompts' summed range with
the Estimate badge, and a prompt's detail page gains an "AI searches a
month" card, read through getPromptVolume (the prompt is checked with the
user's client before prompt_volumes is read with the admin client).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

@gkhngyk PROMPT-013 part 2, stacked on #1361 (own change 3b84ff0). Similar Topics' rows use a keyword-level estimate (measured Google volume × the assumed rate: medium, ±25%), Prompt Suggestions' volume is labelled an AI's guess (always low), and the prompt detail page gets an "AI searches a month" card. That card reads prompt_volumes through a new getPromptVolume action, which checks the prompt with the user's client before reading the server-only table with the admin client, as readPromptDemand does. It lives in its own module, since importing the admin client into volumes.ts broke the tests of every module that imports it.

…an, one note per table

Review fixes for PROMPT-013 part 1. The keywords are head terms that
spread widely by design, so agreement is now the upper over the lower
quartile of the measured volumes (as percentile_cont): high at three or
more within 4x, medium at two or more within 15x. The range is the AI
share of that middle half, clamped to half to twice. The note calls the
45% the share of Google searches that now get an AI answer. Long tables
share one tooltip through createEstimateNoteHandle, the Prompt Volumes
chart shows each platform's share of the range, rankable is used by both
ranking rules, and perMonth waits for part 2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cihan-gyk and others added 2 commits October 22, 2026 20:57
…lume-pages

# Conflicts:
#	web/messages/en.json
#	web/src/components/prompts/volume-estimate.test.tsx
#	web/src/components/prompts/volume-estimate.tsx
…t Suggestions

As ansvisor#1361's tables do: each long list mounts one method note through
createEstimateNoteHandle rather than one per row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

@gkhngyk merged #1361's review fixes (d297d95) forward (eaa42e0): the quartile rule, the "AI answer" wording (also in this PR's methodKeyword), and perMonth back here where Prompt Suggestions uses it. Then 78dacca gives Similar Topics' table and the Suggestions list one shared estimate note each, as #1361's tables do. Checks: web lint (0 errors), typecheck, 2,748 tests, format:check and build.

gkhngyk
gkhngyk previously approved these changes Oct 22, 2026

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I reviewed part 2 on top of #1361 (3b84ff0, eaa42e0 and 78dacca).

  • The merge of #1361 (eaa42e0) hides no changes.
    • Only the three conflicted files differ from a plain re-merge.
    • Those take #1361's side, carry its new wording into methodKeyword and its test, and keep perMonth ("/mo"), which this PR uses.
  • getPromptVolume is scoped to the caller's org. It reads the prompt with the user's client first, so the prompts: member select policy limits it to the caller's org before the admin read. A test covers it.
  • Merge state: it merges cleanly on main and adds no migration.

Two small follow-ups, neither blocking:

  1. Unused field: PromptVolumeCluster.estimatedAiVolume (web/src/lib/prompt-volume-clusters.ts:7, :59, :72) has no reader left. Similar Topics now rebuilds the same number from volume × aiVolumeMultiplier (similar-topics/page.tsx:205). Either build the keyword estimate from the field, or drop it along with its test expectation (prompt-volume-clusters.test.ts:40).
  2. PR body: it still quotes the old note ("the share of searches that now happen in AI assistants") for the keyword estimate. It also names only 3b84ff0 as this PR's own change, but 78dacca is this PR's too.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-approving after merging main into the branch. The merge only brings in the squashed parent PR; the tree matches the one tested (web and server tests, typecheck, lint, format).

@gkhngyk
gkhngyk merged commit 983c140 into ansvisor:main Oct 22, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants