Repository navigation
feat(content): decide create, optimize or expand from the site's pages - #939
Merged
Merged
Conversation
Opportunities suggested new content even when the site already had a page for the need (#857, Phase 2). Generation now reads the site page inventory (#936) and says what to do with which page. - lib/page-matching.js narrows a brand's pages to the 8 most likely to cover a cluster's need, by the rarer words they share. No model call. - The generation call sees those pages, with their AI citations, sessions and last-modified date, and returns a decision per cluster: create, optimize, expand, refresh, consolidate or defend, with the pages it is about. Every decision but create needs a page and consolidate needs two; one that lacks them falls back. - Consolidate is only for near-duplicate pages about the same need, and an opportunity takes at most 3 clusters from other topics before it stops being offered as a merge target. Both came from bad results on real data. - Migration 00105 adds content_opportunities.decision. The pages are kept in source_data.targetPages and survive merges. - The brief works on the named page instead of drafting a new one. - The list shows the decision under the type, and the detail page has a "Your Site" card with the decision and links to the pages.
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
Second PR of Phase 2 in #857. Opportunities suggested writing new content even when the site already had a page for the need. Generation now reads the site page inventory (#936) and decides what to do with which page.
Finding candidate pages (
lib/page-matching.js)The decision
createoptimizeexpandrefreshconsolidatedefendresolveDecisionholds the decision to what it can stand on. Every decision other thancreateneeds a page, andconsolidateneeds two; a decision without them falls back.Tightened after real runs
MAX_MERGED_CLUSTERS).Storage, brief and UI
content_opportunities.decision. It is already applied to the hosted database.source_data.targetPagesand survive later merges.create, the brief is told to work on the named page or pages instead of drafting a new one.Results on the main test brand
Related issue
Part of #857 (Phase 2)
Type of change
feat— New featuretest— Adding or updating testsHow to test
optimizeorexpandopportunity. It works on the named page instead of drafting a new one.page-matching.test.jscovers tokenizing, candidate ranking and the two-word minimum, and the decision fallbacks.Checklist
yarn lint,yarn typecheck,yarn format:check,yarn test(407) andyarn buildpass (run fromweb/)yarn lint,yarn format:checkandyarn test(975) pass (run fromserver/)supabase/schema.sqlrebuilt withbuild-schema.sh🤖 Generated with Claude Code