Constitutional Linting — spellcheck for AI constitutions

An AI constitution is becoming a document organizations will point at when asked “why did your model do that?” — and almost nobody can hold one in their head. So I built the linter.

Two clauses, one state, no way out

A privacy policy says: the system shall not share personal data with third parties. Three sections later: the system may share personal data freely with any partner that improves service quality. A partner improves service quality, both clauses apply, and obeying one means violating the other.

Constitutions — the principle documents behind Constitutional AI training and agent charters — are written by many hands over years. Five failure modes fall out of that: direct contradictions, priority clashes (“privacy above all” vs “log everything forever”), exceptions that swallow their rules, duplicated rules that drift apart on the next edit, and orphan rules with no trigger or actor. Nobody reads every pair. So I wrote something that does.

The idea: clauses as a graph, arithmetic before spending tokens

The linter segments a constitution into clauses (id, section, modality, actor, trigger, source span), embeds each clause as a 384-dimension vector, and prunes the N(N−1)/2 pair space with cosine similarity — 200 clauses is 19,900 pairs; pruning cuts that to hundreds with zero gold pairs lost in our tests. Only surviving candidates reach the LLM judge, which must output a label plus a witness state — the concrete situation where both clauses apply.

Everything smart in this pipeline is a transformer; everything else is bookkeeping. The bookkeeping is what makes the answers complete (every pair accounted for), cheap (free pruning first), and durable (verdicts cached by text hash in a sqlite ledger — edit one clause, re-judge only its pairs).

Why two stages: 16% → 89%

Reported benchmarks for LLM-only pairwise contradiction checks on legal/financial text run at roughly 16% precision — ask a model loosely “do these conflict?” and it over-flags. Add a cheap filter and a strict second-pass verifier and reported precision jumps to ~89% at ~10× lower cost (consistency-checker, PyPI). Our implementation mirrors that shape: a labeling pass, then a verifier that confirms only if a concrete shared state exists and no scoping language separates the two rules.

Cloud verdicts still varied run-to-run at temperature=0, so the default runs each stage twice — union of flags to protect recall, unanimous confirmation to protect precision. That took measured precision from 0.133 to 0.667.

What the measurements say

On a 25-clause test constitution with planted defects and an adjudicated gold key (7 core conflicts, 4 arguable, 4 trap pairs that must NOT be flagged):

  • scaffolded pipeline: precision 0.667, recall 0.857, zero trap hits, zero pairs lost to pruning;
  • a one-shot baseline (whole constitution in one prompt): precision 0.833, recall 0.714 — competitive on small inputs, which is the honest result. Its failure isn’t quality, it’s scale: on Claude’s 1,069-clause constitution (258 KB) the baseline literally cannot be run in one prompt, while the scaffold judged a capped 400 pairs and reported.

Clause graph of the seeded test constitution, conflicts in red

On real, professionally-edited constitutions the tool’s first honest answer is boring: Claude’s constitution (2026-01-20): 0 conflicts, 13 redundancy clusters, coherence score 0.811; AEGIS and a third public charter likewise clean. No panic headlines — just “checked, here’s the score” instead of a guess. Known gaps, measured and documented: redundancy detection missed its gold pair every run, and the big corpus means judging ~0.07% of possible pairs.

Clause graph of Claude's constitution

What it does not do

It doesn’t resolve conflicts or rewrite your constitution — detect and record, human decides. It doesn’t touch the model or training. It’s evidence with provenance (clause IDs, source spans, witness statements), not proof.

The problem is real enough that three independent groups published on it in 2024–26:

But nobody ships the authoring loop: edit → instant conflict + cohesion report → diffable ledger. In this experiment, I explore that missing loop (slide deck).