Agent Code Guard

Deterministic maintainability checks for source code and Markdown changed by a human or coding agent. Catch oversized files and functions, deep nesting, complex control flow, and documents that are becoming difficult to navigate.

View on GitHub · Install from PyPI

Get started

Install the command in an isolated environment with pipx:

pipx install agent-code-guard
code-guard --version
code-guard doctor

Then check your current changes from a Git worktree:

code-guard . --changed-only

No configuration is needed for ordinary use. Outside Git, pass the exact files instead, such as code-guard src/app.py docs/guide.md.

Code Guard measures without rewriting your files. Use it alongside tests, compilers, linters, formatters, and design review.

Use with a coding agent

The package includes a version-matched skill that explains how to interpret findings. Locate it with code-guard --skill-path, then follow the skill activation guide. The human and agent workflow covers repeated checks, compact JSON output, and optional authorized hooks.

Keep reviewed documents from growing unnoticed

A cohesive oversized Markdown document can use an explicitly reviewed, source-controlled size allowance. Unchanged or smaller documents pass the document-size guard; growth returns REVIEW, and section reviews remain active. See the Markdown ratchet workflow for creation, updates, and limitations.

User guides

Product and governance

Research and evidence