Skip to content

feat(content): show a content opportunity's AI volume as its prompts' current estimate - #1367

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

gkhngyk merged 11 commits into
ansvisor:mainfrom
cihan-gyk:feature/estimate-volume-content

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

PROMPT-013, part 3b: a content opportunity's AI volume is its prompts' current estimate, shown as a range, and MCP reads volumes as estimates.

Stacked on #1364 (part 3a), which is stacked on #1362 and #1361. This PR's own change is c78dfdb.

Content opportunity detail

  • Est. AI Volume (Source Data) was the number kept when the opportunity was made ("~12,400/mo"). It now sums the opportunity's prompts' current estimates (getPromptDemand, as the Action Center does), shown as a range with the Estimate badge and the method note on hover.
    • The prompts are the cluster basket's members. A cluster is always summed, even when only one prompt has a volume, so the note says "The sum of N prompts' estimates" with their confidence mix.
    • An opportunity without a cluster reads its one prompt and keeps that prompt's own note.
    • Fallback: when the estimates can't be read, or the basket is empty or fails, the card shows the volume kept on the opportunity as a new snapshot estimate: low confidence, grey, ½–2×. It is undated, because the generator's merge path rewrites estAiVolume without recording when. A cluster opportunity never falls back to its prompt_id, which is only the cluster's representative.
    • A skeleton shows while it is read.
  • The basket is read once. useOpportunityVolume (hooks/use-opportunity-volume.ts) reads it for both the volume and OpportunityBasketCard, which now takes basket / failed props. The card behaves as before: skeleton while loading, hidden on failure, only for cluster opportunities.
  • Copy All Data and Export (CSV / Excel / Word): "Est. AI volume" is the range ("3.3–8.2k/mo"), followed by "Volume type" ("Estimate", or "Estimate, kept when it was made or last updated") and "Volume confidence".
  • StatCard's value wrapper is a div instead of a p, so the skeleton and the range's block content are valid HTML.

MCP

  • get_prompt_volumes rows gain est_ai_volume_low, est_ai_volume_high, volume_confidence and volume_type ("estimate"). They come from promptVolumeEstimate, the same rules and six-month step-down the dashboard uses.
  • The descriptions of get_prompt_volumes, list_prompt_suggestions (est_volume is an AI guess, ½–2×) and get_content_opportunity (source_data.estAiVolume is a kept sum, possibly out of date) say the volumes are estimates and ask the agent to quote ranges.

Strings: volumeEstimate.methodSnapshot, sourcesSnapshot and lowNoteSnapshot.

Not changed: the opportunity generator and brief prompts still pass estAiVolume to the LLM as a number. Generated descriptions can quote it (a demo opportunity reads "Targeting 12,400/mo volume"). A small server follow-up can tell the model it is an estimate and not to quote it.

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. Content › Opportunities: open a cluster opportunity whose prompts have volume analysis. Source Data › Est. AI Volume shows a range "…/mo" with an Estimate badge. Hovering it says "The sum of N prompts' estimates" with the confidence mix.
  2. … › Copy All Data: the text has "Est. AI volume: …/mo", "Volume type: Estimate" and "Volume confidence: …". Export CSV has the same three fields.
  3. An opportunity whose cluster has no prompts left (or with the server down): the card shows the kept volume in grey, "Estimate · low confidence". The note says it is the sum kept when it was made or last updated.
  4. MCP get_prompt_volumes: each row has est_ai_volume_low, est_ai_volume_high, volume_confidence and volume_type.

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

  • a 3-prompt cluster showed "3.3–8.2k/mo · Estimate" (3 high), where the kept number was 12,400;
  • an opportunity whose demo cluster has no members showed the kept "72–290k/mo · Estimate · low confidence".

New tests:

  • hooks/use-opportunity-volume.test.tsx: sum, lone prompt, one measured member, fallback, failed basket with a representative prompt_id, nothing to show;
  • lib/mcp/prompt-volumes.test.ts;
  • the snapshot note in volume-estimate.test.tsx;
  • the export's range in opportunity-markdown.test.ts.

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 (314 files, 2,760 tests) and yarn build.

🤖 Generated with Claude Code

cihan-gyk and others added 10 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]>
…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]>
…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]>
…volumes as estimates

PROMPT-013, part 3a. readPromptDemand returns each prompt's estimate (a
range and a confidence) instead of a number, so the Affected tab, the Why
("28-42k AI searches a month, estimated"), the history drawer and the
action exports show ranges; CSV and Excel gain volume_type and
volume_confidence. A topic opportunity's demand and its suggestions' are
an AI's guess: grey, low-confidence ranges in the title, the drawer and
Insights' Opportunities card.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… volumes

As the Prompts tables do (ansvisor#1361): the column's ranges pass a shared
createEstimateNoteHandle rather than mounting a tooltip each.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… people, keep ranges focusable

Pre-push review fixes for PROMPT-013 part 3a. A sum of suggestions' AI
guesses gets its own note, and its low-confidence line no longer claims it
never ranks. Excel and Markdown word the confidence through
volumeEstimate.level while the CSV keeps the code. The topic context keeps
its separator in en.json and shares one note across its suggestions, the
Opportunities line truncates only its text so the range stays focusable,
and tests date their volumes relative to now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… current estimate

The opportunity detail's Est. AI Volume card, Copy All Data and Export now
read the sum of the opportunity's prompts' current estimates as a range with
its confidence (PROMPT-013), falling back to the volume kept on the
opportunity as an undated, low-confidence estimate. The page reads the
basket once for its card and the volume. The MCP get_prompt_volumes rows
gain est_ai_volume_low/high, volume_confidence and volume_type, and three
tool descriptions say the volumes are estimates.

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

Copy link
Copy Markdown
Collaborator Author

@gkhngyk PROMPT-013 part 3b, stacked on #1364. This is the last web part.

  • Content opportunity detail. Est. AI Volume is now the sum of the opportunity's prompts' current estimates, shown as a range with the Estimate badge. If they can't be read, it falls back to the kept volume, shown as an undated, low-confidence estimate. Copy All Data and Export write the range, the volume type and the confidence.
  • MCP. get_prompt_volumes adds est_ai_volume_low/high, volume_confidence and volume_type. Three tool descriptions now call the volumes estimates.

A review pass before pushing caught:

  • a cluster opportunity whose basket was empty or failed fell back to its representative prompt_id. It showed one prompt's estimate as the whole cluster's;
  • the kept volume was dated by createdAt/reopened.at, but the generator's merge path rewrites it without either. So it is undated now.

Both are fixed in c78dfdb.

Open question: the generator and brief prompts still give the LLM estAiVolume as a number, and descriptions can quote it ("Targeting 12,400/mo volume"). Shall I send a small server PR telling the model it is an estimate it shouldn't quote?

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. One wording follow-up:

  1. web/messages/en.json:5319 (volumeEstimate.methodSnapshot) says the prompts' current estimates "couldn't be read". web/src/hooks/use-opportunity-volume.ts:77 and :80 show the kept sum in two more cases:

    • the read worked, but none of the prompts has an estimate;
    • the cluster has no prompts left.

    In both, the note is wrong. "Their current estimates aren't available, so this one may be out of date." fits all three cases.

Also checked:

  • The basket is read once, and only for cluster opportunities. The card is still only rendered for those, so it can't sit on a skeleton for a per-prompt opportunity.
  • getPromptDemand checks the prompts against the opportunity's brand with the user's client before the admin read.
  • get_prompt_volumes only adds fields.
  • The content Demand score and its breakdown are unchanged.
  • The export builders have no callers other than the detail page.

@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 130c8ee into ansvisor:main Oct 22, 2026
4 of 5 checks passed
gkhngyk pushed a commit that referenced this pull request Oct 22, 2026
…ges (#1368)

Both AEO coach skills gain an "AI search volumes" section: est_ai_volume is
an estimate, quoted as its est_ai_volume_low–high range with its
volume_confidence; low-confidence rows don't rank on their own; a content
opportunity's source_data.estAiVolume is a kept sum. get_prompt_volumes
(and GET /prompt-volumes) list the new fields, and Pitfalls says not to
present a volume as measured. The fields come with #1367.

Co-authored-by: Cihan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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