agent-maintainer 0.1.0b1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. agent_maintainer-0.1.0b1/LICENSE +21 -0
  2. agent_maintainer-0.1.0b1/PKG-INFO +381 -0
  3. agent_maintainer-0.1.0b1/README.md +245 -0
  4. agent_maintainer-0.1.0b1/pyproject.toml +309 -0
  5. agent_maintainer-0.1.0b1/setup.cfg +4 -0
  6. agent_maintainer-0.1.0b1/src/agent_maintainer/__init__.py +0 -0
  7. agent_maintainer-0.1.0b1/src/agent_maintainer/__main__.py +10 -0
  8. agent_maintainer-0.1.0b1/src/agent_maintainer/catalogs/__init__.py +1 -0
  9. agent_maintainer-0.1.0b1/src/agent_maintainer/catalogs/catalog.py +300 -0
  10. agent_maintainer-0.1.0b1/src/agent_maintainer/catalogs/docs.py +153 -0
  11. agent_maintainer-0.1.0b1/src/agent_maintainer/catalogs/python.py +234 -0
  12. agent_maintainer-0.1.0b1/src/agent_maintainer/catalogs/security.py +286 -0
  13. agent_maintainer-0.1.0b1/src/agent_maintainer/checks/__init__.py +0 -0
  14. agent_maintainer-0.1.0b1/src/agent_maintainer/checks/change_budget.py +366 -0
  15. agent_maintainer-0.1.0b1/src/agent_maintainer/checks/file_lengths.py +346 -0
  16. agent_maintainer-0.1.0b1/src/agent_maintainer/checks/pip_audit_config.py +21 -0
  17. agent_maintainer-0.1.0b1/src/agent_maintainer/checks/structure.py +255 -0
  18. agent_maintainer-0.1.0b1/src/agent_maintainer/checks/suppression_budget.py +215 -0
  19. agent_maintainer-0.1.0b1/src/agent_maintainer/checks/tach_config.py +38 -0
  20. agent_maintainer-0.1.0b1/src/agent_maintainer/cli.py +95 -0
  21. agent_maintainer-0.1.0b1/src/agent_maintainer/config/__init__.py +1 -0
  22. agent_maintainer-0.1.0b1/src/agent_maintainer/config/coercion.py +111 -0
  23. agent_maintainer-0.1.0b1/src/agent_maintainer/config/loader.py +192 -0
  24. agent_maintainer-0.1.0b1/src/agent_maintainer/config/modes.py +52 -0
  25. agent_maintainer-0.1.0b1/src/agent_maintainer/config/schema.py +246 -0
  26. agent_maintainer-0.1.0b1/src/agent_maintainer/core/__init__.py +0 -0
  27. agent_maintainer-0.1.0b1/src/agent_maintainer/core/args.py +240 -0
  28. agent_maintainer-0.1.0b1/src/agent_maintainer/core/bootstrap.py +269 -0
  29. agent_maintainer-0.1.0b1/src/agent_maintainer/core/config.py +55 -0
  30. agent_maintainer-0.1.0b1/src/agent_maintainer/core/executor.py +255 -0
  31. agent_maintainer-0.1.0b1/src/agent_maintainer/core/guidance.py +301 -0
  32. agent_maintainer-0.1.0b1/src/agent_maintainer/core/init_template_config.py +121 -0
  33. agent_maintainer-0.1.0b1/src/agent_maintainer/core/init_templates.py +319 -0
  34. agent_maintainer-0.1.0b1/src/agent_maintainer/core/initializer.py +66 -0
  35. agent_maintainer-0.1.0b1/src/agent_maintainer/core/layout.py +64 -0
  36. agent_maintainer-0.1.0b1/src/agent_maintainer/core/reporting.py +245 -0
  37. agent_maintainer-0.1.0b1/src/agent_maintainer/core/runtime.py +33 -0
  38. agent_maintainer-0.1.0b1/src/agent_maintainer/core/tool_capabilities.py +193 -0
  39. agent_maintainer-0.1.0b1/src/agent_maintainer/core/tool_capability_registry.py +104 -0
  40. agent_maintainer-0.1.0b1/src/agent_maintainer/core/tool_capability_types.py +39 -0
  41. agent_maintainer-0.1.0b1/src/agent_maintainer/doctor/__init__.py +0 -0
  42. agent_maintainer-0.1.0b1/src/agent_maintainer/doctor/cli.py +274 -0
  43. agent_maintainer-0.1.0b1/src/agent_maintainer/doctor/setup.py +268 -0
  44. agent_maintainer-0.1.0b1/src/agent_maintainer/doctor/support/__init__.py +0 -0
  45. agent_maintainer-0.1.0b1/src/agent_maintainer/doctor/support/hook_audit.py +157 -0
  46. agent_maintainer-0.1.0b1/src/agent_maintainer/doctor/support/logs.py +225 -0
  47. agent_maintainer-0.1.0b1/src/agent_maintainer/doctor/support/models.py +29 -0
  48. agent_maintainer-0.1.0b1/src/agent_maintainer/doctor/support/policy.py +134 -0
  49. agent_maintainer-0.1.0b1/src/agent_maintainer/models.py +50 -0
  50. agent_maintainer-0.1.0b1/src/agent_maintainer/runners/__init__.py +0 -0
  51. agent_maintainer-0.1.0b1/src/agent_maintainer/runners/bandit.py +109 -0
  52. agent_maintainer-0.1.0b1/src/agent_maintainer/runners/mutmut.py +65 -0
  53. agent_maintainer-0.1.0b1/src/agent_maintainer/runners/pyright.py +158 -0
  54. agent_maintainer-0.1.0b1/src/agent_maintainer/runners/ruff.py +113 -0
  55. agent_maintainer-0.1.0b1/src/agent_maintainer/runners/secret_scan.py +112 -0
  56. agent_maintainer-0.1.0b1/src/agent_maintainer/tach.py +202 -0
  57. agent_maintainer-0.1.0b1/src/agent_maintainer/verify/__init__.py +1 -0
  58. agent_maintainer-0.1.0b1/src/agent_maintainer/verify/artifacts.py +205 -0
  59. agent_maintainer-0.1.0b1/src/agent_maintainer/verify/quiet.py +146 -0
  60. agent_maintainer-0.1.0b1/src/agent_maintainer.egg-info/PKG-INFO +381 -0
  61. agent_maintainer-0.1.0b1/src/agent_maintainer.egg-info/SOURCES.txt +63 -0
  62. agent_maintainer-0.1.0b1/src/agent_maintainer.egg-info/dependency_links.txt +1 -0
  63. agent_maintainer-0.1.0b1/src/agent_maintainer.egg-info/entry_points.txt +2 -0
  64. agent_maintainer-0.1.0b1/src/agent_maintainer.egg-info/requires.txt +96 -0
  65. agent_maintainer-0.1.0b1/src/agent_maintainer.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Doug Monsky
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,381 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-maintainer
3
+ Version: 0.1.0b1
4
+ Summary: Repository maintenance checks and diagnostics for AI-assisted Python development.
5
+ Author: Doug Monsky
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Doug Monsky
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/douglasmonsky/agent-maintainer
29
+ Project-URL: Repository, https://github.com/douglasmonsky/agent-maintainer
30
+ Project-URL: Issues, https://github.com/douglasmonsky/agent-maintainer/issues
31
+ Project-URL: Documentation, https://github.com/douglasmonsky/agent-maintainer#readme
32
+ Keywords: ai,coding-agents,maintainability,ci,python,code-quality,developer-tools
33
+ Classifier: Development Status :: 4 - Beta
34
+ Classifier: Environment :: Console
35
+ Classifier: Intended Audience :: Developers
36
+ Classifier: License :: OSI Approved :: MIT License
37
+ Classifier: Programming Language :: Python :: 3
38
+ Classifier: Programming Language :: Python :: 3.11
39
+ Classifier: Programming Language :: Python :: 3.12
40
+ Classifier: Programming Language :: Python :: 3.13
41
+ Classifier: Programming Language :: Python :: 3.14
42
+ Classifier: Topic :: Software Development :: Quality Assurance
43
+ Classifier: Topic :: Software Development :: Testing
44
+ Classifier: Topic :: Software Development :: Version Control :: Git
45
+ Requires-Python: >=3.11
46
+ Description-Content-Type: text/markdown
47
+ License-File: LICENSE
48
+ Provides-Extra: core
49
+ Requires-Dist: bandit; extra == "core"
50
+ Requires-Dist: coverage; extra == "core"
51
+ Requires-Dist: deptry; extra == "core"
52
+ Requires-Dist: diff-cover; extra == "core"
53
+ Requires-Dist: import-linter; extra == "core"
54
+ Requires-Dist: pre-commit; extra == "core"
55
+ Requires-Dist: pylint; extra == "core"
56
+ Requires-Dist: pyright; extra == "core"
57
+ Requires-Dist: pytest; extra == "core"
58
+ Requires-Dist: pytest-cov; extra == "core"
59
+ Requires-Dist: radon; extra == "core"
60
+ Requires-Dist: ruff; extra == "core"
61
+ Requires-Dist: tach; extra == "core"
62
+ Requires-Dist: vulture; extra == "core"
63
+ Requires-Dist: xenon; extra == "core"
64
+ Provides-Extra: agent
65
+ Requires-Dist: bandit; extra == "agent"
66
+ Requires-Dist: coverage; extra == "agent"
67
+ Requires-Dist: deptry; extra == "agent"
68
+ Requires-Dist: diff-cover; extra == "agent"
69
+ Requires-Dist: import-linter; extra == "agent"
70
+ Requires-Dist: pre-commit; extra == "agent"
71
+ Requires-Dist: pylint; extra == "agent"
72
+ Requires-Dist: pyright; extra == "agent"
73
+ Requires-Dist: pytest; extra == "agent"
74
+ Requires-Dist: pytest-cov; extra == "agent"
75
+ Requires-Dist: radon; extra == "agent"
76
+ Requires-Dist: ruff; extra == "agent"
77
+ Requires-Dist: tach; extra == "agent"
78
+ Requires-Dist: vulture; extra == "agent"
79
+ Requires-Dist: xenon; extra == "agent"
80
+ Provides-Extra: hardening
81
+ Requires-Dist: bandit; extra == "hardening"
82
+ Requires-Dist: coverage; extra == "hardening"
83
+ Requires-Dist: deptry; extra == "hardening"
84
+ Requires-Dist: diff-cover; extra == "hardening"
85
+ Requires-Dist: import-linter; extra == "hardening"
86
+ Requires-Dist: pre-commit; extra == "hardening"
87
+ Requires-Dist: pylint; extra == "hardening"
88
+ Requires-Dist: pyright; extra == "hardening"
89
+ Requires-Dist: pytest; extra == "hardening"
90
+ Requires-Dist: pytest-cov; extra == "hardening"
91
+ Requires-Dist: radon; extra == "hardening"
92
+ Requires-Dist: ruff; extra == "hardening"
93
+ Requires-Dist: tach; extra == "hardening"
94
+ Requires-Dist: vulture; extra == "hardening"
95
+ Requires-Dist: xenon; extra == "hardening"
96
+ Requires-Dist: actionlint-py; extra == "hardening"
97
+ Requires-Dist: check-jsonschema; extra == "hardening"
98
+ Requires-Dist: interrogate; extra == "hardening"
99
+ Requires-Dist: pip-audit; extra == "hardening"
100
+ Requires-Dist: wemake-python-styleguide; extra == "hardening"
101
+ Requires-Dist: yamllint; extra == "hardening"
102
+ Requires-Dist: zizmor; extra == "hardening"
103
+ Provides-Extra: manual
104
+ Requires-Dist: cyclonedx-bom; extra == "manual"
105
+ Requires-Dist: mutmut; extra == "manual"
106
+ Requires-Dist: pip-licenses; extra == "manual"
107
+ Requires-Dist: semgrep; python_version < "3.13" and extra == "manual"
108
+ Provides-Extra: all
109
+ Requires-Dist: actionlint-py; extra == "all"
110
+ Requires-Dist: bandit; extra == "all"
111
+ Requires-Dist: check-jsonschema; extra == "all"
112
+ Requires-Dist: coverage; extra == "all"
113
+ Requires-Dist: cyclonedx-bom; extra == "all"
114
+ Requires-Dist: deptry; extra == "all"
115
+ Requires-Dist: diff-cover; extra == "all"
116
+ Requires-Dist: import-linter; extra == "all"
117
+ Requires-Dist: interrogate; extra == "all"
118
+ Requires-Dist: mutmut; extra == "all"
119
+ Requires-Dist: pip-audit; extra == "all"
120
+ Requires-Dist: pip-licenses; extra == "all"
121
+ Requires-Dist: pre-commit; extra == "all"
122
+ Requires-Dist: pylint; extra == "all"
123
+ Requires-Dist: pyright; extra == "all"
124
+ Requires-Dist: pytest; extra == "all"
125
+ Requires-Dist: pytest-cov; extra == "all"
126
+ Requires-Dist: radon; extra == "all"
127
+ Requires-Dist: ruff; extra == "all"
128
+ Requires-Dist: semgrep; python_version < "3.13" and extra == "all"
129
+ Requires-Dist: tach; extra == "all"
130
+ Requires-Dist: vulture; extra == "all"
131
+ Requires-Dist: wemake-python-styleguide; extra == "all"
132
+ Requires-Dist: xenon; extra == "all"
133
+ Requires-Dist: yamllint; extra == "all"
134
+ Requires-Dist: zizmor; extra == "all"
135
+ Dynamic: license-file
136
+
137
+ # Agent Maintainer
138
+
139
+ Maintainability checks and repair-loop diagnostics for AI-assisted Python
140
+ repositories.
141
+
142
+ > Agent Maintainer is in beta. The core workflow is usable, but starter files
143
+ > and defaults may change as it is tested across more Python repository layouts.
144
+
145
+ Agent Maintainer helps Python repositories stay maintainable under AI-assisted
146
+ development. It combines low-noise verification, change budgets, suppression
147
+ controls, coverage gates, type checks, architecture checks, security checks, and
148
+ structured diagnostics into one workflow for humans and coding agents.
149
+
150
+ ## What This Is
151
+
152
+ Agent Maintainer is a repository maintenance control layer for AI-assisted code
153
+ changes. It checks whether changes are small enough to review, test-backed,
154
+ type-checked, covered, diagnosable, and aligned with repo structure.
155
+
156
+ ## What This Is Not
157
+
158
+ Agent Maintainer is not a runtime AI safety system. It does not moderate model
159
+ outputs, filter prompts, block jailbreaks, or validate chatbot responses. It is
160
+ also not a prompt/output moderation framework. Agent Maintainer focuses on
161
+ repository health during AI-assisted software development.
162
+
163
+ ## Quick Start
164
+
165
+ Install the core toolset:
166
+
167
+ ```bash
168
+ python -m pip install "agent-maintainer[core]"
169
+ ```
170
+
171
+ Initialize a repository:
172
+
173
+ ```bash
174
+ agent-maintainer init --track core
175
+ ```
176
+
177
+ Merge `config/pyproject.agent-maintainer.toml` into your `pyproject.toml`, tune
178
+ paths for your repo, then check setup health:
179
+
180
+ ```bash
181
+ agent-maintainer doctor
182
+ agent-maintainer verify --profile precommit
183
+ ```
184
+
185
+ ## First Successful Run
186
+
187
+ Healthy setup output should be quiet:
188
+
189
+ ```text
190
+ PASS
191
+ ```
192
+
193
+ `doctor` prints one compact `PASS`, `WARN`, or `FAIL` row per setup check. If
194
+ verification fails, inspect generated diagnostics before changing thresholds or
195
+ suppressions:
196
+
197
+ ```bash
198
+ cat .verify-logs/LAST_FAILURE.md
199
+ ```
200
+
201
+ The failure note includes failed checks, relevant artifact paths, and an exact
202
+ rerun command.
203
+
204
+ The console command is convenient for local use. Committed automation should use
205
+ the module entrypoint because it works reliably in editable local-source
206
+ contexts:
207
+
208
+ ```bash
209
+ python3 -m agent_maintainer verify --profile precommit
210
+ ```
211
+
212
+ ## Adoption Tracks
213
+
214
+ `init` writes starter files for three adoption levels:
215
+
216
+ | Track | Use When | Writes |
217
+ |---|---|---|
218
+ | `core` | You want the minimum useful maintenance loop. | Starter config, `config/dev-dependencies.txt`, pre-commit config, CI workflow. |
219
+ | `agent` | Coding agents actively edit the repo. | Core files plus `AGENTS.md` and Codex hook files. |
220
+ | `hardening` | You want docs/config hygiene and security-adjacent surfaces. | Agent files plus Node-backed tooling metadata. |
221
+
222
+ Preview writes before changing a repo:
223
+
224
+ ```bash
225
+ python3 -m agent_maintainer init --track agent --dry-run
226
+ ```
227
+
228
+ Existing files are not overwritten unless `--force` is passed.
229
+
230
+ ## Common Commands
231
+
232
+ ```bash
233
+ python3 -m agent_maintainer bootstrap
234
+ python3 -m agent_maintainer doctor --strict
235
+ python3 -m agent_maintainer guidance
236
+ python3 -m agent_maintainer guidance --check
237
+ python3 -m agent_maintainer verify --profile fast
238
+ python3 -m agent_maintainer verify --profile precommit
239
+ python3 -m agent_maintainer verify --profile full
240
+ python3 -m agent_maintainer verify --profile ci
241
+ python3 -m agent_maintainer verify --profile security
242
+ python3 -m agent_maintainer verify --profile manual
243
+ ```
244
+
245
+ Profiles are intentionally stable:
246
+
247
+ | Profile | Purpose |
248
+ |---|---|
249
+ | `fast` | Hook-friendly checks after edits. |
250
+ | `precommit` | Local completion gate. |
251
+ | `full` | Deeper review gate before larger merges. |
252
+ | `ci` | GitHub Actions gate. |
253
+ | `security` | Security-oriented scan profile. |
254
+ | `manual` | Slow opt-in tools such as mutation testing and Semgrep. |
255
+
256
+ ## What The Tool Checks
257
+
258
+ | Concern | Enforcement |
259
+ |---|---|
260
+ | Oversized Python files | `agent_maintainer.checks.file_lengths` |
261
+ | Huge or diffuse changes | `agent_maintainer.checks.change_budget` |
262
+ | Broad suppressions | `agent_maintainer.checks.suppression_budget` |
263
+ | Required repo layout | Verifier layout checks |
264
+ | Style and simple defects | Ruff |
265
+ | Type discipline | Pyright |
266
+ | Test coverage | Pytest, pytest-cov, coverage, diff-cover |
267
+ | Complexity | Radon reports and Xenon gate |
268
+ | Architecture boundaries | Tach or Import Linter |
269
+ | Dependency hygiene | deptry |
270
+ | Dead code | vulture |
271
+ | Security checks | Bandit, pip-audit, Gitleaks, Semgrep when enabled |
272
+ | Supply-chain artifacts | CycloneDX Python SBOM and pip-licenses when enabled |
273
+ | GitHub Actions checks | actionlint and zizmor when workflows exist |
274
+ | Docs/config hygiene | markdownlint-cli2, yamllint, Taplo, check-jsonschema when enabled |
275
+ | Agent feedback | `AGENTS.agent-maintainer.md` and `.verify-logs` diagnostics |
276
+
277
+ ## Configuration
278
+
279
+ Configuration lives in `pyproject.toml`:
280
+
281
+ ```toml
282
+ [tool.agent_maintainer]
283
+ mode = "custom"
284
+ architecture_tool = "import-linter"
285
+ source_roots = ["src"]
286
+ test_roots = ["tests"]
287
+ package_paths = ["src"]
288
+ coverage_source = ["src"]
289
+ require_tests = true
290
+ coverage_fail_under = 80
291
+ diff_cover_fail_under = 90
292
+
293
+ [tool.agent_maintainer.diagnostics]
294
+ enabled = true
295
+ log_dir = ".verify-logs"
296
+ ```
297
+
298
+ `mode = "fresh-strict"` is for new repositories that can block strict checks on
299
+ day one. `mode = "legacy-ratchet"` is for existing repositories where heavier
300
+ gates should remain opt-in while changed-code discipline ramps up. This
301
+ repository self-enforces stricter settings than the starter template, including
302
+ 90 percent total coverage.
303
+
304
+ Environment overrides use the `AGENT_MAINTAINER_*` prefix:
305
+
306
+ ```bash
307
+ AGENT_MAINTAINER_SOURCE_ROOTS=src,tests python3 -m agent_maintainer doctor
308
+ ```
309
+
310
+ ## Agent Guidance
311
+
312
+ The generated sidecar gives coding agents current repo policy without copying
313
+ long instructions into every prompt:
314
+
315
+ ```bash
316
+ python3 -m agent_maintainer guidance
317
+ python3 -m agent_maintainer guidance --check
318
+ ```
319
+
320
+ This writes `AGENTS.agent-maintainer.md` from `[tool.agent_maintainer]`. Update
321
+ configuration first, then regenerate the sidecar.
322
+
323
+ ## Optional Tooling
324
+
325
+ Install extras by adoption level:
326
+
327
+ ```bash
328
+ python -m pip install "agent-maintainer[core]"
329
+ python -m pip install "agent-maintainer[hardening]"
330
+ python -m pip install "agent-maintainer[manual]"
331
+ python -m pip install "agent-maintainer[all]"
332
+ ```
333
+
334
+ Node-backed tools such as `markdownlint-cli2` and Taplo are managed through
335
+ `package.json` when a repo opts into the hardening track:
336
+
337
+ ```bash
338
+ npm ci
339
+ ```
340
+
341
+ ## Install From Source
342
+
343
+ For local development on Agent Maintainer itself, clone the repository and run:
344
+
345
+ ```bash
346
+ python -m pip install -e ".[core]"
347
+ agent-maintainer --help
348
+ ```
349
+
350
+ Normal downstream repositories should use the package-first init flow rather
351
+ than copying `src/agent_maintainer` into application source trees.
352
+
353
+ ## Local Development
354
+
355
+ For this repo:
356
+
357
+ ```bash
358
+ PYTHONPATH=src python3 -m agent_maintainer bootstrap
359
+ PYTHONPATH=src python3 -m agent_maintainer doctor --strict
360
+ PYTHONPATH=src python3 -m agent_maintainer verify --profile precommit
361
+ PYTHONPATH=src python3 -m agent_maintainer verify --profile full
362
+ ```
363
+
364
+ Refresh the pinned dev lock after changing `config/dev-dependencies.txt`:
365
+
366
+ ```bash
367
+ PYTHONPATH=src python3 -m agent_maintainer bootstrap
368
+ .venv/bin/python -m pip freeze --exclude-editable | sort > config/dev-lock.txt
369
+ ```
370
+
371
+ ## Further Reading
372
+
373
+ - [MIT License](LICENSE)
374
+ - [Changelog](CHANGELOG.md)
375
+ - [Tool map](docs/tool-map.md)
376
+ - [Fresh-strict mode](docs/fresh-strict.md)
377
+ - [Legacy-ratchet mode](docs/legacy-ratchet.md)
378
+ - [Codex hooks](docs/codex-hooks.md)
379
+ - [Release checklist](docs/release-checklist.md)
380
+ - [Troubleshooting](docs/troubleshooting.md)
381
+ - [Structure cohesion](docs/structure-cohesion.md)
@@ -0,0 +1,245 @@
1
+ # Agent Maintainer
2
+
3
+ Maintainability checks and repair-loop diagnostics for AI-assisted Python
4
+ repositories.
5
+
6
+ > Agent Maintainer is in beta. The core workflow is usable, but starter files
7
+ > and defaults may change as it is tested across more Python repository layouts.
8
+
9
+ Agent Maintainer helps Python repositories stay maintainable under AI-assisted
10
+ development. It combines low-noise verification, change budgets, suppression
11
+ controls, coverage gates, type checks, architecture checks, security checks, and
12
+ structured diagnostics into one workflow for humans and coding agents.
13
+
14
+ ## What This Is
15
+
16
+ Agent Maintainer is a repository maintenance control layer for AI-assisted code
17
+ changes. It checks whether changes are small enough to review, test-backed,
18
+ type-checked, covered, diagnosable, and aligned with repo structure.
19
+
20
+ ## What This Is Not
21
+
22
+ Agent Maintainer is not a runtime AI safety system. It does not moderate model
23
+ outputs, filter prompts, block jailbreaks, or validate chatbot responses. It is
24
+ also not a prompt/output moderation framework. Agent Maintainer focuses on
25
+ repository health during AI-assisted software development.
26
+
27
+ ## Quick Start
28
+
29
+ Install the core toolset:
30
+
31
+ ```bash
32
+ python -m pip install "agent-maintainer[core]"
33
+ ```
34
+
35
+ Initialize a repository:
36
+
37
+ ```bash
38
+ agent-maintainer init --track core
39
+ ```
40
+
41
+ Merge `config/pyproject.agent-maintainer.toml` into your `pyproject.toml`, tune
42
+ paths for your repo, then check setup health:
43
+
44
+ ```bash
45
+ agent-maintainer doctor
46
+ agent-maintainer verify --profile precommit
47
+ ```
48
+
49
+ ## First Successful Run
50
+
51
+ Healthy setup output should be quiet:
52
+
53
+ ```text
54
+ PASS
55
+ ```
56
+
57
+ `doctor` prints one compact `PASS`, `WARN`, or `FAIL` row per setup check. If
58
+ verification fails, inspect generated diagnostics before changing thresholds or
59
+ suppressions:
60
+
61
+ ```bash
62
+ cat .verify-logs/LAST_FAILURE.md
63
+ ```
64
+
65
+ The failure note includes failed checks, relevant artifact paths, and an exact
66
+ rerun command.
67
+
68
+ The console command is convenient for local use. Committed automation should use
69
+ the module entrypoint because it works reliably in editable local-source
70
+ contexts:
71
+
72
+ ```bash
73
+ python3 -m agent_maintainer verify --profile precommit
74
+ ```
75
+
76
+ ## Adoption Tracks
77
+
78
+ `init` writes starter files for three adoption levels:
79
+
80
+ | Track | Use When | Writes |
81
+ |---|---|---|
82
+ | `core` | You want the minimum useful maintenance loop. | Starter config, `config/dev-dependencies.txt`, pre-commit config, CI workflow. |
83
+ | `agent` | Coding agents actively edit the repo. | Core files plus `AGENTS.md` and Codex hook files. |
84
+ | `hardening` | You want docs/config hygiene and security-adjacent surfaces. | Agent files plus Node-backed tooling metadata. |
85
+
86
+ Preview writes before changing a repo:
87
+
88
+ ```bash
89
+ python3 -m agent_maintainer init --track agent --dry-run
90
+ ```
91
+
92
+ Existing files are not overwritten unless `--force` is passed.
93
+
94
+ ## Common Commands
95
+
96
+ ```bash
97
+ python3 -m agent_maintainer bootstrap
98
+ python3 -m agent_maintainer doctor --strict
99
+ python3 -m agent_maintainer guidance
100
+ python3 -m agent_maintainer guidance --check
101
+ python3 -m agent_maintainer verify --profile fast
102
+ python3 -m agent_maintainer verify --profile precommit
103
+ python3 -m agent_maintainer verify --profile full
104
+ python3 -m agent_maintainer verify --profile ci
105
+ python3 -m agent_maintainer verify --profile security
106
+ python3 -m agent_maintainer verify --profile manual
107
+ ```
108
+
109
+ Profiles are intentionally stable:
110
+
111
+ | Profile | Purpose |
112
+ |---|---|
113
+ | `fast` | Hook-friendly checks after edits. |
114
+ | `precommit` | Local completion gate. |
115
+ | `full` | Deeper review gate before larger merges. |
116
+ | `ci` | GitHub Actions gate. |
117
+ | `security` | Security-oriented scan profile. |
118
+ | `manual` | Slow opt-in tools such as mutation testing and Semgrep. |
119
+
120
+ ## What The Tool Checks
121
+
122
+ | Concern | Enforcement |
123
+ |---|---|
124
+ | Oversized Python files | `agent_maintainer.checks.file_lengths` |
125
+ | Huge or diffuse changes | `agent_maintainer.checks.change_budget` |
126
+ | Broad suppressions | `agent_maintainer.checks.suppression_budget` |
127
+ | Required repo layout | Verifier layout checks |
128
+ | Style and simple defects | Ruff |
129
+ | Type discipline | Pyright |
130
+ | Test coverage | Pytest, pytest-cov, coverage, diff-cover |
131
+ | Complexity | Radon reports and Xenon gate |
132
+ | Architecture boundaries | Tach or Import Linter |
133
+ | Dependency hygiene | deptry |
134
+ | Dead code | vulture |
135
+ | Security checks | Bandit, pip-audit, Gitleaks, Semgrep when enabled |
136
+ | Supply-chain artifacts | CycloneDX Python SBOM and pip-licenses when enabled |
137
+ | GitHub Actions checks | actionlint and zizmor when workflows exist |
138
+ | Docs/config hygiene | markdownlint-cli2, yamllint, Taplo, check-jsonschema when enabled |
139
+ | Agent feedback | `AGENTS.agent-maintainer.md` and `.verify-logs` diagnostics |
140
+
141
+ ## Configuration
142
+
143
+ Configuration lives in `pyproject.toml`:
144
+
145
+ ```toml
146
+ [tool.agent_maintainer]
147
+ mode = "custom"
148
+ architecture_tool = "import-linter"
149
+ source_roots = ["src"]
150
+ test_roots = ["tests"]
151
+ package_paths = ["src"]
152
+ coverage_source = ["src"]
153
+ require_tests = true
154
+ coverage_fail_under = 80
155
+ diff_cover_fail_under = 90
156
+
157
+ [tool.agent_maintainer.diagnostics]
158
+ enabled = true
159
+ log_dir = ".verify-logs"
160
+ ```
161
+
162
+ `mode = "fresh-strict"` is for new repositories that can block strict checks on
163
+ day one. `mode = "legacy-ratchet"` is for existing repositories where heavier
164
+ gates should remain opt-in while changed-code discipline ramps up. This
165
+ repository self-enforces stricter settings than the starter template, including
166
+ 90 percent total coverage.
167
+
168
+ Environment overrides use the `AGENT_MAINTAINER_*` prefix:
169
+
170
+ ```bash
171
+ AGENT_MAINTAINER_SOURCE_ROOTS=src,tests python3 -m agent_maintainer doctor
172
+ ```
173
+
174
+ ## Agent Guidance
175
+
176
+ The generated sidecar gives coding agents current repo policy without copying
177
+ long instructions into every prompt:
178
+
179
+ ```bash
180
+ python3 -m agent_maintainer guidance
181
+ python3 -m agent_maintainer guidance --check
182
+ ```
183
+
184
+ This writes `AGENTS.agent-maintainer.md` from `[tool.agent_maintainer]`. Update
185
+ configuration first, then regenerate the sidecar.
186
+
187
+ ## Optional Tooling
188
+
189
+ Install extras by adoption level:
190
+
191
+ ```bash
192
+ python -m pip install "agent-maintainer[core]"
193
+ python -m pip install "agent-maintainer[hardening]"
194
+ python -m pip install "agent-maintainer[manual]"
195
+ python -m pip install "agent-maintainer[all]"
196
+ ```
197
+
198
+ Node-backed tools such as `markdownlint-cli2` and Taplo are managed through
199
+ `package.json` when a repo opts into the hardening track:
200
+
201
+ ```bash
202
+ npm ci
203
+ ```
204
+
205
+ ## Install From Source
206
+
207
+ For local development on Agent Maintainer itself, clone the repository and run:
208
+
209
+ ```bash
210
+ python -m pip install -e ".[core]"
211
+ agent-maintainer --help
212
+ ```
213
+
214
+ Normal downstream repositories should use the package-first init flow rather
215
+ than copying `src/agent_maintainer` into application source trees.
216
+
217
+ ## Local Development
218
+
219
+ For this repo:
220
+
221
+ ```bash
222
+ PYTHONPATH=src python3 -m agent_maintainer bootstrap
223
+ PYTHONPATH=src python3 -m agent_maintainer doctor --strict
224
+ PYTHONPATH=src python3 -m agent_maintainer verify --profile precommit
225
+ PYTHONPATH=src python3 -m agent_maintainer verify --profile full
226
+ ```
227
+
228
+ Refresh the pinned dev lock after changing `config/dev-dependencies.txt`:
229
+
230
+ ```bash
231
+ PYTHONPATH=src python3 -m agent_maintainer bootstrap
232
+ .venv/bin/python -m pip freeze --exclude-editable | sort > config/dev-lock.txt
233
+ ```
234
+
235
+ ## Further Reading
236
+
237
+ - [MIT License](LICENSE)
238
+ - [Changelog](CHANGELOG.md)
239
+ - [Tool map](docs/tool-map.md)
240
+ - [Fresh-strict mode](docs/fresh-strict.md)
241
+ - [Legacy-ratchet mode](docs/legacy-ratchet.md)
242
+ - [Codex hooks](docs/codex-hooks.md)
243
+ - [Release checklist](docs/release-checklist.md)
244
+ - [Troubleshooting](docs/troubleshooting.md)
245
+ - [Structure cohesion](docs/structure-cohesion.md)