Repository navigation
feat(content): have the Content Agent read a version 2 brief's plan, keep headings short and write without keyword stuffing, behind CONTENT_BRIEF_RULES (brief rules PR 8) - #1547
Merged
Conversation
…ave as a placeholder, so the writer can't take it as given Co-Authored-By: Claude Opus 5.5 <[email protected]>
…aceholder in half, and test the audience, names in headings and Turkish percentages (pre-push review) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s as a rubric, checks anyone can repeat with a gate on anything the brief wasn't given, a judge model's quoted scores, and a script that records them (CE-EVAL-001, brief rules PR 2) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e by line; record the model's own answers and check them again in the test; read quotes in any marks, shortened, three words at least, in one line the judge saw; version the prompt under Quality's phase and the schema; keep a partial run apart; compare addresses by host and path (pre-push review) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ief behind CONTENT_BRIEF_RULES, with the data numbered, the page type's formats and the rules in effect; keep the facts' sources by kind and ref, cut to the web's version 2 limits and fit under 64 KB (brief rules PR 4) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…umber only the cited pages as sources, take the rules beside the sources, and read version 2's answers and facts in the brief eval (pre-push review) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…N schema only, so an off-list value never fails a charged call; take out only the page numbers given; match a fan-out as listed before its unquoted form; ask the judge for H2 lengths only (pre-push review) Co-Authored-By: Claude Opus 5.5 <[email protected]>
… its essentials, angle, the brand's own proof to gather, the fan-outs left for another page and freshness by page type, with Brief › Your input numbered as sources (brief rules PR 5) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nt the eval's fan-out coverage over the fan-outs the brief keeps, and compare the input kind with the web's (pre-push review) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…on-plan # Conflicts: # server/.env.example # server/src/lib/content-brief-eval.js # server/src/lib/content-brief-eval.test.js # server/src/lib/content-brief.js # server/src/lib/content-brief.test.js # server/src/scripts/eval-brief.js
…n, and plan links to the brand's pages and the sources listed only, in the brief behind CONTENT_BRIEF_RULES (brief rules PR 6) Co-Authored-By: Claude Opus 5.5 <[email protected]>
… past a failed competitors read, cap the pages' titles and skip addresses the web can't keep, drop a link whose words got a placeholder, and give the eval cases competitors and pages to link to (pre-push review) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r-v2 # Conflicts: # server/src/lib/content-brief-eval.js # server/src/lib/content-brief-eval.test.js # server/src/lib/content-brief.js # server/src/lib/content-brief.test.js
…keep headings short and write without keyword stuffing or engineered wording, behind CONTENT_BRIEF_RULES (brief rules PR 8) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and name a fact's source by kind Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk
approved these changes
Oct 26, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good, with follow-ups.
What I checked:
- With
CONTENT_BRIEF_RULESoff.writeSystemPrompt(),suggestSystemPrompt()andrewriteSystemPrompt()return the constants as they were, and all four calls use them (write, suggest, rewrite, and the cut pass). The write and rewrite prompts equal main's, and the suggest prompt's text isn't touched.briefForWriterreturns'', sobriefTextgives main's text byte for byte. I compared main's output with this head's for four briefs, with links on and off. All were equal. The four:- a version 1 brief;
- the web's version 2 sample;
- an opportunity's brief;
- no brief.
- The eval's recording gains
briefRules.no-fabrication.test.jsreads cases by id, so the new key changes nothing.
- The guards (these apply with the flag off too).
- The numbers and names a Start may write unmarked now come from the brief without its
http(s)://addresses. Fix, Quality's hand-off and the brief's own build don't read this. - The change only takes words out of what vouches, so nothing gets through that main stopped. No loophole.
- Once the API is deployed, what changes is a number or a person's name that a brief holds only inside an address. Some examples:
- a key point typed as "Link our guide https://acme.example/blog/top-10-grinders";
- an opportunity's call to action, "Book at https://acme.example/demo-30";
- "Interview: https://acme.example/blog/jane-doe-interview".
- What the agent does with such a number or name:
- A new page or a rewrite writes "top [figure, source] grinders" or "[name of a real person] said", where main kept "10" and "Jane Doe".
- On a live page, a suggestion that adds "10" is dropped unless one of its sources has it, and the name becomes a placeholder.
- That's right: a slug isn't a source, and a page's own links never vouched either.
- The same number written in the words still passes: "our top 10 grinders guide (https://…)".
- A brief the model built rarely keeps such a number. The brief's own guard already writes "best-[figure, source]-espresso" in an address.
- The one false refusal is in text without spaces. See item 2.
- The numbers and names a Start may write unmarked now come from the brief without its
- What the agent is told, with the flag on. I printed it for the web's sample: 1,437 characters, about 350 tokens.
-
Bounded.
content_drafts.briefis at most 64 KB (00212). Each field is cut to the web's limits when the brief is built or edited. -
Fenced.
- Your input's labels, the link words and their H2s are in quotes. The other fields follow a label, as version 1's goal and key points do.
- Only a source's title can bring outside words in, through a link's words. Those words are guarded, at most 120 characters and in quotes.
-
Facts. Each one is told by its source:
- a fact from Your input names the item's label;
- one with a cited page says "a placeholder: check it against , whose words you don't see";
- one with no source says "a placeholder until a source is found".
Whatever the model writes, a figure that nothing it was given has becomes a placeholder.
-
Links. Only pages listed are kept, as #1545 promised.
- A new page's writer isn't told of them, and it can't write a link:
renderPageescapes every text. - Suggestions keep a link only when it's on
linkAllowList(targets). A rewrite keeps it there or on a link the page already has. Anything else is unwrapped to its words. - Their addresses never vouch (see above). The test with "/top-37-tools" and "/interview-with-john-smith" fails without
briefGiven.
- A new page's writer isn't told of them, and it can't write a link:
-
- Short headings and no keyword stuffing. Both are prompt only.
- The heading line is in the new page's prompt only. Suggestions and rewrites keep their own heading rules and checks, unchanged.
- The guardrail goes into the write, suggest, rewrite and cut prompts.
- There's no new check, so nothing new can refuse a good page or rewrite.
- The work.
- One new regex,
/https?:\/\/\S+/g. It runs once per Start on the brief's text (from a brief of at most 64 KB), never on the page. - It has no alternation, no nested quantifier and no lookbehind. A try fails within 8 characters, and a match ends at the first space, so it's linear.
- On 100 KB inputs it took under 0.2 ms. The inputs: spaces, capitals, initials, punctuation, digits, a keyword repeated, "http://" with no spaces, and Japanese.
- The guards after it took under 20 ms on 180 KB of brief text.
briefForWriterhas no regex and is linear in the brief.
- One new regex,
- The AI budget. No new call.
- Start's one hold is charged by what its call used. The cut pass has its own hold, charged the same way.
- With the flag on, the plan's tokens are charged with the rest. With it off, the tokens are the same as before.
- Tests.
- Every new test fails without the change: the functions are new, and the address test fails without
briefGiven. - The flag-off test compares the write and rewrite prompts with their constants. The suggest prompt is only checked for not having the guardrail (
content-writer.test.js:1068). ExportSUGGEST_SYSTEM_PROMPTand compare it withtoBeas well.
- Every new test fails without the change: the functions are new, and the address test fails without
- Merge.
- The head (8bbeaa1) merges #1545's squash (dfa51a0) cleanly.
- Against main (54da3b1), the merge base is dfa51a0 and the diff is these five files only. Main's one newer commit, #1546, is web only, so the merge is clean.
- In each file the change is this PR's hunks, and nothing of main is dropped.
- Server only, no migration. Nothing changes on Vercel at merge. At the API deploy with the flag off, only the guards above change.
Earlier open items:
- Nothing reads
leftOut(#1543 item 4): partly done.- The writer now says "Keep to one topic; these searches are for another page: …".
- But
buildWritePromptstill lists those fan-outs under "AI searches" (server/src/lib/content-writer.js:345), and the editor's fan-out rules can still ask for an H2 on them. So the writer is told both. - Fix:
- With a version 2 brief, list its
leftOutfan-outs apart ("for another page"), or leave them out. - Have the web's fan-out rules skip them before the flag goes on.
- With a version 2 brief, list its
- The brief plans links the rules have turned off (#1545 item 3): not touched, and now the agent reads those links.
- With internal links off, or a page no longer among the brand's top pages, the agent is told of a link it can't keep. A link it writes there is unwrapped, so nothing bad is kept.
- Fix: read the targets before
briefText, and tell the agent only the planned links whoselinkKey(url)is inlinkAllowList(targets)(content-writer.js:859-861;server/src/lib/content-brief.js:400-405).
- A renamed H2 leaves a planned link pointing at it (#1546 item 2): now the agent reads it as 'in "Old heading"' and places the link anywhere. That's harmless.
- A fact's source ref isn't checked to be http(s) (#1540 item 3): still open.
- The writer takes out only http(s) addresses, so a cited page sent without a scheme would vouch for the numbers in its address.
- Checking the ref when the brief is built (#1540's fix) closes both.
- The eval's items (#1540 items 1–2, #1543 items 1–2, #1545 items 1–2): not touched.
Follow-ups (before the flag goes on):
- The plan asks a new page for a year, a date and step numbers that the writer isn't given (
server/src/lib/content-brief.js:337,:390-391;server/src/lib/content-writer.js:176-178).- The year in the title. With the flag on, best-of, buying guide, alternatives and comparison pages are told to put "the year in the title". The writer isn't told the year, and the guard knows only this one (
todayText).- A model that assumes its training year writes "Best espresso grinders of 2025".
- The title then comes out "Best espresso grinders of [figure, source]".
- The "Updated" line. No date is given.
- "Updated 26 October 2026" becomes "Updated [figure, source] October 2026".
- The guard doesn't read a month, so a made-up "Updated March 2026" passes.
- Numbered steps. A new page has bullets only (
pageSchema, rendered as a<ul>). So the model types "1." into each bullet, and a tenth step reads "[figure, source]. Adjust". - I ran these through
sourcedPageto confirm. - Fix:
- Name the year:
`the year (${todayText()}) in the title`. - Ask for the date as a placeholder:
an "Updated [date]" line, for the person to fill. Do the same fordatedPointwhen no source gives the month. - For a new page, word steps as "a list, in order". Or let a section be ordered and render it as an
<ol>. - Add a test with a best-of brief: the title keeps its year.
- Name the year:
- The year in the title. With the flag on, best-of, buying guide, alternatives and comparison pages are told to put "the year in the title". The writer isn't told the year, and the guard knows only this one (
- Read an address to its end, not to the next space (
server/src/lib/content-writer.js:865). This applies with the flag off.\S+runs on through text with no spaces. In a Japanese key point, "詳細はhttps://acme.jp/priceを参照、3980円から" loses "3980" as well.- On a new page, "3980円" becomes a placeholder.
- On a live page, a suggestion with "3980円" is dropped.
- It also misses "HTTPS://…" and "www.…" addresses. These still vouch, as on main.
- Fix:
- Take the plan's own addresses out where they're written: write each link as its words and H2, and a cited page as "a cited page". That's exact, whatever script a path is in.
- For an address typed into the brief, stop at whitespace or at the first character outside ASCII. Match either case, and
www.too:/(?:https?:\/\/|\bwww\.)[!-~]+/gi. It's linear: 100 KB inputs took under 0.3 ms. - Add the Japanese case to the address test.
- The no-fabrication eval doesn't see the plan (
server/src/scripts/eval-no-fabrication.js:103;server/src/lib/__fixtures__/no-fabrication/guarded.js:21-36).- It asks with the new write prompt but with
briefText(null, null). So a run with the flag on never shows what the plan adds:- facts with no source;
- proof to gather that Your input doesn't have;
- an "Updated" line and a year;
- a planned link with a number in its address.
- The guards read digits and names only. Written as if it happened, "a customer who caught a shortfall six weeks out" passes them. Only the eval can show whether the model writes it from the plan.
- Fix (before PR 10 records):
- With the flag on, give each case, or some of them, a version 2 brief with those parts, as the web's sample has.
- Have
sourcing()read that brief's words without addresses, aswriteWithRundoes.
- It asks with the new write prompt but with
7 of 12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brief rules 2026, PR 8 of 10: the Content Agent reads a version 2 brief's plan.
CONTENT_BRIEF_RULES(off by default). No migration.What the agent is told, with the flag on
The plan (
briefForWriter, incontent-brief.js). After the brief's goal, outline and keywords, a version 2 brief adds:linkAllowListstill decide every link.The prompts.
HEADING_LIMITS).writeSystemPrompt(),suggestSystemPrompt()andrewriteSystemPrompt()return the old constants with the flag off. All four calls use them (write, suggest, rewrite, and the rewrite's cut to length).The guards
The numbers and names a run may write unmarked come partly from the brief. Their source is now the brief text without its web addresses:
https://acme.example/top-37-toolswould have let "37" through, and…/interview-with-john-smithwould have let "John Smith" through;sourceWords, which already keeps a cited page's address out.This also applies with the flag off: a brief someone typed an address into no longer vouches for that address's numbers and names. A version 1 brief rarely has one.
The no-fabrication eval
eval-no-fabrication.jsasks withwriteSystemPrompt(), so a run with the flag on checks the new write prompt.recorded.jsonnow notesbriefRules: true|false, so a recording says which prompt it checked.Cost with the flag on
Related issue
Roadmap CE-EVAL-001 / brief rules 2026 (no GitHub issue).
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
CONTENT_BRIEF_RULES=true:Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/): no web changesyarn typecheckpasses (run fromweb/): no web changesyarn format:checkpasses (run fromweb/): no web changesServer checks, run locally after the review fixes: format and lint clean; 225 test files, 2,888 passed, 3 skipped (the eval's recorded-baseline tests). Root
npm run version:checkfails as it does on main (compose images 0.2.0); not changed here.Tests:
briefForWriter,briefTextand a real create run;/top-37-toolsand "John Smith" from/interview-with-john-smithstill become placeholders. This test fails without the fix.Pre-push review
A review agent read the change before the push. Fixed from it:
🤖 Generated with Claude Code