Skip to content

feat(content): score Trust from the page's sourced figures, fresh sources and working links (CE-039) - #1416

Merged
gkhngyk merged 116 commits into
ansvisor:mainfrom
cihan-gyk:feature/quality-trust-links
Oct 23, 2026
Merged

gkhngyk merged 116 commits into
ansvisor:mainfrom
cihan-gyk:feature/quality-trust-links

Conversation

@cihan-gyk

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

Copy link
Copy Markdown
Collaborator

Summary

Content Editor Quality spec, Phase 1: Trust in Instructions › Quality (§2.2), web part. It reads three checks from the page:

Check Points When it counts When it's left out
Claims have a source 30 A sentence with a figure counts as sourced when its own paragraph, list item, quote or cell links another site (not the brand's). The page has no figure.
Fresh sources (≤ 24 months) 7 Linked pages on other sites that give a date: the share that are newer than 24 months. No linked page gives a date.
No broken links 3 Links the API could read: the share that answer. No link has been read yet.

A figure is a percentage, an amount with a magnitude ("$2.5 million"), or a number with a magnitude or multiplier ("2 million", "10k", "3x", "3 times faster"). A bare number, a year, a price ("$29/month") or a size ("10 x 20 cm") isn't one. User-written claims beyond figures (stats, superlatives, facts) come with Phase 2's claim detection (CE-045).

Each check is left out when it has nothing to read, so a score only shows once there's something real to score (no fake points). Site trust (5) comes with CE-043.

Stacked on #1415 (server: link check, POST /api/content-pages/links). Deploy that first: migration 00258, then the server, then this. Before the server ships, the editor just gets errors from the link check (logged, nothing shown), and only with the flag on.

What the person sees

  • The Trust badge (until now always "Not scored yet") scores the page. The header's Quality chip averages the three scores.
  • New suggestions, each with Show, which marks the passage:
    • "{n} sentences with figures have no source": link the source in the same paragraph, or take the figure out ("Content Agent won't make one up").
    • "{n} of {m} dated sources are over 24 months old"
    • "{n} links don't work": "Fix or remove it: {url}"

How the links are read

  • checkDraftLinks(draftId): the API reads the links from the draft as saved.
  • _use-link-checks.ts asks 3 s after the page's links or the save change, and only about links it has no read of. A link without a read (not saved yet, over the API's budget, a failed ask) is asked about again after the next save. A link the API never reads (an account link) isn't asked about again.
  • Links are compared as the draft saves them (cleanHref: lower-case host, no tracking parameters).
  • Trust waits for the brand's domains, so the brand's own links are never counted as sources.

Text read per block (trustBlocks): a list item without its nested list (as Readability reads it), with its own links. Each link and each sentence counts once.

After review (2026-10-23):

  • Discounts, materials, 4K/401k and per-period prices no longer count as unsourced figures.
  • Trust is scored only once a figure or a dated source is there. A broken link is still listed, its gain out of the 40 Phase 1 points.

Related issue

Drive spec Quality §2.2 (Trust), CE-039 scores. No GitHub issue.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation

How to test

  1. Run the server PR (migration 00258 and the server).
  2. With NEXT_PUBLIC_CONTENT_QUALITY_PHASE=1, open a draft. Write "Win rates rose 42% last year." with no link, and add a link to a removed page and one to an old article.
  3. A few seconds after it saves, Instructions › Quality › Trust has a score.
  4. The suggestions name the unsourced figure, the old source and the broken link, and Show marks each.
  5. Add a link to the figure's source in the same paragraph. That suggestion goes away, and Trust rises after the next read.
  6. On a page without figures or links, Trust stays "Not scored yet".

Checked locally against a server from this branch, at 1024 px in light and dark, on a temporary draft linking only to ansvisor.com pages:

  • Trust read 52 · Needs work: one unsourced figure, one sourced "3x" figure, and a link to a removed page caught as broken (404).
  • Show marked the paragraph.
  • content_link_checks held the three reads.
  • No horizontal overflow.
  • The temporary rows were deleted afterwards.

Checklist

  • web/: yarn format, yarn lint (0 errors; 6 existing warnings elsewhere), yarn typecheck, yarn test (345 files, 3,067 tests), yarn format:check and yarn build pass.
  • server/: npm run format, npm run lint and npm test (186 files, 2,224 tests) pass on this branch, which includes feat(content): read a saved draft's links once a day for Trust: working or broken, and their page's date #1415.
  • Tests:
    • quality-checks.test.ts: figures and non-figures, sourced by block, freshness, broken vs unknown, saved-form links, each link and sentence once
    • _use-link-checks.test.tsx: asks after the links settle, re-asks after the next save, skipped links, failed asks, flag off
    • _quality-tab.test.tsx: Trust rows with Show
  • UI text in messages/en.json

🤖 Generated with Claude Code

cihan-gyk and others added 30 commits October 23, 2026 02:24
The workspace's one AI budget (Improve, the Content Editor's AI and the
Action Center's task writer) had no meter: the first sign of it was an
"AI usage is used up" error. Migration 00242 records what each AI call
was for (prompt_improve_usage.feature, backfilled) and sums the period's
spend by feature (ai_usage_by_feature). GET /api/billing/ai-usage
returns the shares of the plan's budget, and the Billing page shows the
share used, when it resets and what used it, with Agent Chat noted as
running on the workspace's own key.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The workspace's AI budget was checked by reading the period's spend; the
call's cost was written once the model answered. Calls running at once
(two tabs, a teammate, an Action Center sweep) all read the same spend
and all ran past the budget. 00243's reserve_ai_usage takes a
per-organization lock, reads the spend with the calls in flight, and
holds the call's estimated cost; reserveAiBudget turns the hold into the
real cost or releases it. Improve, the brief rebuild, Apply rules with
Agent, Start Agent and the Action Center task writer use it in place of
enforceImproveQuota, which goes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review fixes:
- Apply rules with Agent and Start Agent charge an answer the provider
  billed but that missed the schema (NoObjectGeneratedError), as Improve,
  the brief and the task writer do; before, the hold was let go and the
  call ran free.
- A call holds the org's median cost over its last 20 calls this period,
  never less than the model's typical cost, so calls in flight pass the
  budget by far less.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Apply rules with Agent makes at most 8 small edits a run, which can't
bring a long page to its Length (about 2% a run on prod). The Content
Agent can now rewrite the whole page in one background call, left as ONE
suggestion (kind 'page', migration 00247) to compare and accept or reject:
- POST /api/content-drafts/:draftId/rewrite, through Start Agent's claim,
  budget hold and background run;
- passages AI quotes today, tables, images, quotes and HTML blocks go to
  the model as [[KEEP n]] lines and come back as they were; a rewrite that
  drops one fails the run;
- one H1, only the page's own links and the ones offered, the editor's
  tags; the page as it was is kept on the suggestion (before_html).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Length

Review fixes:
- Kept blocks are described under the page (a quoted passage's words, a
  table's rows, an image's alt) and their text counts toward Length, so a
  rewrite aims at the whole page's length; with Length off it keeps the
  page's own. A kept H1 stays first, and the page's language is kept.
- The answer is taken out of a code fence, text left at its root goes in
  paragraphs, and an answer in Markdown fails the run.
- The page's own links stay exactly as written (query and anchor too).
- Kept blocks go back untouched (an empty table cell stays), only the
  page's first H1 counts as its title, a page that writes "[[KEEP" gets
  markers of its own, and a page that is only kept blocks isn't sent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…compare it

The Rules tab opens with the agent's two ways to meet its rules: Apply
rules with Agent (small edits, up to 8 a run) and Rewrite the page to
these rules (the whole page as one change). The rewrite is recommended,
with a one-line reason, when the page is more than 30% off its Length or
4 rules or more are open.

A rewritten page comes back as one suggestion with its own bar over the
page: the characters before and after and the agent's reason, Compare
(the page and the rewrite side by side), Accept (History keeps the page
first), Reject, and Undo. A page that changed since the agent read it
isn't written over. The page waits for the rewrite with its own steps,
and a failed rewrite's Try again rewrites again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review fixes:
- A page is compared with the one the agent read by its words, with a
  space between blocks, so stored line breaks and lists don't read as a
  change (Accept and Undo were refused on imported pages).
- One agent run at a time from the page; a rewrite never starts before
  the locked passages are read, and sends the editor's own locked keys.
- Accept holds the page still from the start and checks it again before
  putting the rewrite in; Undo puts the page back as it was (two H1s too),
  and the bar waits while the HTML view is open.
- No rewrite advice for an empty page or one too long to send whole; the
  rewrite mark survives a reload; the waiting view says the rewrite waits
  in the editor; Compare's links don't navigate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Content Editor v1.1, part 1 (CE-025, CE-026, §4): the agent row and the
rewrite bar become one card above the toolbar, in three states:
- waiting: "Content Agent has {n} suggestions for you", what they change
  and the rules they gain ("Rules 5 → 6 of 13"), with Review (scrolls to
  the first suggestion and marks it), Reject all and Accept all; a page
  rewritten shows its characters, with Compare;
- all reviewed: what was accepted and the rules met and still open, with
  Undo all and Run Agent;
- working: while Apply rules with Agent runs.
The tile moves a little (a soft ring, a blink, a spark; a sweep and a
breath while working), never a rotating ring, and not at all with reduced
motion. The card wraps on a narrow page; Accept all and Run Agent are the
primary buttons.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Run Agent on the card keeps to one agent run at a time and says why it
  waits; Apply rules never starts beside another run or before the locked
  passages are read.
- Ghost buttons show their hover on the card's grey; the tile and its
  count are hidden from screen readers (the title says it) and the count
  is darker for contrast; "+N more" comes from en.json, the reason's first
  letter is upper-cased in the page's locale.
- Review picks the first open suggestion in the page's order and focuses
  it; the sweep shows on the light tile in dark mode; the spark is slower
  once all are reviewed; without motion the working line is a faint full
  line; "0 still open" isn't said.
- globals.css keeps its own lines; only the motion block is added.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…split Run Agent

Content Editor v1.1 part 2 (CE-028–CE-031): the side panel's tabs become
Instructions · Sources · Live page. Instructions holds Brief | Rules, with
the rules still open on the tab and the segment. Each segment opens with a
status card: Rules has one split Run Agent ▾ (Fix open rules, or Rewrite
the whole page, which renames it "Rewrite page") in place of the two rule
buttons; Brief has Run Agent while empty and Rebuild brief once written.
Why the agent can't run is written under the card, and each card's ⓘ tip
opens below it. The brief shows "Not set yet" and its Length in characters
and about as many words; the toolbar counter adds the page's words.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Run Agent's choice is worked out once and falls back to Fix without a
  rewrite; once a rewrite starts, the button is back on Fix.
- ▾'s choices are menu radio items; Fix is off when only rules the agent
  can't fix are open, and the card says what to do instead.
- The reason line under the card stays mounted for screen readers; Rewrite
  from brief writes its reason too; the tab's count is read out.
- Brief | Rules switch with the arrow keys, one tab stop.
- An edited brief's rebuild question sits under the card; a brief without
  H2s says to rebuild it; an empty brief shows no origin line.
- Plural copy for the open suggestions and the counter's words; rule names
  joined by the formatter; Run Agent's tip leaves ▾ out without a rewrite.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Content Editor v1.1 part 3 (CE-032, CE-034): under each Run Agent card,
"Uses your data: 1 prompt · 21 fan-outs · 20 cited pages · 10 Search
Console queries · Edit sources", counted as the Sources tab keeps them, so
turning one off lowers it at once. The Sources tab carries its count, and
its top says "N sources in use" and when the Content Agent last wrote from
them (its latest suggestions or the brief it built). A first visit's note
at the top of Instructions says the agent writes from the person's data;
closing it is kept in their own user metadata.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- "Last used by Content Agent" also counts the agent writing the page
  (agent_state_at: Start with Agent, Rewrite from brief on a new page),
  not a run that failed; a value that isn't a date is skipped.
- The latest batch's time is its first suggestion's, not a sort per render.
- Tests: the Brief segment's line, no line while the sources can't be read,
  the tab's count, the note showing again after a failed write, and a
  suggestion read with its createdAt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… name them

Content Editor v1.1, CE-033 (server): Fix open rules, Start with Agent and
Rewrite the whole page read the sources the Sources tab keeps, numbered
S1, S2… (content-sources.js). Each suggestion keeps the sources it names
and the words each supports (content_draft_suggestions.sources and
source_marks, 00248); a page rewritten whole keeps its sources.

No number without a source: the model reads a source by its words only, so
a number the agent adds must be the page's, the brand's, the brief's, the
rules', today's, or in a source's own words (then marked to it). A
suggestion with any other number is not kept; a page written whole gets a
placeholder in its place. Source numbers written into the words are taken
out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Content Editor v1.1, CE-033 (web) and the rest of CE-034: under each
suggestion, "Based on" chips name the sources it used (number, kind, name;
the Sources tab's details on hover), and a small number marks the words
each supports. A click on either opens Sources on that row, scrolled to
and ringed for a moment, once. The agent card adds "built from N of your
sources · See sources". Fix open rules sends the kept sources, and the
first-visit note says every change shows the sources it used.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Content Editor v1.1, CE-027/035 (server): each Content Agent run (Fix open
rules, Start with Agent, Rewrite the whole page, the brief) is written in
content_agent_runs (00249) with its steps named by the data it reads
("Reading 20 cited pages", "Matching 21 fan-outs", "Writing 3 changes") as
it reaches them. POST /api/content-drafts/:id/stop marks the run stopped
and aborts its model call; the run checks before it keeps anything, so a
stopped run changes nothing (no suggestions, page, brief or History).

A run that can't be written still runs; runs a stopped server left are
closed when the next starts, and Stop ignores them. Background runs are
written before Start answers, so Stop finds them at once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Stop also clears the draft's 'writing' state at once: a background run lets
go once it sees the stop, but one no server holds any more never would, and
the waiting page would wait out the 10 minutes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…p it (CE-027, CE-035)

The agent card, the brief and the waiting page show the run's real steps
(content_agent_runs, read from the browser every second) and a Stop button
that ends the run through the API proxy, leaving the page as it was. A dashed
decoration under the H1 says where Fix is drafting, and the agent's dots
replace every spinner on its buttons.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…h (CE-030)

When the brief is rebuilt, the server reads the first few cited pages kept
in Sources (only addresses AI answers cited for the brand, never the draft's
own page), counts their main text as the Rules tab counts length, and saves
the median as brief.citedLength. The Brief tab says "From the rules · cited
pages average N characters"; with fewer than two pages read it stays "From
the rules". textLength moves to page-content.js to avoid an import cycle.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	server/src/lib/content-writer.js
#	server/src/lib/content-writer.test.js
#	supabase/schema.sql
…le it writes

content_drafts.agent_run ('write' or 'rewrite', in 00247 and its guard) is
set when Start or a rewrite claims the draft, so every device knows a failed
rewrite from a failed Start. Fix open rules and the MCP suggest call answer
409 'writing' while a run holds the draft, so its answer is never dropped
after it was charged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…le it writes

content_drafts.agent_run ('write' or 'rewrite', in 00247 and its guard) is
set when Start or a rewrite claims the draft, so every device knows a failed
rewrite from a failed Start. Fix open rules and the MCP suggest call answer
409 'writing' while a run holds the draft, so its answer is never dropped
after it was charged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…st batch's rows

The editor reads content_drafts.agent_run, so a failed rewrite is tried again
as one on every device (the localStorage mark is gone). Fix open rules' new
409 'writing' says the agent is already writing. getDraftSuggestions finds
the latest batch first and reads only its rows, and Compare's links can't
take focus.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The card's Run Agent writes its reason in the card's second line (amber, tied
to the button by aria-describedby) instead of a hover title, and is turned
off when the only rules left open are ones the agent doesn't fix (one H1),
as the Rules card does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cihan-gyk added a commit to cihan-gyk/ansvisor that referenced this pull request Oct 23, 2026
ansvisor#1416's review fix reads "1 of 1 dated source is over 24 months old".

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

Copy link
Copy Markdown
Collaborator Author

@gkhngyk Fixed, and main merged.

  1. Figures that aren't claims are stripped before figures are looked for:
    • a percentage after "save" or before off/discount/APR/APY;
    • 100% unless "of" follows;
    • 4K/8K and 401k/401(k);
    • an amount with a magnitude followed by / or "per".
    • All eight sentences are in plain. "100% of our customers renewed." stays a claim.
  2. Trust is scored only once claimsSourced or freshSources is live. A broken link is still listed before that, with trustGain taking its gain out of the 40 Phase 1 points: "+8 Trust" while Trust reads "Not scored yet".
  3. Copy:
    • "{count} of {total} dated source(s) is/are…" with both plurals;
    • "Link each figure's source…".

Deploy: after #1415's 00258 and its server.

gkhngyk
gkhngyk previously approved these changes Oct 23, 2026

@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. All items done:

  1. Figures that aren't claims. I ran all eight sentences through trust(), and none counts as a figure now. "100% of our customers renewed." and "Get 50% off and 20% more reach." still count.
  2. Trust is scored only with a figure or a dated source (quality-checks.ts:315). A page with one link and no figure isn't scored, and its broken link is listed at +8 (trustGain, :100). Add a figure, and the same dead link gives 91, with the same gain from trustGain and scoreGain.
  3. Copy. "1 of 1 dated source is" and "2 of 3 dated sources are" both read right, and the detail now says "Link each figure's source…".

Follow-ups (low, not blocking):

  • A few real claims now count as no figure:

    • "Teams save 30% of their time with it." The save rule has no of exception, unlike the 100% one.
    • "Sales rose 100% in 2025." and "A 100% increase in traffic." The 100% rule removes these.
    • "Clients saved $3 million per year." The price rule includes million and billion.

    Fixes for quality-checks.ts:155-161:

    • add (?!\s*of\b) to the save rule;
    • keep 100% as a figure after rose, grew, up or by, and before increase or growth;
    • limit the price rule to k amounts.

    Then add these sentences to claims (quality-checks.test.ts:161).

  • Copy. checks.freshSources.detail says "Swap them" when only one source is stale (en.json:4145). Pass count and use {count, plural, one {Swap it} other {Swap them}}.

The merges carry nothing beyond their parents (466553a, 6773824). One merge, b9889ee, resolves the _quality-tab.test.tsx conflict by keeping both tests. It merges cleanly on main.

Merge note: deploy after #1415's 00258 and its server.

@gkhngyk
gkhngyk dismissed their stale review October 23, 2026 21:06

The merge-base changed after approval.

@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.

Re-approving after merging main into the branch. The merge only brings in the squashed parent PR; the tree matches the one tested (web and server tests, typecheck, lint, format).

@github-actions github-actions Bot removed the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 23, 2026
@gkhngyk
gkhngyk merged commit 8bbf0da into ansvisor:main Oct 23, 2026
4 of 5 checks passed
gkhngyk added a commit that referenced this pull request Oct 23, 2026
…-LD to paste (CE-041) (#1420)

* feat(billing): show this period's AI usage on the Billing page

The workspace's one AI budget (Improve, the Content Editor's AI and the
Action Center's task writer) had no meter: the first sign of it was an
"AI usage is used up" error. Migration 00242 records what each AI call
was for (prompt_improve_usage.feature, backfilled) and sums the period's
spend by feature (ai_usage_by_feature). GET /api/billing/ai-usage
returns the shares of the plan's budget, and the Billing page shows the
share used, when it resets and what used it, with Agent Chat noted as
running on the workspace's own key.

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

* fix(billing): hold an AI call's share of the budget before it runs

The workspace's AI budget was checked by reading the period's spend; the
call's cost was written once the model answered. Calls running at once
(two tabs, a teammate, an Action Center sweep) all read the same spend
and all ran past the budget. 00243's reserve_ai_usage takes a
per-organization lock, reads the spend with the calls in flight, and
holds the call's estimated cost; reserveAiBudget turns the hold into the
real cost or releases it. Improve, the brief rebuild, Apply rules with
Agent, Start Agent and the Action Center task writer use it in place of
enforceImproveQuota, which goes.

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

* fix(billing): charge a schema miss and hold the org's recent median cost

Review fixes:
- Apply rules with Agent and Start Agent charge an answer the provider
  billed but that missed the schema (NoObjectGeneratedError), as Improve,
  the brief and the task writer do; before, the hold was let go and the
  call ran free.
- A call holds the org's median cost over its last 20 calls this period,
  never less than the model's typical cost, so calls in flight pass the
  budget by far less.

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

* feat(content): rewrite a whole page to its rules as one suggestion

Apply rules with Agent makes at most 8 small edits a run, which can't
bring a long page to its Length (about 2% a run on prod). The Content
Agent can now rewrite the whole page in one background call, left as ONE
suggestion (kind 'page', migration 00247) to compare and accept or reject:
- POST /api/content-drafts/:draftId/rewrite, through Start Agent's claim,
  budget hold and background run;
- passages AI quotes today, tables, images, quotes and HTML blocks go to
  the model as [[KEEP n]] lines and come back as they were; a rewrite that
  drops one fails the run;
- one H1, only the page's own links and the ones offered, the editor's
  tags; the page as it was is kept on the suggestion (before_html).

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

* fix(content): describe a rewrite's kept blocks and count them toward Length

Review fixes:
- Kept blocks are described under the page (a quoted passage's words, a
  table's rows, an image's alt) and their text counts toward Length, so a
  rewrite aims at the whole page's length; with Length off it keeps the
  page's own. A kept H1 stays first, and the page's language is kept.
- The answer is taken out of a code fence, text left at its root goes in
  paragraphs, and an answer in Markdown fails the run.
- The page's own links stay exactly as written (query and anchor too).
- Kept blocks go back untouched (an empty table cell stays), only the
  page's first H1 counts as its title, a page that writes "[[KEEP" gets
  markers of its own, and a page that is only kept blocks isn't sent.

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

* feat(content): rewrite the page to its rules from the Rules tab, and compare it

The Rules tab opens with the agent's two ways to meet its rules: Apply
rules with Agent (small edits, up to 8 a run) and Rewrite the page to
these rules (the whole page as one change). The rewrite is recommended,
with a one-line reason, when the page is more than 30% off its Length or
4 rules or more are open.

A rewritten page comes back as one suggestion with its own bar over the
page: the characters before and after and the agent's reason, Compare
(the page and the rewrite side by side), Accept (History keeps the page
first), Reject, and Undo. A page that changed since the agent read it
isn't written over. The page waits for the rewrite with its own steps,
and a failed rewrite's Try again rewrites again.

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

* fix(content): compare a rewrite by its words and run one agent at a time

Review fixes:
- A page is compared with the one the agent read by its words, with a
  space between blocks, so stored line breaks and lists don't read as a
  change (Accept and Undo were refused on imported pages).
- One agent run at a time from the page; a rewrite never starts before
  the locked passages are read, and sends the editor's own locked keys.
- Accept holds the page still from the start and checks it again before
  putting the rewrite in; Undo puts the page back as it was (two H1s too),
  and the bar waits while the HTML view is open.
- No rewrite advice for an empty page or one too long to send whole; the
  rewrite mark survives a reload; the waiting view says the rewrite waits
  in the editor; Compare's links don't navigate.

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

* feat(content): show the Content Agent as a card over the page

Content Editor v1.1, part 1 (CE-025, CE-026, §4): the agent row and the
rewrite bar become one card above the toolbar, in three states:
- waiting: "Content Agent has {n} suggestions for you", what they change
  and the rules they gain ("Rules 5 → 6 of 13"), with Review (scrolls to
  the first suggestion and marks it), Reject all and Accept all; a page
  rewritten shows its characters, with Compare;
- all reviewed: what was accepted and the rules met and still open, with
  Undo all and Run Agent;
- working: while Apply rules with Agent runs.
The tile moves a little (a soft ring, a blink, a spark; a sweep and a
breath while working), never a rotating ring, and not at all with reduced
motion. The card wraps on a narrow page; Accept all and Run Agent are the
primary buttons.

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

* fix(content): agent card review fixes

- Run Agent on the card keeps to one agent run at a time and says why it
  waits; Apply rules never starts beside another run or before the locked
  passages are read.
- Ghost buttons show their hover on the card's grey; the tile and its
  count are hidden from screen readers (the title says it) and the count
  is darker for contrast; "+N more" comes from en.json, the reason's first
  letter is upper-cased in the page's locale.
- Review picks the first open suggestion in the page's order and focuses
  it; the sweep shows on the light tile in dark mode; the spark is slower
  once all are reviewed; without motion the working line is a faint full
  line; "0 still open" isn't said.
- globals.css keeps its own lines; only the motion block is added.

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

* feat(content): put brief and rules under one Instructions tab with a split Run Agent

Content Editor v1.1 part 2 (CE-028–CE-031): the side panel's tabs become
Instructions · Sources · Live page. Instructions holds Brief | Rules, with
the rules still open on the tab and the segment. Each segment opens with a
status card: Rules has one split Run Agent ▾ (Fix open rules, or Rewrite
the whole page, which renames it "Rewrite page") in place of the two rule
buttons; Brief has Run Agent while empty and Rebuild brief once written.
Why the agent can't run is written under the card, and each card's ⓘ tip
opens below it. The brief shows "Not set yet" and its Length in characters
and about as many words; the toolbar counter adds the page's words.

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

* fix(content): instructions tab review fixes

- Run Agent's choice is worked out once and falls back to Fix without a
  rewrite; once a rewrite starts, the button is back on Fix.
- ▾'s choices are menu radio items; Fix is off when only rules the agent
  can't fix are open, and the card says what to do instead.
- The reason line under the card stays mounted for screen readers; Rewrite
  from brief writes its reason too; the tab's count is read out.
- Brief | Rules switch with the arrow keys, one tab stop.
- An edited brief's rebuild question sits under the card; a brief without
  H2s says to rebuild it; an empty brief shows no origin line.
- Plural copy for the open suggestions and the counter's words; rule names
  joined by the formatter; Run Agent's tip leaves ▾ out without a rewrite.

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

* feat(content): show the data the Content Agent writes from

Content Editor v1.1 part 3 (CE-032, CE-034): under each Run Agent card,
"Uses your data: 1 prompt · 21 fan-outs · 20 cited pages · 10 Search
Console queries · Edit sources", counted as the Sources tab keeps them, so
turning one off lowers it at once. The Sources tab carries its count, and
its top says "N sources in use" and when the Content Agent last wrote from
them (its latest suggestions or the brief it built). A first visit's note
at the top of Instructions says the agent writes from the person's data;
closing it is kept in their own user metadata.

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

* fix(content): data note review fixes

- "Last used by Content Agent" also counts the agent writing the page
  (agent_state_at: Start with Agent, Rewrite from brief on a new page),
  not a run that failed; a value that isn't a date is skipped.
- The latest batch's time is its first suggestion's, not a sort per render.
- Tests: the Brief segment's line, no line while the sources can't be read,
  the tab's count, the note showing again after a failed write, and a
  suggestion read with its createdAt.

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

* feat(content): have the Content Agent write from the kept sources and name them

Content Editor v1.1, CE-033 (server): Fix open rules, Start with Agent and
Rewrite the whole page read the sources the Sources tab keeps, numbered
S1, S2… (content-sources.js). Each suggestion keeps the sources it names
and the words each supports (content_draft_suggestions.sources and
source_marks, 00248); a page rewritten whole keeps its sources.

No number without a source: the model reads a source by its words only, so
a number the agent adds must be the page's, the brand's, the brief's, the
rules', today's, or in a source's own words (then marked to it). A
suggestion with any other number is not kept; a page written whole gets a
placeholder in its place. Source numbers written into the words are taken
out.

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

* feat(content): show what each agent suggestion was written from

Content Editor v1.1, CE-033 (web) and the rest of CE-034: under each
suggestion, "Based on" chips name the sources it used (number, kind, name;
the Sources tab's details on hover), and a small number marks the words
each supports. A click on either opens Sources on that row, scrolled to
and ringed for a moment, once. The agent card adds "built from N of your
sources · See sources". Fix open rules sends the kept sources, and the
first-visit note says every change shows the sources it used.

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

* feat(content): write the Content Agent's runs step by step and stop them

Content Editor v1.1, CE-027/035 (server): each Content Agent run (Fix open
rules, Start with Agent, Rewrite the whole page, the brief) is written in
content_agent_runs (00249) with its steps named by the data it reads
("Reading 20 cited pages", "Matching 21 fan-outs", "Writing 3 changes") as
it reaches them. POST /api/content-drafts/:id/stop marks the run stopped
and aborts its model call; the run checks before it keeps anything, so a
stopped run changes nothing (no suggestions, page, brief or History).

A run that can't be written still runs; runs a stopped server left are
closed when the next starts, and Stop ignores them. Background runs are
written before Start answers, so Stop finds them at once.

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

* fix(content): let go of a background draft when its run is stopped

Stop also clears the draft's 'writing' state at once: a background run lets
go once it sees the stop, but one no server holds any more never would, and
the waiting page would wait out the 10 minutes.

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

* feat(content): show the content agent's steps while it works, and stop it (CE-027, CE-035)

The agent card, the brief and the waiting page show the run's real steps
(content_agent_runs, read from the browser every second) and a Stop button
that ends the run through the API proxy, leaving the page as it was. A dashed
decoration under the H1 says where Fix is drafting, and the agent's dots
replace every spinner on its buttons.

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

* feat(content): show the cited pages' length next to the brief's Length (CE-030)

When the brief is rebuilt, the server reads the first few cited pages kept
in Sources (only addresses AI answers cited for the brand, never the draft's
own page), counts their main text as the Rules tab counts length, and saves
the median as brief.citedLength. The Brief tab says "From the rules · cited
pages average N characters"; with fewer than two pages read it stays "From
the rules". textLength moves to page-content.js to avoid an import cycle.

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

* fix(content): record which run holds a draft, and keep Fix off it while it writes

content_drafts.agent_run ('write' or 'rewrite', in 00247 and its guard) is
set when Start or a rewrite claims the draft, so every device knows a failed
rewrite from a failed Start. Fix open rules and the MCP suggest call answer
409 'writing' while a run holds the draft, so its answer is never dropped
after it was charged.

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

* fix(content): record which run holds a draft, and keep Fix off it while it writes

content_drafts.agent_run ('write' or 'rewrite', in 00247 and its guard) is
set when Start or a rewrite claims the draft, so every device knows a failed
rewrite from a failed Start. Fix open rules and the MCP suggest call answer
409 'writing' while a run holds the draft, so its answer is never dropped
after it was charged.

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

* fix(content): read a failed rewrite from the draft, and only the latest batch's rows

The editor reads content_drafts.agent_run, so a failed rewrite is tried again
as one on every device (the localStorage mark is gone). Fix open rules' new
409 'writing' says the agent is already writing. getDraftSuggestions finds
the latest batch first and reads only its rows, and Compare's links can't
take focus.

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

* fix(content): say in the agent card why Run Agent won't run

The card's Run Agent writes its reason in the card's second line (amber, tied
to the button by aria-describedby) instead of a hover title, and is turned
off when the only rules left open are ones the agent doesn't fix (one H1),
as the Rules card does.

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

* chore(content): keep AddSourceInput as Prettier formats it

A merge brought in a line formatted by another Prettier version; this puts
back main's formatting, so format:check passes.

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

* fix(content): recommend no Run Agent choice that is turned off

With only One H1 open and no rewrite advice, ▾ no longer shows the disabled
Fix as Recommended.

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

* fix(content): match an added figure by its unit, and read none from dates, addresses or words

A claim (a %, a ×, a scale, a currency) is known only with the same unit or
sign, so a fan-out's "crm for 50 users" no longer sources "50%". Today adds
only its year. A cited page's address is no words of its own. The brand's
name and industry are known, digits stuck to a letter ("B2B", "H2") are no
figure, and a source number written into a reason is taken out.

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

* feat(content): name the agent's steps by the work the server does

Short names for what each run does (CE-027/035): Fix and a rewrite read the
rules, gather the sources (numbered, so a number can be checked), write, and
check what they wrote (a number needs a source, a link must be allowed, a
locked passage stays). The brief gathers, writes the outline and matches
fan-outs. "Reading 20 cited pages" is gone: the agent sees their addresses,
not their content.

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

* fix(content): name the Rules tab's button as it reads now in a test and two lines

A test from main still pressed "Apply rules with Agent", and two messages
still named it; the button is Run Agent, its default Fix open rules.

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

* fix(content): charge a call Stop aborted, end only a run's own claim, and stop the run named

- A Stop that aborts a model call already sent keeps its hold on the AI
  budget as its cost (reserveAiBudget's keep()), since the provider bills
  it; a run stopped before its call sends nothing (runCall).
- A background run ends only the claim it still holds (agent_state_at), so
  one stopped from another server never clears a newer run's.
- A run closes only runs a stopped server left (older than RUN_STALE_MS),
  and /stop takes an optional runId, so another tab's run goes on.

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

* feat(content): show the steps by their new names, and stop the run the editor shows

The step chips read the server's short names (Reading 4 rules, Gathering 52
sources, Writing changes, Checking sources). Stop sends the run's id, so
another tab's run goes on. The waiting page keeps the run's last steps and
reads the draft as soon as its run ends, and a hidden tab reads the run every
AGENT_POLL_MS, then at once when it shows again.

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

* test(content): read the hook's run from what it renders

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

* fix(content): call the cited-page figure the median it is, and stop its reads with the run

The Brief's Length now says "a typical cited page has N characters (median of
M)". A Stop settles the cited-page read on nothing at once: the run's signal
ends each page read (fetchPage takes a signal beside its timeout), so a fast
model answer followed by a Stop never waits on them.

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

* fix(content): show loading without a spinning ring anywhere in Content

Every Loader2 spinner in Content (the editor, Library, Plan, the content
page and its dialogs and menus, the webhook settings) is now LoadingDots:
three dots that bounce in turn, in the text's color, still with reduced
motion, as the Content Editor brief asks ("no spinning ring anywhere"). The
agent's WorkingDots are built on it.

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

* feat(content): read the draft's Readability and show it in Instructions › Quality (CE-036, CE-039)

Quality spec Phase 1, behind NEXT_PUBLIC_CONTENT_QUALITY_PHASE (off unset):
- readability.ts: seven checks read from the draft in the browser, no AI
  cost — average sentence 15–20 words, none over 35, reading level by the
  language's formula (Flesch, Ateşman, Amstad, Kandel–Moles,
  Fernández-Huerta; else sentence and word length), answer first, short
  paragraphs, a heading every 200–300 words, passive voice and jargon
  (English). A check a language can't be read for is left out and the
  score rescaled to 100.
- Instructions gets a Quality segment: the score with its band (80+
  Strong, 60–79 Can improve, under 60 Needs work), "Ansvisor estimates
  based on Google's published quality signals. Not a Google score.", and
  what would raise it, the biggest gain first, with Show.
- The header gets a "Quality {score}" chip that opens it.

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

* fix(content): read Readability from the page's own blocks, and show a passage by its block

- A quote's and a list item's paragraphs are read apart (the editor's HTML
  has no space between tags) and a nested list once; sentence length is
  measured on running text, a list's points aside, and a page of short
  sentences is asked to join some.
- Fernández-Huerta subtracts words per sentence (the corrected form).
- Answer first skips an empty line, fails without an H1, and reads an H1's
  subject without its question and common words.
- Abbreviations don't end a sentence; "-ted" keeps its syllable, French
  "-ent" is no silent ending, Turkish â î û are vowels; "is indeed" isn't
  passive, jargon is read in all its forms, and Show goes to what falls short.
- Show finds the passage's block in the page (never a suggestion's card)
  and marks it with a decoration; the band is read out with the chip and
  the segment's badge.

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

* fix(content): count a passive sentence that says not or never in Readability

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

* feat(content): add Settings › Authors, the real people a page is by (CE-037)

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

* fix(content): let whoever added an author edit it, link only yourself, and renumber to 00251

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

* feat(content): name the page's author in the editor's header and a Page info strip outside the page (CE-038)

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

* fix(content): keep the Page info strip right under the H1, count authors' pages only in Settings

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

* fix(content): draw the Page info strip as the mockup's one line, with the author's face and title at the brand

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

* feat(content): score E-E-A-T from the page's author and Trust from the agent's sourced claims in Quality (CE-039)

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

* fix(content): score only checks that can fail: no Trust and no author schema until they read the page

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

* fix(content): say only what an author's profile is missing in Quality

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

* feat(content): read a draft's links once a day for Trust: working or broken, and their page's date

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

* fix(content): read only a saved draft's links, a few at a time and within a budget, and date pages by their own entity

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

* feat(content): score Trust from the page's sourced figures, fresh sources and working links (CE-039)

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

* fix(content): reserve link reads up front, say which links are never read, and date an article before its page

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

* fix(content): compare links as the draft saves them, count each link and sentence once, and read prices and sizes as no figures

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

* feat(audit): read a brand's site trust: About, Contact, editorial policy, Organization schema and author pages (CE-043)

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

* fix(audit): read site trust in parallel and once per brand, tell a page from the home page, and re-read a partial read soon

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

* feat(audit): show Site trust n/5 in Site Audit, and count it in Quality's Trust (CE-043)

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

* fix(audit): scroll to Site trust from Quality, keep it per brand, say when checking again fails, and count it only beside the page's own Trust

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

* fix(audit): give the Site trust card its own key beside the auto-run notice

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

* feat(content): list what only you can do in Quality, and nudge the next one (CE-040)

Your to-dos in Instructions › Quality: picking the page's author (or adding
one) and completing their profile move out of the suggestions, with a box
the checks tick and E-E-A-T's gain. A dark "Next for you" pill names the
first open one when the agent's run ends (not a failed or stopped one),
when the last open suggestion is accepted (Accept all, one by one, or the
page rewrite) and on Mark ready, once per moment and to-do in the session;
Later hides it. Its words go to a status kept on the page for screen
readers.

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

* feat(content): check the page before it's marked ready, with its JSON-LD to paste (CE-041)

Before you publish opens on Mark ready once Quality is live: a warning
only when Trust is under 60 (the check that raises it most, and to about
what), a note while the page's links are still being read, what the CMS
does for the page (author, visible dates, schema), and for an article an
Article JSON-LD from the title, author, brand, its image and today's date
(Person with sameAs, or the brand's Organization; no author while the
authors aren't read; a live page keeps its published date) with Copy
JSON-LD. Fix first goes to Quality and puts the caret at the passage.
Mark ready anyway is logged with the page's Trust and the check named
(00255 content_draft_ready_log: members add rows as themselves for a
ready draft, three columns only). useLinkChecks also says how many reads
may still come.

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

* fix(content): keep the loading dots visible with reduced motion

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

* fix(content): check author profile links in the table, unlink a removed member and revoke anon

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

* fix(content): let a Stop go only of the claim the stopped run holds

A Stop that named a Fix or brief run cleared agent_state whatever the run
was, so a Start or Rewrite on the same draft went on without its claim.
Each run now carries the claim it holds (content_agent_runs.claimed_at,
00249), stopDraftRun answers it, and the route clears agent_state only
where agent_state_at is still that claim.

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

* fix(content): say in the Remove dialog that the author's pages go back to the team byline

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

* fix(content): date a page over the read cap from its start, and count a private-address link as broken

fetchPage gets an opt-in truncate that resolves with the first maxBytes
instead of refusing the page, and the link check uses it, so a large
article page still gives its date and stays working. A link the fetch
refuses as a private or local address reads as broken, since no reader
of the published page can open it; a non-standard port stays unknown.

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

* fix(content): offer Edit author in Quality only to who can edit that author, and say who can otherwise

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

* fix(content): read discounts, materials and short forms as no figures, and score Trust only with a figure or a dated source

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

* fix(audit): read a bot wall as unsure, read a walled home page through Scrape.do once a day, and look for author pages at the usual addresses

A 401/403/429, or a 200 challenge page, now leaves the read incomplete
instead of failing About, Contact, Editorial or Organization schema for a
day (looksBlocked from site-pages.js). A walled home page goes through
Scrape.do, unrendered, at most once a day per brand (site_trust.scraped_at),
and a pass it read stands for that day while the wall hides the page.
An author the page list has no page for is looked for at /author/<slug>
and /authors/<slug> (a few authors per read), with the probes' guards and
their name in the title or H1. readSiteTrust returns complete, so the web
can tell a partial read from a fix to make.

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

* fix(audit): hold Check again until the read can change, say when the site didn't answer, and say Site trust counts in Quality

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

* fix(content): leave a placeholder title out of the JSON-LD headline, and say why

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

* fix(content): read Readability in the draft's language, and split its sentences where they end

- Japanese, Chinese and Thai, written without spaces between words, get no
  score: Quality says "Readability isn't read for this language yet"
  instead of asking for more paragraphs. Sentences also end after 。!?,
  । and ؟, and a Hindi word keeps its vowel signs, so Hindi is read by its
  own sentences and words.
- The language is the draft's Language rule when it is on, else the
  brand's; every brand language's name is read ("Portuguese", "Brazilian
  Portuguese", "日本語"…).
- A sentence doesn't end before a lower-case word, nor at a German or
  Turkish ordinal ("am 3. Oktober") or a language's common abbreviations
  ("z. B.", "p. ex.", "örn."); one before a number only ("No. 5") counts
  there. A full stop before a closing quote or bracket ends one.
- Show goes to the first copy of a passage, and a second Show within the
  moment keeps its mark for the full time.
- Passive voice reads common irregular participles (sent, found, held…).

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

* fix(content): offer Edit author on the profile to-do only to who can edit the author

#1414's review fix moved here: the to-dos replaced E-E-A-T's suggestions,
so the to-do now carries the rule (whoever added the author, the author
themself or an admin) and tells anyone else who can.

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

* test(content): expect the dated source line's corrected plural

#1416's review fix reads "1 of 1 dated source is over 24 months old".

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

* fix(content): pass the nudge whether the member can edit the author

Its to-do text names who can complete the profile when they can't.

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

* test(content): give Before you publish's quality read whether the member can edit the author

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

* chore(content): type the agent run's claimed_at

#1400 adds the column to 00249.

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]>
gkhngyk added a commit that referenced this pull request Oct 23, 2026
…s (CE-044) (#1421)

* feat(billing): show this period's AI usage on the Billing page

The workspace's one AI budget (Improve, the Content Editor's AI and the
Action Center's task writer) had no meter: the first sign of it was an
"AI usage is used up" error. Migration 00242 records what each AI call
was for (prompt_improve_usage.feature, backfilled) and sums the period's
spend by feature (ai_usage_by_feature). GET /api/billing/ai-usage
returns the shares of the plan's budget, and the Billing page shows the
share used, when it resets and what used it, with Agent Chat noted as
running on the workspace's own key.

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

* fix(billing): hold an AI call's share of the budget before it runs

The workspace's AI budget was checked by reading the period's spend; the
call's cost was written once the model answered. Calls running at once
(two tabs, a teammate, an Action Center sweep) all read the same spend
and all ran past the budget. 00243's reserve_ai_usage takes a
per-organization lock, reads the spend with the calls in flight, and
holds the call's estimated cost; reserveAiBudget turns the hold into the
real cost or releases it. Improve, the brief rebuild, Apply rules with
Agent, Start Agent and the Action Center task writer use it in place of
enforceImproveQuota, which goes.

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

* fix(billing): charge a schema miss and hold the org's recent median cost

Review fixes:
- Apply rules with Agent and Start Agent charge an answer the provider
  billed but that missed the schema (NoObjectGeneratedError), as Improve,
  the brief and the task writer do; before, the hold was let go and the
  call ran free.
- A call holds the org's median cost over its last 20 calls this period,
  never less than the model's typical cost, so calls in flight pass the
  budget by far less.

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

* feat(content): rewrite a whole page to its rules as one suggestion

Apply rules with Agent makes at most 8 small edits a run, which can't
bring a long page to its Length (about 2% a run on prod). The Content
Agent can now rewrite the whole page in one background call, left as ONE
suggestion (kind 'page', migration 00247) to compare and accept or reject:
- POST /api/content-drafts/:draftId/rewrite, through Start Agent's claim,
  budget hold and background run;
- passages AI quotes today, tables, images, quotes and HTML blocks go to
  the model as [[KEEP n]] lines and come back as they were; a rewrite that
  drops one fails the run;
- one H1, only the page's own links and the ones offered, the editor's
  tags; the page as it was is kept on the suggestion (before_html).

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

* fix(content): describe a rewrite's kept blocks and count them toward Length

Review fixes:
- Kept blocks are described under the page (a quoted passage's words, a
  table's rows, an image's alt) and their text counts toward Length, so a
  rewrite aims at the whole page's length; with Length off it keeps the
  page's own. A kept H1 stays first, and the page's language is kept.
- The answer is taken out of a code fence, text left at its root goes in
  paragraphs, and an answer in Markdown fails the run.
- The page's own links stay exactly as written (query and anchor too).
- Kept blocks go back untouched (an empty table cell stays), only the
  page's first H1 counts as its title, a page that writes "[[KEEP" gets
  markers of its own, and a page that is only kept blocks isn't sent.

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

* feat(content): rewrite the page to its rules from the Rules tab, and compare it

The Rules tab opens with the agent's two ways to meet its rules: Apply
rules with Agent (small edits, up to 8 a run) and Rewrite the page to
these rules (the whole page as one change). The rewrite is recommended,
with a one-line reason, when the page is more than 30% off its Length or
4 rules or more are open.

A rewritten page comes back as one suggestion with its own bar over the
page: the characters before and after and the agent's reason, Compare
(the page and the rewrite side by side), Accept (History keeps the page
first), Reject, and Undo. A page that changed since the agent read it
isn't written over. The page waits for the rewrite with its own steps,
and a failed rewrite's Try again rewrites again.

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

* fix(content): compare a rewrite by its words and run one agent at a time

Review fixes:
- A page is compared with the one the agent read by its words, with a
  space between blocks, so stored line breaks and lists don't read as a
  change (Accept and Undo were refused on imported pages).
- One agent run at a time from the page; a rewrite never starts before
  the locked passages are read, and sends the editor's own locked keys.
- Accept holds the page still from the start and checks it again before
  putting the rewrite in; Undo puts the page back as it was (two H1s too),
  and the bar waits while the HTML view is open.
- No rewrite advice for an empty page or one too long to send whole; the
  rewrite mark survives a reload; the waiting view says the rewrite waits
  in the editor; Compare's links don't navigate.

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

* feat(content): show the Content Agent as a card over the page

Content Editor v1.1, part 1 (CE-025, CE-026, §4): the agent row and the
rewrite bar become one card above the toolbar, in three states:
- waiting: "Content Agent has {n} suggestions for you", what they change
  and the rules they gain ("Rules 5 → 6 of 13"), with Review (scrolls to
  the first suggestion and marks it), Reject all and Accept all; a page
  rewritten shows its characters, with Compare;
- all reviewed: what was accepted and the rules met and still open, with
  Undo all and Run Agent;
- working: while Apply rules with Agent runs.
The tile moves a little (a soft ring, a blink, a spark; a sweep and a
breath while working), never a rotating ring, and not at all with reduced
motion. The card wraps on a narrow page; Accept all and Run Agent are the
primary buttons.

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

* fix(content): agent card review fixes

- Run Agent on the card keeps to one agent run at a time and says why it
  waits; Apply rules never starts beside another run or before the locked
  passages are read.
- Ghost buttons show their hover on the card's grey; the tile and its
  count are hidden from screen readers (the title says it) and the count
  is darker for contrast; "+N more" comes from en.json, the reason's first
  letter is upper-cased in the page's locale.
- Review picks the first open suggestion in the page's order and focuses
  it; the sweep shows on the light tile in dark mode; the spark is slower
  once all are reviewed; without motion the working line is a faint full
  line; "0 still open" isn't said.
- globals.css keeps its own lines; only the motion block is added.

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

* feat(content): put brief and rules under one Instructions tab with a split Run Agent

Content Editor v1.1 part 2 (CE-028–CE-031): the side panel's tabs become
Instructions · Sources · Live page. Instructions holds Brief | Rules, with
the rules still open on the tab and the segment. Each segment opens with a
status card: Rules has one split Run Agent ▾ (Fix open rules, or Rewrite
the whole page, which renames it "Rewrite page") in place of the two rule
buttons; Brief has Run Agent while empty and Rebuild brief once written.
Why the agent can't run is written under the card, and each card's ⓘ tip
opens below it. The brief shows "Not set yet" and its Length in characters
and about as many words; the toolbar counter adds the page's words.

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

* fix(content): instructions tab review fixes

- Run Agent's choice is worked out once and falls back to Fix without a
  rewrite; once a rewrite starts, the button is back on Fix.
- ▾'s choices are menu radio items; Fix is off when only rules the agent
  can't fix are open, and the card says what to do instead.
- The reason line under the card stays mounted for screen readers; Rewrite
  from brief writes its reason too; the tab's count is read out.
- Brief | Rules switch with the arrow keys, one tab stop.
- An edited brief's rebuild question sits under the card; a brief without
  H2s says to rebuild it; an empty brief shows no origin line.
- Plural copy for the open suggestions and the counter's words; rule names
  joined by the formatter; Run Agent's tip leaves ▾ out without a rewrite.

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

* feat(content): show the data the Content Agent writes from

Content Editor v1.1 part 3 (CE-032, CE-034): under each Run Agent card,
"Uses your data: 1 prompt · 21 fan-outs · 20 cited pages · 10 Search
Console queries · Edit sources", counted as the Sources tab keeps them, so
turning one off lowers it at once. The Sources tab carries its count, and
its top says "N sources in use" and when the Content Agent last wrote from
them (its latest suggestions or the brief it built). A first visit's note
at the top of Instructions says the agent writes from the person's data;
closing it is kept in their own user metadata.

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

* fix(content): data note review fixes

- "Last used by Content Agent" also counts the agent writing the page
  (agent_state_at: Start with Agent, Rewrite from brief on a new page),
  not a run that failed; a value that isn't a date is skipped.
- The latest batch's time is its first suggestion's, not a sort per render.
- Tests: the Brief segment's line, no line while the sources can't be read,
  the tab's count, the note showing again after a failed write, and a
  suggestion read with its createdAt.

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

* feat(content): have the Content Agent write from the kept sources and name them

Content Editor v1.1, CE-033 (server): Fix open rules, Start with Agent and
Rewrite the whole page read the sources the Sources tab keeps, numbered
S1, S2… (content-sources.js). Each suggestion keeps the sources it names
and the words each supports (content_draft_suggestions.sources and
source_marks, 00248); a page rewritten whole keeps its sources.

No number without a source: the model reads a source by its words only, so
a number the agent adds must be the page's, the brand's, the brief's, the
rules', today's, or in a source's own words (then marked to it). A
suggestion with any other number is not kept; a page written whole gets a
placeholder in its place. Source numbers written into the words are taken
out.

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

* feat(content): show what each agent suggestion was written from

Content Editor v1.1, CE-033 (web) and the rest of CE-034: under each
suggestion, "Based on" chips name the sources it used (number, kind, name;
the Sources tab's details on hover), and a small number marks the words
each supports. A click on either opens Sources on that row, scrolled to
and ringed for a moment, once. The agent card adds "built from N of your
sources · See sources". Fix open rules sends the kept sources, and the
first-visit note says every change shows the sources it used.

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

* feat(content): write the Content Agent's runs step by step and stop them

Content Editor v1.1, CE-027/035 (server): each Content Agent run (Fix open
rules, Start with Agent, Rewrite the whole page, the brief) is written in
content_agent_runs (00249) with its steps named by the data it reads
("Reading 20 cited pages", "Matching 21 fan-outs", "Writing 3 changes") as
it reaches them. POST /api/content-drafts/:id/stop marks the run stopped
and aborts its model call; the run checks before it keeps anything, so a
stopped run changes nothing (no suggestions, page, brief or History).

A run that can't be written still runs; runs a stopped server left are
closed when the next starts, and Stop ignores them. Background runs are
written before Start answers, so Stop finds them at once.

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

* fix(content): let go of a background draft when its run is stopped

Stop also clears the draft's 'writing' state at once: a background run lets
go once it sees the stop, but one no server holds any more never would, and
the waiting page would wait out the 10 minutes.

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

* feat(content): show the content agent's steps while it works, and stop it (CE-027, CE-035)

The agent card, the brief and the waiting page show the run's real steps
(content_agent_runs, read from the browser every second) and a Stop button
that ends the run through the API proxy, leaving the page as it was. A dashed
decoration under the H1 says where Fix is drafting, and the agent's dots
replace every spinner on its buttons.

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

* feat(content): show the cited pages' length next to the brief's Length (CE-030)

When the brief is rebuilt, the server reads the first few cited pages kept
in Sources (only addresses AI answers cited for the brand, never the draft's
own page), counts their main text as the Rules tab counts length, and saves
the median as brief.citedLength. The Brief tab says "From the rules · cited
pages average N characters"; with fewer than two pages read it stays "From
the rules". textLength moves to page-content.js to avoid an import cycle.

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

* fix(content): record which run holds a draft, and keep Fix off it while it writes

content_drafts.agent_run ('write' or 'rewrite', in 00247 and its guard) is
set when Start or a rewrite claims the draft, so every device knows a failed
rewrite from a failed Start. Fix open rules and the MCP suggest call answer
409 'writing' while a run holds the draft, so its answer is never dropped
after it was charged.

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

* fix(content): record which run holds a draft, and keep Fix off it while it writes

content_drafts.agent_run ('write' or 'rewrite', in 00247 and its guard) is
set when Start or a rewrite claims the draft, so every device knows a failed
rewrite from a failed Start. Fix open rules and the MCP suggest call answer
409 'writing' while a run holds the draft, so its answer is never dropped
after it was charged.

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

* fix(content): read a failed rewrite from the draft, and only the latest batch's rows

The editor reads content_drafts.agent_run, so a failed rewrite is tried again
as one on every device (the localStorage mark is gone). Fix open rules' new
409 'writing' says the agent is already writing. getDraftSuggestions finds
the latest batch first and reads only its rows, and Compare's links can't
take focus.

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

* fix(content): say in the agent card why Run Agent won't run

The card's Run Agent writes its reason in the card's second line (amber, tied
to the button by aria-describedby) instead of a hover title, and is turned
off when the only rules left open are ones the agent doesn't fix (one H1),
as the Rules card does.

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

* chore(content): keep AddSourceInput as Prettier formats it

A merge brought in a line formatted by another Prettier version; this puts
back main's formatting, so format:check passes.

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

* fix(content): recommend no Run Agent choice that is turned off

With only One H1 open and no rewrite advice, ▾ no longer shows the disabled
Fix as Recommended.

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

* fix(content): match an added figure by its unit, and read none from dates, addresses or words

A claim (a %, a ×, a scale, a currency) is known only with the same unit or
sign, so a fan-out's "crm for 50 users" no longer sources "50%". Today adds
only its year. A cited page's address is no words of its own. The brand's
name and industry are known, digits stuck to a letter ("B2B", "H2") are no
figure, and a source number written into a reason is taken out.

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

* feat(content): name the agent's steps by the work the server does

Short names for what each run does (CE-027/035): Fix and a rewrite read the
rules, gather the sources (numbered, so a number can be checked), write, and
check what they wrote (a number needs a source, a link must be allowed, a
locked passage stays). The brief gathers, writes the outline and matches
fan-outs. "Reading 20 cited pages" is gone: the agent sees their addresses,
not their content.

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

* fix(content): name the Rules tab's button as it reads now in a test and two lines

A test from main still pressed "Apply rules with Agent", and two messages
still named it; the button is Run Agent, its default Fix open rules.

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

* fix(content): charge a call Stop aborted, end only a run's own claim, and stop the run named

- A Stop that aborts a model call already sent keeps its hold on the AI
  budget as its cost (reserveAiBudget's keep()), since the provider bills
  it; a run stopped before its call sends nothing (runCall).
- A background run ends only the claim it still holds (agent_state_at), so
  one stopped from another server never clears a newer run's.
- A run closes only runs a stopped server left (older than RUN_STALE_MS),
  and /stop takes an optional runId, so another tab's run goes on.

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

* feat(content): show the steps by their new names, and stop the run the editor shows

The step chips read the server's short names (Reading 4 rules, Gathering 52
sources, Writing changes, Checking sources). Stop sends the run's id, so
another tab's run goes on. The waiting page keeps the run's last steps and
reads the draft as soon as its run ends, and a hidden tab reads the run every
AGENT_POLL_MS, then at once when it shows again.

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

* test(content): read the hook's run from what it renders

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

* fix(content): call the cited-page figure the median it is, and stop its reads with the run

The Brief's Length now says "a typical cited page has N characters (median of
M)". A Stop settles the cited-page read on nothing at once: the run's signal
ends each page read (fetchPage takes a signal beside its timeout), so a fast
model answer followed by a Stop never waits on them.

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

* fix(content): show loading without a spinning ring anywhere in Content

Every Loader2 spinner in Content (the editor, Library, Plan, the content
page and its dialogs and menus, the webhook settings) is now LoadingDots:
three dots that bounce in turn, in the text's color, still with reduced
motion, as the Content Editor brief asks ("no spinning ring anywhere"). The
agent's WorkingDots are built on it.

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

* feat(content): read the draft's Readability and show it in Instructions › Quality (CE-036, CE-039)

Quality spec Phase 1, behind NEXT_PUBLIC_CONTENT_QUALITY_PHASE (off unset):
- readability.ts: seven checks read from the draft in the browser, no AI
  cost — average sentence 15–20 words, none over 35, reading level by the
  language's formula (Flesch, Ateşman, Amstad, Kandel–Moles,
  Fernández-Huerta; else sentence and word length), answer first, short
  paragraphs, a heading every 200–300 words, passive voice and jargon
  (English). A check a language can't be read for is left out and the
  score rescaled to 100.
- Instructions gets a Quality segment: the score with its band (80+
  Strong, 60–79 Can improve, under 60 Needs work), "Ansvisor estimates
  based on Google's published quality signals. Not a Google score.", and
  what would raise it, the biggest gain first, with Show.
- The header gets a "Quality {score}" chip that opens it.

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

* fix(content): read Readability from the page's own blocks, and show a passage by its block

- A quote's and a list item's paragraphs are read apart (the editor's HTML
  has no space between tags) and a nested list once; sentence length is
  measured on running text, a list's points aside, and a page of short
  sentences is asked to join some.
- Fernández-Huerta subtracts words per sentence (the corrected form).
- Answer first skips an empty line, fails without an H1, and reads an H1's
  subject without its question and common words.
- Abbreviations don't end a sentence; "-ted" keeps its syllable, French
  "-ent" is no silent ending, Turkish â î û are vowels; "is indeed" isn't
  passive, jargon is read in all its forms, and Show goes to what falls short.
- Show finds the passage's block in the page (never a suggestion's card)
  and marks it with a decoration; the band is read out with the chip and
  the segment's badge.

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

* fix(content): count a passive sentence that says not or never in Readability

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

* feat(content): add Settings › Authors, the real people a page is by (CE-037)

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

* fix(content): let whoever added an author edit it, link only yourself, and renumber to 00251

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

* feat(content): name the page's author in the editor's header and a Page info strip outside the page (CE-038)

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

* fix(content): keep the Page info strip right under the H1, count authors' pages only in Settings

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

* fix(content): draw the Page info strip as the mockup's one line, with the author's face and title at the brand

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

* feat(content): score E-E-A-T from the page's author and Trust from the agent's sourced claims in Quality (CE-039)

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

* fix(content): score only checks that can fail: no Trust and no author schema until they read the page

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

* fix(content): say only what an author's profile is missing in Quality

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

* feat(content): read a draft's links once a day for Trust: working or broken, and their page's date

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

* fix(content): read only a saved draft's links, a few at a time and within a budget, and date pages by their own entity

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

* feat(content): score Trust from the page's sourced figures, fresh sources and working links (CE-039)

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

* fix(content): reserve link reads up front, say which links are never read, and date an article before its page

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

* fix(content): compare links as the draft saves them, count each link and sentence once, and read prices and sizes as no figures

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

* feat(audit): read a brand's site trust: About, Contact, editorial policy, Organization schema and author pages (CE-043)

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

* fix(audit): read site trust in parallel and once per brand, tell a page from the home page, and re-read a partial read soon

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

* feat(audit): show Site trust n/5 in Site Audit, and count it in Quality's Trust (CE-043)

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

* fix(audit): scroll to Site trust from Quality, keep it per brand, say when checking again fails, and count it only beside the page's own Trust

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

* fix(audit): give the Site trust card its own key beside the auto-run notice

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

* feat(content): list what only you can do in Quality, and nudge the next one (CE-040)

Your to-dos in Instructions › Quality: picking the page's author (or adding
one) and completing their profile move out of the suggestions, with a box
the checks tick and E-E-A-T's gain. A dark "Next for you" pill names the
first open one when the agent's run ends (not a failed or stopped one),
when the last open suggestion is accepted (Accept all, one by one, or the
page rewrite) and on Mark ready, once per moment and to-do in the session;
Later hides it. Its words go to a status kept on the page for screen
readers.

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

* feat(content): check the page before it's marked ready, with its JSON-LD to paste (CE-041)

Before you publish opens on Mark ready once Quality is live: a warning
only when Trust is under 60 (the check that raises it most, and to about
what), a note while the page's links are still being read, what the CMS
does for the page (author, visible dates, schema), and for an article an
Article JSON-LD from the title, author, brand, its image and today's date
(Person with sameAs, or the brand's Organization; no author while the
authors aren't read; a live page keeps its published date) with Copy
JSON-LD. Fix first goes to Quality and puts the caret at the passage.
Mark ready anyway is logged with the page's Trust and the check named
(00255 content_draft_ready_log: members add rows as themselves for a
ready draft, three columns only). useLinkChecks also says how many reads
may still come.

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

* feat(content): keep the Content Agent from inventing people and quotes (CE-044)

Every person's name and quoted sentence the agent writes is looked up in
what it was given: the page, the brand, the brief, the rules, the
person's data (Sources) and Settings › Authors. One that isn't becomes a
placeholder ("[name of a real person]", "[quote from a real person, with
its source]"): in Fix open rules' and the first optimize's suggestions,
read in their words as written before they are cleaned; in a page
written whole; and in a rewrite before what it kept goes back, so the
page's own passages are never touched.

A name is read where a person is plainly meant: an honorific, a role
("CEO Jane Doe", "Jane Doe, head of sales", "Jane Doe (CEO)"), or speech
("Jane Doe said", "according to Jane Doe", "Ayşe Yılmaz'a göre"); a
known author stays with the words before it, and a heading is read for
quotes and speech only. A quote is two words or more in quotation marks
next to speech, four or more anywhere, or a blockquote or <q> (its cite
read for the name), across the bold and the links in a line. One reading
per word keeps long text fast.

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

* fix(content): keep the loading dots visible with reduced motion

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

* fix(content): check author profile links in the table, unlink a removed member and revoke anon

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

* fix(content): let a Stop go only of the claim the stopped run holds

A Stop that named a Fix or brief run cleared agent_state whatever the run
was, so a Start or Rewrite on the same draft went on without its claim.
Each run now carries the claim it holds (content_agent_runs.claimed_at,
00249), stopDraftRun answers it, and the route clears agent_state only
where agent_state_at is still that claim.

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

* fix(content): say in the Remove dialog that the author's pages go back to the team byline

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

* fix(content): date a page over the read cap from its start, and count a private-address link as broken

fetchPage gets an opt-in truncate that resolves with the first maxBytes
instead of refusing the page, and the link check uses it, so a large
article page still gives its date and stays working. A link the fetch
refuses as a private or local address reads as broken, since no reader
of the published page can open it; a non-standard port stays unknown.

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

* fix(content): offer Edit author in Quality only to who can edit that author, and say who can otherwise

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

* fix(content): read discounts, materials and short forms as no figures, and score Trust only with a figure or a dated source

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

* fix(audit): read a bot wall as unsure, read a walled home page through Scrape.do once a day, and look for author pages at the usual addresses

A 401/403/429, or a 200 challenge page, now leaves the read incomplete
instead of failing About, Contact, Editorial or Organization schema for a
day (looksBlocked from site-pages.js). A walled home page goes through
Scrape.do, unrendered, at most once a day per brand (site_trust.scraped_at),
and a pass it read stands for that day while the wall hides the page.
An author the page list has no page for is looked for at /author/<slug>
and /authors/<slug> (a few authors per read), with the probes' guards and
their name in the title or H1. readSiteTrust returns complete, so the web
can tell a partial read from a fix to make.

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

* fix(audit): hold Check again until the read can change, say when the site didn't answer, and say Site trust counts in Quality

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

* fix(content): leave a placeholder title out of the JSON-LD headline, and say why

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

* fix(content): read Readability in the draft's language, and split its sentences where they end

- Japanese, Chinese and Thai, written without spaces between words, get no
  score: Quality says "Readability isn't read for this language yet"
  instead of asking for more paragraphs. Sentences also end after 。!?,
  । and ؟, and a Hindi word keeps its vowel signs, so Hindi is read by its
  own sentences and words.
- The language is the draft's Language rule when it is on, else the
  brand's; every brand language's name is read ("Portuguese", "Brazilian
  Portuguese", "日本語"…).
- A sentence doesn't end before a lower-case word, nor at a German or
  Turkish ordinal ("am 3. Oktober") or a language's common abbreviations
  ("z. B.", "p. ex.", "örn."); one before a number only ("No. 5") counts
  there. A full stop before a closing quote or bracket ends one.
- Show goes to the first copy of a passage, and a second Show within the
  moment keeps its mark for the full time.
- Passive voice reads common irregular participles (sent, found, held…).

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

* fix(content): know a name only as whole words, read a bare name only with a verb said of people, and run on without the authors

isKnown matched names as substrings of what the agent was given, so
"Dr. Sarah Chen" passed on a page with "kitchen" and "Mr. Doe" on one
with "does". Both sides are now compared as whole words. A name without
an honorific or role is read only with said, told, explained, recalled,
admitted, insisted or argued (and German sagte, Turkish söyledi), so
"Google Ads recommends" or "according to Google Analytics" no longer
become name placeholders. authorWords logs a failed read (content_authors
not there yet) and reads as no author words instead of failing the run.

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

* fix(content): offer Edit author on the profile to-do only to who can edit the author

#1414's review fix moved here: the to-dos replaced E-E-A-T's suggestions,
so the to-do now carries the rule (whoever added the author, the author
themself or an admin) and tells anyone else who can.

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

* test(content): expect the dated source line's corrected plural

#1416's review fix reads "1 of 1 dated source is over 24 months old".

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

* fix(content): pass the nudge whether the member can edit the author

Its to-do text names who can complete the profile when they can't.

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

* test(content): give Before you publish's quality read whether the member can edit the author

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

* chore(content): type the agent run's claimed_at

#1400 adds the column to 00249.

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]>
gkhngyk added a commit that referenced this pull request Oct 23, 2026
…o (CE-044) (#1422)

* feat(billing): show this period's AI usage on the Billing page

The workspace's one AI budget (Improve, the Content Editor's AI and the
Action Center's task writer) had no meter: the first sign of it was an
"AI usage is used up" error. Migration 00242 records what each AI call
was for (prompt_improve_usage.feature, backfilled) and sums the period's
spend by feature (ai_usage_by_feature). GET /api/billing/ai-usage
returns the shares of the plan's budget, and the Billing page shows the
share used, when it resets and what used it, with Agent Chat noted as
running on the workspace's own key.

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

* fix(billing): hold an AI call's share of the budget before it runs

The workspace's AI budget was checked by reading the period's spend; the
call's cost was written once the model answered. Calls running at once
(two tabs, a teammate, an Action Center sweep) all read the same spend
and all ran past the budget. 00243's reserve_ai_usage takes a
per-organization lock, reads the spend with the calls in flight, and
holds the call's estimated cost; reserveAiBudget turns the hold into the
real cost or releases it. Improve, the brief rebuild, Apply rules with
Agent, Start Agent and the Action Center task writer use it in place of
enforceImproveQuota, which goes.

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

* fix(billing): charge a schema miss and hold the org's recent median cost

Review fixes:
- Apply rules with Agent and Start Agent charge an answer the provider
  billed but that missed the schema (NoObjectGeneratedError), as Improve,
  the brief and the task writer do; before, the hold was let go and the
  call ran free.
- A call holds the org's median cost over its last 20 calls this period,
  never less than the model's typical cost, so calls in flight pass the
  budget by far less.

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

* feat(content): rewrite a whole page to its rules as one suggestion

Apply rules with Agent makes at most 8 small edits a run, which can't
bring a long page to its Length (about 2% a run on prod). The Content
Agent can now rewrite the whole page in one background call, left as ONE
suggestion (kind 'page', migration 00247) to compare and accept or reject:
- POST /api/content-drafts/:draftId/rewrite, through Start Agent's claim,
  budget hold and background run;
- passages AI quotes today, tables, images, quotes and HTML blocks go to
  the model as [[KEEP n]] lines and come back as they were; a rewrite that
  drops one fails the run;
- one H1, only the page's own links and the ones offered, the editor's
  tags; the page as it was is kept on the suggestion (before_html).

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

* fix(content): describe a rewrite's kept blocks and count them toward Length

Review fixes:
- Kept blocks are described under the page (a quoted passage's words, a
  table's rows, an image's alt) and their text counts toward Length, so a
  rewrite aims at the whole page's length; with Length off it keeps the
  page's own. A kept H1 stays first, and the page's language is kept.
- The answer is taken out of a code fence, text left at its root goes in
  paragraphs, and an answer in Markdown fails the run.
- The page's own links stay exactly as written (query and anchor too).
- Kept blocks go back untouched (an empty table cell stays), only the
  page's first H1 counts as its title, a page that writes "[[KEEP" gets
  markers of its own, and a page that is only kept blocks isn't sent.

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

* feat(content): rewrite the page to its rules from the Rules tab, and compare it

The Rules tab opens with the agent's two ways to meet its rules: Apply
rules with Agent (small edits, up to 8 a run) and Rewrite the page to
these rules (the whole page as one change). The rewrite is recommended,
with a one-line reason, when the page is more than 30% off its Length or
4 rules or more are open.

A rewritten page comes back as one suggestion with its own bar over the
page: the characters before and after and the agent's reason, Compare
(the page and the rewrite side by side), Accept (History keeps the page
first), Reject, and Undo. A page that changed since the agent read it
isn't written over. The page waits for the rewrite with its own steps,
and a failed rewrite's Try again rewrites again.

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

* fix(content): compare a rewrite by its words and run one agent at a time

Review fixes:
- A page is compared with the one the agent read by its words, with a
  space between blocks, so stored line breaks and lists don't read as a
  change (Accept and Undo were refused on imported pages).
- One agent run at a time from the page; a rewrite never starts before
  the locked passages are read, and sends the editor's own locked keys.
- Accept holds the page still from the start and checks it again before
  putting the rewrite in; Undo puts the page back as it was (two H1s too),
  and the bar waits while the HTML view is open.
- No rewrite advice for an empty page or one too long to send whole; the
  rewrite mark survives a reload; the waiting view says the rewrite waits
  in the editor; Compare's links don't navigate.

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

* feat(content): show the Content Agent as a card over the page

Content Editor v1.1, part 1 (CE-025, CE-026, §4): the agent row and the
rewrite bar become one card above the toolbar, in three states:
- waiting: "Content Agent has {n} suggestions for you", what they change
  and the rules they gain ("Rules 5 → 6 of 13"), with Review (scrolls to
  the first suggestion and marks it), Reject all and Accept all; a page
  rewritten shows its characters, with Compare;
- all reviewed: what was accepted and the rules met and still open, with
  Undo all and Run Agent;
- working: while Apply rules with Agent runs.
The tile moves a little (a soft ring, a blink, a spark; a sweep and a
breath while working), never a rotating ring, and not at all with reduced
motion. The card wraps on a narrow page; Accept all and Run Agent are the
primary buttons.

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

* fix(content): agent card review fixes

- Run Agent on the card keeps to one agent run at a time and says why it
  waits; Apply rules never starts beside another run or before the locked
  passages are read.
- Ghost buttons show their hover on the card's grey; the tile and its
  count are hidden from screen readers (the title says it) and the count
  is darker for contrast; "+N more" comes from en.json, the reason's first
  letter is upper-cased in the page's locale.
- Review picks the first open suggestion in the page's order and focuses
  it; the sweep shows on the light tile in dark mode; the spark is slower
  once all are reviewed; without motion the working line is a faint full
  line; "0 still open" isn't said.
- globals.css keeps its own lines; only the motion block is added.

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

* feat(content): put brief and rules under one Instructions tab with a split Run Agent

Content Editor v1.1 part 2 (CE-028–CE-031): the side panel's tabs become
Instructions · Sources · Live page. Instructions holds Brief | Rules, with
the rules still open on the tab and the segment. Each segment opens with a
status card: Rules has one split Run Agent ▾ (Fix open rules, or Rewrite
the whole page, which renames it "Rewrite page") in place of the two rule
buttons; Brief has Run Agent while empty and Rebuild brief once written.
Why the agent can't run is written under the card, and each card's ⓘ tip
opens below it. The brief shows "Not set yet" and its Length in characters
and about as many words; the toolbar counter adds the page's words.

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

* fix(content): instructions tab review fixes

- Run Agent's choice is worked out once and falls back to Fix without a
  rewrite; once a rewrite starts, the button is back on Fix.
- ▾'s choices are menu radio items; Fix is off when only rules the agent
  can't fix are open, and the card says what to do instead.
- The reason line under the card stays mounted for screen readers; Rewrite
  from brief writes its reason too; the tab's count is read out.
- Brief | Rules switch with the arrow keys, one tab stop.
- An edited brief's rebuild question sits under the card; a brief without
  H2s says to rebuild it; an empty brief shows no origin line.
- Plural copy for the open suggestions and the counter's words; rule names
  joined by the formatter; Run Agent's tip leaves ▾ out without a rewrite.

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

* feat(content): show the data the Content Agent writes from

Content Editor v1.1 part 3 (CE-032, CE-034): under each Run Agent card,
"Uses your data: 1 prompt · 21 fan-outs · 20 cited pages · 10 Search
Console queries · Edit sources", counted as the Sources tab keeps them, so
turning one off lowers it at once. The Sources tab carries its count, and
its top says "N sources in use" and when the Content Agent last wrote from
them (its latest suggestions or the brief it built). A first visit's note
at the top of Instructions says the agent writes from the person's data;
closing it is kept in their own user metadata.

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

* fix(content): data note review fixes

- "Last used by Content Agent" also counts the agent writing the page
  (agent_state_at: Start with Agent, Rewrite from brief on a new page),
  not a run that failed; a value that isn't a date is skipped.
- The latest batch's time is its first suggestion's, not a sort per render.
- Tests: the Brief segment's line, no line while the sources can't be read,
  the tab's count, the note showing again after a failed write, and a
  suggestion read with its createdAt.

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

* feat(content): have the Content Agent write from the kept sources and name them

Content Editor v1.1, CE-033 (server): Fix open rules, Start with Agent and
Rewrite the whole page read the sources the Sources tab keeps, numbered
S1, S2… (content-sources.js). Each suggestion keeps the sources it names
and the words each supports (content_draft_suggestions.sources and
source_marks, 00248); a page rewritten whole keeps its sources.

No number without a source: the model reads a source by its words only, so
a number the agent adds must be the page's, the brand's, the brief's, the
rules', today's, or in a source's own words (then marked to it). A
suggestion with any other number is not kept; a page written whole gets a
placeholder in its place. Source numbers written into the words are taken
out.

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

* feat(content): show what each agent suggestion was written from

Content Editor v1.1, CE-033 (web) and the rest of CE-034: under each
suggestion, "Based on" chips name the sources it used (number, kind, name;
the Sources tab's details on hover), and a small number marks the words
each supports. A click on either opens Sources on that row, scrolled to
and ringed for a moment, once. The agent card adds "built from N of your
sources · See sources". Fix open rules sends the kept sources, and the
first-visit note says every change shows the sources it used.

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

* feat(content): write the Content Agent's runs step by step and stop them

Content Editor v1.1, CE-027/035 (server): each Content Agent run (Fix open
rules, Start with Agent, Rewrite the whole page, the brief) is written in
content_agent_runs (00249) with its steps named by the data it reads
("Reading 20 cited pages", "Matching 21 fan-outs", "Writing 3 changes") as
it reaches them. POST /api/content-drafts/:id/stop marks the run stopped
and aborts its model call; the run checks before it keeps anything, so a
stopped run changes nothing (no suggestions, page, brief or History).

A run that can't be written still runs; runs a stopped server left are
closed when the next starts, and Stop ignores them. Background runs are
written before Start answers, so Stop finds them at once.

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

* fix(content): let go of a background draft when its run is stopped

Stop also clears the draft's 'writing' state at once: a background run lets
go once it sees the stop, but one no server holds any more never would, and
the waiting page would wait out the 10 minutes.

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

* feat(content): show the content agent's steps while it works, and stop it (CE-027, CE-035)

The agent card, the brief and the waiting page show the run's real steps
(content_agent_runs, read from the browser every second) and a Stop button
that ends the run through the API proxy, leaving the page as it was. A dashed
decoration under the H1 says where Fix is drafting, and the agent's dots
replace every spinner on its buttons.

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

* feat(content): show the cited pages' length next to the brief's Length (CE-030)

When the brief is rebuilt, the server reads the first few cited pages kept
in Sources (only addresses AI answers cited for the brand, never the draft's
own page), counts their main text as the Rules tab counts length, and saves
the median as brief.citedLength. The Brief tab says "From the rules · cited
pages average N characters"; with fewer than two pages read it stays "From
the rules". textLength moves to page-content.js to avoid an import cycle.

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

* fix(content): record which run holds a draft, and keep Fix off it while it writes

content_drafts.agent_run ('write' or 'rewrite', in 00247 and its guard) is
set when Start or a rewrite claims the draft, so every device knows a failed
rewrite from a failed Start. Fix open rules and the MCP suggest call answer
409 'writing' while a run holds the draft, so its answer is never dropped
after it was charged.

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

* fix(content): record which run holds a draft, and keep Fix off it while it writes

content_drafts.agent_run ('write' or 'rewrite', in 00247 and its guard) is
set when Start or a rewrite claims the draft, so every device knows a failed
rewrite from a failed Start. Fix open rules and the MCP suggest call answer
409 'writing' while a run holds the draft, so its answer is never dropped
after it was charged.

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

* fix(content): read a failed rewrite from the draft, and only the latest batch's rows

The editor reads content_drafts.agent_run, so a failed rewrite is tried again
as one on every device (the localStorage mark is gone). Fix open rules' new
409 'writing' says the agent is already writing. getDraftSuggestions finds
the latest batch first and reads only its rows, and Compare's links can't
take focus.

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

* fix(content): say in the agent card why Run Agent won't run

The card's Run Agent writes its reason in the card's second line (amber, tied
to the button by aria-describedby) instead of a hover title, and is turned
off when the only rules left open are ones the agent doesn't fix (one H1),
as the Rules card does.

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

* chore(content): keep AddSourceInput as Prettier formats it

A merge brought in a line formatted by another Prettier version; this puts
back main's formatting, so format:check passes.

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

* fix(content): recommend no Run Agent choice that is turned off

With only One H1 open and no rewrite advice, ▾ no longer shows the disabled
Fix as Recommended.

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

* fix(content): match an added figure by its unit, and read none from dates, addresses or words

A claim (a %, a ×, a scale, a currency) is known only with the same unit or
sign, so a fan-out's "crm for 50 users" no longer sources "50%". Today adds
only its year. A cited page's address is no words of its own. The brand's
name and industry are known, digits stuck to a letter ("B2B", "H2") are no
figure, and a source number written into a reason is taken out.

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

* feat(content): name the agent's steps by the work the server does

Short names for what each run does (CE-027/035): Fix and a rewrite read the
rules, gather the sources (numbered, so a number can be checked), write, and
check what they wrote (a number needs a source, a link must be allowed, a
locked passage stays). The brief gathers, writes the outline and matches
fan-outs. "Reading 20 cited pages" is gone: the agent sees their addresses,
not their content.

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

* fix(content): name the Rules tab's button as it reads now in a test and two lines

A test from main still pressed "Apply rules with Agent", and two messages
still named it; the button is Run Agent, its default Fix open rules.

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

* fix(content): charge a call Stop aborted, end only a run's own claim, and stop the run named

- A Stop that aborts a model call already sent keeps its hold on the AI
  budget as its cost (reserveAiBudget's keep()), since the provider bills
  it; a run stopped before its call sends nothing (runCall).
- A background run ends only the claim it still holds (agent_state_at), so
  one stopped from another server never clears a newer run's.
- A run closes only runs a stopped server left (older than RUN_STALE_MS),
  and /stop takes an optional runId, so another tab's run goes on.

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

* feat(content): show the steps by their new names, and stop the run the editor shows

The step chips read the server's short names (Reading 4 rules, Gathering 52
sources, Writing changes, Checking sources). Stop sends the run's id, so
another tab's run goes on. The waiting page keeps the run's last steps and
reads the draft as soon as its run ends, and a hidden tab reads the run every
AGENT_POLL_MS, then at once when it shows again.

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

* test(content): read the hook's run from what it renders

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

* fix(content): call the cited-page figure the median it is, and stop its reads with the run

The Brief's Length now says "a typical cited page has N characters (median of
M)". A Stop settles the cited-page read on nothing at once: the run's signal
ends each page read (fetchPage takes a signal beside its timeout), so a fast
model answer followed by a Stop never waits on them.

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

* fix(content): show loading without a spinning ring anywhere in Content

Every Loader2 spinner in Content (the editor, Library, Plan, the content
page and its dialogs and menus, the webhook settings) is now LoadingDots:
three dots that bounce in turn, in the text's color, still with reduced
motion, as the Content Editor brief asks ("no spinning ring anywhere"). The
agent's WorkingDots are built on it.

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

* feat(content): read the draft's Readability and show it in Instructions › Quality (CE-036, CE-039)

Quality spec Phase 1, behind NEXT_PUBLIC_CONTENT_QUALITY_PHASE (off unset):
- readability.ts: seven checks read from the draft in the browser, no AI
  cost — average sentence 15–20 words, none over 35, reading level by the
  language's formula (Flesch, Ateşman, Amstad, Kandel–Moles,
  Fernández-Huerta; else sentence and word length), answer first, short
  paragraphs, a heading every 200–300 words, passive voice and jargon
  (English). A check a language can't be read for is left out and the
  score rescaled to 100.
- Instructions gets a Quality segment: the score with its band (80+
  Strong, 60–79 Can improve, under 60 Needs work), "Ansvisor estimates
  based on Google's published quality signals. Not a Google score.", and
  what would raise it, the biggest gain first, with Show.
- The header gets a "Quality {score}" chip that opens it.

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

* fix(content): read Readability from the page's own blocks, and show a passage by its block

- A quote's and a list item's paragraphs are read apart (the editor's HTML
  has no space between tags) and a nested list once; sentence length is
  measured on running text, a list's points aside, and a page of short
  sentences is asked to join some.
- Fernández-Huerta subtracts words per sentence (the corrected form).
- Answer first skips an empty line, fails without an H1, and reads an H1's
  subject without its question and common words.
- Abbreviations don't end a sentence; "-ted" keeps its syllable, French
  "-ent" is no silent ending, Turkish â î û are vowels; "is indeed" isn't
  passive, jargon is read in all its forms, and Show goes to what falls short.
- Show finds the passage's block in the page (never a suggestion's card)
  and marks it with a decoration; the band is read out with the chip and
  the segment's badge.

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

* fix(content): count a passive sentence that says not or never in Readability

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

* feat(content): add Settings › Authors, the real people a page is by (CE-037)

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

* fix(content): let whoever added an author edit it, link only yourself, and renumber to 00251

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

* feat(content): name the page's author in the editor's header and a Page info strip outside the page (CE-038)

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

* fix(content): keep the Page info strip right under the H1, count authors' pages only in Settings

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

* fix(content): draw the Page info strip as the mockup's one line, with the author's face and title at the brand

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

* feat(content): score E-E-A-T from the page's author and Trust from the agent's sourced claims in Quality (CE-039)

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

* fix(content): score only checks that can fail: no Trust and no author schema until they read the page

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

* fix(content): say only what an author's profile is missing in Quality

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

* feat(content): read a draft's links once a day for Trust: working or broken, and their page's date

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

* fix(content): read only a saved draft's links, a few at a time and within a budget, and date pages by their own entity

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

* feat(content): score Trust from the page's sourced figures, fresh sources and working links (CE-039)

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

* fix(content): reserve link reads up front, say which links are never read, and date an article before its page

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

* fix(content): compare links as the draft saves them, count each link and sentence once, and read prices and sizes as no figures

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

* feat(audit): read a brand's site trust: About, Contact, editorial policy, Organization schema and author pages (CE-043)

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

* fix(audit): read site trust in parallel and once per brand, tell a page from the home page, and re-read a partial read soon

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

* feat(audit): show Site trust n/5 in Site Audit, and count it in Quality's Trust (CE-043)

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

* fix(audit): scroll to Site trust from Quality, keep it per brand, say when checking again fails, and count it only beside the page's own Trust

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

* fix(audit): give the Site trust card its own key beside the auto-run notice

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

* feat(content): list what only you can do in Quality, and nudge the next one (CE-040)

Your to-dos in Instructions › Quality: picking the page's author (or adding
one) and completing their profile move out of the suggestions, with a box
the checks tick and E-E-A-T's gain. A dark "Next for you" pill names the
first open one when the agent's run ends (not a failed or stopped one),
when the last open suggestion is accepted (Accept all, one by one, or the
page rewrite) and on Mark ready, once per moment and to-do in the session;
Later hides it. Its words go to a status kept on the page for screen
readers.

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

* feat(content): check the page before it's marked ready, with its JSON-LD to paste (CE-041)

Before you publish opens on Mark ready once Quality is live: a warning
only when Trust is under 60 (the check that raises it most, and to about
what), a note while the page's links are still being read, what the CMS
does for the page (author, visible dates, schema), and for an article an
Article JSON-LD from the title, author, brand, its image and today's date
(Person with sameAs, or the brand's Organization; no author while the
authors aren't read; a live page keeps its published date) with Copy
JSON-LD. Fix first goes to Quality and puts the caret at the passage.
Mark ready anyway is logged with the page's Trust and the check named
(00255 content_draft_ready_log: members add rows as themselves for a
ready draft, three columns only). useLinkChecks also says how many reads
may still come.

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

* feat(content): keep the Content Agent from inventing people and quotes (CE-044)

Every person's name and quoted sentence the agent writes is looked up in
what it was given: the page, the brand, the brief, the rules, the
person's data (Sources) and Settings › Authors. One that isn't becomes a
placeholder ("[name of a real person]", "[quote from a real person, with
its source]"): in Fix open rules' and the first optimize's suggestions,
read in their words as written before they are cleaned; in a page
written whole; and in a rewrite before what it kept goes back, so the
page's own passages are never touched.

A name is read where a person is plainly meant: an honorific, a role
("CEO Jane Doe", "Jane Doe, head of sales", "Jane Doe (CEO)"), or speech
("Jane Doe said", "according to Jane Doe", "Ayşe Yılmaz'a göre"); a
known author stays with the words before it, and a heading is read for
quotes and speech only. A quote is two words or more in quotation marks
next to speech, four or more anywhere, or a blockquote or <q> (its cite
read for the name), across the bold and the links in a line. One reading
per word keeps long text fast.

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

* feat(content): list the placeholders the agent left as the first to-do (CE-044)

Your to-dos in Quality now opens with "Fill {n} placeholders" while the
page has words in square brackets (what the agent leaves where it had no
real name, quote or number), with Show on the first. The Next for you
nudge names it too ("Show now"). Only the person can fill them; an export
never ships one (CE-057).

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

* fix(content): keep the loading dots visible with reduced motion

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

* fix(content): check author profile links in the table, unlink a removed member and revoke anon

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

* fix(content): let a Stop go only of the claim the stopped run holds

A Stop that named a Fix or brief run cleared agent_state whatever the run
was, so a Start or Rewrite on the same draft went on without its claim.
Each run now carries the claim it holds (content_agent_runs.claimed_at,
00249), stopDraftRun answers it, and the route clears agent_state only
where agent_state_at is still that claim.

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

* fix(content): say in the Remove dialog that the author's pages go back to the team byline

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

* fix(content): date a page over the read cap from its start, and count a private-address link as broken

fetchPage gets an opt-in truncate that resolves with the first maxBytes
instead of refusing the page, and the link check uses it, so a large
article page still gives its date and stays working. A link the fetch
refuses as a private or local address reads as broken, since no reader
of the published page can open it; a non-standard port stays unknown.

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

* fix(content): offer Edit author in Quality only to who can edit that author, and say who can otherwise

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

* fix(content): read discounts, materials and short forms as no figures, and score Trust only with a figure or a dated source

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

* fix(audit): read a bot wall as unsure, read a walled home page through Scrape.do once a day, and look for author pages at the usual addresses

A 401/403/429, or a 200 challenge page, now leaves the read incomplete
instead of failing About, Contact, Editorial or Organization schema for a
day (looksBlocked from site-pages.js). A walled home page goes through
Scrape.do, unrendered, at most once a day per brand (site_trust.scraped_at),
and a pass it read stands for that day while the wall hides the page.
An author the page list has no page for is looked for at /author/<slug>
and /authors/<slug> (a few authors per read), with the probes' guards and
their name in the title or H1. readSiteTrust returns complete, so the web
can tell a partial read from a fix to make.

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

* fix(audit): hold Check again until the read can change, say when the site didn't answer, and say Site trust counts in Quality

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

* fix(content): leave a placeholder title out of the JSON-LD headline, and say why

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

* chore(content): move Show's doc comment back onto showInPage

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

* fix(content): read Readability in the draft's language, and split its sentences where they end

- Japanese, Chinese and Thai, written without spaces between words, get no
  score: Quality says "Readability isn't read for this language yet"
  instead of asking for more paragraphs. Sentences also end after 。!?,
  । and ؟, and a Hindi word keeps its vowel signs, so Hindi is read by its
  own sentences and words.
- The language is the draft's Language rule when it is on, else the
  brand's; every brand language's name is read ("Portuguese", "Brazilian
  Portuguese", "日本語"…).
- A sentence doesn't end before a lower-case word, nor at a German or
  Turkish ordinal ("am 3. Oktober") or a language's common abbreviations
  ("z. B.", "p. ex.", "örn."); one before a number only ("No. 5") counts
  there. A full stop before a closing quote or bracket ends one.
- Show goes to the first copy of a passage, and a second Show within the
  moment keeps its mark for the full time.
- Passive voice reads common irregular participles (sent, found, held…).

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

* fix(content): know a name only as whole words, read a bare name only with a verb said of people, and run on without the authors

isKnown matched names as substrings of what the agent was given, so
"Dr. Sarah Chen" passed on a page with "kitchen" and "Mr. Doe" on one
with "does". Both sides are now compared as whole words. A name without
an honorific or role is read only with said, told, explained, recalled,
admitted, insisted or argued (and German sagte, Turkish söyledi), so
"Google Ads recommends" or "according to Google Analytics" no longer
become name placeholders. authorWords logs a failed read (content_authors
not there yet) and reads as no author words instead of failing the run.

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

* fix(content): offer Edit author on the profile to-do only to who can edit the author

#1414's review fix moved here: the to-dos replaced E-E-A-T's suggestions,
so the to-do now carries the rule (whoever added the author, the author
themself or an admin) and tells anyone else who can.

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

* refactor(content): read the title's placeholder with the shared pattern

#1420 kept its own copy while placeholders.ts wasn't below it; now it is.

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

* test(content): expect the dated source line's corrected plural

#1416's review fix reads "1 of 1 dated source is over 24 months old".

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

* fix(content): pass the nudge whether the member can edit the author

Its to-do text names who can complete the profile when they can't.

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

* test(content): give Before you publish's quality read whether the member can edit the author

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

* chore(content): type the agent run's claimed_at

#1400 adds the column to 00249.

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]>
gkhngyk added a commit that referenced this pull request Oct 23, 2026