Use legacy-ratchet when installing the kit into an existing repository that should improve without first paying down every historical issue.
[tool.agent_maintainer]
mode = "legacy-ratchet"
source_roots = ["src"]
test_roots = ["tests"]
package_paths = ["src"]
coverage_source = ["src"]This mode keeps conservative defaults and leaves the heavy optional gates off unless explicitly configured. In particular, it disables wemake-python-styleguide, Interrogate, and pip-audit at the mode layer. Existing explicit pyproject fields still win.
Unlike fresh-strict, legacy mode does not require every historical file to satisfy the file-length thresholds immediately. It defaults:
file_length_baseline = ".agent-maintainer/file-length-baseline.json"With that baseline, existing oversized files pass when they are unchanged or improved. The check fails when a new file exceeds the limits or an existing baseline entry grows beyond its recorded physical or source-line count.
Baseline format:
{
"version": 1,
"limits": {
"max_physical": 600,
"max_source": 450
},
"files": {
"src/legacy_module.py": {
"physical": 724,
"source": 510
}
}
}Generate or refresh the baseline after choosing the intended limits:
python3 -m agent_maintainer.checks.file_lengths \
--write-baseline .agent-maintainer/file-length-baseline.jsonRefresh deliberately. A refresh accepts the current state as the new floor, so review the diff and do not use it to hide newly worsened files.
Recommended adoption path:
- Configure correct source, test, package, coverage, file-length, and vulture paths.
- Run
python3 -m agent_maintainer doctorand fix hard failures first. - Run
python3 -m agent_maintainer verify --profile fast. - Add tests or set
require_tests = falseonly when tests are intentionally absent. - Generate
.agent-maintainer/file-length-baseline.jsonif oversized legacy files exist. - Promote to
precommit, thenfull, thenci. - Enable
tach.tomlor.importlinter, Interrogate,pip-audit, andwemakeonly after each has a clean baseline or explicit ratchet plan.
Useful overrides during adoption:
python3 -m agent_maintainer verify --profile full \
--mode legacy-ratchet \
--source-root my_package \
--package-path my_package \
--coverage-source my_packageKeep suppressions narrow. The suppression budget is meant to prevent new broad ignores even when old code still needs cleanup.