Skip to main content

WitnessKit (Python) · v0

Tamper-evident audit trails for AI agents. Every action becomes a signed, hash-chained log entry; any later tamper is detected and located.

v0, experimental, unaudited. On PyPI as witnesskit since 2026-06-10.

Signing uses the vetted cryptography library and RFC 8785 canonicalization; pure-Python fallbacks keep it runnable with zero deps. The signing key stays local.

Install

pip install witnesskit

Or from source: git clone https://github.com/major-matters/witnesskit && pip install -e witnesskit/python, or drop the witnesskit/ folder next to your code.

Quick start

from witnesskit import Chain, generate_keypair, verify_chain

key, public_key = generate_keypair()
trail = Chain(key, actor="agent-7")
trail.append("tool_call", {"tool": "search", "query": "running shoes"})
trail.append("payment",   {"merchant": "Fleet Feet", "amount": 240, "currency": "USD"})

verdict = verify_chain(trail.to_json(), trusted_keys=[public_key])
print(verdict["valid"], verdict["reason"])   # True  chain intact

A tampered entry returns {"valid": False, "broken_at": <index>, "reason": ...}.

Security model

A valid signature proves integrity, not authority — pin the issuer with trusted_keys; without it (or allow_unverified_issuer=True) verification fails closed. verify_chain never throws. Tamper-evident, not tamper-proof; see ../SECURITY.md.

Reconcile a summary against the chain

Since 0.1.0: reconcile(claims, chain, parser="auto", summary=None) diffs an agent's report against its own chain. Claims are {"step", "counterparty", "verb", "claimed"} with claimed one of done, failed, declined, not_attempted; findings are no_entry, contradicted or undisclosed; bind_summary(text_or_object, mode=..., encoding=...) gives the run.completed fields. It never raises. It compares claims to entries and does not judge the truth of a tool result; run verify_chain first. Full notes in the repository README and the witnesskit.reconcile docstring.

from witnesskit import reconcile
diff = reconcile(claims, chain_json, summary=report_text)
print(diff["result"], diff["summary_bound"])

Tests

PYTHONPATH=. python3 tests/test_witnesskit.py      # unit (no pytest needed)
PYTHONPATH=. python3 tests/test_reconcile.py       # reconcile, driven by ../fixtures/reconcile.json
PYTHONPATH=. python3 tests/test_properties.py    # property-based (needs hypothesis)

License

MIT.

Metadata

Release files for witnesskit 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for witnesskit 0.1.0
File Size Uploaded Provenance
witnesskit-0.1.0.tar.gz 24.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for witnesskit 0.1.0
File Interpreter ABI Platform
witnesskit-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 43.2 kB

Release files / witnesskit-0.1.0.tar.gz

Download URL witnesskit-0.1.0.tar.gz
Size 24.6 kB
Tags Source
SHA-256 checksum
How to use checksums
89e67f78768b2ee346d5d6c7f34dd22c13176fade60b55f31ea96a1616afe40a
BLAKE2b-256 checksum
How to use checksums
0129c408637d4b7b68fc8af339af4b27686bdad0c4ff7403e88d5085378168cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / witnesskit-0.1.0-py3-none-any.whl

Download URL witnesskit-0.1.0-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce3776f48ffe4f038f80ec01928b97a999692fbb827864b4a6047dbd959116be
BLAKE2b-256 checksum
How to use checksums
ed67a615993b77a67fb1dea52a4bdfdbb4fe07d662beefcd11d34b1beb23750f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for witnesskit 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.

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page