Metadata-Version: 2.5
Name: contradish
Version: 1.65.0
Summary: contradish certifies that an AI agent's changes, to what it does and what it remembers, are exactly what its governing information warrants, on every future the policy permits. Judge-free: correct answers are derived from a machine-readable policy and re-derived by an independent checker. Behavioral Update Fidelity was introduced by Michele Joseph in 2026.
Project-URL: Homepage, https://contradish.com
Project-URL: Repository, https://github.com/michelejoseph/contradish
Project-URL: Issues, https://github.com/michelejoseph/contradish/issues
Author: Michele Joseph
License: MIT
License-File: LICENSE
Keywords: agent-evaluation,agent-reliability,agents,ai,authority,automotive,behavioral-update,behavioral-update-fidelity,belief-revision,benchmark,cai,change-impact-analysis,consistency,corrigibility,counterexample,deontic-logic,ecommerce,education,employment,evaluation,evaluation-contract,finance,financial-planning,fingerprinting,firewall,food-delivery,government,healthcare,hr,immigration,insurance,legal,llm,medication,mental-health,norm-change,paraphrase-invariance,paraphrase-robustness,pluralistic-alignment,policy,policy-consistency,policy-diff,policy-grounded,prompt-engineering,prompt-injection,rag,real-estate,regression,runtime-verification,saas,semantic-invariance,telecommunications,testing,tool-use,transition-fidelity,travel,warranted-change
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.9
Provides-Extra: all
Requires-Dist: anthropic>=0.25.0; extra == 'all'
Requires-Dist: jsonschema>=4.0.0; extra == 'all'
Requires-Dist: litellm>=1.40.0; extra == 'all'
Requires-Dist: openai>=1.0.0; extra == 'all'
Requires-Dist: redis>=4.0.0; extra == 'all'
Provides-Extra: analysis
Requires-Dist: numpy>=1.24; extra == 'analysis'
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.25.0; extra == 'anthropic'
Provides-Extra: dev
Requires-Dist: anthropic>=0.25.0; extra == 'dev'
Requires-Dist: jsonschema>=4.0.0; extra == 'dev'
Requires-Dist: litellm>=1.40.0; extra == 'dev'
Requires-Dist: openai>=1.0.0; extra == 'dev'
Requires-Dist: pytest-mock; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: redis>=4.0.0; extra == 'dev'
Provides-Extra: litellm
Requires-Dist: litellm>=1.40.0; extra == 'litellm'
Provides-Extra: openai
Requires-Dist: openai>=1.0.0; extra == 'openai'
Provides-Extra: redis
Requires-Dist: redis>=4.0.0; extra == 'redis'
Provides-Extra: schema
Requires-Dist: jsonschema>=4.0.0; extra == 'schema'
Description-Content-Type: text/markdown

# 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.*

contradish certifies that an AI agent's changes, to what it does and what it remembers, are exactly what its governing information warrants, on every future the policy permits.

## What only contradish does

1. **Future-certified change.** A memory or behavior change is checked against every future the policy permits: each day of the horizon, scheduled policy changes, any revocation someone with standing could still make, and cascades through sub-delegations. A memory can be right today and unsafe later; contradish says which, and shows the first failing future.
2. **Proofs, not judges.** Correct answers are derived from a machine-readable policy. An independent, standard-library checker re-derives every verdict, so no model grades another model.
3. **Update fidelity, both ways.** For any change in governing information, contradish works out what must change, what must be preserved, and what must be resisted because its source has no standing. This covers actions, memory, and groups of agents.

What it is not: an LLM-as-judge consistency scorer, a benchmark of failure rates alone, or a general runtime firewall. How it relates to AuthMem-Bench, EAL-Bench, FORGE, PolicyBank and STALE: [docs/POSITIONING.md](docs/POSITIONING.md).

## Install

```bash
pip install git+https://github.com/michelejoseph/contradish
```

PyPI currently has an older release; install from source to get everything on this page. Python 3.9+. Optional extras: `contradish[schema]` for JSON-schema validation; the Anthropic or OpenAI SDK for hosted models; [Ollama](https://ollama.com) for free local runs.

## Try it in two minutes (offline, no API key)

```bash
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

```bash
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](docs/CERTIFY.md).

## Profile a model

```bash
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](docs/PROFILE.md).

## Instruments

| instrument | question | doc |
| --- | --- | --- |
| certify | Is this memory safe on every permitted future? | [CERTIFY](docs/CERTIFY.md) |
| profile | One model, one people-safety verdict | [PROFILE](docs/PROFILE.md) |
| protect | Does it keep the protections people depend on, under pressure? A fail-closed gate. | [PROTECTION](docs/PROTECTION.md) |
| correctability | Does its certainty decide whether it accepts a legitimate correction? | [CORRECTABILITY](docs/CORRECTABILITY.md) |
| separation | Is a contradiction a scope boundary or a real replacement? | [SEPARATION](docs/SEPARATION.md) |
| stereo | Is the difference between two answers the difference the policy warrants? | [STEREO](docs/STEREO.md) |
| swarm | In a group of copies of itself, does it herd, polarize or repair? | [SWARM](docs/SWARM.md) |
| collective | How do group failures change with scale and composition? | [COLLECTIVE](docs/COLLECTIVE.md) |
| memory, transform | Does consolidated memory keep its authority? Is a rewrite safe? | [MEMORY](docs/MEMORY.md), [TRANSFORM](docs/TRANSFORM.md), [SPEC](docs/SPEC-memory-1.md) |
| sufficiency, fulfillment | Is a compressed memory sufficient for the future? Is a promise kept? | [SUFFICIENCY](docs/SUFFICIENCY.md), [FULFILLMENT](docs/FULFILLMENT.md) |
| integrity, study | Does a model change exactly what authority warrants? | [INTEGRITY](docs/INTEGRITY.md) |
| integrate, mcp | Use contradish in CI, agents and MCP clients | [INTEGRATE](docs/INTEGRATE.md), [MCP](docs/MCP.md) |

The specification is [docs/BUF-SPEC.md](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](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](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.

```bibtex
@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](CITATION.cff). Specification: [docs/BUF-SPEC.md](docs/BUF-SPEC.md). Full technical report: [PAPER.md](PAPER.md).

---

## License

MIT. See [LICENSE](LICENSE).

Behavioral Update Fidelity was introduced by Michele Joseph in 2026.
