belief-check
A machine's way to know when it's wrong.
Two services agree on a contract. Months later one of them changes what a
field means — amount_cents starts carrying 49.99 instead of 4999 —
and every type checker, schema validator, and integration test stays green.
The field kept its name. The wrongness flows.
belief-check is the smallest thing that catches that: a document stating what you believe about a counterparty, a way to check whether it still holds, and a tripwire that stops the call when it doesn't.
Zero dependencies. Python 3.9+, standard library only. No registry, no coordination, no permission, no cryptographic identity.
python example.py
That runs the whole proof against a live local server — drift, containment, recovery — in four acts.
The three layers
Layer 1 — the belief. A plain JSON document: the schema fingerprint you built against, a semantic version, and probes that test meaning (values, units, types), not just shape.
Layer 2 — the check. POST /.well-known/belief-check. The counterparty
answers confirmed or diff. On silence — non-200, timeout, endpoint absent
— the consumer runs its probes itself and decides unilaterally. The first
adopter gets fail-fast against counterparties that never cooperate.
Layer 3 — the tripwire. Detection is the primitive; blocking is policy,
and the two are never fused. FAIL_CLOSED (default) blocks the call with a
typed, machine-readable BeliefBroken. HALF_OPEN blocks but re-checks and
resumes automatically. OBSERVE never blocks and hands every break to your
own handler.
Consumer
from beliefcheck import Belief, Probe, Tripwire, Policy, schema_hash
belief = Belief(
counterparty="https://api.example.com",
schema_hash=schema_hash(openapi_dict), # the artifact you built against
semantic_version="orders-v2",
probes=[
Probe(
name="amount-is-integer-cents",
request={"method": "POST", "path": "/orders/echo",
"body": {"sku": "A1", "qty": 1}},
expect={"status": 200, "body_subset": {"amount_cents": 4999}},
)
],
)
wire = Tripwire(belief, policy=Policy.FAIL_CLOSED, interval=300)
wire.connect() # check on connect
order = wire.guard(client.place_order, "A1") # blocks if belief broke
guard also probes on anomaly: if the wrapped call raises, the wire checks
whether drift — rather than ordinary failure — is the real cause, and tells
you which.
Producer
One route makes you a cooperating counterparty:
from beliefcheck import answer, WELL_KNOWN, schema_hash
@app.post(WELL_KNOWN)
def belief_check(doc: dict):
return answer(doc, schema_hash(CURRENT_SCHEMA), "orders-v2")
A handshake confirmed is your claim about your declared state, not
verified behavior. The producer never executes a stranger's probes against
itself — that is a security hole, not a courtesy. Probes verify behavior;
handshakes verify declaration.
Read this before trusting it
Probes are examples, not invariants. The two outcomes are not symmetric:
A fired check is proof of drift. A passing check is evidence of health, never proof.
Drift outside your probes' coverage is invisible to this protocol. Widen
coverage; accept that it never closes. Probes are also perishable — the most
dangerous deployment is a confidently FAIL_CLOSED wire whose probes went
stale. Treat a long-silent tripwire with suspicion, not comfort.
Anything claiming a silent tripwire means a healthy integration is lying to you.
When not to use this
- You own both sides and deploy them together. Types, review, and shared libraries already enforce the contract; a belief document is a second source of truth that can rot.
- The producer is simple and stable. If probe maintenance costs more than the expected breakage, the ROI is negative.
- The drift you fear is syntactic. Strict parsers and compiled protos already scream at shape changes. This protocol exists for the residue: meaning changes that survive the type system.
- You need audit or compliance guarantees. This is a safety mechanism, not an evidence trail. Proving to a third party that you checked is attestation, a different layer.
It earns its keep where drift is silent, dangerous, and outside your control.
Non-goals
Signatures, gossip, history, anchoring, repair, and dashboards are other layers answering other questions. SPEC.md is one page and is complete as written.
License
Apache-2.0. No CLA.
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 belief_check-0.3.4.tar.gz.
File metadata
- Download URL: belief_check-0.3.4.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7a7248383d24eceb27666d747ea04a3a0f096a1df7d58e465d6ef906c188218
|
|
| MD5 |
06a9f5e57c5fe5747ef4b98010f04038
|
|
| BLAKE2b-256 |
1a1daed87ee938c659372507f2a0e99a9c58ea98286975910586341dcff3fa2e
|
Provenance
The following attestation bundles were made for belief_check-0.3.4.tar.gz:
Publisher:
release.yml on vsdawkins-creator/belief-check
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
belief_check-0.3.4.tar.gz -
Subject digest:
a7a7248383d24eceb27666d747ea04a3a0f096a1df7d58e465d6ef906c188218 - Sigstore transparency entry: 2268385212
- Sigstore integration time:
-
Permalink:
vsdawkins-creator/belief-check@e7eb0031427f19feb0b10920f4186f409658275f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vsdawkins-creator
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e7eb0031427f19feb0b10920f4186f409658275f -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file belief_check-0.3.4-py3-none-any.whl.
File metadata
- Download URL: belief_check-0.3.4-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8d60de74ff7d87c7653144335fa09f541fa6fc477acdf6d96f847bb705d9ca0
|
|
| MD5 |
e30236cbee520171ab66b441ff292648
|
|
| BLAKE2b-256 |
5383a61dd53d522f5e1a4da562433e0f901b255cd1b2849c1ed61104bd9861b3
|
Provenance
The following attestation bundles were made for belief_check-0.3.4-py3-none-any.whl:
Publisher:
release.yml on vsdawkins-creator/belief-check
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
belief_check-0.3.4-py3-none-any.whl -
Subject digest:
d8d60de74ff7d87c7653144335fa09f541fa6fc477acdf6d96f847bb705d9ca0 - Sigstore transparency entry: 2268385448
- Sigstore integration time:
-
Permalink:
vsdawkins-creator/belief-check@e7eb0031427f19feb0b10920f4186f409658275f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vsdawkins-creator
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e7eb0031427f19feb0b10920f4186f409658275f -
Trigger Event:
workflow_dispatch
-
Statement type: