evidence-gate
SHA-256 digest-bound test execution ledger & anti-loop monitor gate — zero wasted re-runs on unchanged trees.
Quick Start · Live Demo · Architecture · Evidence Ladder · Core Commands · Threat Model · Ecosystem
Autonomous coding agents burn 30–60% of their context window and API budget re-running identical passing test suites and polling unchanged CI/deploy logs in tight loops. evidence-gate stops both deterministically with SHA-256 digest-bound PASS reuse and a rate-limited, loop-breaking monitor FSM — pure Python 3.10+ stdlib (zero runtime dependencies, shell=False always).
Quick Start
1-line zero-friction usage — auto-defaults to --kind targeted, --reason cli-run, deterministic --suite-id auto-<sha256>, and the current directory as watched artifact. Run evidence-gate status (or zero-arg evidence-gate) to inspect your local ledger anytime.
Linux / macOS (bash)
# Option 1: Isolated CLI Install via pipx (ALWAYS `integrity-evidence-gate`, NEVER `evidence-gate`)
pipx install integrity-evidence-gate
evidence-gate run -- pytest
# Option 2: Zero-install ephemeral run via uvx
uvx --from integrity-evidence-gate evidence-gate run -- pytest
# Option 3: Isolated .venv via pip
python3 -m venv .venv
.venv/bin/python -m pip install integrity-evidence-gate
.venv/bin/evidence-gate run -- pytest
# Option 4: Zero-install standalone script from source (pure Python 3.10+ stdlib)
python3 agensi-skill-pack/evidence-test-gate/scripts/evidence_test.py -- pytest
Windows (pwsh 7)
# Option 1: Isolated CLI Install via pipx (ALWAYS `integrity-evidence-gate`, NEVER `evidence-gate`)
pipx install integrity-evidence-gate
evidence-gate run -- pytest
# Option 2: Zero-install ephemeral run via uvx
uvx --from integrity-evidence-gate evidence-gate run -- pytest
# Option 3: Isolated .venv via pip
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install integrity-evidence-gate
.\.venv\Scripts\evidence-gate.exe run -- pytest
Live Demo
Verified CLI capture showing a cold EXECUTED run, an immediate warm SKIP_CACHED_PASS hit (command_calls=0, 0 ms), and evidence-gate status:
Architecture
Key Mechanical Properties
- Zero runtime dependencies — pure Python 3.10+ standard library.
- Digest-bound PASS reuse (
run): hashes target files/directories (symlink-safe SHA-256, ignoring.git/__pycache__/node_modules), OS/Python environment fingerprint, and exact command argv. If an identical PASS already exists in the append-only JSONL ledger, returnsSKIP_CACHED_PASSin milliseconds withcommand_calls=0. - Fail-safe invalidation: failed runs are never cached; any 1-byte change in any watched artifact invalidates the key immediately;
--forcerequires an explicit--force-reasonaudit trail. - Bounded monitor polling (
observe): enforces--min-interval-seconds,--deadline-utc, and--max-unchangedconsecutive identical-output loop breaking (STOP_UNCHANGED,STOP_DEADLINE,SKIP_TOO_SOON). - Concurrency & integrity: atomic
O_CREAT | O_EXCLfile lease (exit 75on active duplicate run, automatic stale-lock reclamation), atomicos.replacestate updates,0o600/0o700private permissions,shell=Falsealways.
Evidence Ladder (E0–E4)
Pair evidence-gate with a progressive verification budget so agents start with the smallest proving gate instead of running full suites on every edit:
| Level | --kind |
Typical scope | Freshness default |
|---|---|---|---|
| E0 | static |
Linter / typecheck / schema check on edited files | artifact |
| E1 | targeted |
Single failing/changed unit test module | artifact |
| E2 | impacted |
Affected package test suite | artifact |
| E3 | smoke / replay |
End-to-end smoke or fixture replay | ttl or artifact |
| E4 | full |
Full repository suite before release/PR | artifact |
Core Commands
1. Digest-bound test gate (run)
# Zero-flag 1-liner: cold run -> EXECUTED, immediate repeat -> SKIP_CACHED_PASS (0 command calls)
evidence-gate run -- pytest
python3 agensi-skill-pack/evidence-test-gate/scripts/evidence_test.py -- pytest
# Full explicit form: narrow watched artifacts and record audit metadata
evidence-gate run \
--kind targeted \
--suite-id auth-unit \
--reason "verify token parser fix" \
--artifact src/auth \
--artifact tests/test_auth.py \
-- python -m unittest tests/test_auth.py
# Second run with unchanged artifacts -> instant SKIP_CACHED_PASS (0 command calls, 1-line summary)
evidence-gate run \
--kind targeted \
--suite-id auth-unit \
--reason "re-check before commit" \
--artifact src/auth \
--artifact tests/test_auth.py \
-- python -m unittest tests/test_auth.py
# Force a fresh run with mandatory audit reason
evidence-gate run \
--kind smoke \
--suite-id api-health \
--reason "post-restart verification" \
--freshness volatile \
--force --force-reason "container restarted externally" \
-- python scripts/smoke_check.py
2. Rate-limited, loop-breaking monitor (observe)
# Take at most 1 sample every 60s, stop after 3 identical outputs or after deadline
evidence-gate observe \
--monitor-id deploy-rollout \
--reason "watch staging rollout" \
--deadline-utc 2026-12-31T23:59:59Z \
--min-interval-seconds 60 \
--max-unchanged 3 \
--json \
-- python scripts/check_rollout.py
3. Local ledger status (status)
evidence-gate status
Exit Codes
| Exit code | Meaning |
|---|---|
0 |
Command passed, SKIP_CACHED_PASS, SKIP_TOO_SOON, or STOP_DEADLINE |
2 |
PolicyError (nonexistent --artifact, --force without --force-reason, invalid TTL/cwd/command) |
75 |
BusyError (SKIP_BUSY — an identical run/monitor already holds the FileLease) |
<rc> |
Underlying command's non-zero exit code (with compact failure_tail: on stdout) |
Guarantee & Threat Model
- What
evidence-gateguarantees: deterministic SHA-256 key binding over declared--artifactpaths + OS/Python/cwd + command argv; append-only JSONL audit ledger; zero shell injection (shell=False); strict concurrency exclusion viaO_CREAT | O_EXCL. - Boundary you must respect: if a test depends on external mutable state (live database, remote API, clock, undeclared config file), either pass the config as an
--artifact, use--freshness ttl --ttl-seconds N, or mark it--freshness volatile. The gate can only hash what you declare. - State defaults to
~/.evidence-gate(override viaEVIDENCE_GATE_HOMEor--ledger/--logs-dir/--state-dir).
Development & Verification
ruff check evidence_gate evidence_gate_cli.py tests agensi-skill-pack
python -m pytest -q
# or unittest:
python -m unittest discover -s tests -p "test_*.py" -v
Integrity Harness Ecosystem
| Repository | Role in the Harness | Stack |
|---|---|---|
| BlackBadHope/agent-killswitch | OS process-tree killswitch & runaway execution breaker | Python stdlib · Win32 / POSIX |
| BlackBadHope/agent-token-forensics | Read-only JSONL token, cache-cliff & retry-loop forensics | Python 3.10+ stdlib · MCP |
| BlackBadHope/evidence-gate | SHA-256 digest-bound test cache & anti-loop monitor gate | Python 3.10+ stdlib · CLI |
| BlackBadHope/integrity-platform | Multi-plane execution firewall, witness ledger & control plane | Go / Python · Hybrid |
| BlackBadHope/neon-studio | Multi-stage agent studio & CAS patch rail | TypeScript / Python |
| BlackBadHope/integrity-landing | Public control-plane site & docs (integrityharness.dev) | Cloudflare Pages |
License & Disclaimer
MIT — see LICENSE. Security policy and responsible disclosure: SECURITY.md.
Independent Open-Source Project:
evidence-gate(integrity-evidence-gate) is an independent open-source project maintained by BlackBadHope and is not affiliated with, endorsed by, or sponsored by Anthropic, OpenAI, Cursor, Google, or any other AI/IDE vendor referenced for compatibility.
Metadata
Release files for integrity-evidence-gate 0.1.2
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 | Actions |
|---|---|---|---|---|
| integrity_evidence_gate-0.1.2.tar.gz | 27.5 kB | With provenance | Details for integrity_evidence_gate-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| integrity_evidence_gate-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for integrity_evidence_gate-0.1.2-py3-none-any.whl |
Total release size: 45.5 kB
Release files / integrity_evidence_gate-0.1.2.tar.gz
| Download URL | integrity_evidence_gate-0.1.2.tar.gz |
|---|---|
| Size | 27.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0291023d98854056f27c5f0aeae47cbd5fc2cc24c40f8025c2e4b5b01e5c0cbc
|
|
BLAKE2b-256 checksum How to use checksums |
a02ee6610ceddbb6fbe44d7b0b214e8685debf429ec22157ef3ed00057c457c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 3, 2026.
Transparency logRelease files / integrity_evidence_gate-0.1.2-py3-none-any.whl
| Download URL | integrity_evidence_gate-0.1.2-py3-none-any.whl |
|---|---|
| Size | 18.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f75b4cd171d5de13217aac8a5f7a1eb8ecb98e3584ad4ffbd29b37e80c0f4aba
|
|
BLAKE2b-256 checksum How to use checksums |
180c0a822980382d1097f2cbf071daf8d405c4a99af934b3edaf1687e71b6fbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 3, 2026.
Transparency logSecurity for integrity-evidence-gate 0.1.2
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
Both files in this release have been uploaded with provenance metadata.
Attestation for integrity_evidence_gate-0.1.2.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 Dec 3, 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.