Skip to content

feat(content): generate content opportunities per prompt cluster, not per prompt #857

Closed

Description

@gkhngyk

Problem

Content opportunities are generated per prompt, and the generator only looks at the 25 highest-scoring prompts on each nightly run. On a brand with 709 active prompts:

  • Only 82 prompts have any open opportunity.
  • Those 82 prompts hold 748 open opportunities between them, and one prompt alone has 38.
  • The opportunities cover 10 of the brand's 22 topics.

User feedback put it directly: suggesting 44 pieces of content for a single prompt makes no sense. Related prompts should be grouped first, and content suggested per group.

There are two problems here:

  1. Pile-up. The same prompts win the ranking every night and the model rewords the same idea each time. This is tracked in fix(content): stop opportunities piling up on the same prompts #837.
  2. Wrong unit. One piece of content answers many closely related prompts. A guide on "the benefits of open-source AEO for startups" can earn visibility across 8–10 prompts that ask the same thing in different words. Generating per prompt suggests the same article over and over and leaves most prompts uncovered.

Proposal

1. Cluster prompts within each topic

Topics are too broad to act as clusters: the median topic has 24 prompts and the largest has 91. They are a good boundary, though.

  • Within each topic, group prompts by intent into clusters of roughly 3–8 prompts.
  • An LLM call per topic is the simplest start. The brand above would need 22 calls. Embeddings are a later option; we have no vector infrastructure today.
  • Store the clusters, for example prompt_clusters (id, brand_id, topic_id, label) with prompt membership.
  • Recompute a topic's clusters only when its prompts change: added, removed, or moved to another topic.

2. Generate per cluster

  • Rank clusters by the combined opportunity of their member prompts: estimated AI volume, visibility gap and competitor gap.
  • Generate for the best clusters that have no open opportunity yet, and allow at most 1–2 open opportunities per cluster.
  • Over successive runs this reaches every cluster, and with them every prompt, instead of the same top 25 prompts.

3. Opportunity ↔ cluster

  • An opportunity belongs to a cluster and lists the cluster's prompts.
  • The content brief treats those prompts as the questions the piece must answer, for example as FAQ entries or section headings.

4. Knock-on changes

Open questions

  • Cluster size bounds, and whether a prompt can belong to more than one cluster. The proposal assumes exactly one.
  • Whether users can see or rename clusters, or whether they stay internal to generation.
  • How often to re-cluster, and whether reassigning a prompt should move its open opportunities with it.

Activity

  1. added
    enhancement
    content
    on Sep 30, 2026
  2. gkhngyk commented on Oct 2, 2026

    @gkhngyk
    ContributorAuthor

    Decisions on the open questions:

    • Cluster size and membership. Clusters hold 3–8 prompts, and each prompt belongs to exactly one cluster. Overlapping membership would complicate the prompt filter (feat(content): filter opportunities by prompt #836), the prompt detail card (feat(prompts): show a prompt's content opportunities on its detail page #838) and every count, for little gain.
    • Visibility. There is no cluster management UI in the first version: no cluster list and no renaming. Each opportunity shows the prompts its cluster covers ("this piece covers these 6 prompts"), and the brief uses them as the questions the content must answer. If a real need appears, editing comes as a second step.
    • Re-clustering. It is event-driven, not scheduled. When a topic's prompts change (added, removed, or moved to another topic), only that topic is re-clustered. That keeps the cost low and clusters stable. Open opportunities stay with the cluster they were generated for, and a moved prompt gets new opportunities in its new cluster.

    Order. This starts after #869 lands, which stops the per-prompt pile-up now. The per-prompt cap there becomes a per-cluster cap here. Most of the work is data-model and pipeline changes, so we'll build this one ourselves.

  3. self-assigned this
    on Oct 4, 2026
  4. gkhngyk commented on Oct 4, 2026

    @gkhngyk
    ContributorAuthor

    Updated plan

    This issue now also covers a wider spec for Content Opportunities. The spec's core asks for the same thing as the proposal above: turn many prompt and fan-out signals into a few opportunity baskets, instead of one opportunity per prompt. The plan below folds the spec into phases. Each phase ships on its own.

    Phase 1: clusters as the unit (this issue)

    1. Clusters within a topic
      • Group a topic's active prompts by intent with one LLM call per topic.
      • Prompts with no topic (topic_id is null) are clustered in their own "unassigned" scope. They are not dropped.
      • Store the result in prompt_clusters (brand_id, topic_id, label, primary intent, secondary intents) with prompt membership. Each prompt belongs to exactly one cluster.
      • Re-cluster a topic only when its prompts change.
    2. Fan-outs in the basket
      • Attach each prompt's fan-out queries to its cluster.
      • Each unique query gets a single included/excluded decision with a short reason, and the decision is cached so a query is judged once.
      • The basket shows both counts, e.g. "63 included / 148 excluded".
    3. One opportunity per cluster
      • Rank clusters by their members' combined demand, visibility gap and competitor gap.
      • Generate for clusters with no open opportunity, and allow at most one or two open opportunities per cluster.
      • Before inserting, compare the candidate with open opportunities in other topics of the same brand. If it is the same need with the same content target, merge its signals into the existing opportunity and keep both topics: one primary and the rest related.
    4. Explainable score
      • Store the score's components (demand, visibility gap, competitor gap, intent) next to the total, and show them on the detail view.
      • Cluster metrics are computed from member prompts for the measurement window. Topic-level totals are not copied down. If data is missing, the component shows as unavailable.
    5. List and filters
    6. Backlog
      • Map existing per-prompt opportunities to their prompt's cluster where possible. Archive the rest.

    Phase 2: existing content and assets

    • Page inventory per brand
      • Sources: sitemap, plus the pages we already see in GA, GSC and the site audit.
      • Each page stores its URL, title, summary and last-modified date.
    • Match each cluster to inventory pages
      • Decide on one of create / optimize / expand / consolidate / refresh / defend.
      • Until a brand has an inventory, the decision defaults to create and says so.
    • Opportunity ≠ one piece of content
      • An opportunity holds several recommended assets.
      • Each asset has a decision, a channel (owned / earned) and an asset type.
      • Start with about ten asset types: blog post, pillar guide, landing/feature page, comparison, glossary, FAQ, product/category page, third-party article, backlink, other.
    • Send to the Action Center
      • The whole opportunity, or a single asset, can be sent as an action. The existing tasks flow applies.

    Phase 3: company-aware relevance

    • Add brand profile fields: products/services, target customers, business model, conversion goals.
    • Prefill them from the brand's site, and let the user edit them.
    • Feed the profile into the fan-out relevance decision and into asset type selection. For example, a SaaS brand leans to feature and comparison pages, and a store leans to category and product pages.

    Phase 4: measurement loop

    • Link an opportunity to the actions it produced.
    • Reuse the Action Center's before/after validation for visibility, citations, mentions, share of voice, GSC impressions and AI referral traffic.
    • A completed opportunity whose signals strengthen again is re-opened as "new signal detected" instead of being duplicated.

    Not planned for now

    • Generation methods and levels (Raw / Retrieval / Structured / Hybrid 1–5). The spec requires each level to change real generation behavior, but it does not define what each level does. We also have no retrieval layer to vary. We'll pick this up once each level has a concrete definition: which sources, how many, and what output structure.
    • A single "basket confidence" percentage. The basket shows its underlying counts (prompts, included queries, demand, competitor citations, related pages) instead of a number with no defined formula.
    • Embeddings. LLM clustering per topic is enough for Phase 1. pgvector is the likely next step if cross-topic dedup or page matching outgrows it.
  5. gkhngyk commented on Oct 7, 2026

    @gkhngyk
    ContributorAuthor

    Phases 1, 2 and 4 have shipped (#925, #930, #932, #936, #939, #940, #943, #952, #956, #960). Phase 3, the brand profile, continues in #964.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

contentenhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions