Skip to main content

Agent Safety Doctor

Production-grade local-first scanner and report generator for teams giving AI coding agents access to repos, terminals, credentials, MCP tools, and automation workflows.

Why this exists

AI coding agents are moving from autocomplete to execution. They can read files, run commands, call tools, mutate repos, invoke MCP servers, and sometimes touch production credentials. Most teams do not have a simple way to answer:

  • What can the agent touch?
  • Are destructive commands or prod tokens reachable?
  • Are MCP tools over-permissioned?
  • Is there an approval policy?
  • Could we produce a useful incident postmortem after a bad run?

agent-safety-doctor starts as a productized-service accelerator: it generates a first-pass safety report for an AI Coding Agent Safety Audit.

Quick start

Install from PyPI:

python -m pip install agent-safety-doctor
agent-safety-doctor scan /path/to/repo --output agent-safety-report.md

Run directly from a source checkout:

python -m agent_safety_doctor.cli scan /path/to/repo --output agent-safety-report.md

For editable development:

python -m pip install -e .
agent-safety-doctor scan /path/to/repo --output agent-safety-report.md

JSON output:

agent-safety-doctor scan /path/to/repo --output agent-safety-report.json

HTML output for buyer-facing review:

agent-safety-doctor scan /path/to/repo --output agent-safety-report.html

CI/pilot gating:

agent-safety-doctor scan /path/to/repo --fail-under 85 --output agent-safety-report.md

If the safety score is below the threshold, the CLI exits non-zero.

Current checks

  • Secret-bearing file names near the workspace.
  • Secret-looking assignments in text files, with values redacted.
  • Risky/destructive command patterns in scripts/config/docs.
  • MCP config and tool exposure indicators.
  • Missing agent approval policy documentation.
  • Missing backup/rollback documentation.
  • Git missing or dirty state.

Config

Create .agent-safety-doctor.toml in the scanned workspace:

[scanner]
ignore_dirs = [".git", "node_modules", ".venv", "dist", "build"]
ignore_globs = ["*.pyc", "*.png", "*safety-report.md"]
allow_secret_file_globs = ["*.example", ".env.example"]
max_file_bytes = 300000
scan_tests = false

Or pass an explicit config:

agent-safety-doctor scan /path/to/repo --config /path/to/.agent-safety-doctor.toml

Output

Markdown report includes:

  • scan metadata
  • safety score
  • risk distribution
  • findings table with line/evidence where safe
  • top recommended fixes
  • incident postmortem template
  • approval policy starter

JSON report includes:

  • schema_version
  • metadata
  • score
  • counts
  • findings

HTML report includes:

  • designed executive summary
  • score card
  • severity table
  • top fixes
  • postmortem starter

Secret values are redacted from reports.

Demo

Generate a sample high-risk report from the included unsafe demo workspace:

python -m agent_safety_doctor.cli scan examples/unsafe-agent-workspace --output docs/sample-unsafe-workspace-report.md --display-root unsafe-agent-workspace
python -m agent_safety_doctor.cli scan examples/unsafe-agent-workspace --output docs/sample-unsafe-workspace-report.json --display-root unsafe-agent-workspace
python -m agent_safety_doctor.cli scan examples/unsafe-agent-workspace --output docs/sample-unsafe-workspace-report.html --display-root unsafe-agent-workspace

View the included buyer-facing example:

Professional audit

The CLI is the first-pass evidence layer. Teams that need a scoped review of agent permissions, secrets exposure, destructive command paths, approval gates, and rollback readiness can review the AI Coding Agent Safety Audit.

Limitations

This is a first-pass operational safety scanner, not a full penetration test, compliance audit, SAST engine, or guarantee of agent safety. It is designed to generate buyer-facing evidence quickly and identify obvious risky paths before deeper review.

Development verification

PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -m pytest -q
python -m agent_safety_doctor.cli --version
python -m agent_safety_doctor.cli scan examples/unsafe-agent-workspace --output docs/sample-unsafe-workspace-report.md --summary

Business wedge

Sell the audit first. Productize repeated checks second.

Metadata

Release files for agent-safety-doctor 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 agent-safety-doctor 0.1.0
File Size Uploaded Provenance
agent_safety_doctor-0.1.0.tar.gz 21.2 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 39.9 kB

Release files / agent_safety_doctor-0.1.0.tar.gz

Download URL agent_safety_doctor-0.1.0.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ff27c1f714761c515bcf8977b64e7bb08cce784e6bf368332e21498969755686
BLAKE2b-256 checksum
How to use checksums
625b75aea7afedc471e5f9f15e3d8a385064738c8a6651486036fc3deed3ea3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

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

Download URL agent_safety_doctor-0.1.0-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5fafbaf8d30427fba53fe94f9bf6c4197537df646ff10f80f56d86e27b12c559
BLAKE2b-256 checksum
How to use checksums
66004da9bc6f3a6d71d70266d5e098c0f2ccb959cb7788d3da20f0d8582052a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Security for agent-safety-doctor 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.

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