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_versionmetadatascorecountsfindings
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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agent_safety_doctor-0.1.0.tar.gz.
File metadata
- Download URL: agent_safety_doctor-0.1.0.tar.gz
- Upload date:
- Size: 21.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff27c1f714761c515bcf8977b64e7bb08cce784e6bf368332e21498969755686
|
|
| MD5 |
807b621344626cead4c4fc5e0577e00e
|
|
| BLAKE2b-256 |
625b75aea7afedc471e5f9f15e3d8a385064738c8a6651486036fc3deed3ea3b
|
File details
Details for the file agent_safety_doctor-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agent_safety_doctor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fafbaf8d30427fba53fe94f9bf6c4197537df646ff10f80f56d86e27b12c559
|
|
| MD5 |
f3639b166a6be0a995153c394e77a431
|
|
| BLAKE2b-256 |
66004da9bc6f3a6d71d70266d5e098c0f2ccb959cb7788d3da20f0d8582052a1
|