Repository navigation
feat(prompts): show a prompt's real demand on its page (PROMPT-014, part 2) - #1651
Merged
Merged
Conversation
…OMPT-014, part 1) A prompt's AI search volume is an estimate. This reads what shows people really ask it, for the Demand card on the prompt's page (part 2): - prompt_demand (00370): per prompt, Search Console, Google Trends, People Also Ask and YouTube, each with the day it was read, the level they come to (high / medium / low) and how many of the four were read. Members read their brands' rows; the server writes them. - Search Console, every night and free: the brand's queries over 28 days (prompt_demand_gsc_queries), each matched to the closest prompt with the Action Center's rule (classify.js matchPrompt), summed per prompt. - Trends, PAA and YouTube: DataForSEO Standard tasks for the prompt's top volume keyword and its location and language, once a week, at most 500 prompts a night. Set at night, read an hour later or the next night (tasks_ready, task_get). Off unless DEMAND_SIGNALS=true. - The level is the share of points the read signals give (demandLevel): high at 60% with two signals or more, medium at 30%, low below. - Workspaces whose plan has ended are skipped. Runs after the nightly Search Console sync. - GET /api/prompts/:promptId/demand answers the card. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…art 2) The prompt's page shows what the nightly sweep (part 1) read, as in the roadmap mockup's screen 2: - The KPI row gets "Demand · 3 of 4 signals" with the level (High, Medium, Low) and a Measured badge: measured numbers never carry the Estimate badge (PROMPT-013). - "Demand · is this asked for real?": a 2x2 grid of Search Console, Google Trends (a 12-month line, rising / steady / falling and the change on a year ago), People Also Ask and YouTube, each with its source and the day it was read. - A People Also Ask question is tracked in one click (+ Track), in the prompt's topic, with trackPagePrompts. - A missing signal says why and what to do: connect Search Console (in place, as on AI Traffic), pick its property, wait for the first sync, analyze the prompt's volume first, being read, or not read yet. - A note under the grid says what the level does to the Priority Score. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tasks (PROMPT-014, part 1) Review fixes for the nightly demand sweep: - postTasks catches each 100-task request's failure on its own and hands every request's ids to the caller as soon as they're in; the sweep writes them at once, so a later failure loses none that were paid for. - A write that hits a prompt deleted meanwhile (foreign key) is written again without it, instead of dropping the whole chunk. - Done tasks whose ids were never written are read back by their tag (the prompt's id) from tasks_ready. - The sweep claims the prompts it is about to set (prompt_demand_claim, claimed_at) and sets only those, so two sweeps at once never set the same prompt twice; a claim older than two hours may be taken again. - Brands go never-written first, then longest since their last write (prompt_demand_brand_updates); the ones a sweep runs out of time for are counted (unfinished) and logged. The due count is logged too. - 00370: drop the unused prompt_demand_posted_idx, fix the header. - DEMAND_SIGNALS documented in env-variables.mdx (paid, off by default). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ds wording (PROMPT-014, part 2) Review fixes for the Demand card: - Google Trends says "from no search interest a year ago" only for a rising line; a steady one with no change to give shows its label alone. - GET /api/prompts/:id/demand marks each People Also Ask question the brand already tracks (case, accents, punctuation and spacing aside), so it shows "Tracked" after a reload; +Track goes through a new trackDemandQuestion action that adds nothing for a text the brand already has. Each button names its question for screen readers. - The note under the cards says the level feeds the Priority Score of Action Center actions about the prompt. - "about once a week" instead of "once a week". Co-Authored-By: Claude Opus 5.5 <[email protected]>
9 of 12 tasks
…d route, and link only http(s) pages (PROMPT-014, part 2) A 404 without our error body means the API doesn't have the route yet: the prompt page then shows no Demand section instead of "Couldn't load". The route's own 404 and other failures still show the error. The People Also Ask and YouTube signals keep a provider link only when it is an http(s) URL, and the card links the top video only then.
# Conflicts: # supabase/schema.sql
gkhngyk
approved these changes
Oct 28, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good with ca949fe: while the API has no demand route yet (a 404 with no body of ours), the prompt page hides the demand section instead of showing an error; the route's own errors still show. Provider links are kept only when they're http(s), on the server and in the YouTube card. 00370 is applied to production. The remaining follow-ups (the #1599 read-only gate on + Track and Connect) stay open.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PROMPT-014, part 2 of 3: show a prompt's real demand on its page. It follows the roadmap mockup's screen 2.
Stacked on #1650 (part 1). This PR's own change is its commits after part 1's: 3f27a6f and b1103f3 (the pre-push review's fixes). Merge it together with part 3 (#1652).
KPI row
"Demand · is this asked for real?" A 2×2 grid. Each card names its source and the day it was read.
trackDemandQuestionadds nothing for a text the brand already has.A missing signal says why and what to do
DEMAND_SIGNALSoff).A note under the grid says the level raises the Priority Score of Action Center actions about this prompt (part 3).
Where people see it: Prompts › a prompt's page, under the KPI row.
Related issue
PROMPT-014 of the roadmap (Drive › ROADMAP-plan.md). No GitHub issue.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
prompt_demandrow for a demo prompt withgsc,trends,paaandyoutubedata. One People Also Ask question should have the same text as a prompt the brand already tracks.cd web && npx vitest run src/components/prompts/demand-card.test.tsx src/lib/prompt-demand.test.ts src/lib/actions/prompt-demand-signals.test.tsChecked in the browser (local, 1024 px, light and dark) with a temporary row on a demo prompt: KPI tile, the four cards, Tracked and + Track, Trends "Rising · +186%", and the note. The temporary row was deleted afterwards.
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Full checks were run at the top of the stack (part 3): server 3,404 tests, web 4,362 tests, typecheck, lint and build all pass.
Follow-up: the read-only gate (#1599) on + Track and on Connect Search Console, once the read-only chain merges.
🤖 Generated with Claude Code