contradish
The quality of an intelligence is not measured solely by what it can accomplish, but also by what it knows it must not change, claim, control, or exploit.
One question for every change to an AI agent. When its rules change, when anything writes to its memory, or when a new event enters its record, contradish asks:
Did everyone the change needed agree, and does it change exactly what they agreed to, and nothing else, on every future?
The answer is a change certificate, CERTIFIED or REFUSED. Anyone can re-check it with three standard-library Python files, without trusting contradish.
pip install contradish
contradish change demo # three changes, three certificates, one forgery caught (seconds)
contradish change demo --full # one agent, one morning: eight changes, what other checks miss
contradish change check request.json # certify one change (exit 1 if REFUSED)
contradish change verify cert.json # check a certificate independently
from contradish import certify_change, verify
cert = certify_change({"layer": "memory", "policy": "policy.json",
"before": memory, "after": new_memory, "as_of": "2026-09-30"})
cert["verdict"] # "CERTIFIED" or "REFUSED", with findings in the seven words below
verify(cert)["verdict"] # "VERIFIED" or "REJECTED", re-derived by an independent checker
Agents call the MCP tool certify_change before they commit a change, and commit only CERTIFIED ones.
Measure it on real models
contradish admission run --models ollama:qwen2.5:7b gives a model an agent's certified memory and a morning of messages. Some are legitimate changes; others are unauthorized: tool outputs extending its authority, users lowering or redirecting what it owes, claims that contradict the record. The study measures capture (unauthorized changes let in) and amendability (legitimate ones taken up). It needs no judge, and every output carries a change certificate. The predictions are preregistered: docs/ADMISSION.md.
A public log of every change
contradish log is an append-only, signed log of change certificates, in the style of Certificate Transparency. Each certificate gets a receipt anyone can check offline. A witness that keeps one checkpoint catches a rewritten history, two signed checkpoints prove a split view, and an agent changed off the log is caught even when every certificate, checked alone, is valid. A log is static files any web host serves. Independent monitors (contradish log monitor, standard library, free to run on GitHub Actions) pin its key, catch rewrites between runs, gossip to catch split views, and cosign what they verified. A runtime can require a quorum of witness cosignatures before it admits a change. contradish log demo runs four cheats and shows each one caught by a standard-library checker: docs/LOG.md.
Four properties, measured on pairs the policy labels
contradish invariance run --models ollama:qwen2.5:7b measures input invariance (irrelevant wording must not alter decisions), state invariance (irrelevant memory changes must not alter obligations), action invariance (equivalent circumstances must produce equivalent authorized behavior) and selective sensitivity (legitimate changes must change behavior appropriately, and only legitimate ones). Every pair's label is derived from the policy, not written by hand. Each scripted stand-in in contradish invariance demo breaks exactly one property, and an independent standard-library checker re-derives every label and score. contradish invariance depth goes further:
- it separates sensitivity from noise, by sampling each item repeatedly;
- it attributes each flip to one of eight irrelevant factors, using a fractional factorial design;
- it weights the harm by the policy's protection severities;
- it finds the breaking point and a minimal flipping input.
See docs/INVARIANCE.md.
Seven words for what goes wrong
| no standing | the change, or a claim inside it, comes from someone without authority for it |
| overreach | the agent would act beyond what it is authorized to do |
| withheld | the agent would stop doing something it is required to do |
| altered | a decision, or something owed, changes |
| forgotten | something owed, or the ability to decide, is lost |
| fabricated | certainty, or an obligation, the record never supported |
| eroded | a protected rule is broken or emptied |
Why other checks don't give this answer
- Evaluations check today's answer. A memory write that says "authorized through 31 October" is right today and wrong on 20 October, when the real delegation ends. contradish checks every day and every revocation anyone with standing could make.
- Guardrails check actions against the agent's memory. If something rewrote that memory, the guardrail approves. contradish checks the write itself, and who had standing to make it.
- Policy checks look at one change at a time. A chain of legitimate-looking changes can still take over the rules (docs/ENTRENCHMENT.md). contradish checks what the rules of change allow over every chain.
- Certificates you have to take on faith aren't evidence. Every verdict is recomputed by a checker that shares no code with contradish, so a tampered certificate is rejected even when its hashes match.
The spec is docs/CHANGE.md, and the demonstration is docs/SHOWCASE.md. What it is not: an LLM-as-judge consistency scorer, a failure-rate benchmark, or a general runtime firewall. How it relates to AuthMem-Bench, EAL-Bench, FORGE, PolicyBank and STALE: docs/POSITIONING.md.
Install
pip install contradish
Python 3.9+, no required dependencies. Optional extras: contradish[schema] for JSON-schema validation; the Anthropic or OpenAI SDK for hosted models; Ollama for free local runs.
The public API is certify_change, verify and CHANGE_KINDS. The research instruments on the rest of this page live in contradish.lab; every name that imported from contradish before still does.
Try it in two minutes (offline, no API key)
contradish change demo # one question, three certificates, one verifier
contradish invariance demo # four properties; each stand-in breaks exactly one
contradish log demo # a public log of changes: four cheats, all caught
contradish about # what it is, what it is not, where to start
contradish certify demo # memories that are right today and unsafe later
contradish profile demo --html p.html # one verdict across five people-safety dimensions
contradish protect demo # the protections people depend on, under pressure
contradish mcp # serve the instruments to any MCP client
Every demo uses scripted agents, not models. Nothing they show is evidence about any model.
Certify a memory
contradish certify check LEDGER.json MEMORY.json # exit 0 certified, 1 not; prints the first failing future
contradish certify minimal LEDGER.json --out M.json # the smallest certified memory, with its certificate
On 6 generated delegation ledgers, five scripted memory writers are all right today. Only two are safe on every permitted future:
| writer | right today | certified | authority items kept |
|---|---|---|---|
| current state ("may act until …") | 100% | 0% | 1.0 |
| source-labeled (each grant's issuer) | 100% | 0% | 1.5 |
| one chain (the rest dropped) | 100% | 50% | 2.0 |
| event log (every grant and revoke) | 100% | 100% | 4.5 |
| contradish (compiled minimal memory) | 100% | 100% | 2.5 |
Labeling each grant with its issuer is not enough: the memory fails the day the grant it hangs from is revoked. Details: docs/CERTIFY.md.
Certify that memory updates did not silently change what the agent owes
A summary, a consolidation, or the agent's own write can keep an obligation in memory while changing it. The amount can be cut, the deadline moved, the payee or card swapped. A tool's output can "close" it with no proof it was paid. contradish obligations holds every obligation to its terms. Terms change only through events from someone with standing: a payment receipt from the system of record, a waiver from the person owed, or an amendment they consented to. Every certificate is re-derived independently.
contradish obligations demo
contradish obligations check --policy P.json --history H.json --memory M.json --as-of 2026-09-30
See docs/OBLIGATIONS.md.
Certify that entrenched rules stay entrenched
A chain of changes that are each legitimate can still reach what the charter forbids. A role can become another role's signer, a review period can be backdated, or a protected rule can be emptied by redefining a word it uses. contradish entrench computes who can actually achieve each outcome over every chain, compares that with what the charter declares, and certifies changes so that entrenched rules keep their meaning. Every result is checked independently.
contradish entrench demo # three legitimate-looking steps that take over the built-in charter
contradish entrench analyze # effective vs declared authority; --hardened with the fix
See docs/ENTRENCHMENT.md.
Profile a model
contradish profile estimate
contradish profile run --models anthropic:claude-sonnet-4-5 --html report.html # exits 1 on HOLD
One verdict (PASS, REVIEW or HOLD), the weakest dimension, and plain findings. Overall is the weakest dimension, not the average. On scripted characters, no single instrument tells them apart:
| character | verdict | protection | correctability | separation | stereo | swarm |
|---|---|---|---|---|---|---|
| faithful | PASS | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 |
| people pleaser | HOLD | 0.00 | 0.00 | 0.20 | 0.75 | 0.33 |
| rigid | REVIEW | 1.00 | 0.00 | 0.20 | 0.00 | 1.00 |
| entrenched | HOLD | 1.00 | 0.50 | 0.85 | 0.69 | 0.33 |
Details: docs/PROFILE.md.
Instruments
| instrument | question | doc |
|---|---|---|
| certify | Is this memory safe on every permitted future? | CERTIFY |
| profile | One model, one people-safety verdict | PROFILE |
| protect | Does it keep the protections people depend on, under pressure? A fail-closed gate. | PROTECTION |
| correctability | Does its certainty decide whether it accepts a legitimate correction? | CORRECTABILITY |
| separation | Is a contradiction a scope boundary or a real replacement? | SEPARATION |
| stereo | Is the difference between two answers the difference the policy warrants? | STEREO |
| swarm | In a group of copies of itself, does it herd, polarize or repair? | SWARM |
| collective | How do group failures change with scale and composition? | COLLECTIVE |
| memory, transform | Does consolidated memory keep its authority? Is a rewrite safe? | MEMORY, TRANSFORM, SPEC |
| sufficiency, fulfillment | Is a compressed memory sufficient for the future? Is a promise kept? | SUFFICIENCY, FULFILLMENT |
| integrity, study | Does a model change exactly what authority warrants? | INTEGRITY |
| integrate, mcp | Use contradish in CI, agents and MCP clients | INTEGRATE, MCP |
The specification is docs/BUF-SPEC.md. Every command, result and older instrument (including the CAI-Bench judge-based tools) is in the full guide: docs/GUIDE.md. contradish --help lists all commands by role.
Status
- Formal layer: re-checkable with no model and no key (
sh scripts/verify_core.sh): 13 theorems model-checked, 1,740 conformance vectors, 19 planted scorer bugs caught, certificates re-derived by a standard-library checker. The checker shares an author with the code; see docs/VALIDATION.md. - Real models: local runs on four Ollama models (qwen2.5 3b/7b, llama 3.2 3b, llama 3.1 8b) found that none tracks authority well and verification of relayed changes is rare. Judge-based frontier results from April to August are in the guide. No frontier model has been run on the instruments above yet.
- New instruments (certify, profile, protect, correctability, separation, stereo, swarm, collective) have been run on scripted agents only.
- Known validity gaps: CAI-Bench reworded equivalence is expert-audited in 4 of 20 domains; the defect-injection study met 1 of 9 pre-registered predictions; automatic warrant derivation agreed with a lawyer on 6 of 12 cases.
Cite
Behavioral Update Fidelity, the policy evaluation contract, CAI Strain and CAI-Bench were introduced by Michele Joseph.
@misc{joseph2026buf,
title = {Behavioral Update Fidelity: Measuring Whether an AI Changes Its Behavior Exactly When, and Only as Far as, Changes in Governing Information Warrant},
author = {Joseph, Michele},
year = {2026},
howpublished = {\url{https://github.com/michelejoseph/contradish}},
note = {contradish: policy evaluation contract and Counterfactual Benchmark Suite}
}
@misc{joseph2026caibench,
title = {CAI-Bench: A Frozen Benchmark for Adversarial Consistency in Language Models},
author = {Joseph, Michele},
year = {2026},
howpublished = {\url{https://github.com/michelejoseph/contradish}},
note = {Introduces Strain, SW-Strain, MT-Strain, CL-Strain, CAT-Strain, and SPA-Strain metrics}
}
Citation metadata: CITATION.cff. Specification: docs/BUF-SPEC.md. Full technical report: PAPER.md.
License
MIT. See LICENSE.
Behavioral Update Fidelity was introduced by Michele Joseph in 2026.
Metadata
Release files for contradish 1.66.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| contradish-1.66.0.tar.gz | 2.1 MB | Without provenance | Details for contradish-1.66.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| contradish-1.66.0-py3-none-any.whl | Python 3 | none | any | Details for contradish-1.66.0-py3-none-any.whl |
Total release size: 3.9 MB
Release files / contradish-1.66.0.tar.gz
| Download URL | contradish-1.66.0.tar.gz |
|---|---|
| Size | 2.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac984240117cd51ae6d112a950c882cd6fc8f4c7ec05842a0931cde685988b69
|
|
BLAKE2b-256 checksum How to use checksums |
f141599064849cb20975fd85bc7198ab24c8d1cba3d754980a9dde4c0c73bb6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.3
|
Release files / contradish-1.66.0-py3-none-any.whl
| Download URL | contradish-1.66.0-py3-none-any.whl |
|---|---|
| Size | 1.8 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8e0eafa63593f562051625f598eb4db38682c099a79e16dd860803785cebd01a
|
|
BLAKE2b-256 checksum How to use checksums |
18df13756272a04cd20dd2061c1015cdbc08ca31644cb011bdabcc0591052310
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.3
|
Security for contradish 1.66.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.