Repository navigation
feat(action-center): raise an action's Priority Score with its prompts' measured demand (PROMPT-014, part 3) - #1652
Merged
gkhngyk merged 14 commits intoOct 28, 2026
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]>
…s' measured demand (PROMPT-014, part 3)
A prompt's demand level (part 1) now feeds the Priority Score (AC-006):
- loadPromptDemand reads each prompt's level from prompt_demand beside
its volume; best effort, so the volumes still count without it.
- The demand factor of an action about the prompt is at least High's
0.85 (as about 2,500 monthly AI searches) or Medium's 0.55 (about
160); Low leaves it. The seven weights are unchanged: the level is
better evidence of the same thing the demand factor measures, so it
raises that factor instead of adding an eighth.
- "Why this priority?" names the level ("measured demand High"), stored
as priority_reason.realDemand.
- When a prompt's level changes in the nightly sweep, the brand's open
actions are scored again the same night.
- Docs: Real demand, the level's rule and its effect in prompts.mdx;
the Priority Score's demand line in action-center.mdx.
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]>
…iority # Conflicts: # server/src/lib/prompt-demand.js # server/src/lib/prompt-demand.test.js
…nd skip unchanged rescores (PROMPT-014, part 3) Review fixes for the demand level in the Priority Score: - Low raises nothing, so it is no reason: the stored reason keeps the level only for High and Medium, and "Why this priority?" never names Low (also for a reason stored before). - rescoreBrandActions leaves an action whose score, level and reason come out as stored: a brand is often scored twice a night (signal pass, then demand sweep), and the second has nothing new to write. - Docs: "about once a week", the weekly reads are off by default (DEMAND_SIGNALS), and +Track shows Tracked for a question the brand already has. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ndActions' params Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
8 of 12 tasks
8 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
…t success in the priority score
gkhngyk
approved these changes
Oct 28, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good. Merged with main after #1696: the score keeps both factors (the measured demand level and the kind's past success), with tests that both add up and that the web's "Why this priority?" reads both. The follow-ups from the review 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 3 of 3: a prompt's measured demand raises the Priority Score of actions about it.
Stacked on #1651 (part 2, itself on #1650). This PR's own change is its commits after part 2's: ca7eb28, 6364c71 and 44c2887. Merge it together with part 2.
How the score changes
loadPromptDemandreads each prompt's level fromprompt_demandbeside its volume. It's best effort: the volumes still count without it."Why this priority?"
priority_reason.realDemand.Rescoring
rescoreBrandActionsleaves an action alone when its score, level and reason come out as stored. A brand is often scored twice a night (the signal pass, then the demand sweep), and the second pass has nothing new to write.Docs
prompts.mdx: Real demand, the level's rule, "about once a week", the weekly reads off by default (DEMAND_SIGNALS), and Tracked on questions the brand already has.action-center.mdx: the Priority Score's demand line.Where people see it: the Action Center's priority order, and the action drawer's "Why this priority?".
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
cd server && npx vitest run src/lib/action-center/priority.test.js src/lib/action-center/priority-data.test.jscd web && npx vitest run src/lib/action-center/priority.test.tsprompt_demandrow athighfor a prompt with open actions, run the rescore (or wait for the nightly sweep). The action's score goes up, and its drawer says "measured demand High".Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Full checks at this branch (44c2887):
npm test: 249 files, 3,404 tests passed;vitest: 446 files, 4,362 tests passed;🤖 Generated with Claude Code