Volume buys nothing
Governed memory promotes claims to knowledge, and at low stakes it can do that without a human. Which makes the confidence number an authorization input, and therefore something an attacker wants to control.
The original implementation took the arithmetic mean of the supporting evidence's confidences. That is trivially gamed: flood N near-identical corroborating items and the average converges on whatever value you submitted. Ten copies of the same sentence, pasted by ten identities, reads as overwhelming agreement.
Getting there took five separate mechanisms, because there are five separate ways to fake agreement.
First: which direction is dangerous?
The risk scorer fails malformed input to 10, the worst score, because high risk is the cautious direction. This module does the exact opposite and fails to zero.
Same principle, opposite pole. Here high confidence is what unlocks auto-promotion, so a broken value must never buy any. Every normalisation step in the module is a variation on that:
pointsOf() non-finite, wrong type, out of range → 0 points
trustOf() unrecognised trust class → 'tainted'
sourceOf() missing or blank source id → one synthetic anonymous source
hashOf() missing content hash → one bucket per source
The last two are the interesting ones, because they are not merely clamping — they are closing a bypass.
If a missing sourceId were treated as its own identity, submitting a hundred unattributed items would look like a hundred independent sources. So all anonymous items collapse into exactly one source. Anonymity cannot manufacture independence.
If a missing contentHash made every item unique, omitting the hash would defeat deduplication entirely. So items without a usable hash collapse to a single bucket per source. You cannot opt out of dedup by leaving a field blank.
Both are the same move: the absence of a field must not be more powerful than any value you could put in it.
Second: the same statement counts once
Evidence is deduplicated by content hash before anything is counted. Ten identities submitting identical text produce one item.
The subtlety is in the sort:
const sorted = [...items].sort((a, b) =>
a.contentHash.localeCompare(b.contentHash) ||
a.sourceId.localeCompare(b.sourceId) ||
a.id.localeCompare(b.id));
Deduplication keeps the first occurrence, so without a sort the survivor would depend on the order the caller happened to pass items in. Sorting first makes the result a deterministic function of the set. Two callers holding the same evidence in different orders compute the same confidence — which matters because this number gates an approval, and an approval that depends on iteration order is not reproducible.
Third: a source contributes its best item, not its sum
Per source, the contribution is the maximum of that source's items, capped at 60 points.
Max rather than sum, deliberately: a single source submitting a thousand items contributes exactly what its strongest one does. And the cap means no single source can ever reach the auto-approve bar on its own, however confident it claims to be. A perfectly trusted source asserting 100% confidence contributes 60.
That is the structural version of "one witness is not corroboration." It is not a policy sitting on top of the arithmetic; it is arithmetic that cannot express the thing you want to forbid.
Fourth: independence has a definition, and it excludes almost everyone
Breadth is rewarded — 15 points per independent source beyond the first, capped at 40. But "independent" is narrow, and two filters do the work.
Only trusted and observed sources count. An attacker holding a hundred distinct external identities gains no independence at all, which collapses the cheapest Sybil strategy: registering more accounts.
And a source must have contributed non-zero points. Without that clause, submitting sources whose evidence is malformed or worthless would still buy the full diversity bonus — corroboration by parties who corroborated nothing. It is a one-line condition guarding an attack that is easy to miss precisely because the items being submitted are garbage rather than lies.
Fifth: trust sets a ceiling the bonus cannot climb past
Each trust class carries a maximum:
trusted 100
observed 85
external 67
tainted 40
auto-approve bar: 90
Read those two together and a structural property falls out. The ceiling is the best trust class present, and observed tops out at 85, below the bar of 90.
So evidence that is merely observed can never auto-promote. Not with three sources, not with thirty. No quantity of observation reaches the threshold, because the threshold is above the ceiling that observation can produce. Auto-promotion structurally requires at least one trusted source — and separately requires breadth, because one trusted source caps at 60.
The arithmetic lands exactly where it was aimed:
1 independent source 60 + 0 = 60
2 independent sources 60 + 15 = 75
3 independent sources 60 + 30 = 90 ← exactly the bar
4+ 60 + 40 (cap) = 100
Three independent sources, at least one of them trusted, with no conflicts and nothing tainted. That is the shape of a claim this system will promote without asking a human, and every one of those four conditions is a separate mechanism rather than a tuned coefficient.
The conflict penalty is capped, which is the non-obvious half
Conflicting evidence weakens a claim. The natural implementation accumulates the penalty — and that hands an attacker the mirror-image of the original attack. If conflicts summed, flooding twenty mediocre objections would destroy any inconvenient true claim.
So the penalty is the worst single conflict, capped at 40. One devastating conflict and twenty mediocre ones weigh the same.
Note the symmetry: support uses max-per-source and caps the total, conflict uses max-overall and caps the total. Both directions refuse to let volume substitute for quality — because both directions are attack surfaces, and a system that hardens only the one it thought of first is a system with an inverted exploit.
Auto-eligibility is conjunctive on purpose
const autoEligible = enoughPoints && enoughSources && unconflicted && untainted;
Four clauses, each refusing a distinct attack, and points alone are never sufficient. A claim can sit at 100 points and still be ineligible because one tainted item is present, or because a conflict exists, or because the breadth came from two sources rather than three.
The alternative — a single score compared against a threshold — is what the per-source cap and the trust ceilings exist to prevent, so collapsing back to a single number at the final step would undo the whole design.
And the result carries an ordered, deterministic reasons array explaining which clause failed. Not a log line — a field on the returned object, so the caller that refuses an auto-promotion can say why in the same breath.
Integer points end to end
Everything is integer points from 0 to 100. Confidence arrives as a 0–1 float and is converted immediately; the 0–1 view exposed on the result is derived from the integer, not carried alongside it.
This is deliberate, and copied from the risk scorer: no float ever reaches a threshold comparison. A claim at 89.999999999 is not a claim that might round over the bar depending on accumulated error. It is 90 points or it is not.
The module is otherwise a pure function — no I/O, no clock, no locale, no randomness. A conformance test runs a thousand identical calls and asserts byte-identical output, and another asserts invariance to input order. Both are cheap, and both are the kind of property that quietly stops being true a year later without them.
What it does not do
This measures corroboration, not truth. Three independent trusted sources that are all wrong produce a confidently promoted falsehood, and nothing here can detect that. What the module guarantees is narrower and worth stating precisely: the number cannot be raised by volume, by duplication, by anonymity, by registering identities, or by submitting worthless items in bulk. Raising it requires genuinely distinct sources that the system independently classifies as trustworthy.
Trust classes are system-stamped from the source registry, never proposer-declared — which is what keeps the ceiling meaningful. An attacker who can write his own trust class has defeated the ceiling and everything resting on it, so that boundary is doing more work than its one line suggests.
And the auto-approve path exists for low-stakes promotion only. Everything else routes to a human regardless of score. The confidence number decides how much friction is spared, not whether the rules apply — which is the same division of labour the risk scorer uses, pointed in the opposite direction.