Repository navigation
feat(content): add the brief eval: 30 cases, the 2026 brief rules as a rubric, a gate on what the brief wasn't given, and a judge's quoted scores (CE-EVAL-001, brief rules PR 2) - #1538
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]>
gkhngyk
left a comment
There was a problem hiding this comment.
Looks good, with one fix before the baseline is recorded, and follow-ups.
What I checked:
- Only by hand, and nothing touched.
- The script isn't an npm script, and no test imports it. Vitest includes only
src/**/*.test.js. - The test calls no model. It reads
recorded.jsononly when the file is there, so CI needs no key and spends nothing. - The script makes two calls a case, the brief's model and then the judge, each with a 120 s timeout.
countruns fewer cases. - A missing provider key fails at start, before any call.
- No
reserveAiBudget, so no workspace's AI usage is charged. - No read or write: it loads the Supabase client from
.envonly because the modules import it, aseval-no-fabrication.jsdoes.
- The script isn't an npm script, and no test imports it. Vitest includes only
- The refactor.
shapeBriefandbriefKnownmove #1535's code as it was, so Rebuild outline saves the same brief.SYSTEM_PROMPTandoutlineSchemaare only exported. - The record.
- The model's own answers are kept and shaped again in the test, so a later change to the guard is read against them.
- A failed case is recorded, not left out, and a partial run goes to the ignored file.
promptVersioncovers the rules, the schema and each case's prompt under the recorded phase, and leaves the environment as it was. A stale record is skipped, not failed.
- Cases.
- 30 cases: ten per site type, in three languages, new and live pages, with page types the editor offers.
- The brands are made up. The cited pages are generic sites.
- The judge.
- Another model family.
- Scores are whole numbers from 0 to 2.
- A score above 0 needs three words or more from one line of the brief.
- Merge.
- Server only, and it contains #1535 and nothing else. It merges cleanly on main.
- No runtime path changes, so nothing changes at merge or at the API deploy.
Before the baseline run:
- A quote with its line's label earns 0 (
server/src/lib/content-brief-eval.js:179,:216-239).- The judge sees lines that start "Goal: ", "Audience: ", "H2: " and "Keywords: ", and is told to copy "exactly from one of its lines".
- A quote that starts with its label, e.g. "H2: What a rolling 13-week cash forecast is", isn't in the field, which has no label. So a fair score becomes 0, marked
unquoted.EDGEStakes off a key point's "- ", but not the other labels. - The record keeps only the scores as read (
server/src/scripts/eval-brief.js:88-93). An unquoted score keeps its quote but loses its number. A later fix can't re-read the baseline; it has to be paid for again. - Fix:
- Take a leading
goal:/audience:/h2:/keywords:off each part before the lookup. - Keep the judge's own answer (
graded.object) in the record, and read it withreadJudgedin the test and the sums, as the brief's answer is read. - Add a test: a quote that starts with "H2: " keeps its score.
- Take a leading
Follow-ups:
2. The gate reads as the guard does, so it can't fail on figures or people (content-brief-eval.js:131-132, content-brief.js:340-348).
-
founduses the guard's own numbers, cues and question rule, on a brief the guard has just shaped. It finds nothing there, except a figure the cut happens to make. So in the baseline and in v2 alike, the gate's figures and people are 0 by design. It still tests that every field goes through the guard: the test on the unshaped answer shows that. -
It can't show what the guard lets through:
- a role and a name in a heading (the description says the record will show whether that matters; it can't);
- a name inside a quoted question;
- a name without a cue.
-
Nor can it show what the guard takes out by mistake: a count, or a reworded search in quotes (#1535's follow-ups).
-
Fix: for each case, list and print two things, and keep both out of the gate:
- What the guard took out of the model's answer:
guard.foundon the raw answer's fields. The test can work it out from the record for free. - What a person should look over, read without the guard's cues, as
toReviewdoes for the no-fabrication set (src/lib/__fixtures__/no-fabrication/guarded.js). That means names asNAMEreads them and quotes of four words or more, a line at a time, that the case didn't give.
Then name the gate for what it checks: every field guarded, and no address the case didn't give.
- What the guard took out of the model's answer:
- A recorded address can turn CI red (
content-brief-eval.test.js:262).- The record test fails when any recorded brief has an address the case didn't give.
- The brief has no address guard, so a made-up address is something to measure, not a regression. A baseline with one can't be committed without failing CI.
- Until #1535 leaves addresses alone, a given address fails too: case
b2b-de-solution_pagecites ".../thread/123", which the guard turns into ".../thread/[figure, source]" if the brief names it. - Fix: fail the record test on figures and people only, and count addresses in the sums.
Summary
Brief rules 2026, PR 2 of 10: the brief eval (CE-EVAL-001). Stacked on #1535 (the brief's number and name guard). This PR's own changes are its commits after #1535's branch. Server only.
Before the brief gains the 2026 rules (answer-first lines, facts with their kind of source, a TL;DR, an angle and proof to gather, entities, freshness, format hints, guardrails, links), this PR adds a way to measure briefs, so the change can be measured against today's (v1) briefs. It covers our own briefs only; there are no competitor briefs.
content-brief-eval.js:BRIEF_CRITERIA: nine criteria, one per rule, each scored 0 (missing), 1 (partly) or 2 (fully).briefChecks: checks anyone can repeat:briefGuard(...).found): a heading in heading mode, and a question in quotes kept. Addresses are compared by host and path, and one without a scheme (www.…) is read too.judgeSchema,JUDGE_SYSTEM_PROMPT,buildJudgePrompt: a judge model scores each criterion with the brief's own words. The judge sees the brief as plain lines: Goal, Audience, each H2 and key point, Keywords.readJudgedkeeps one whole score from 0 to 2 per criterion. A score above 0 whose quote isn't in the brief becomes 0, markedunquoted, so the judge can't vouch for what the brief doesn't say. A quote must be at least 3 words and within one line. It's compared in one Unicode form, with straight quotes and apostrophes, without the marks around it, and split where it was shortened ("…").summarize: the mean per criterion, the gate, the checks, the tokens.promptVersion: a short hash of the brief's rules, its schema and every case's prompt, under Quality's phase (from phase 2 the prompt names the site type). A record made under another prompt or phase is stale.__fixtures__/brief-eval/cases.js:SITE_PAGE_TYPES, tested), new pages and live ones;samples.js: a good brief and a bad one, plus a judge answer, for the tests.scripts/eval-brief.js: for each case, it writes the brief with the brief's own model, prompt and shaping, checks it, has the judge score it, and prints the sums.recorded.json; any other goes torecorded.partial.json(gitignored).BRIEF_EVAL_JUDGE_MODEL, elseanthropic/claude-haiku-4-5(another model family), at the model's own temperature: newer models take no other.CONTENT_QUALITY_PHASEthe API runs with.node src/scripts/eval-brief.js, aseval-no-fabrication.jsis. I didn't add an npm script.content-brief.js:shapeBrief, and its known numbers and names intobriefKnown, so Rebuild outline and the eval read the model's answer the same way;SYSTEM_PROMPTandoutlineSchemaare exported;.env.example:BRIEF_EVAL_JUDGE_MODEL, with a note.CI (as agreed with the user: the recorded results in CI, live runs by the maintainer only):
content-brief-eval.test.jschecks the cases, the rubric, the checks and the judge's reading on every run, for free and without a key.recorded.jsonexists, it also reads the models' briefs:For @gkhngyk:
BRIEF_EVAL_JUDGE_MODEL), and theCONTENT_QUALITY_PHASEthe API runs with, runnode src/scripts/eval-brief.jsfromserver/. That records today's (v1) baseline before PR 4 changes the brief.recorded.jsonto this branch, or post the printed sums and I'll add it.PR 10 records the v2 briefs and sets the thresholds per criterion. The new brief fields stay behind
CONTENT_BRIEF_RULESuntil then.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
cd server && npx vitest run src/lib/content-brief-eval.test.js src/lib/content-brief.test.js.node src/scripts/eval-brief.js 3records three cases and prints their sums.npx vitest run src/lib/content-brief-eval.test.jsthen reads them.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:
npm run format,npm run lint(clean) andnpm test(2,765 passed, 3 skipped: the two record tests withoutrecorded.json, and the one skipped on main).Tests:
Seen by the eval's own tests, for #1535: the guard reads a heading in heading mode, as page headings are read. So a role before a name in a heading ("What CFO Anna Weber Needs From A Forecast") isn't read, and the name stays. That's the writer's own trade-off for title case ("Questions A CTO Asks Before Switching"); the record will show whether it matters for briefs.
A pre-push review ran; its findings are fixed in the second commit (the gate as the guard reads it, the raw answers checked again, quote reading, the prompt's version, partial runs, addresses).
🤖 Generated with Claude Code