Repository navigation
feat(content): read a page's visual proof spots and proof asks in one AI pass (CE-049, part a) - #1467
Conversation
… AI pass, kept by its hash (00270, CE-049, part a)
Quality phase 2, CE-049 (spec §4b), the server: one model read of the
whole page, with its page type, the brand's business type (B2B, B2C,
e-commerce) and the brand's approved claims about itself (CE-047):
- spots: where one specific image the business can take itself would
prove a paragraph ("A photo of this backpack on a real hike"); kept
only on a paragraph, list item or quote, in its own words, plain text,
not generic (EN/TR/DE blocklist), naming the page's own thing (a word
shared with its passage or headings), one an H2 section, three a page;
- proofs: the business's own claims whose proof only it has (award,
certification, research, rating, ranking, number, test, customer case,
else unknown), in the paragraph's words, not where it already links
out; a customer case on a B2C or shop page only when the claim names
one;
- regulated (health, finance, legal) on a B2C page.
00270: content_quality_pages (server-only, by page hash; items name
their paragraph by its 00266 hash, so a changed one drops out; missed
answers read again after a day) and content_draft_own_images (a member's
"this is my own image", as themself, 50 a draft; for part d).
POST /api/content-pages/page-read behind phase 2 with its own limiter: a
changed page read once a minute at most, 20 a day per draft (the shared
cap rises to 110: claims 50, page reads 20, sources at least 40), held
$0.01 as "quality"; a spent budget answers the kept read, paused. Logs
carry no page words.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…mage spots out (CE-049, part a) Review fixes before the PR: - count the day's page reads on the row (day_reads, day_started_at): 20 a draft, within its shared Quality calls; - an image naming only words every business page has (product, team, customer, dashboard) anchors nothing; generic patterns read with the Turkish "İ" folded; logo and illustration patterns narrowed; - keep proofs in a block that links out (the editor checks them off), so removing the link brings the ask back; - a customer case on a shop or consumer page needs case words or a named customer; a count asks for its source; kinds and regulated normalised; one claim inside another of its block is dropped; - a kept read is re-mapped for the business type as it is now; - two asks at once are each mapped to their own page, the older pending; - the hash covers what the model reads (headings cut at 300, the 16k cut, the brand's facts in any order, no addresses); facts ordered by first_seen_at, id; - each block keeps its H2's words (an empty H2 shifted the lookup); - own-images cap trigger: advisory lock, a re-confirm passes ON CONFLICT; spots and proofs up to 8 KB. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…a link on a claim reads nothing new (CE-049, part a)
A link put on a claim adds a space at its edge ("roll -top"): the page
and its block were read as changed, a paid read within the minute's
pending dropped the block's items. Blocks and the page are now hashed
without spaces; the kept read maps to the block as the page has it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk
left a comment
There was a problem hiding this comment.
Looks good. Three small follow-ups:
-
Editing the end of a long paragraph drops its items, and nothing reads it again (
server/src/lib/content-quality-page.js:109,:136,:168). A block is keyed byparagraphHash(squeeze(text))over its full text, but the model reads it, andpageHashhashes it, only up toMAX_BLOCK_CHARS(1200). If someone edits a paragraph after its 1200th character, the page hash stays the same, so no new read happens. The block's hash changes, though, soonPagedrops that block's spots and proofs. They stay hidden until some other change sets off a read. Fix: build the block's key from the words the model reads (squeeze(text.slice(0, MAX_BLOCK_CHARS))). Then an edit past the cut keeps its items, as it already does for blocks past the 16k cut. Add a test with a block over 1200 characters edited at its end. -
A failed read counts toward neither the minute's wait nor the 20-a-day cap (
content-quality-page.js:526,:532). A row is written only when a read succeeds or misses the schema. After a timeout or a provider error,read_atandday_readsstay as they were, so the next save calls the model again straight away. A timeout keeps its $0.01 hold each time. Those calls are then limited only by the shared Quality calls (up to 70 left after sources) and the route's limiter, not byPAGE_READS_PER_DAY. Fix: when a read times out, record it on the row: bumpday_readsandread_atand keep the oldpage_hashand items. If there is no row yet, write an empty one with a hash that never matches. Add a test where two timeouts in a row make only one call within the minute. -
00270's comments describe the old block hash (
supabase/migrations/00270_content_quality_pages.sql:19,:62). Since fa9fe54, items name their block by the hash of its words without spaces, not "the hash the claims read keeps it by (00266)". 00270 is applied on prod as it is (the round couldn't wait), so please fix the file's header comment and set the table's description again with acomment on table public.content_quality_pages is …in the next migration.
Checked, no action needed:
- Route: off before phase 2,
assertBrandAccesson the draft's brand, its own limiter (20 per 15 min per user), and the draft's HTML read as saved. Only approved claim facts that haven't gone from the site are read, in a stable order. Logs keep only an error's name, message and stack. - Budget: a $0.01 hold as
qualityon each read. Answers that miss the schema are charged and read again after a day, timeouts keep their hold, and a spent budget returns the kept read withpaused. Claims still stop at 50, page reads at 20 (counted on the row) and sources keep at least 40, out of 110. - Model output: a spot or proof is kept only when its words appear in the block it names. Images and alt texts are plain text of bounded length with no addresses or angle brackets, kinds and
regulatedare normalised to fixed lists, and everything is written only to this draft's row through the service role. Text in the page can at most change this draft's own suggestions. - 00270: dry-run against production on top of 00269, rolled back. RLS is on for both tables, and
content_quality_pageshas no grants or policies (server-only). Forcontent_draft_own_images:- A member can confirm only as themselves, and only within ±1 minute.
- A member can't confirm with
confirmed_byempty or set to someone else, can't use ajavascript:/data:address, and can't confirm on a draft that doesn't exist. Members can't update or delete. - The 51st image is refused with 23514. A re-confirm through
ON CONFLICT DO NOTHINGstill goes through at the cap. - Another workspace's member sees nothing and can't insert. Anon has no access.
- The cap trigger is
security invokerwith an emptysearch_path. prompt_improve_usage.feature's check is unchanged and already allowsquality.
…with Add image (CE-049, part c) (#1469) * feat(content): read what kind of source each link is, and underline the weak ones (CE-046, part a) Quality phase 2 (NEXT_PUBLIC_CONTENT_QUALITY_PHASE=2), by rules only: - sourceClass(): primary (official, research, standards), secondary (news, reviews, Wikipedia), weak (forums, social posts, uploaded papers), a competitor's page (primary on a comparison) or the brand's own; an address the rules can't place is left out (an AI read comes in part b) - Trust's primarySources (15) and noWeakSources (10); two placed sources score Trust on their own - Quality suggests replacing weak sources (Show, Keep) and adding a primary one, once Trust is scored; the editor underlines weak sources in amber (a decoration: never exported) - 00263: content_drafts.kept_sources (≤ 50) and content_draft_keep_source() - byUrl keeps a link's first place, so Show goes there Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(content): read the kind of a source's site the rules can't place with AI (CE-046, part b) Quality phase 2 (web NEXT_PUBLIC_CONTENT_QUALITY_PHASE and server CONTENT_QUALITY_PHASE at 2): - POST /api/content-pages/source-classes reads the sites a draft links (as saved) that the editor's rules can't place: the model sees each site's address alone and answers primary, secondary or weak; each read is kept for every workspace 90 days (00264 content_source_classes); 20 sites a read, 30 reads a draft a day, its own rate limit - the reads draw on the AI budget as their own feature, "quality" (00264 widens prompt_improve_usage.feature): a small hold (holdUsd), left out of the median that sizes other calls' holds and the Improve tab's estimate; a read cut off by its timeout keeps its hold; Billing lists it - the editor asks 3 s after a save (useSourceClasses), Trust takes the reads for sites the rules can't place, the weak-sources suggestion is tagged "AI check", and a spent budget pauses the reads with a note Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): ask only about public site names, keep an unknown read a day, and skip kept sources (CE-046, part b review) - SITE_NAME (LDH, a dot, a letter TLD; no IP, no single label) in keptSite/linkedSites, the editor's unplacedSites and 00264's check; a label that reads as words isn't asked about either - the model may answer unknown, which Trust leaves out; it, and a site the model left out, is kept a day, so it isn't asked again (and charged) after every save - a site whose every link the person kept isn't asked about (route and editor); a kept link counts in Trust with or without a read - a failed classifyDraftSources call lets its sites go (.catch/.finally) - .env.example: phase 2 turns the AI source reads on, from the AI budget Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(content): size Quality's checks against Starter's $5 AI budget after #1435 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(content): read the claims in a draft's own paragraphs with AI, kept by the paragraph (CE-045, part a) Quality phase 2 (CONTENT_QUALITY_PHASE at 2), server side: - POST /api/content-pages/claims reads the draft as saved: each paragraph and list item long enough to hold a claim; the model finds what a reader would want a source for (number, stat, superlative, fact), each claim in the paragraph's own words or dropped, five a paragraph at most - 00266 content_quality_claims keeps the reads by draft and paragraph hash: an unchanged paragraph isn't read again, a removed one's row goes; the paragraph being written (skip) waits; 12 paragraphs a call, 2 calls an ask, one after the other - the calls draw on the AI budget as "quality" (holdUsd 0.004), and share one day's cap per draft with the source kinds' reads (content-quality-calls.js, QUALITY_CALLS_PER_DAY 60) Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): read the claims by the editor's blocks, short list items too, and keep a missed answer as read (CE-045, part a review) - draftParagraphs reads p, li, blockquote, td and th as trustBlocks does, with ownText's spacing (a line break, sibling paragraphs): the answer is { paragraphs: [{ text, claims }] }, so the editor knows each claim's block - blocks from 12 characters ("Award-winning support"); a call takes 12 paragraphs or 6,000 characters, whichever comes first - an answer billed that missed the schema is charged and its paragraphs read with none (not sent, and charged, on every save); a kind the editor doesn't know drops that claim only; a paragraph answered twice keeps both - claims leave 10 of the day's Quality calls to the sources' kinds, and the route has its own limiter; the reading's version is in the hash; logs carry no page words Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(content): count the claims in the page's own words in Trust and underline the unsourced ones (CE-045, part b) The editor asks the API for the claims a few seconds after a save (never with changes to save), leaving the block being written until the person leaves it. Trust counts each claim in its own block as a figure, the draft underlines the unsourced ones in their blocks, and Quality's suggestion gets Add source (link dialog on the claim's words) and Remove. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): read each source site in its own call, held and counted per site (CE-046, part b review) One generateObject per site the rules can't place, run together with Promise.allSettled: no site's name reaches another's read, and a failed site keeps the others' reads. Each read holds $0.0005; the day's cap counts sites (SOURCE_READS_PER_DAY = 40). An answer off the schema is charged and kept as unknown for a day. The route logs an error's name and message only. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): read a missed answer's paragraphs again after a day, match claims across curly quotes, log no page words (CE-045, part a review) - 00266 gets a `missed` column: an answer that missed the schema (cut short, or blocked by the provider's filter) keeps its paragraphs as read with no claims, and they're read again after MISSED_DAYS (1). - keptClaims compares folded copies (’ ‘ → ', “ ” → ", ‐ ‑ – — → -), one character for one, and keeps the paragraph's own span. - The claims route logs an error's name and message only: a provider's error carries the request, the page's paragraphs. - QUALITY_CALLS_PER_DAY = 90, the claims leaving the sources' SOURCE_READS_PER_DAY (40) now that each site is a call: the claims keep their 50 calls a day. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): say a spent budget first, read five sites at a time, and log no whole error (CE-046, part b review) When no site is read, the error thrown is a spent budget's if any (429, the editor pauses) rather than the first site's. An ask reads its sites five at a time, so 20 holds and their queries don't go out at once. A site's hold is $0.001 (the model's thinking is billed as output). The route's error log keeps the stack, not the provider's request. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): read a missed answer's paragraphs again one a call, after the new ones, and fold more quote and dash forms (CE-045, part a review) A paragraph whose answer missed the schema is read again after a day in a call of its own, after the paragraphs not read yet: one the provider's filter blocks no longer keeps its neighbours unread every day. The fold also covers low quotes, primes, figure and horizontal-bar dashes and the minus sign. The claims route keeps the error's stack in its log. Tests pin the select's columns, both fold directions and the route's log. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(content): read a brand's facts from its own pricing, About and product pages, kept for approval (00269, CE-047, part a) Quality phase 2, CE-047: the brand's prices and plans, trial, founding year and claims, read from its own site for Trust's "consistent with brand facts" check. The model finds the facts and copies each one's words; a fact is kept only when its words are on the page as written, and its value (amount, currency, period, days, year) is read from them by rule. A person approves each one. - 00269: brand_facts (members read, and change only the status, as themselves) and brand_fact_pages (server-only: a hash of each page's text, so an unchanged page isn't read by the model again; no text kept). - brand-facts.js: findFactPages (page list, Site trust's About page, else probes on the main domain; never Scrape.do), factText, keptFacts, refreshBrandFacts (new values pending, approved ones gone from the site marked gone, pending ones dropped), readBrandFacts (first ask reads, asking again every 10 minutes at most), setFactStatus. - GET /api/brand-facts, POST /fetch, PATCH /:id behind phase 2, with their own limiter; logs carry no page text. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(content): review and approve brand facts in Brand settings (CE-047, part c) Brand settings › Brand facts, with Quality's phase 2: the facts the API read from the brand's own pricing, About and product pages, each with its words on the page, where it was read and the approved value it would replace ("Was $59"). A member approves or rejects each one (no approve all: the spec has each approved); approved facts no longer on the site say so. Each page's read is listed (read, not found, turned our reader away, didn't answer); Read again reads the site again once the API allows it, and a spent AI budget says so. `?tab=facts` opens the tab, for the editor's to-do to link to. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): read brand facts' text in one walk, keep facts any page still has, and store no wrong price (CE-047, part a review) - factText walks the page once and stops near MAX_TEXT_CHARS: a page of 100k blocks reads in well under a second (was quadratic). Struck-through old prices (del, s, strike) are left out. - A fact still on any page read (its words, a price's with its plan near them; across a card's lines too) stays; only facts whose page was read and has them no more are marked gone or dropped, written once. - A plan's name is found on the folded text without lowering it (a Turkish "İ" lowers to two characters), and a quote only where it doesn't run into a number ("$49" in "$499", "$1,2"). - parsePrice reads one price only, no saving, discount or old price, a dollar named by its code after it ("$49 CAD"), and the period in the words right after it, the first named ("Lifetime access, monthly updates" is once). Magnitudes in any case; a trial needs a trial word, "started in" is no founding year. - A page read after a wall or a failure says "ok" again; a missed answer's hash isn't kept past a failed read. A changed page goes to the model once an hour at most (MODEL_EVERY_MS). A page that failed (or a spent budget) is read again at the next ask after RECHECK_MS. - Facts are written before the pages' hashes; source_url is cut to 2048. - A listed page that no longer answers falls back to the usual addresses; a probe that is the home page again isn't read as one. - readPage maps not-HTML, refused and redirect-loop reads to not_found; 401/403/429 to blocked, 5xx to failed. setFactStatus answers 404 for a fact removed meanwhile. - GET has no bucket of its own (the editor reads it as its tab comes back); POST /fetch keeps brandFactsLimiter. - 00269: each kind's value checked (amount ≥ 0, currency, days, year), source_url http(s) only, a member's reviewed_at within a minute of now. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(content): check a page's prices against approved brand facts in Trust, with an Approve to-do (CE-047, part d) Trust's "consistent with brand facts" (10 points, phase 2): the page's prices, trial and founding year against the brand's approved facts still on its site, read so as not to cry wolf: a price in its own currency only, against a plan's prices (any of them: monthly and annual billing both count) when the sentence names the plan, else only when it names the brand (or "we") with a period; "from $29" against the lowest price; no sentence naming a competitor; discounts, scales and ranges aren't prices. Like a working link, it doesn't score Trust on its own. - A mismatch is Quality's suggestion, "Price differs from brand facts · Page $39 · pricing page $49", with Show on its sentence. - "Approve {n} brand facts" is the person's to-do while facts wait, with Review linking to Brand settings › Brand facts (the to-do row and the next-step nudge, not Settings › Authors). - useBrandFacts reads them once with phase 2 and again when the tab comes back from Brand settings; the next-step reads wait for it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): give Brand facts' reads their time, keep the list right after a review, and do one thing at a time (CE-047, part c review) - settings/layout.tsx sets maxDuration 300: the first read and Read again wait while the API reads the site (pages, then the model). - A review updates the list in place (no read that could read the whole site again); a failed one reads the list as kept, a fact a read removed meanwhile gone from it. Approve, Reject and Read again don't run at once; the row being saved says so (aria-busy). - An API with brand facts off says they aren't available yet; a thrown action shows the failure instead of loading for ever. - Page links read as the page's name; sections are labelled by their heading; the quote marks and the page status separator are messages; "missed" and the paused note say when the read comes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): leave a short page's facts alone, read a code or scale after a price, and read brand facts once at a time (CE-047, part a review 2) - A page under 200 characters (one its scripts write, a wall not told apart) leaves its facts as they are on every read, not only the first. - A currency code or a scale right after a quote is read ("$49" then "CAD per month" is CAD; "$2" then "million" is no price); only "off" right after a price drops it (the next card's "Save 20%" doesn't). A period is named within 24 characters of the price, the first one named; "per active user" is per seat. - A plan's name matches as whole words ("Pro" isn't in "Product"); a quote isn't taken inside another mark's dollar ("C$49") or a space-grouped number ("299 €" in "1 299 €"). - factText counts words toward its length, not indentation. - A page whose model read failed waits MODEL_EVERY_MS like any other; a GET reads a failed page again behind its answer, not before it. - New facts get the room the removed ones leave; a page whose new facts didn't fit keeps its old hash, to be read again. A kind no longer read (a shop's product page) loses its row. - refreshOnce: one read per brand at a time, for the tab and the weekly read alike. - 00269: a missing key is a check violation, and numbers compare as numeric (no cast error). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): cry no wolf on brand facts: plans named as written beside the price, the brand's own trial and founding year only (CE-047, part d review) - A price is compared with the plan named nearest it, its name as the page writes it (case too); a plan that is an everyday word ("Pro", "Team", "Free", "Growth") only beside "plan"/"tier" or with the brand named. With no plan, only a sentence naming the brand and saying what it costs; no "we/our" path. Free ($0) is never compared; "from $19" matches any approved price. - A sentence with an old price, a saving, a discount, credits, tax or a team's bill ("was $49", "incl. VAT", "5 users pay") isn't read for prices; "billed monthly/annually" narrows to that billing. - Ranges need a number before the dash or word (French "à", Turkish "ile", "between … and"), so "Pro – $49" is a price again; an amount doesn't start inside a number. - A trial is compared where it is the brand's ("your free trial", "every plan", its name), its days right beside the trial; a founding year right after "founded", with the brand named or "we were founded". - Each sentence once. The to-do is last (the brand's, no points of the page's), "Review your brand facts" at 0 and "reviewed" when done. - useBrandFacts fails instead of loading for ever when the action throws. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(content): read a page's visual proof spots and proof asks in one AI pass, kept by its hash (00270, CE-049, part a) Quality phase 2, CE-049 (spec §4b), the server: one model read of the whole page, with its page type, the brand's business type (B2B, B2C, e-commerce) and the brand's approved claims about itself (CE-047): - spots: where one specific image the business can take itself would prove a paragraph ("A photo of this backpack on a real hike"); kept only on a paragraph, list item or quote, in its own words, plain text, not generic (EN/TR/DE blocklist), naming the page's own thing (a word shared with its passage or headings), one an H2 section, three a page; - proofs: the business's own claims whose proof only it has (award, certification, research, rating, ranking, number, test, customer case, else unknown), in the paragraph's words, not where it already links out; a customer case on a B2C or shop page only when the claim names one; - regulated (health, finance, legal) on a B2C page. 00270: content_quality_pages (server-only, by page hash; items name their paragraph by its 00266 hash, so a changed one drops out; missed answers read again after a day) and content_draft_own_images (a member's "this is my own image", as themself, 50 a draft; for part d). POST /api/content-pages/page-read behind phase 2 with its own limiter: a changed page read once a minute at most, 20 a day per draft (the shared cap rises to 110: claims 50, page reads 20, sources at least 40), held $0.01 as "quality"; a spent budget answers the kept read, paused. Logs carry no page words. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(content-editor): ask for the proof of the page's own claims as to-dos (CE-049b) The page read (CE-049a) names the claims only the brand can prove: an award, a certification, its own test, a rating, a ranking, a figure, a named customer. Quality lists each as a to-do while its paragraph has no link, worded by the kind of proof and the business type (spec §4b), five open at once in the page's order, checked once linked; Add proof link selects the claim and opens the link dialog, as Add source does. A link to the brand's own site sources its own claim in Trust, and a sentence a proof to-do covers leaves Trust's source suggestion. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): cap a draft's page reads at 20 a day and keep generic image spots out (CE-049, part a) Review fixes before the PR: - count the day's page reads on the row (day_reads, day_started_at): 20 a draft, within its shared Quality calls; - an image naming only words every business page has (product, team, customer, dashboard) anchors nothing; generic patterns read with the Turkish "İ" folded; logo and illustration patterns narrowed; - keep proofs in a block that links out (the editor checks them off), so removing the link brings the ask back; - a customer case on a shop or consumer page needs case words or a named customer; a count asks for its source; kinds and regulated normalised; one claim inside another of its block is dropped; - a kept read is re-mapped for the business type as it is now; - two asks at once are each mapped to their own page, the older pending; - the hash covers what the model reads (headings cut at 300, the 16k cut, the brand's facts in any order, no addresses); facts ordered by first_seen_at, id; - each block keeps its H2's words (an empty H2 shifted the lookup); - own-images cap trigger: advisory lock, a re-confirm passes ON CONFLICT; spots and proofs up to 8 KB. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content-editor): keep a proof to-do when its link adds a space, and let Next step wait for the page read (CE-049b) Pre-push review fixes: - match proof asks and Trust's own-site proof by their words without spaces (a link put on a claim adds one at its edge), so the row is checked, not lost; a block's claims in their order; - an own-site link sources only the proof claim's sentence, not the block's other figures; - usePageRead says when its first answer is in (settled): Next step drops a stale skip only after it; a failed ask clears pending; - Next step reads each proof to-do by its key; proofKey names the block by a short hash; had holds only the to-dos shown open; - Before you publish names the claims a proof to-do covers again; - "license". Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): hash a page's blocks by their words without spaces, so a link on a claim reads nothing new (CE-049, part a) A link put on a claim adds a space at its edge ("roll -top"): the page and its block were read as changed, a paid read within the minute's pending dropped the block's items. Blocks and the page are now hashed without spaces; the kept read maps to the block as the page has it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(content-editor): show visual proof spots in the draft's margin, with Add image (CE-049, part c) The page read's visual proof spots (#1467) stand beside their passages: from 1120 px a card with the image to take, "For: “{passage}”" and Add image; narrower a 20 px marker in the page's padding. A widget decoration, never the page's (no save, export, copy or CMS push has it), placed again only when the spots or the page change; hidden while the agent changes the page. A spot goes once an image follows its block. Add image takes the image by its https address, the alt text drafted from the passage (required) and an optional caption (an italic paragraph), put in right after the passage's block; a passage gone meanwhile says so. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): tie a brand fact's figure to the brand, one price per plan Review fixes on the brand-facts check (CE-047): - a price with no plan named is read only right after the brand's name and a pricing verb; "was founded" needs the brand, "we" or "our company" right before it; a sentence with two trial lengths is skipped - each named plan takes the one price nearest it, skipped when another price sits between; add-on words ("extra", "additional", "add-on") aren't prices - the next step no longer waits for the brand's first site read; the brand facts' to-do joins when it lands Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): keep a linked proof to-do checked, ask the page read past the API's minute Review fixes on the proof to-dos (CE-049, part b): - a proof ask's key hashes its block's words without spaces, so a link's edge space on the next read keeps the to-do checked and the nudge quiet - the page read asks a few seconds past the API's minute, which counts from when the last ask reached it, so it isn't answered "pending" - the hook's constants are PROOF_READ_*, apart from the panel's PAGE_READ_DELAY_MS Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): take only https image addresses up to 2,048 characters in the proof image dialog Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): pair plan prices closest first, keep a trial to the brand's part of a sentence Pre-push review fixes on the brand-facts check: - each plan takes its nearest price, the closest pairs first; a sentence with more prices than plans named isn't read for prices - setup, onboarding and one-time fees aren't a plan's price; with no plan named, only the plan or pricing may sit between the name and the verb - a trial is read in the part of the sentence that is the brand's, and a length said of another ("Ledgerly's runs for 14 days") makes two - "was founded" needs who at the start of its clause, and "we" outside quoted speech - stale Next step skips wait for the brand facts again: only the dropping waits, and a proof skip's Trust can move when they land Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): key a proof to-do by its claim's words without spaces too The API cuts a claim from its block as the page has it, so a link's edge space changes the claim as well as the block. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): read a sentence's prices only when they match its plans one to one, a partner's trial apart - prices are read only when the sentence has as many as plans named (one with none named): a plan beside another's price, or a monthly and an annual price with no plan, are unsure - ", which/who/whose" turns to another subject: a partner's trial isn't the brand's - "Ledgerly's trial runs for 30 days" is read as the brand's trial Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(content-editor): let the page read land before the stale-skip check in phase 2 Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content-editor): read a plan's price only right after its name, and a trial only after the brand's (CE-047) - A named plan's price is read as the brand's is: right after its name (with its plan or tier word), with nothing, "is", a colon, a dash, "(" or a pricing verb between. A price compared within a few words after it ("$30 more than", "$20 less … than") is read for no one, and "saves", "saved", "saving" are a saving. - In a part of the sentence that is the brand's, only a trial length after its name or "your trial", "every plan" is its own; "free for N days" is a trial only after "try"/"use" and the brand, or in a sentence that says "trial". - "We were founded" starts its clause only at the sentence's start or after since/when/after/and, not after a colon (quoted speech). - In phase 2, the Quality score also waits for the brand's facts. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content-editor): hold the Quality score until the page as saved is read for proof (CE-049) usePageRead counts a save it hasn't asked about yet as reading, as useClaims does, and waits only for changes on their way (the editor's narrower `saving`), so a failed save, a conflict or a page too large doesn't hold it. In phase 2, qualitySettled waits for the page's read. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
… proof (CE-049, part d) (#1475) * feat(content): read what kind of source each link is, and underline the weak ones (CE-046, part a) Quality phase 2 (NEXT_PUBLIC_CONTENT_QUALITY_PHASE=2), by rules only: - sourceClass(): primary (official, research, standards), secondary (news, reviews, Wikipedia), weak (forums, social posts, uploaded papers), a competitor's page (primary on a comparison) or the brand's own; an address the rules can't place is left out (an AI read comes in part b) - Trust's primarySources (15) and noWeakSources (10); two placed sources score Trust on their own - Quality suggests replacing weak sources (Show, Keep) and adding a primary one, once Trust is scored; the editor underlines weak sources in amber (a decoration: never exported) - 00263: content_drafts.kept_sources (≤ 50) and content_draft_keep_source() - byUrl keeps a link's first place, so Show goes there Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(content): read the kind of a source's site the rules can't place with AI (CE-046, part b) Quality phase 2 (web NEXT_PUBLIC_CONTENT_QUALITY_PHASE and server CONTENT_QUALITY_PHASE at 2): - POST /api/content-pages/source-classes reads the sites a draft links (as saved) that the editor's rules can't place: the model sees each site's address alone and answers primary, secondary or weak; each read is kept for every workspace 90 days (00264 content_source_classes); 20 sites a read, 30 reads a draft a day, its own rate limit - the reads draw on the AI budget as their own feature, "quality" (00264 widens prompt_improve_usage.feature): a small hold (holdUsd), left out of the median that sizes other calls' holds and the Improve tab's estimate; a read cut off by its timeout keeps its hold; Billing lists it - the editor asks 3 s after a save (useSourceClasses), Trust takes the reads for sites the rules can't place, the weak-sources suggestion is tagged "AI check", and a spent budget pauses the reads with a note Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): ask only about public site names, keep an unknown read a day, and skip kept sources (CE-046, part b review) - SITE_NAME (LDH, a dot, a letter TLD; no IP, no single label) in keptSite/linkedSites, the editor's unplacedSites and 00264's check; a label that reads as words isn't asked about either - the model may answer unknown, which Trust leaves out; it, and a site the model left out, is kept a day, so it isn't asked again (and charged) after every save - a site whose every link the person kept isn't asked about (route and editor); a kept link counts in Trust with or without a read - a failed classifyDraftSources call lets its sites go (.catch/.finally) - .env.example: phase 2 turns the AI source reads on, from the AI budget Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(content): size Quality's checks against Starter's $5 AI budget after #1435 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(content): read the claims in a draft's own paragraphs with AI, kept by the paragraph (CE-045, part a) Quality phase 2 (CONTENT_QUALITY_PHASE at 2), server side: - POST /api/content-pages/claims reads the draft as saved: each paragraph and list item long enough to hold a claim; the model finds what a reader would want a source for (number, stat, superlative, fact), each claim in the paragraph's own words or dropped, five a paragraph at most - 00266 content_quality_claims keeps the reads by draft and paragraph hash: an unchanged paragraph isn't read again, a removed one's row goes; the paragraph being written (skip) waits; 12 paragraphs a call, 2 calls an ask, one after the other - the calls draw on the AI budget as "quality" (holdUsd 0.004), and share one day's cap per draft with the source kinds' reads (content-quality-calls.js, QUALITY_CALLS_PER_DAY 60) Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): read the claims by the editor's blocks, short list items too, and keep a missed answer as read (CE-045, part a review) - draftParagraphs reads p, li, blockquote, td and th as trustBlocks does, with ownText's spacing (a line break, sibling paragraphs): the answer is { paragraphs: [{ text, claims }] }, so the editor knows each claim's block - blocks from 12 characters ("Award-winning support"); a call takes 12 paragraphs or 6,000 characters, whichever comes first - an answer billed that missed the schema is charged and its paragraphs read with none (not sent, and charged, on every save); a kind the editor doesn't know drops that claim only; a paragraph answered twice keeps both - claims leave 10 of the day's Quality calls to the sources' kinds, and the route has its own limiter; the reading's version is in the hash; logs carry no page words Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(content): count the claims in the page's own words in Trust and underline the unsourced ones (CE-045, part b) The editor asks the API for the claims a few seconds after a save (never with changes to save), leaving the block being written until the person leaves it. Trust counts each claim in its own block as a figure, the draft underlines the unsourced ones in their blocks, and Quality's suggestion gets Add source (link dialog on the claim's words) and Remove. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): read each source site in its own call, held and counted per site (CE-046, part b review) One generateObject per site the rules can't place, run together with Promise.allSettled: no site's name reaches another's read, and a failed site keeps the others' reads. Each read holds $0.0005; the day's cap counts sites (SOURCE_READS_PER_DAY = 40). An answer off the schema is charged and kept as unknown for a day. The route logs an error's name and message only. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): read a missed answer's paragraphs again after a day, match claims across curly quotes, log no page words (CE-045, part a review) - 00266 gets a `missed` column: an answer that missed the schema (cut short, or blocked by the provider's filter) keeps its paragraphs as read with no claims, and they're read again after MISSED_DAYS (1). - keptClaims compares folded copies (’ ‘ → ', “ ” → ", ‐ ‑ – — → -), one character for one, and keeps the paragraph's own span. - The claims route logs an error's name and message only: a provider's error carries the request, the page's paragraphs. - QUALITY_CALLS_PER_DAY = 90, the claims leaving the sources' SOURCE_READS_PER_DAY (40) now that each site is a call: the claims keep their 50 calls a day. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(content): say a spent budget first, read five sites at a time, and log no whole error (CE-046, part b review) When no site is read, the error thrown is a spent budget's if any (429, the editor pauses) rather than the first site's. An ask reads its sites five at a time, so 20 holds and their queries don't go out at once. A site's hold is $0.001 (the model's thinking is billed as output). The route's error log keeps the stack, not the
Summary
Quality Phase 2, CE-049 "Dynamic suggestions" (spec §4b), part a: the server. Part b (proof to-dos in the editor) follows, stacked on this; parts c–e (visual proof spots, own-image confirm, regulated reviewer) come after. Everything sits behind
CONTENT_QUALITY_PHASE=2.What the model reads
One call reads the whole page with its page type, the brand's business type (B2B, B2C, e-commerce), the brand's name and up to 10 of its approved claims (brand facts, CE-047). It returns:
What is kept, by rule (never cry wolf)
customer_case), elseunknown;number("Trusted by 2,000 patients"), anything else is dropped.Cost
content_quality_pages, server-only), keyed by a hash of what the model reads: the types, the brand's claims in any order, and the page up to the 16k cut. An unchanged page isn't read again.pendingmeanwhile), and 20 times a day per draft at most (day_reads/day_started_aton its row). This sits within the draft's shared Quality calls:QUALITY_CALLS_PER_DAYgoes 90 → 110. Claims stop at 50 (LEFT_FOR_OTHERS), and sources keep at least 40.quality:paused.pending.Own images (for part d)
content_draft_own_images: the images a member confirmed are their own, not stock (E-E-A-T's visual proof).ON CONFLICT DO NOTHING.Route
POST /api/content-pages/page-read { draftId }, with its own limiter (20 per 15 min).offbefore phase 2. Checks the brand's workspace.first_seen_at,id).Related issue
Quality spec (Drive), Phase 2, CE-049 (part a).
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
CONTENT_QUALITY_PHASE=2. Applied on the dev DB. A member inserting a row as another user is refused by RLS, and the 51st image is refused (23514).POST /api/content-pages/page-read {"draftId": "<a draft of 120+ words with an award or a certification>"}. It returns proof asks with their kinds, and spots when a specific image fits.pending: true, and the changed paragraph's items are gone.server/src/lib/content-quality-page.test.jspins:Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/): no web changeyarn typecheckpasses (run fromweb/): no web changeyarn format:checkpasses (run fromweb/): no web changeServer:
npm run format,npm run lintandnpm testpass.supabase/schema.sqlis rebuilt.🤖 Generated with Claude Code