Repository navigation
Description
Summary
Every generation run asks the model for 5 to 15 content opportunities. In production it consistently returns about ten. That is more than anyone acts on in a day, and because the nightly run repeats it, the list grows faster than a customer can work through it.
Three opportunities per run is enough. A short list that gets read beats a long one that gets scrolled past.
What it looks like now
Ten days of production generation:
| Day | Generated | Brands | Per brand |
|---|---|---|---|
| Day 1 | 208 | 21 | 9.9 |
| Day 2 | 199 | 19 | 10.5 |
| Day 3 | 182 | 18 | 10.1 |
| Day 4 | 181 | 17 | 10.6 |
The model lands mid-range, so roughly ten arrive per brand per night.
Where the limit lives
The same rule is written twice, in two files that have drifted into near-copies of each other:
server/src/lib/opportunity-generator.js— the automatic run, fired from the tracking worker after each cycleserver/src/workers/content-worker.js— the queued run behind the Generate button
Both carry the same two constraints:
.min(1)
.max(20)- Generate between 5 and 15 opportunities.
Proposed change
Ask for three, and cap the schema so a talkative model cannot exceed it. Both files need the change, or the button and the nightly run will disagree.
The count is the easy half. The harder half is that with only three slots, which three matters much more than it did at ten. The prompt already receives the top 25 scored prompts, ranked by volume, visibility gap, competitor gap and intent. The instruction should say the three must be the highest-impact available, not the first three the model composes — otherwise cutting from ten to three trades away the good ones as easily as the filler.
Worth deciding while implementing
The two code paths write to the table differently, and this change makes the difference more visible:
content-worker.jsdeletes everynewrow for the brand before inserting, so a manual run replaces the list.opportunity-generator.jsappends, skipping only rows whoseprompt_idand title match an existingnewrow exactly.
So a manual Generate leaves the customer with exactly what the model just produced, while the nightly run adds to whatever is already there. Three per night with the append behaviour is still ninety a month.
Reducing the count does not fix that on its own, and this issue is not asking it to — the accumulation and near-duplicate problem deserves its own issue and its own decision about whether the nightly run should replace, expire, or genuinely deduplicate. But whoever implements this should know both paths exist and keep them consistent on the count.
Scope
- The prompt instruction and schema ceiling in both files
- No schema migration, no surface changes — the Content page already paginates whatever exists
How to test
- Trigger a manual generation for a brand with a rich tracking history and confirm exactly three opportunities are returned.
- Confirm the three are distinct recommendations, not one idea in three wordings.
- Run a tracking cycle for a brand on a plan with content optimization and confirm the automatic path produces the same count as the button.
- Confirm a brand with very little data still produces a sensible result rather than failing the schema.
Activity
feat(content): generate three opportunities per run instead of five t…