Skip to main content

audit-autopilot

A domain-agnostic, zero-dependency Python 3.10+ toolkit for automated audit batch selection, pluggable audit execution with strict schema and hash verification, isolated candidate label storage, controlled label promotion, and anonymized regression test scaffold generation.

Key Capabilities

  • Batch Selection: Reads candidate pool JSON (compatible with ranker/sampler outputs) and selects up to N unaudited, single-blocker records that include required artifacts per reason bucket, while tracking missing-evidence counts by bucket.
  • Pluggable Audit Adapters: Includes an AuditAdapter protocol, a deterministic MockAuditAdapter for local runs and testing, and a SubprocessJsonAdapter for integrating external audit workers over stdin/stdout JSON.
  • Tampering & Prompt-Injection Defense: Enforces strict JSON schema validation (expected_action in submit, hold, unsupported; non-empty root_cause_category; field_values dict; evidence string; strict sha256 equality with the input record; rejection of unexpected keys). Invalid or tampered responses are safely rejected without crashing the batch.
  • Strict Label Isolation: Writes newly audited results exclusively to an isolated candidate_labels.json file and never modifies production_labels.json during audit runs.
  • Controlled Promotion: Provides a promote subcommand that defaults to --dry-run (showing added/updated/unchanged diffs) and requires explicit --approve to merge selected candidates into a target production labels file.
  • Anonymized Regression Test Generation: When >= 3 audited candidates share the same root_cause_category, replaces entity names, store names, phone numbers, registration IDs, emails, and raw amounts with deterministic placeholders (ENTITY_001, STORE_001, 000-0000-0000, 1000, etc.), generates a layout_of(...) style unittest scaffold, and verifies zero PII leakage via check_no_pii_leak.

Installation

Requires Python 3.10+ with zero third-party runtime dependencies.

pip install -e .

Or run directly from source:

PYTHONPATH=src python -m audit_autopilot.cli --help

CLI Usage

1. Run an audit batch

audit-autopilot run \
  --pool candidate_pool.json \
  --candidate-labels candidate_labels.json \
  --production-labels production_labels.json \
  --max-per-bucket 5 \
  --adapter mock \
  --tests-dir generated_tests \
  --format table

Use --format json to emit the structured run summary JSON (audited_count, rejected_count, by_root_cause, pending_promotion_count, generated_test_files, missing_evidence_by_bucket).

2. Preview and promote candidate labels

Preview diff (default dry-run, never modifies the target file):

audit-autopilot promote \
  --candidate-labels candidate_labels.json \
  --production-labels production_labels.json \
  --format table

Apply promotion explicitly:

audit-autopilot promote \
  --candidate-labels candidate_labels.json \
  --production-labels production_labels.json \
  --approve

Filter to specific records with repeatable --record-id:

audit-autopilot promote \
  --candidate-labels candidate_labels.json \
  --production-labels production_labels.json \
  --record-id rec-001 \
  --record-id rec-002 \
  --approve

3. Generate anonymized regression tests from candidate labels

audit-autopilot generate-tests \
  --candidate-labels candidate_labels.json \
  --output-dir generated_tests \
  --min-cluster-size 3 \
  --format json

Running Tests

PYTHONPATH=src python -m unittest discover -s tests -v

Project Structure

src/audit_autopilot/
  __init__.py      Public package exports
  models.py        Typed dataclasses for records, results, summaries, and diffs
  adapters.py      AuditAdapter protocol, strict validator, MockAuditAdapter, SubprocessJsonAdapter
  anonymizer.py    Deterministic anonymizer, PII leak verifier, unittest scaffold generator
  pipeline.py      Batch selector, isolated label persistence, end-to-end runner
  promote.py       Dry-run diffing and explicit-approval promotion logic
  cli.py           Command-line interface (run, promote, generate-tests)
  py.typed         PEP 561 type marker
docs/
  REQUIREMENTS.md  Functional and safety requirements specification
tests/
  test_pipeline.py     End-to-end pipeline, isolation, validation, and promotion tests
  test_sanitization.py Repository hygiene and confidentiality checks

Metadata

Release files for audit-autopilot 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 audit-autopilot 0.1.0
File Size Uploaded Provenance Actions
audit_autopilot-0.1.0.tar.gz 23.5 kB Without provenance Details for audit_autopilot-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 43.5 kB

Release files / audit_autopilot-0.1.0.tar.gz

Download URL audit_autopilot-0.1.0.tar.gz
Size 23.5 kB
Tags Source
SHA-256 checksum
How to use checksums
43520131b6af539ef08a2916b0aa900f43e4fdd5a16bf471aad8982aa9402ef6
BLAKE2b-256 checksum
How to use checksums
7f52047aa5aff01a452a1360af8f6201d2a7e60ad414b1d80478325e28cf2900
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

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

Download URL audit_autopilot-0.1.0-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fecd7b19adc653a356785ee11d433c6299643c4253f2ffaee4fd858637e2e13f
BLAKE2b-256 checksum
How to use checksums
445e9966a36a4a6d2f9e6a079de0d9a871dc70afc52b6e099c8655cd13ab8703
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Security for audit-autopilot 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