Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Agent Maintainer

CI PyPI Python 3.10-3.14 License: MIT

Maintainability checks and repair-loop diagnostics for AI-assisted Python repositories.

Agent Maintainer is in beta. The core workflow is usable, but starter files and defaults may change as it is tested across more Python repository layouts.

Agent Maintainer workflow: an agent edits code, hooks run checks, rules and budgets are enforced, diagnostics guide repair, and CI verifies final state.

Agent Maintainer helps Python repositories stay maintainable under AI-assisted development. It combines low-noise verification, change budgets, suppression controls, coverage gates, type checks, architecture checks, security checks, and structured diagnostics into one workflow for humans and coding agents.

What This Is

Agent Maintainer is a repository maintenance control layer for AI-assisted code changes. It checks whether changes are small enough to review, test-backed, type-checked, covered, diagnosable, and aligned with repo structure.

What This Is Not

Agent Maintainer is not a runtime AI safety system. It does not moderate model outputs, filter prompts, block jailbreaks, or validate chatbot responses. It is also not a prompt/output moderation framework. Agent Maintainer focuses on repository health during AI-assisted software development.

Quick Start

Install the core toolset:

python -m pip install "agent-maintainer[core]"

Initialize a repository:

agent-maintainer init --track core --preset existing-app

Merge config/pyproject.agent-maintainer.toml into your pyproject.toml, tune paths for your repo, then check setup health:

agent-maintainer doctor
agent-maintainer verify --profile precommit

First Successful Run

Healthy setup output should be quiet:

PASS

doctor prints one compact PASS, WARN, or FAIL row per setup check. If verification fails, inspect generated diagnostics before changing thresholds or suppressions:

cat .verify-logs/LAST_FAILURE.md

The failure note includes failed checks, relevant artifact paths, and an exact rerun command.

The console command is convenient for local use. Committed automation should use the module entrypoint because it works reliably in editable local-source contexts:

python3 -m agent_maintainer verify --profile precommit

Adoption Tracks

init writes starter files for three adoption levels:

Track Use When Writes
core You want the minimum useful maintenance loop. Starter config, config/dev-dependencies.txt, pre-commit config, CI workflow.
agent Coding agents actively edit the repo. Core files plus AGENTS.md, Codex hooks, and Claude Code hooks.
hardening You want docs/config hygiene and security-adjacent surfaces. Agent files plus Node-backed tooling metadata.

Preview writes before changing a repo:

python3 -m agent_maintainer init --track agent --dry-run

Existing files are not overwritten unless --force is passed.

Policy Presets

--track chooses which files are written. --preset tunes the starter policy in config/pyproject.agent-maintainer.toml:

Preset Use When
small-library A compact Python package can start with tighter budgets.
existing-app An existing app needs useful defaults without immediate strict-mode friction.
ai-agent-heavy Coding agents will frequently change code and source-without-test changes should fail.
legacy-ratchet Existing debt should improve by baseline and ranked repair targets.
strict-new-repo A clean new repo can start with strict budgets and wemake enabled.

Example:

python3 -m agent_maintainer init --track agent --preset ai-agent-heavy

Common Commands

python3 -m agent_maintainer bootstrap
python3 -m agent_maintainer doctor --strict
python3 -m agent_maintainer guidance
python3 -m agent_maintainer guidance --check
python3 -m agent_maintainer verify --profile fast
python3 -m agent_maintainer verify --profile precommit
python3 -m agent_maintainer verify --profile full
python3 -m agent_maintainer verify --profile ci
python3 -m agent_maintainer verify --profile security
python3 -m agent_maintainer verify --profile manual
python3 -m agent_maintainer report html
python3 -m agent_maintainer hooks status all
python3 -m agent_maintainer hooks install all --dry-run
python3 -m agent_maintainer hooks install claude-code --scope user
python3 -m agent_maintainer ratchet status
python3 -m agent_maintainer ratchet next
python3 -m archguard tach-config --strict-root-module
python3 -m archguard decision-check --base-ref HEAD

Profiles are intentionally stable:

Profile Purpose
fast Hook-friendly checks after edits.
precommit Local completion gate.
full Deeper review gate before larger merges.
ci GitHub Actions gate.
security Security-oriented scan profile.
manual Slow opt-in tools such as mutation testing and Semgrep.

What The Tool Checks

Concern Enforcement
Oversized Python files agent_maintainer.checks.file_lengths
Huge or diffuse changes agent_maintainer.checks.change_budget
Broad suppressions agent_maintainer.checks.suppression_budget
Required repo layout Verifier layout checks
Style and simple defects Ruff
Type discipline Pyright
Test coverage Pytest, pytest-cov, coverage, diff-cover
Complexity Radon reports and Xenon gate
Architecture boundaries and policy governance Tach or Import Linter; Archguard for Tach policy-change decisions
Dependency hygiene deptry
Dead code vulture
Security checks Bandit, pip-audit, Gitleaks, Semgrep when enabled
Supply-chain artifacts CycloneDX Python SBOM and pip-licenses when enabled
GitHub Actions checks actionlint and zizmor when workflows exist
Docs/config hygiene markdownlint-cli2, yamllint, Taplo, check-jsonschema when enabled
Agent feedback AGENTS.agent-maintainer.md and .verify-logs diagnostics

Configuration

Configuration lives in pyproject.toml:

[tool.agent_maintainer]
mode = "custom"
architecture_tool = "import-linter"
source_roots = ["src"]
test_roots = ["tests"]
package_paths = ["src"]
coverage_source = ["src"]
require_tests = true
coverage_fail_under = 80
diff_cover_fail_under = 90

[tool.agent_maintainer.diagnostics]
enabled = true
log_dir = ".verify-logs"

mode = "fresh-strict" is for new repositories that can block strict checks on day one. mode = "legacy-ratchet" is for existing repositories where heavier gates should remain opt-in while changed-code discipline ramps up. This repository self-enforces stricter settings than the starter template, including 90 percent total coverage.

Environment overrides use the AGENT_MAINTAINER_* prefix:

AGENT_MAINTAINER_SOURCE_ROOTS=src,tests python3 -m agent_maintainer doctor

Agent Guidance

The generated sidecar gives coding agents current repo policy without copying long instructions into every prompt:

python3 -m agent_maintainer guidance
python3 -m agent_maintainer guidance --check

This writes AGENTS.agent-maintainer.md from [tool.agent_maintainer]. Update configuration first, then regenerate the sidecar.

Optional Tooling

Install extras by adoption level:

python -m pip install "agent-maintainer[core]"
python -m pip install "agent-maintainer[hardening]"
python -m pip install "agent-maintainer[manual]"
python -m pip install "agent-maintainer[all]"

Node-backed tools such as markdownlint-cli2 and Taplo are managed through package.json when a repo opts into the hardening track:

npm ci

Install From Source

For local development on Agent Maintainer itself, clone the repository and run:

python -m pip install -e ".[core]"
agent-maintainer --help

Normal downstream repositories should use the package-first init flow rather than copying src/agent_maintainer into application source trees.

Local Development

For this repo:

PYTHONPATH=src python3 -m agent_maintainer bootstrap
PYTHONPATH=src python3 -m agent_maintainer doctor --strict
PYTHONPATH=src python3 -m agent_maintainer verify --profile precommit
PYTHONPATH=src python3 -m agent_maintainer verify --profile full

Refresh the pinned dev lock after changing config/dev-dependencies.txt:

PYTHONPATH=src python3 -m agent_maintainer bootstrap
.venv/bin/python -m pip freeze --exclude-editable | sort > config/dev-lock.txt

Further Reading

Example starter projects:

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_maintainer-0.1.0b4.tar.gz (163.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_maintainer-0.1.0b4-py3-none-any.whl (223.1 kB view details)

Uploaded Python 3

File details

Details for the file agent_maintainer-0.1.0b4.tar.gz.

File metadata

  • Download URL: agent_maintainer-0.1.0b4.tar.gz
  • Upload date:
  • Size: 163.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for agent_maintainer-0.1.0b4.tar.gz
Algorithm Hash digest
SHA256 95ec1a332bed69be12ebc61510bd20889bdd71673d2abcf982508f8bec12538f
MD5 949fa5a9d4f414b1f0d45583b0b60185
BLAKE2b-256 32ea414af0a4deb2e8ee367d17531e5b86c87fd2cff5f9c20a7ffd1513d6430b

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_maintainer-0.1.0b4.tar.gz:

Publisher: publish.yml on douglasmonsky/agent-maintainer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent_maintainer-0.1.0b4-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_maintainer-0.1.0b4-py3-none-any.whl
Algorithm Hash digest
SHA256 c508c893cfe36b9cc24133a12620f5caf07d5e49c46b9bf5c648793d4729a46b
MD5 782f6ab16af61167e68ad77316d8f9a2
BLAKE2b-256 651f12de3d2d849fb1d1cfa3a93226e61b479248a356f0b1d6c077447359e017

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_maintainer-0.1.0b4-py3-none-any.whl:

Publisher: publish.yml on douglasmonsky/agent-maintainer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page