Agent Code Guard
Deterministic guardrails for agent-assisted software development.
Code Guard gives coding agents objective measurements and PASS / REVIEW / FAIL signals while leaving design decisions to agent and user judgment.
deterministic measurement
↓
PASS / REVIEW / FAIL
↓
agent judgment
Installation
pipx keeps the command isolated from project environments:
pipx install agent-code-guard
See the usage guide for a virtual-environment alternative and developer installation.
Quick start
Run all enabled, applicable guards over your current Git work:
code-guard . --changed-only
Git determines the edited-file candidates, Code Guard applies every enabled and applicable guard, and project or user exclusions remain authoritative. No configuration file is required.
Result model
- PASS — no special action.
- REVIEW — inspect the finding and decide whether meaningful improvement is warranted. REVIEW is not automatic refactoring.
- FAIL — blocks normal completion until fixed or an explicitly authorized exception applies.
Never game the metric. Preserve clarity and useful structure; do not create artificial helpers, files, abstractions, formatting, or exclusions merely to lower a measurement.
Default guards
| Guard | Default |
|---|---|
| File LOC | REVIEW >400, FAIL >600 |
| Callable size | REVIEW >80 physical LOC |
| Structural nesting | REVIEW >4 |
| Cyclomatic complexity | REVIEW >15 |
| Markdown document size | REVIEW >800 physical lines |
| Markdown direct-section size | REVIEW >200 physical lines |
Comparisons are strictly greater-than, so equality passes. All guards except file LOC are REVIEW-only; only file LOC can FAIL.
Agent Code Guard intentionally remains small. A new guard must provide distinct, deterministic agent-guardrail value rather than merely duplicate mature conventional tooling. See Guard admission.
Common workflows
Normal Git work:
code-guard . --changed-only
Explicit agent-owned scope without Git:
code-guard src/Foo.py src/Bar.ts docs/guide.md
Pull request or branch comparison:
code-guard . --base-ref origin/main --ci
The actual base ref must exist or be fetched correctly in the chosen CI environment.
Deliberate full audit:
code-guard .
Changed work is not a full audit. Use Git selection during normal development; do not repeatedly scan unrelated repository history after every edit.
Supported languages and formats
Syntax guards support Python, Go, Kotlin, C#, Java, JavaScript, TypeScript, JSX,
TSX, Vue JavaScript/TypeScript script regions, C++, Rust, PHP, Swift, and Dart.
Markdown guards apply to .md files.
Important boundaries:
- Generic
.hfiles are not syntax-dispatched because their language context is ambiguous. .markdownis not currently enabled for Markdown guards.- Vue template and style regions are not executable syntax input.
- Unsupported artifacts are simply inapplicable.
- Malformed applicable syntax or a required provider failure is a fail-closed tool error, never heuristic partial analysis.
See Language support for extension and mixed-content details.
Agent integration
CLI-only use requires no skill export. Each installed distribution also carries a version-matched Code Guard skill payload for agent workflows:
code-guard --skill-path
code-guard --export-skill <target-directory>
See Skill distribution for discovery, export, and integration guarantees. The checkout compatibility runner is for repository and skill compatibility, not primary end-user installation.
Configuration
Built-in defaults require no config. A minimal project configuration is:
{
"version": 1
}
Use configuration only when a project has a concrete policy reason to change a guard or scope. See the Configuration guide.
Documentation
Platform support
The maintained interpreter range is CPython 3.10–3.14. The normal binary installation envelope is:
- Windows x86-64 and ARM64;
- macOS x86-64 and ARM64;
- Linux glibc 2.34 or newer on x86-64 and ARM64.
Source builds outside that binary envelope are best effort and are not release-supported. See Platform support for exact wheel and deployment boundaries.
Feedback and security
Report normal defects through the bug report form and propose new measurements through the Candidate guard form. For vulnerability reporting, follow the repository Security policy.
Background and license
Agent Code Guard grew from the Agent LOC Guard prototype and is now the canonical implementation. It remains focused on deterministic measurements that complement—not replace—tests, compilers, formatters, linters, security tools, or design judgment.
Licensed under the MIT License.
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_code_guard-0.1.0.tar.gz.
File metadata
- Download URL: agent_code_guard-0.1.0.tar.gz
- Upload date:
- Size: 37.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
276d8280741fa7c792602a6e04e5cf80887b654ccedc2d43646b04ff8893e522
|
|
| MD5 |
c21b007fed71f24315954fc24f4befaa
|
|
| BLAKE2b-256 |
492f4a28e24c9880edaa6d1eef8aca78f515ab37f088080417ef7badc5595abc
|
Provenance
The following attestation bundles were made for agent_code_guard-0.1.0.tar.gz:
Publisher:
release.yml on stef-k/agent-code-guard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_code_guard-0.1.0.tar.gz -
Subject digest:
276d8280741fa7c792602a6e04e5cf80887b654ccedc2d43646b04ff8893e522 - Sigstore transparency entry: 2581527502
- Sigstore integration time:
-
Permalink:
stef-k/agent-code-guard@d6aea2807470528d383ce6548f88419d71e41eae -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/stef-k
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d6aea2807470528d383ce6548f88419d71e41eae -
Trigger Event:
release
-
Statement type:
File details
Details for the file agent_code_guard-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agent_code_guard-0.1.0-py3-none-any.whl
- Upload date:
- Size: 51.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b557239a79266a2cdffe77421f3084844e2ec96a1775953b6820ab8212392e2
|
|
| MD5 |
47eaaecfde5d7fee9fa772ece61e0160
|
|
| BLAKE2b-256 |
5bd20910f15ad574666efadbdd926d3f9b508cc49413f78934c82b4489e48725
|
Provenance
The following attestation bundles were made for agent_code_guard-0.1.0-py3-none-any.whl:
Publisher:
release.yml on stef-k/agent-code-guard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_code_guard-0.1.0-py3-none-any.whl -
Subject digest:
4b557239a79266a2cdffe77421f3084844e2ec96a1775953b6820ab8212392e2 - Sigstore transparency entry: 2581527516
- Sigstore integration time:
-
Permalink:
stef-k/agent-code-guard@d6aea2807470528d383ce6548f88419d71e41eae -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/stef-k
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d6aea2807470528d383ce6548f88419d71e41eae -
Trigger Event:
release
-
Statement type: