receipt-kernel
Append-only, hash-chained run ledger with invariant evaluation.
Zero dependencies. Stdlib only. Python 3.10+.
What it does
- Run ledger: append-only, hash-chained event store (SQLite, WAL mode)
- Stage machine: explicit stage graph with hard-fail on illegal transitions
- Evidence store: content-addressed blobs with pre-write redaction and retention policies
- Invariant evaluation: PASS / WARN / FAIL / UNKNOWN — no silent downgrade
What it doesn't do
No daemons, schedulers, reconciliation loops, plugins, auth, tenancy, or LLM abstractions. It records what happened, proves the chain is intact, and evaluates invariants. That's it.
Install
pip install receipt-kernel
Quick start
from receipt_kernel import Verdict
from receipt_kernel.store_sqlite import SqliteReceiptStore
from receipt_kernel.envelope import make_envelope
# Create a store
store = SqliteReceiptStore(":memory:")
store.initialize_schema()
# Start a run
run_id = "run-001"
store.ensure_run(run_id, policy_id="default", policy_version="1.0", stage_graph_id="default")
# Append an event (store fills run_id, seq, prev_hash, event_hash)
env = make_envelope(
event_type="RUN_START",
stage="START",
actor_kind="system",
actor_id="test",
policy_id="default",
policy_version="1.0",
stage_graph_id="default",
payload={"task": "example"},
)
store.append_event(run_id, env)
events = store.get_events(run_id)
print(f"Events: {len(events)}, chain intact: {events[0]['event_hash'] is not None}")
Invariants
Six constitutional invariants ship with the kernel:
| Invariant | What it checks |
|---|---|
ledger_chain_valid |
Hash chain integrity (seq contiguity, prev_hash, event_hash) |
receipt_completeness |
Required evidence keys present, blobs retrievable |
evaluation_completeness |
Attested evaluation, no silent downgrade |
finalization_completeness |
Clean endings, decision ref, last event |
run_shape.single_finalize |
Exactly one RUN_FINALIZE per run |
run_shape.stage_required_path |
Required stages appear in order |
All invariants return InvariantResult with a Verdict. Any UNKNOWN or FAIL in required invariants poisons overall success.
Verdicts
from receipt_kernel import Verdict
Verdict.PASS # verified and satisfied
Verdict.WARN # verified but degraded
Verdict.FAIL # verified and violated
Verdict.UNKNOWN # cannot verify (missing evidence, read failure)
UNKNOWN is a failure, not a shrug.
Evidence
Evidence is stored as content-addressed blobs (blob://sha256:<hex>).
Two evidence classes:
- public: retained longer, safe for logging
- sealed: aggressively expired, encrypted-at-rest when applicable
An optional redaction hook runs before persistence (13 built-in secret patterns).
License
Apache-2.0
Metadata
Release files for receipt-kernel 0.1.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 | |
|---|---|---|---|---|
| receipt_kernel-0.1.0.tar.gz | 43.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| receipt_kernel-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 85.6 kB
Release files / receipt_kernel-0.1.0.tar.gz
| Download URL | receipt_kernel-0.1.0.tar.gz |
|---|---|
| Size | 43.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1c5bfc0d43ba5a7a9486145aa66ff6eb45de571fc381fb8cf90aaed6479dcdc5
|
|
BLAKE2b-256 checksum How to use checksums |
08881a425f17b3cbbb267225e5369925571173b2b7526b5c65632d6a93cd1a8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency logRelease files / receipt_kernel-0.1.0-py3-none-any.whl
| Download URL | receipt_kernel-0.1.0-py3-none-any.whl |
|---|---|
| Size | 41.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e3ab9b176dc598ccb08bc4ea015d15eed39475dd147fa485828e453feaa02c09
|
|
BLAKE2b-256 checksum How to use checksums |
09a4ddf07a0ac5aa669fe6a269f693473d83d2755ef55b5c3eb48cadf99a16b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency logSecurity for receipt-kernel 0.1.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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for receipt_kernel-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency logA 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.