Epistemic trust layer for AI agents — confidence tiers, routing, and accountability
Project description
cognilateral-trust
Epistemic trust layer for AI agents. AI that tells you when it's guessing.
pip install cognilateral-trust
Zero external dependencies. Python 3.11+.
Quick Start
from cognilateral_trust import evaluate_trust
result = evaluate_trust(0.7)
if result.should_proceed:
perform_action()
else:
escalate(result.accountability_record.reasons)
Confidence Tiers (C0-C9)
| Tier | Name | Route |
|---|---|---|
| C0-C3 | Unverified to Measured | basic — straight-through |
| C4-C6 | Tested to Falsifiable | warrant_check — evidence required |
| C7-C9 | Governance to Resilient | sovereignty_gate — full evaluation |
Features
Core
evaluate_trust()— confidence to tier to verdict (ACT/ESCALATE)@trust_gate— one-line trust enforcement decoratorextract_confidence()— parse confidence from text, OpenAI, or Anthropic responsesCalibratedTrustEngine— learning loop with JSONL persistence
Verification
- Claims extraction — factual, causal, comparative, quantitative
- Fidelity verification — word-overlap source checking
- Epistemic firewall — confidence mismatch detection (7-tier)
- Sovereignty gate — D-07 with D-05 welfare hard constraint
Network Primitives
- Trust decay — confidence attenuates across agent handoffs
- Contagion detection — track low-trust claim propagation
- Trust-weighted consensus — Bayesian composition, not majority vote
- Sovereign worker — leaf-level self-governance (D-07 at edge)
- Provenance chain — cryptographic accountability ledger
User Consent
- Sensitivity — end user controls trust threshold:
"low","default","high" - Nutrition label — every evaluation includes a structured disclosure (schema v1.0.0)
TrustBench (Calibration Benchmark)
- 200 scenarios across 5 domains: factual, reasoning, ambiguous, out-of-distribution, adversarial
- ECE scoring — expected calibration error measurement
- Adapters — plug any model (Ollama, OpenAI, Anthropic, custom callable)
- Fingerprint — radial calibration profile per model/domain
- Leaderboard — self-contained HTML ranking
Integrations
- LangGraph —
TrustNodefor StateGraph + conditional edges - CrewAI —
TrustToolimplementing the Tool protocol - OpenClaw —
TrustProviderfor always-on agent governance - Cognee — trust scoring on knowledge graph edges
MCP Server
Zero-install trust evaluation as an MCP tool:
uvx cognilateral-trust-mcp
Exposes trust_evaluate, trust_extract_confidence, and trust_health over stdio JSON-RPC 2.0.
Calibration Results (TrustBench v1.0.0)
200 scenarios across 5 epistemic domains. Higher = better calibrated (1.0 = perfect).
| Model | Type | Overall |
|---|---|---|
| qwen3:8b | General | 0.51 |
| qwen3:32b | General | 0.50 |
| qwen2.5-coder:7b | Code | 0.42 |
| qwen2.5-coder:32b | Code | 0.33 |
Findings:
- General models score ~0.50 — confidence correlates with correctness about half the time
- 4x larger model is no better calibrated (0.50 vs 0.51)
- Code-specialized models are worse (0.33-0.42) — specialization harms epistemic honesty
- The larger coder (32b) is the worst of all four models
Reproduce: BenchRunner(OllamaAdapter("qwen3:8b")).run("qwen3:8b")
Nutrition Label
Every trust_evaluate() response includes a structured disclosure:
{
"nutrition_label": {
"confidence": 0.87,
"tier": 8,
"tier_name": "C8",
"calibration_score": null,
"sensitivity": "default",
"evidence_count": 0,
"escalation_risk": "none",
"version": "1.0.0"
}
}
Like an FDA nutrition label, but for AI confidence. Schema v1.0.0.
User Sensitivity
The person downstream controls how cautious the trust engine is:
# Default: standard thresholds
result = evaluate_trust(0.6) # may proceed
# High sensitivity: stricter — user wants more caution
result = evaluate_trust(0.6, sensitivity="high") # likely escalates
# Low sensitivity: relaxed — user accepts more risk
result = evaluate_trust(0.6, sensitivity="low") # likely proceeds
Sensitivity shifts the proceed/escalate threshold without changing the tier. C7 is always C7.
Examples
See examples/ for runnable demos including a Colab notebook.
| Example | Description |
|---|---|
demo_trust_agent.py |
End-to-end agent with trust gating and calibration |
langgraph_trust_agent.py |
LangGraph agent with trust node |
crewai_trust_tool.py |
CrewAI tool integration |
anthropic_trust_wrapper.py |
Anthropic API with trust evaluation |
openai_trust_wrapper.py |
OpenAI API with trust evaluation |
Package Stats
| Metric | Value |
|---|---|
| Modules | 44 |
| Tests | Run uv run pytest -q for current count |
| External dependencies | 0 |
| Python | 3.11+ |
| Version | 1.2.0 |
| TrustBench scenarios | 200 |
| Calibration score (qwen3:8b) | 0.51 |
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cognilateral_trust-1.3.0.tar.gz.
File metadata
- Download URL: cognilateral_trust-1.3.0.tar.gz
- Upload date:
- Size: 221.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5524f530ac5fe650f95860e95f69c0ddecd950a2a18942ed38106f17b434ec93
|
|
| MD5 |
2abf699472e2d310f87da0bbb8cff610
|
|
| BLAKE2b-256 |
dc034b817a9442ebbae5c779adcca80fcd30844d7bef864096b1eead92884143
|
File details
Details for the file cognilateral_trust-1.3.0-py3-none-any.whl.
File metadata
- Download URL: cognilateral_trust-1.3.0-py3-none-any.whl
- Upload date:
- Size: 94.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f7f94a483678825aff8d3bce3e1c3dff353ec12810752bd5c36f1a014127214
|
|
| MD5 |
bb0da69c7d3fb8e7108d7c04a7f45e3d
|
|
| BLAKE2b-256 |
3d884241db42b9291dace137430e8b71e96d5983019280bce13b371a8089a42d
|