Skip to content

feat(action-center): label the Action Center's and Opportunities' AI volumes as estimates - #1364

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

gkhngyk merged 10 commits into
ansvisor:mainfrom
cihan-gyk:feature/estimate-volume-actions

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

PROMPT-013, part 3a: the Action Center and Insights' Opportunities label their AI volumes as estimates, with ranges.

Stacked on #1362 (part 2), which is stacked on #1361 (part 1). This PR's own changes are 9b8a0b7, 1513f3e and 669f272, on top of #1362 with #1361's review fixes merged in (e524595).

Action Center

  • Prompt volumes are estimates. readPromptDemand (lib/action-center/prompt-demand.ts) also reads each prompt's keyword volumes, rate and fetched_at, and returns a VolumeEstimate per prompt instead of a number. So the drawer, the history drawer and the MCP export get the range and confidence from feat(prompts): show estimated AI volume as a range with an Estimate badge and method note #1361's rules.
  • Topic opportunities (sent from Insights): their demand is the suggestions' est_volume, an AI's guess, so it reads as a grey, low-confidence range.
    • The title: "Capture 600–2.4k/mo of estimated AI demand in Espresso machines under $500".
    • The context: "Suggested prompts when sent: 2 prompts · 600–2.4k/mo", with each suggestion's range. The separator stays in en.json (t.rich with a <range> tag), and the suggestions share one note.
  • Export (Copy Data, Export CSV / Excel, and the MCP action export):
    • the affected volume is the range;
    • CSV and Excel gain volume_type (estimate) and volume_confidence columns after volume. The CSV keeps the code (medium), and Excel words it for people ("Medium", from volumeEstimate.level);
    • Markdown reads "18–32k (estimate, Medium confidence)".

Insights › Opportunities: a topic's or a prompt's volume is the suggestions' AI guess, shown as a grey range with its note ("2 prompts · 600–2.4k/mo · you lead").

  • The card's ranking (relevance × volume × gap) is unchanged.
  • In the row's line, only the text truncates, so the range's button and focus ring stay whole.
  • A sum of guesses has its own note ("The sum of an AI's estimates for suggested prompts you don't track yet…"). Its low-confidence line says only that it is an AI's guess, shown in grey. It doesn't claim it never ranks, since this card and a topic action's impact do use it.

Not changed: the server's demand tiers (Action Center priority, detector thresholds) still read est_ai_volume. They combine it with other signals. See #1361.

Strings:

  • actionsPage.export.volumeType, volumeConfidence and estimatedVolume;
  • story.subject.volume now says "estimated";
  • topic_opportunity.title says "estimated AI demand";
  • topicOpportunity.demandValue no longer carries the number;
  • removed the unused topicOpportunity.volume and insights.opportunities.volume ("~{volume}/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. Visibility (Insights) › Opportunities, at 30 days on a brand with rated suggestions: each row's volume is a grey range "…/mo", and hovering it explains it is an AI's guess.
  2. Send action on a topic row, then open the action:
    • the title reads "Capture …/mo of estimated AI demand in …";
    • Overview › "Suggested prompts when sent" shows the total and each prompt as grey ranges.
  3. An action with affected prompts (citation or visibility signals):
    • the Affected tab's Volume column shows ranges;
    • the Why says "(… AI searches a month, estimated)";
    • Export CSV has volume_type and volume_confidence.

Checked locally on the demo brand at 1024 px, in light and dark, with three temporary rated suggestions:

  • Opportunities showed "2 prompts · 600–2.4k/mo · you lead" and "170–700/mo · not tracked";
  • the topic action AC-62 sent from it showed the title and context above.

The demo has no signal-backed action, so step 3 is covered by tests. The temporary suggestions and AC-62 have been deleted.

Tests (updated to estimates):

  • prompt-demand.test.ts;
  • story.test.ts;
  • affected-tab.test.tsx;
  • history-drawer.test.tsx;
  • export.test.ts (CSV, Excel and Markdown columns);
  • display.test.ts (title);
  • mcp/action-export.test.ts;
  • new insights/_opportunities.test.tsx (grey ranges, no "~").

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,750 tests) and yarn build.

🤖 Generated with Claude Code

cihan-gyk and others added 9 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]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

@gkhngyk PROMPT-013 part 3a, stacked on #1362, with #1361's quartile rule merged in.

  • Action Center. readPromptDemand returns an estimate per prompt, so the Affected tab, the Why, the history drawer and the action exports show ranges. CSV and Excel gain volume_type and volume_confidence.
  • Topic opportunities and Insights' Opportunities. Their demand is the suggestions' AI guess: a grey, low-confidence range with its own note.
  • Not changed: the server's demand tiers, which still read est_ai_volume.

A review pass before pushing caught:

  • two tests that would have gone stale in April 2027;
  • a note that claimed AI guesses never rank;
  • a range that could lose its focus ring in a truncated line;
  • confidence written as a raw code in the human-facing exports.

All four are fixed in 669f272.

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. Two small follow-ups. Neither blocks the merge:

  1. web/src/app/[locale]/(dashboard)/dashboard/insights/_opportunities.tsx:329-338: every text part of the row's line now truncates, the · separators included. Flex shrinks each one in proportion to its width, so on a narrow row (a phone) the count and the separators turn into ellipses before the standing does: "2… … 600–2.4k/mo … A…", where the old single span read "2 prompts · ~1.2k/mo · Acme…". Make the count and the separators shrink-0 too, and let only the last text part (the standing or "not tracked") truncate.
  2. web/src/lib/action-center/export-labels.ts:198 → export.ts:550: the Excel sheet spells out the confidence ("Medium") but writes the type as the code estimate. In #1367 the opportunity export writes "Estimate". Give Excel a label like that, for example actionsPage.export.estimate: "Estimate", and keep the code in the CSV.

Also checked:

  • Merge commit e524595 re-merges to the same tree, so it has no hidden changes.
  • readPromptDemand still checks the prompts against the brand with the caller's client before it reads with the admin client. It reads prompt_volumes by its unique prompt_id, 150 ids per request.
  • The server's priority and demand tiers are unchanged.
  • The CSV only adds columns, after volume.
  • The removed en.json keys have no callers left.

@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 9f42bba 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