Skip to main content

ZMB Standalone Codebase Auditor (zmb_audit.py)

PyPI version GitHub release

A zero-dependency, standard-library-only static AST auditor that catches the exact failure modes AI coding agents introduce while passing unit tests.

What It Catches

  1. Orphan Modules (ZMB001): Non-test Python modules imported by nothing across the repo (allow_orphan_modules configurable).
  2. Unresolved Repo-Class Attribute Calls (ZMB002): Method calls on classes defined inside your repository where the method does not exist (zero false positives on stdlib or third-party objects).
  3. Silent Exception Fallbacks (ZMB003): Broad except Exception: / except: blocks that swallow errors and return [], {}, None, "", or pass, turning fatal runtime bugs into false-green tests.
  4. Custom .zmb-audit.toml Policy Rules (ZMB004, ZMB005): Enforce forbidden_imports, banned_calls, ignore_paths, min_health_score, max_orphans, max_unresolved, and max_silent_fallbacks.
  5. Multi-Repo Audits & PR Markdown Summaries: Audit multiple repositories in one command (zmb-audit repo_a repo_b --markdown) and populate GitHub Step Summaries automatically.

Requirements

  • Python 3.8+ (Stdlib only, zero runtime dependencies).

Installation (v0.4.1)

# Run immediately with pipx (zero manual install)
pipx run zmb-audit . --strict

# Or install from PyPI
pip install zmb-audit

# Or download the standalone single-file script directly
curl -sLO https://raw.githubusercontent.com/ADevBelgie/zmb-audit/main/zmb_audit.py

Usage

# Run via installed CLI entry point (auto-loads .zmb-audit.toml if present)
zmb-audit . --strict

# Explicitly pass a policy file & generate PR Markdown summary
zmb-audit . --config .zmb-audit.toml --markdown --out pr-summary.md --strict

# Audit multiple repositories together
zmb-audit ./service-a ./service-b ./agent-worker --markdown

# Output structured JSON
zmb-audit . --json

# Output SARIF v2.1.0 for GitHub Code Scanning
zmb-audit . --sarif --out zmb-audit.sarif

# Ignore repository .zmb-audit.toml for a clean baseline run
zmb-audit . --no-config

Example .zmb-audit.toml Policy

[policy]
min_health_score = 80
max_orphans = 0
max_unresolved = 0
max_silent_fallbacks = 3
ignore_paths = ["migrations/*", "legacy/*"]
allow_orphan_modules = ["wsgi", "asgi", "*_cli"]
forbidden_imports = ["pickle", "telnetlib"]
banned_calls = ["eval", "exec", "os.system"]

Drop-In GitHub Actions Marketplace & Code Scanning (SARIF + Step Summary)

name: Agent Code Audit
on: [pull_request]
permissions:
  security-events: write
jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ADevBelgie/zmb-audit@v0.4.1
        with:
          strict: "true"
          config: ".zmb-audit.toml"
          sarif-file: zmb-audit.sarif
          markdown-file: zmb-summary.md
          write-step-summary: "true"
      - if: always()
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: zmb-audit.sarif

Full Report, Governance Kit & Team/CI Policy Pack

  • Failure-Mode Report & Core Governance Kit (EUR 14): 10-chapter empirical postmortem (144+ autonomous cycles), Python 3.14 sys.monitoring live-path reachability tracer, cryptographic pre-commit guard, and two-arm benchmark starter.
  • Team/CI Policy Pack (EUR 29): Pre-tuned .zmb-audit.toml rulesets for LangChain, CrewAI, AutoGen, OpenAI Agents SDK, Pydantic AI, and Claude Code + sticky PR comment workflow + multi-repo HTML scorecard generator.

Metadata

Release files for zmb-audit 0.4.1

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

Source distribution (sdist)

Source distribution for zmb-audit 0.4.1
File Size Uploaded Provenance Actions
zmb_audit-0.4.1.tar.gz 14.5 kB With provenance Details for zmb_audit-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zmb-audit 0.4.1
File Interpreter ABI Platform Actions
zmb_audit-0.4.1-py3-none-any.whl Python 3 none any Details for zmb_audit-0.4.1-py3-none-any.whl

Total release size: 30.1 kB

Release files / zmb_audit-0.4.1.tar.gz

Download URL zmb_audit-0.4.1.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d09fbe7ef99bd58f8e37c0c630a50443a2708688a0cffeead01d7944bcc440a4
BLAKE2b-256 checksum
How to use checksums
d2290877f7f2c374479108690dc2e6294a404332869f9917a16ff3329643f3e6
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 5, 2026.

Transparency log

Release files / zmb_audit-0.4.1-py3-none-any.whl

Download URL zmb_audit-0.4.1-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1aab48b661c5233b2b5c0999fb1bda842a88b415bf08df36d25741ed442ebff0
BLAKE2b-256 checksum
How to use checksums
457bdbba62fd65cd7834400f1e4e744d44696b6a22f3b9d03b27db0d4f32226f
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 5, 2026.

Transparency log

Security for zmb-audit 0.4.1

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.

Select from 2 files

Attestation for zmb_audit-0.4.1.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 5, 2026.

Transparency log

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.4.1 This release

2 release files Full 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