/** * The issue-authoring contract, and the one copy of it. * * Every rule here is one `issueWrite` refuses, or one a real review got wrong. It is delivered to * **every** reviewer rather than to one of them, and that is the whole point of the file. * * ## Why this is not in the one-shot's system prompt any more * * It used to be, and only there. `review-oneshot.ts` inlined the severity rubric, the prose rules and * the title rules into its `SYSTEM`; `SHARD_CONTRACT` in `review-payload.ts` carried route scoping, * batching and the stop test and **none of the three**. So the tool-free reader was held to a contract * the agentic readers were never shown, and `qa-review.ts` pointed those readers at `modes.md` and * `fan-out.md`, neither of which contains a writing rule. * * Measured on 2026-08-24 over byte-identical facts, one route: a `solo` reviewer at high effort with * tools and the site's checkout wrote **30,577 characters against the one-shot's 22,322** and graded the * homepage's `` — the literal string `Homepage` — **`minor` where the one-shot said `major`**, * justifying the downgrade with *"It is one field on one document"*, which is fix effort and not * urgency. The better-equipped reviewer produced the worse report, because capability is not a contract. * * ## The rule for editing this * * A section belongs here when it holds for any reviewer of any run. A section that turns on **what the * reader can do** does not: "you have no tools, and you may not describe an action you did not take" * stays in `review-oneshot.ts`, because it is false for a reader holding `qa_fetch`. Adding a rule here * reaches three consumers at once, so `oneshot-parity.test.ts` asserts it arrives in both. * * ## The house-style block is advice, and a word list was sized and rejected * * Nothing at the write path enforces it. `issue-rules.ts` refuses tool narration, a leading numeral and * a two-place bundle; it reads no prose beyond that, and the obvious next step — refuse the hedges and * the filler — was measured against **978 stored issues and abandoned**. A ban on * `probably`/`often`/`usually` refuses **17 (1.74%)**, and one of them is the severity rubric's own * *"doing nothing is probably right"* four sections below. A ban on `just`/`simply` refuses **34 * (3.48%)**, mostly correct English: quoted site copy — *"Admins simply review and publish"* appears six * times because the site says it — plus `just-in-time`, *"sits just under the floor"* and *"not just * crawlers"*. That is the same failure `issue-rules.ts` records at its bare-verb ban, which refused * *"role-checked"* and a coverage title. **So the block bans hedging a measurement rather than a word, * and if you come back to automate it, size it first.** */ /** Heading depth the host document needs: `2` for a system prompt, `3` inside a brief's sections. */ export interface AuthoringContractOptions { headingLevel?: 2 | 3 } const CONTRACT = `A FINDING is a record of a rule firing. An ISSUE is a unit of work. The difference is judgement: what the thing actually is, in the site's own vocabulary, and what somebody should change. ## A crop is evidence for one finding — the one named on it Every image is preceded by the finding id it belongs to. **It is evidence for that finding and for nothing else.** Do not use it to describe a different finding, and do not let what it shows change what you say about one. **Most findings have no crop at all.** Only some checks capture one, and the run caps how many are sent. So if a finding has no image beside it, you have not seen that element — say what was measured and stop. Never write that a crop, screenshot or image shows anything for a finding whose id is not on one. This is the failure that made the rule: a reviewer wrote that the crop showed text at 1.03:1 contrast. No crop had been captured for that finding. The image it was reading belonged to a *different* finding — the undetermined-contrast one — and showed that text rendering legibly. The measurement was real; the sentence describing it was invented, and it read as the best-evidenced line in the issue. You may describe an image you were given, attributed to its own finding, and that is the whole of it. ## An issue is one fix, in one place, by one person The test is: can you name the single file, CMS document or config where the change happens? That answer is \`where\` and it is required. So "shared" means one fix location rendered by many pages — nine nav 404s from one navigation document are ONE issue — and never "the same check fired on several pages": contrast failing in six components is six issues. If several citations do not resolve to one place, SPLIT them. If they genuinely are one place and the per-finding refs are heuristic noise, set \`sharedLocation\` to the place they share. If there is genuinely no single place and the issue exists to record that you looked, open \`where\` with "not localised" and say there what the places are. **Citations spanning several surfaces are several issues.** One root cause does not make one issue: 48 links failing because of one redirect still break in the nav list, the footer, the card component and the CTA, and those are four edits by possibly four people. Ask where the change is typed, not why it broke. \`issue-rules.ts\` refuses a multi-cite issue whose citations resolve to two or more places, so a bundle that survives is a bundle whose \`where\` was vague enough to hide the split. **The test cuts both ways.** Two issues whose fix happens in the same place are ONE issue, and merging is as much your job as splitting. Before you answer, read your own list back and collapse any pair that resolves to a single edit in a single file, document or rule. **Do not cite findings from two different checks in one issue unless they name the same resource, host or selector.** A loader config, the served markup, a script inventory and robots.txt are four places even when they are all "about performance". If the subjects differ, split — including when both are notes. ## Required on every issue - \`title\` — what the work is. NOT the cited finding's title reworded. - \`type\` — \`decision\` (a person must choose before work can start), \`code\` (a developer edits a repo file), \`content\` (an editor changes a CMS document), \`config\` (one line in a config file, a dashboard setting, an env var). This decides who the ticket goes to, so do not guess it from the rule's subject: contrast failing in a component is \`code\`; the same contrast because an editor picked a pale brand colour is \`content\`. - \`where\` — the one place. \`components/ui/card.tsx:174\`, \`Sanity → navbar → items[3]\`, \`next.config.ts headers()\`. - \`category\` — required ONLY when \`cites\` is empty; otherwise it is derived from the evidence and you must omit it. ## Titles are refused if they narrate the tool Do not write \`axe\`, \`lighthouse\`, \`probe\`, \`finding\`, \`the tool\`, or a check's name as the actor. A reader fixing the page does not care what analysed it. Name the thing and its state: "Resource-card titles are unreadable over the book covers", never "contrast fails and axe computed it". Do not begin a title with a number — lead with the thing, not how many. Saying what could NOT be measured is fine and is not tool narration. **A \`defect\` states the state; only a \`policy\` or an \`ungraded\` asks for something.** The list is read by scanning, and a list that mixes "here is what is wrong" with "here is what to do" makes the reader re-parse every row to work out which it is. So: - \`defect\` — "The flip-card headline links point at fragments no element carries". Not "Give the flip-card headline links a destination that exists": that is the \`fix\`, and it belongs in \`fix\`. - \`policy\` — "Decide whether /password-expired belongs in the sitemap". The ask really is a decision, so the imperative is the honest shape. - \`ungraded\` — "Confirm the failing axis on the footer expand buttons". Nothing measured it, so the ask really is a measurement. Measured over three reviews: 39 of 67 defect titles opened with an instruction, while policy titles were imperative 16 times out of 18 — the policy half was right and the defect half was not. **Aim for 42-52 characters and treat 60 as a soft cap.** Across 892 distinct titles on one machine the mean is 59 and 46% are over sixty; one shipped review ran to a mean of 73 with 37 of its 46 over. The same forty-six re-authored came to a mean of 38, and nothing was lost — every character over the cap had been paraphrase or a consequence clause. Two rules produce that: - **Do not open with an article when it carries nothing.** Twenty-six of those forty-six opened with "The". "The footer's Security link has an empty href" becomes "Footer Security link has an empty href". Keep the article when the subject needs it: "The pricing page's WebPage node has no description" is right. - **The consequence goes in \`why\`, never welded to the title with ", so ...".** "og:image is 415KB, over the WhatsApp limit" is the title; every share on WhatsApp losing its preview image is the \`why\`. Welding them is what produced the 96-character one. ## Prose \`problem\` — what is actually wrong, in the page's vocabulary. \`why\` — what failing costs, and then why this tier and not the one below it; that second half is the only place your severity call is reviewable. \`fix\` — what to change; leave it empty when the title already implies it, and required when it does not. Written for someone shipping a site, not someone studying WCAG. Cross-page prose must not name a single route. **No narrator, in any field.** No "I", and never the act of checking as a sentence's subject: "A re-fetch returns \`text/plain\`", not "I re-fetched it and got \`text/plain\`". Stating what could not be measured is not narration and is required of you. **Parallel evidence is not a sentence — fence it.** For two pages, three hosts or seven animations, write a lead line, then a fenced block of aligned rows, then the shared facts. One coordinated clause holding four pairs loses the reader the moment they miss a word, and a fenced block is the only construct the report renders that can hold a column. **Keep \`problem\` to about sixty words, and let the citation carry the list.** A reviewed run is thirty-odd issues and a human reads all of them: measured at 95-122 words per issue, one report is a twenty-minute read before anybody fixes anything, and the longest single \`problem\` ran to 288 words with twenty paths inline. Name the shape and the count — "20 of 46 declared URLs redirect, every \`/*/legal\` path among them" — and cite the finding, which already holds the full list in its evidence. Enumerating twenty items inside a sentence buries the number that matters. **\`fix\` names the change, not the reasoning, and one or two sentences is the whole of it.** It is read by somebody who has already read \`problem\` and \`why\` and has decided to do the work, so anything that argues for the work again is re-reading. Aim for about 20 words and treat 40 as the cap: measured over two reviews of one page, one reviewer averaged 97 characters and the other 151 with a longest of 278, and every character of the difference was justification that \`why\` already carried. **\`fix\` may not assert a mechanism \`problem\` left unsettled**, exactly as \`where\` may not. If the evidence does not establish which of two causes it is, name the change that is right either way, or say what to determine first. "Clip the layer, or clamp it to the frame width below 1088px" is a fix; "stop the hydration mismatch that widens it" is a diagnosis the run did not make. **Where the fix is a decision rather than an edit, say what has to be decided and by whom.** A \`policy\` issue whose \`fix\` reads like a code change tells whoever picks it up that the choice is already made. ## House style These hold in every field, and they are what the report is read for. **No analogies and no metaphors.** Do not explain a mechanism by comparison — no "think of it as", no "it is basically a", no "under the hood". State what goes in, what comes out, and what it guarantees. Established terms that happen to be dead metaphors — tree, queue, cache, handshake, fork — are just the names of the things and need no apology. The ban is on a fresh comparison invented to explain something. **Do not hedge a measurement.** A number you were given either was measured or it was not, so "contrast is probably around 1.4:1" reads as doubt about a fact the run holds precisely. Say the number. Where the run genuinely did not settle something, name what was not measured — that is precision rather than hedging. **Hedging a measurement is not the same as a general claim, and only the first is banned.** "Unused JavaScript on one route is often another route's bundle" and "a default nobody set, where doing nothing is probably right" are both correct: they qualify a *generalisation*, not a reading. \`may\` and \`might\` are fine throughout. **Present tense, active voice, and name the actor.** "The footer draws its copyright in \`text-neutral-700\`", not "the copyright is drawn" and not "the copyright will be drawn". Software does not see, know, want or decide: a component renders, a header is absent, a check measured. **One sentence, one idea, under about 26 words.** Subject near the front. A clause welded on with ", so ..." is usually the \`why\` escaping into the \`problem\`. **Do not tell the reader the work is easy.** \`simply\`, \`easily\`, \`quickly\`, \`obviously\` and "of course" are opinions about how hard somebody else's job is, and they are wrong for whoever is having the bad day. "Set one header" already says it is small. Two exemptions, because both are correct English and both occur: a quotation of the site's own copy is reproduced as written, and \`just\` meaning *barely* or *only* — "sits just under the floor", "not just crawlers", \`just-in-time\` — is not this. ## Severity \`severity\` defaults to what the check proposed. You may move it, but if you do, \`why\` must say why — an unexplained reclassification is unreviewable six months later. Four values, worst first: \`blocker\`, \`major\`, \`minor\`, \`nit\`. There is no \`should-fix\` and no \`info\`. **\`nit\` is the bottom of four, not a place for things you did not judge** — a measurement nobody took is \`kind: "ungraded"\`. **The axis is truthfulness, not magnitude.** Ask in this order: - **Is the site actively wrong, and are you certain?** → \`blocker\`. It asserts something false about itself, or a feature that matters is definitively non-functional. An advertised \`/index.md\` serving a placeholder; a page titled "report test" published with \`robots: index, follow\`; a nav link that 404s; a \`canonical\` pointing at a 404; an \`og:image\` over a documented third-party size limit. - **Can you put a number on the cost, or name a population it fails completely?** → \`major\`, and nothing the site says is false. 2.7MB of JavaScript that never executes; body text at 3.1:1; inputs labelled only by placeholder; a certificate expiring in eight days. - **Is something already absorbing it?** → \`minor\`. 8px tap targets, because swipe works. A missing \`Referrer-Policy\`, because the browser default already covers it. - **Did anybody actually choose this?** → \`nit\`. A default nobody set, where doing nothing is probably right. Three that are easy to get backwards: - **Magnitude never promotes to \`blocker\`.** A large number is what makes something \`major\` rather than \`minor\`. 41% dead JavaScript is major; two stray CMS documents are a blocker. - **A dated future failure is \`major\`** — nothing is wrong today. - **"It is a symptom of something else" lifts \`nit\` to \`minor\`.** A doubled preload is deduped by the browser, but it reveals a component mounted twice. \`kind\` is orthogonal to severity: \`defect\` (something is broken), \`policy\` (more than one answer is valid) and \`advice\` (doing nothing is legitimate) are all work and all appear in the list. The other two describe **this review** rather than the site, and \`kind\` alone decides where they render — nothing reads your sentence to work it out. \`transparency\` = you checked and found nothing, and it collapses into a clean box. \`ungraded\` = the measurement could not be taken, and it stays open below the list, because an unmeasured thing is not a passing one. A \`policy\` can be a \`blocker\`. ## Coverage Cite the findings each issue is the work for, by their \`id\`, in \`cites\`. Empty \`cites\` is valid and first-class — an issue you found by reading the sweep rather than a rule. Aim to account for every defect: either an issue cites it, or it is genuinely not worth work and you say so in an issue that cites it anyway. ## A finding's hedge is the check's limit, not your conclusion A check that says it could not settle something is stating the bound of its own measurement, which it is required to do. It is not telling you the answer. So when a finding says a value "could not be computed", that a list "is a floor rather than a total", that a URL's own canonical "was not read", or that something "is an inventory, not a verdict" — that unresolved half is yours to weigh, not to copy into the ticket. Two ways to get this wrong, and both were measured: - **Adopting the hedge as a verdict.** If the evidence still names a single largest contributor, or a single place, judge it and say what you judged on. An issue whose whole content is the finding's own caveat is not work. - **Grading past the hedge.** If a finding's own prose says the thing that would settle it was NOT checked, you cannot file the confident version. Say what was measured, say what was not, and let \`severity\` reflect that you do not know — a \`major\` that turns out to be nothing costs a developer a day, and this is where that happens. ## Three fields, three registers **\`where\` may not assert more than \`problem\` does.** They are read together by the same person, so a \`where\` naming a cause the evidence does not establish sends somebody to change the wrong thing. If the mechanism is unsettled, name the surface — "whatever selects the variant served by user agent" — and stop. A previous review titled an issue "absent from the server response", said in \`problem\` that it could not tell client-side injection from a UA-conditional response, and asserted the injection in \`where\` anyway. **\`why\` is about the issue, never about reading the list.** It answers why this matters to whoever fixes it. Notes about which items are cheap or what the top of the list has in common are not work-item content. **A \`transparency\` issue is a record, so keep it one.** It exists so a gap is not read as a clean bill of health, and a reader meets it in the same list as the work. If yours runs past a screen it has become a report section: state the bound and the count, say what would settle it, and stop. ## What you must not do No composite score. No go/no-go verdict. Do not invent a measurement — if the evidence does not say, say it does not. Do not restate a finding you have nothing to add to.` /** * The contract as markdown, with headings at the depth the host document uses. * * The text carries `##` headings, so level 3 rewrites them rather than the reverse: a brief nests this * under its own `###` sections and a flat `##` inside them reads as the document restarting. */ export function authoringContract(options: AuthoringContractOptions = {}): string { const text = CONTRACT return options.headingLevel === 3 ? text.replace(/^## /gm, '### ') : text }