Skip to main content

evidence-gate

CI

SHA-256 digest-bound test execution cache and rate-limited monitor gate for autonomous AI coding agents (Claude Code, Codex CLI, Cursor, Antigravity, Aider, Windsurf, CI runners).

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:

  • 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, returns SKIP_CACHED_PASS in milliseconds with command_calls=0.
  • Fail-safe invalidation: failed runs are never cached; any 1-byte change in any watched artifact invalidates the key immediately; --force requires an explicit --force-reason audit trail.
  • Bounded monitor polling (observe): enforces --min-interval-seconds, --deadline-utc, and --max-unchanged consecutive identical-output loop breaking (STOP_UNCHANGED, STOP_DEADLINE, SKIP_TOO_SOON).
  • Concurrency & integrity: atomic O_CREAT | O_EXCL file lease (exit 75 on active duplicate run, automatic stale-lock reclamation), atomic os.replace state updates, 0o600/0o700 private permissions, shell=False always.

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

60-Second Quickstart

PyPI package-name warning: Do NOT run pip install evidence-gate. The unscoped evidence-gate name on PyPI is owned by an unrelated third party (blazingRadar). The official PyPI distribution for this repository is integrity-evidence-gate (which provides the evidence-gate CLI command and the evidence_gate Python module).

1-line zero-friction usage (auto-defaults to --kind targeted, --reason cli-run, deterministic --suite-id auto-<sha256>, and current directory as watched artifact):

Linux / macOS (bash)

# Zero-install standalone script (pure Python 3.10+ stdlib)
python3 agensi-skill-pack/evidence-test-gate/scripts/evidence_test.py -- pytest

# Or via the CLI shim / installed command
python3 evidence_gate_cli.py run -- pytest
evidence-gate run -- pytest

# Isolated install from source via pipx or .venv (PEP 668 / Ubuntu 24.04 safe)
pipx install .
python3 -m venv .venv && .venv/bin/python -m pip install --no-deps .
.venv/bin/evidence-gate run -- pytest

# Once published on PyPI (ALWAYS use `integrity-evidence-gate`, NEVER `evidence-gate`):
# pipx install integrity-evidence-gate

Windows (pwsh 7)

# Zero-install standalone script (pure Python 3.10+ stdlib)
python agensi-skill-pack\evidence-test-gate\scripts\evidence_test.py -- pytest

# Or via the CLI shim
python evidence_gate_cli.py run -- pytest

# Isolated virtual environment (.venv) from source
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install --no-deps .
.\.venv\Scripts\evidence-gate.exe run -- pytest

# Once published on PyPI (ALWAYS use `integrity-evidence-gate`, NEVER `evidence-gate`):
# .\.venv\Scripts\python.exe -m pip install integrity-evidence-gate

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

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-gate guarantees: deterministic SHA-256 key binding over declared --artifact paths + OS/Python/cwd + command argv; append-only JSONL audit ledger; zero shell injection (shell=False); strict concurrency exclusion via O_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 via EVIDENCE_GATE_HOME or --ledger/--logs-dir/--state-dir).

Development & Verification

ruff check evidence_gate evidence_gate_cli.py tests agensi-skill-pack
python -m unittest discover -s tests -p "test_*.py" -v

Project Homepage

License

MIT — see LICENSE.

Metadata

Release files for integrity-evidence-gate 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 integrity-evidence-gate 0.1.0
File Size Uploaded Provenance Actions
integrity_evidence_gate-0.1.0.tar.gz 24.5 kB Without provenance Details for integrity_evidence_gate-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for integrity-evidence-gate 0.1.0
File Interpreter ABI Platform Actions
integrity_evidence_gate-0.1.0-py3-none-any.whl Python 3 none any Details for integrity_evidence_gate-0.1.0-py3-none-any.whl

Total release size: 40.8 kB

Release files / integrity_evidence_gate-0.1.0.tar.gz

Download URL integrity_evidence_gate-0.1.0.tar.gz
Size 24.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c68dd55716f95bd4efcfd7924e406846d49030fca027dd249fe5e8673e73985c
BLAKE2b-256 checksum
How to use checksums
ffe517e7a75f570cef5aeecf64cc6ce79574c02ea22821643f28987162f3d7f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Download URL integrity_evidence_gate-0.1.0-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7da6b2034a5002447a3940906c8f1e501b1a9d2d746d7db30ec78b25271b5fe2
BLAKE2b-256 checksum
How to use checksums
005df5df64273577acf017e6c0dbd92aa449e4c891be3cd3231a3d955f60e0bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for integrity-evidence-gate 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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