# Source Quote Law: The Code That Refuses a Source Card Without the Source's Own Words

slug: source-quote-law · https://miscsubjects.com/a/source-quote-law · category: engineering · tags: source-law, editorial-gate, source-quotes, build-integrity, miscsubjects · updated 2026-08-06T07:35:33.416Z

# Source Quote Law: The Code That Refuses a Source Card Without the Source's Own Words

Every source card on miscsubjects.com is supposed to show the source's verbatim words — the sentence from the study, the text of the tweet, the line from the paper. For months, that did not happen. Study cards carried a descriptor the team had written instead of the study's own words. Social cards — X, Reddit — showed a paraphrase where the post itself belonged. Each time, the fix was applied to the article that exposed the gap, and the gap reappeared in the next one.

`functions/_lib/source_law.js` is the structural fix. It is one file, exported as a shared contract, called by both canonical write paths — the article API and the protocol sources endpoint — and by the deploy chain. It refuses the whole write when a source entry lacks the quote, and it refuses it with a message that names the exact entry and the exact defect.

## The failure it removes

The file's header comment describes the failure class in plain terms: "The owner reported, repeatedly, that source cards on the site show no quote: study cards carried a descriptor we had written instead of the study's own words, and social cards (X, Reddit) showed a paraphrase where the post itself belonged. Each time, the fix applied was to the article that exposed it."

The problem was not the renderer. `functions/_lib/widgets/rail-platform.js` has always printed `s.quote` inside the card and falls through to `s.summary` only when `quote` is empty. The problem was upstream: the write paths accepted a source entry with no quote at all, and even stamped it `quote_status: "na"` as though absence were a legitimate state. They also accepted entries that were not objects — bare strings sitting in `meta.sources`, which render as empty fallback cards.

## The invariant enforced

The law states the invariant directly: "A source entry is an object, it has a URL, and it carries the source's own verbatim words in `quote`. The words in `quote` are never our words: they may not equal the title, the summary, or the plain-language gloss. A card can therefore never render without the quote the reader came for, because a quote-less source can no longer be stored."

The `SOURCE_LAW` constant makes this machine-checkable. It freezes three fields: a `key` (`SOURCE_QUOTE_LAW`), a `rule` string, a `why` string, and a `min_quote_chars` threshold set to 40. The rule is the one above, compressed into two lines. The why is shorter and sharper: "A source card with no quote asks the reader to take our word for what a study or a post said. That is the one thing this site exists not to do."

## How a source entry is checked

`checkSourceEntry(raw, index)` is the per-entry validator. It runs four checks in order:

1. **Type check.** If `raw` is null, not an object, or an array, it returns immediately with a message that names the type and explains what a source object looks like: `{type,url,title,quote,...}`. A bare string, the error says, renders as an empty card.

2. **URL check.** If the entry has no `url` (or `href` or `link`), it pushes an error.

3. **Quote presence check.** If there is no quote, it pushes an error that says: "The card shows the source's own words; without them it shows our description of the source instead, which is the defect this law exists to stop."

4. **Quote length check.** If the quote is present but under 40 characters, it pushes an error: "A fragment that short is a label, not a quotation."

5. **Quote-originality check.** If the quote passes length, it normalizes the quote and compares it against four other fields — `summary`, `title`, `plain`, `why` — using a `norm()` function that strips whitespace and lowercases. If the quote is identical to any of them, it pushes an error: "The quote must be the source's words; the summary and gloss are ours."

The normalization matters. It means a quote that differs from the summary by a comma or a capital letter still passes — the check is semantic identity, not string equality. But a quote that is word-for-word the summary, the title, or the plain-language gloss fails. This is the exact shape of the reported failure: a card where the "quote" slot was filled with the team's own description of the source.

## How a whole list is checked

`checkSources(list)` runs `checkSourceEntry` against every entry in the array and returns every violation, not just the first. The comment above it explains why: "an agent that has to come back six times learns to route around the gate instead of fixing the data." Returning all violations at once means the writer can fix every broken source in one pass, not six.

The return object carries `ok`, `violations` (each with the index, the source id if present, and the error messages), and `checked` (the count of entries examined).

## The refusal object

`sourceLawRefusal(result)` is the shape a write path returns when `checkSources` finds violations. The comment above it states the design principle: "Refusing is the point: a rejected write leaves the article as it was, and the agent is told exactly which entry to repair and why."

The refusal carries the law key (`SOURCE_QUOTE_LAW`), the rule, the why, the number of entries checked, the number refused, the violations array, and a `how_to_fix` string: "Open the URL, copy the sentence that actually supports the claim, and put those exact words in `quote`. Keep your own description in `summary` or `plain`."

The `how_to_fix` is the most important field operationally. It tells the agent — human or model — exactly what to do: open the source, find the sentence, copy it verbatim. It does not say "add a quote." It says add the source's own words. The distinction is the whole law.

## Where it is enforced

Two layers enforce the law:

**At write time.** Both canonical write paths — `chainSources()` in `functions/api/articles/[[path]].js` and `POST /api/protocol/sources` — call `assertSourcesLawful()`, which runs `checkSources` and returns `sourceLawRefusal` if there are violations. The write is refused. The article stays as it was. Nothing is partially saved.

**At deploy time.** `scripts/check-source-quotes.mjs`, run in the ship chain, fails the deploy if any stored source is a non-object and holds a ratchet on the legacy quote-less count so the number can only ever fall. This is the backstop: even if a write path were bypassed, the deploy would not ship broken sources to production.

The two layers are complementary. The write-time gate stops new violations from entering. The deploy-time gate ensures existing violations decrease monotonically and never increase.

## What the law assumes

The law assumes the quote is verifiable. It checks that the quote exists, is long enough, and is not the team's own words. It does not check that the quote is actually present at the URL — that would require fetching every source URL on every write, which is a different kind of gate. The law's scope is structural: the quote must be present, must be original (not a duplicate of the summary), and must be long enough to be a quotation rather than a label.

The `min_quote_chars` threshold of 40 is a judgment call. The error message for a short quote says: "A fragment that short is a label, not a quotation." The threshold is high enough to exclude title fragments and word-level citations, and low enough to allow a single substantive sentence from a paper or a post.

## The quote-is-the-body types

The file exports a second frozen constant: `QUOTE_IS_THE_BODY`, an array of source types whose card body is the quote itself — the post, the message, the sentence from the paper. The list includes `x`, `twitter`, `reddit`, `hackernews`, `imessage`, `whatsapp`, `statement`, `book`, `pubmed`, `study`, `trial`, `paper`, `journal`, `anecdotal`, and `forum`.

These are the types where the source's content IS the evidence. A tweet's text is the quote. A study's abstract sentence is the quote. A forum post's body is the quote. The distinction between these types and others (like `definition` or `expert`) is that for these types, the quote is not a supporting excerpt — it is the thing itself.

## What the corpus actually looks like, by register

The gate holds a ceiling and the ceiling is a single number, which hides where the debt is. Measured
6 August 2026, by register, over the newer half of the corpus:

| register | source entries | quote-less | rate |
| --- | --- | --- | --- |
| technical | 269 | 216 | 80% |
| unlabelled | 501 | 185 | 37% |
| standard | 1081 | 198 | 18% |
| essay | 886 | 89 | 10% |
| oip_protocol | 301 | 51 | 17% |
| grain | 181 | 35 | 19% |
| source_ledger | 1907 | 60 | 3% |
| accessible | 145 | 3 | 2% |

Corpus-wide the recorded ceiling is 804 quote-less entries of 9,812, and it may only fall.

Two findings a single ceiling number could never have surfaced, both of which came from a model
asking for this table rather than for the total. There is no compound register — the peptide and
drug pages sit under `standard`, so the highest-risk-looking category does not exist as a thing the
data can be cut by. And the worst register is not the compound pages at all: it is `technical`, at
eighty percent quote-less, four times the rate of the pages anyone would have guessed. Roughly a
fifth of the corpus carries no register label at all, and that unlabelled set runs at 37 percent.

## Why it matters

The law exists because the alternative — a source card that shows the team's description of a source instead of the source's own words — is the exact thing the site was built not to do. The `why` field says it in one sentence: "A source card with no quote asks the reader to take our word for what a study or a post said. That is the one thing this site exists not to do."

The code is the enforcement. The comments are the rationale. The deploy gate is the backstop. Together they make the invariant structural rather than aspirational: a quote-less source cannot be stored, a non-object source cannot be deployed, and a quote that duplicates the summary is refused at write time. The reader sees the source's own words, or the source does not appear.

## Sources

1. functions/_lib/source_law.js — functions/_lib/source_law.js
2. functions/_lib/source_law.js — functions/_lib/source_law.js
3. functions/_lib/source_law.js — functions/_lib/source_law.js
4. functions/_lib/source_law.js — functions/_lib/source_law.js
5. functions/_lib/source_law.js — functions/_lib/source_law.js
6. functions/_lib/source_law.js — functions/_lib/source_law.js
7. functions/_lib/source_law.js — functions/_lib/source_law.js
8. functions/_lib/source_law.js — functions/_lib/source_law.js
9. functions/_lib/source_law.js — functions/_lib/source_law.js
10. functions/_lib/source_law.js — functions/_lib/source_law.js
11. functions/_lib/source_law.js — functions/_lib/source_law.js
12. functions/_lib/source_law.js — functions/_lib/source_law.js

