Skip to content

feat(content): rank the Content Plan by the Action Center's Priority Score model - #1356

Merged
gkhngyk merged 2 commits into
ansvisor:mainfrom
cihan-gyk:feature/plan-priority-weights
Oct 22, 2026
Merged

gkhngyk merged 2 commits into
ansvisor:mainfrom
cihan-gyk:feature/plan-priority-weights

Conversation

@cihan-gyk

@cihan-gyk cihan-gyk commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Step 2 of the Plan's Priority Score (step 1, the column and its breakdown, was #1342). The spec asks for the Plan's ranking to follow the Action Center's Priority Score (AC-006) plus page value. The user asked not to wait for weight input on #1342 (comment 6336864974) and to build it with the weights below. Comments on the weights are welcome; this doesn't block on them.

Score = 40·Severity + 30·Opportunity + 20·Page value + 10·Citation strength (web/src/lib/content/plan.ts). As in priority.js, each factor is 0–1, and an unknown value is neutral, not zero.

Factor Value
Severity A page losing citations: 0.6 + 0.4·max(drop%, min(1, lost/20)), so 0.6–1. A new page 0.5, an existing page from an opportunity 0.35, a page to protect 0.2.
Opportunity Its score / 100. A page row with no opportunity: 0.4 (neutral).
Page value AI visits, log10(1+v)/log10(1001), so 1,000 a period counts in full. A new page: 0.5. A brand with no AI traffic data (no page with an AI visit): 0.5, so brands without GA or the snippet aren't penalised.
Citation strength Citations this period / 30, at most 1. A new page: 0.
  • Points are kept to one decimal, so top pages a citation apart don't tie. The badge shows the whole score.
  • The badge's level has the Plan's own cut-offs: Critical 75+, High 55+, Medium 40+, else Low (planPriorityLevel). The Action Center's 90 / 75 / 50 left almost every row Low under these weights. A new page tops out at 60, an existing page with no drop at 74 and a top page with no opportunity at 50.
    • A new page reads High from an opportunity score of about 82. At 60 it would need 99.
    • An existing page can read High too.
    • A top page with no opportunity tops out at Medium; a defend opportunity can reach High.
    • Only a page losing citations can be Critical.
  • Unchanged: priority marks first, hidden rows, MAX_PROTECT, MAX_ROWS, ties by title.
  • Removed: DROP_BASE, PROTECT_BASE, MAX_PROTECT_SCORE, citationsDownScore, protectScore.
  • The tooltip lists the four parts and their points, e.g. "Losing citations: 70% fewer, 7 citations lost: 35.2 of 40 · No content opportunity behind it (neutral): 12 of 30 · 0 AI visits this period: 0 of 20 · 3 citations this period: 1 of 10 · Together: 48 of 100", then "This score ranks the Plan. The Action Center scores its tasks on its own."
  • Not here: AI conversions per page (00179's landing-page key events). They need content_plan_pages to read them, a migration of its own, so they're a follow-up. Page value then becomes 60% visits + 40% conversions.

Demo data, 30 days, before → after:

Row Action Before After
Best Coffee Subscriptions of 2026 Protect 83 (1st) 43 (6th)
The Complete Guide to Coffee Subscriptions Optimize 81 48
Espresso Machines for Beginners Optimize 76 47
Create an office coffee subscription page Create 75 (4th) 53 (1st)
How to Make Café-Style Milk Drinks Optimize 71 45
Shipping & Delivery Optimize 71 45
Plans & Pricing Optimize 60 42
5 Compact Espresso Machines Optimize 58 41
Coffee Gift Subscriptions Optimize 51 39

Drops rank first (none in the demo), then new and existing pages, with protecting last. In unit tests, a page down 75% outranks an 80-point new page, which outranks a 70-point optimize, then the top page.

Related issue

Content Plan Priority Score, step 2 (follows #1342).

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. Open Content › Plan (30 days). The order changes as in the table. Hover a Priority Score to see its four parts and points.
  2. A brand with AI traffic data: a page's AI visits move its score; a page with none gets 0 of 20. A brand without any gets 10 of 20 (neutral).
  3. yarn test src/lib/content/plan.test.ts covers each factor, the neutral values, the order (drop → create → optimize → protect), the five protected pages and the drop cap.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Also run: yarn test (2631 tests pass) and yarn build. Checked at 1024 px, light and dark.

🤖 Generated with Claude Code

…Score model

Step 2 of the Plan's Priority Score (spec v2): the score follows AC-006's
model, weighted factors with an unknown value neutral, not zero:
40 severity (a drop 0.6–1 by its share or the citations lost, a new page
0.5, a page to improve 0.35, one to protect 0.2), 30 opportunity (its score,
0.4 without one), 20 page value (AI visits on a log scale, 1,000 counting in
full; 0.5 for a new page or a brand with no AI traffic data) and 10
citation strength (citations / 30). Points are kept to one decimal so pages
a citation apart don't tie; the badge shows the whole score.

Drops rank first, then new and existing pages, protecting last. The score's
tooltip lists the four parts and their points. Priority marks, hidden rows,
MAX_PROTECT and MAX_ROWS are unchanged; the old bases and caps go.
Conversions per page are left for a follow-up (they need content_plan_pages
to read them).

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

Copy link
Copy Markdown
Collaborator Author

@gkhngyk this is step 2 of the Plan's Priority Score: AC-006's weighted model (40 severity, 30 opportunity, 20 page value, 10 citation strength), with an unknown value counted as neutral. You reviewed the old weights on #1308; the before/after on demo data is in the body. The user asked to go ahead without waiting on the weights, so any change you'd like can follow here or in a later PR. Conversions per page are a follow-up, since they need content_plan_pages to read them.

@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 on the mechanics:

  • The list is ranked by the same score the badge shows (Math.round, which keeps the order).
  • The tooltip's parts add up to it.
  • Unknown values are neutral.
  • Nothing else used the removed citationsDownScore / protectScore.
  • There's no SQL change: page value reads the aiVisits that content_plan_pages (00238) already returns.

One thing to settle before merge:

  1. Almost every row now reads "Low". The badge keeps the Action Center's level cut-offs (_plan-table.tsx:258, priorityLevelOf: 50 / 75 / 90). Under these weights (web/src/lib/content/plan.ts:134-140) the scores have ceilings:

    Row Highest score
    New page 60
    Existing page with no drop 74
    Protected page 50

    So only a page losing citations can reach High. In the demo table, 8 of the 9 rows are Low, where #1342 showed Medium or High.
    Either give the Plan its own cut-offs that fit this range, or leave the level word off the Plan's badge until the weights settle. Then update the page.test.tsx expectations to match.

Optional: once a row goes to the Action Center as a task, that task gets its own Priority Score from priority.js, a different number for the same work. A line in the tooltip ("ranks the Plan; the Action Center scores its tasks on its own") would head off the question.

…offs

Review fix: under the Plan's weights a new page tops out at 60, an
existing page with no drop at 74 and a top page with no opportunity at 50,
so the Action Center's 90/75/50 read nearly every row Low. The Plan's
badge now reads Critical from 75, High from 55 (a new page from an
opportunity score of about 82), Medium from 40. The tooltip adds that the
score ranks the Plan and the Action Center scores its tasks on its own.

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

Copy link
Copy Markdown
Collaborator Author

@gkhngyk fixed in 5415120: the Plan's badge has its own cut-offs (planPriorityLevel in lib/content/plan.ts):

  • Critical 75+, High 55+, Medium 40+, else Low;
  • High sits at 55, not 60: a new page tops out at exactly 60, so at 60 it would need an opportunity score of 99, and at 55 it reads High from about 82;
  • an existing page with no drop (≤ 74) can reach High too;
  • a top page with no opportunity (≤ 50) tops out at Medium, while a defend opportunity can reach High;
  • only a page losing citations can be Critical.

In the demo table the rows now read 52 Medium, 48 Medium and 35 Low. page.test.tsx is updated. plan.test.ts covers the cut-offs, and a buildPlan case shows a strong new page (opportunity 85) reading High and the fixture's 70 reading Medium.

The optional line is in the tooltip too: "This score ranks the Plan. The Action Center scores its tasks on its own."

Checks: web lint (0 errors), typecheck, 2,633 tests, format:check and build.

@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. Both earlier items are done in 5415120a:

  • Levels. The badge uses planPriorityLevel (web/src/lib/content/plan.ts:146-153): Critical from 75, High from 55, Medium from 40. The ceilings in its comment match the weights:

    Row Highest score Highest level
    New page (20 + 30 + 10 neutral) 60 High, from an opportunity score of 82
    Existing page, no drop (14 + 30 + 20 + 10) 74 High
    Defend opportunity, no drop (8 + 30 + 20 + 10) 68 High
    Top page, no opportunity (8 + 12 + 20 + 10) 50 Medium
    Any page losing citations (severity 24 to 40) 82 to 100 Critical

    So only a page losing citations can reach Critical.

  • Where the level shows. ScoreBadge (_plan-table.tsx:265) is the only place the Plan shows a level. It passes the same rounded score it displays, which is also what the test uses. Nothing filters or sorts by level: the list still ranks by score. Merged on main, the table has no priorityLevelOf left.

  • Tooltip. The "ranks the Plan" line is in, and page.test.tsx checks it.

Optional: the comment at web/src/app/[locale]/(dashboard)/dashboard/content/plan/page.test.tsx:214 says "High from 60". The cut-off is 55.

Merge notes

  • It merges cleanly on current main (401558db), with no conflicts. It contains no other open PR and adds no migration.

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