Lint AI coding agent git diffs using static analysis.
Project description
agentlint
agentlint is a Python CLI that lints AI coding-agent git diffs for common risky patterns using static analysis only (no LLM calls).
Install
pip install ai-agentlint
For local development:
pip install -e ".[dev]"
Quick Start
Basic check against last commit:
agentlint check
Check staged changes:
agentlint check --staged
Check a commit range:
agentlint check HEAD~3..HEAD
Pipe a diff through stdin:
git diff | agentlint check --stdin
Provide task context for scope-aware checks:
agentlint check --task "only update parser error handling"
JSON output for automation:
agentlint check --format json
Markdown output for PR comments:
agentlint check --format markdown
Available report formats: text (default), json, and markdown.
Checks
scope_drift: Warns when changed files appear unrelated to--task. Example: task is "parser bugfix" but diff editsinfra/main.tf.secret_leak: Errors on likely credential leaks (AWS/GitHub tokens, passwords, private keys, DB URLs). Example: added linepassword = "supersecret123".test_regression: Warns when test lines are deleted without replacement or tests are changed off-task. Example: deletetests/test_api.pyassertions and add no test updates.config_vandalism: Warns for CI/infra/lock-file edits outside scope. Example: modify.github/workflows/ci.ymlin a docs-only task.dependency_injection: Warns when new dependencies are introduced unexpectedly. Example: addflask==3.0.0torequirements.txtwithout dependency-related task text.todo_bombs: Warns/errors on TODO/FIXME/HACK spikes. Example: adding 4 TODO markers raises an error.mcp_permissions: Errors on dangerous MCP server configuration patterns. Example:.mcp.jsonwith"autoApprove": trueor"autoApprove": ["*"](related to CVE-2026-21852 auto-approve bypass).permission_escalation: Errors on risky patterns (sudo, permissivechmod,eval,exec,shell=True,os.system). Example:subprocess.run(cmd, shell=True).dead_code: Warns on added commented-out code blocks (5+ lines). Example: pasting a large block of# old implementationlines.
Configuration
agentlint discovers .agentlint.toml by walking up from the current directory.
disabled_checks = ["scope_drift"]
[severity]
todo_bombs = "error"
config_vandalism = "info"
[ignore]
secret_leak = ["tests/fixtures/*"]
scope_drift = ["docs/*"]
[secrets]
allowed_patterns = ["^dummy_token_for_tests$"]
CLI config controls:
--config PATH: Load config from explicit file.--no-config: Ignore discovered config files.
GitHub Actions
Use the bundled composite action in this repository to lint PR diffs and post markdown results as a pull request comment.
name: agentlint
on:
pull_request:
permissions:
contents: read
pull-requests: write
jobs:
lint-diff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch origin main --depth=1
- uses: ./
id: agentlint
with:
fail-on-error: true
fail-on-warning: false
format: markdown
comment: true
python-version: "3.12"
- if: always()
run: |
echo "exit-code=${{ steps.agentlint.outputs.exit-code }}"
printf '%s\n' "${{ steps.agentlint.outputs.report }}"
Why agentlint?
- Enforces deterministic, static checks suitable for CI gates.
- Focuses on agent-specific failure patterns in patch output.
- Fast enough to run on every PR and staged commit.
Part of the Agent Toolkit
agentlint is one of three tools for AI coding agent quality:
- coderace — Race coding agents against each other on real tasks. Automated, reproducible, scored comparisons.
- agentmd — Generate and score context files (CLAUDE.md, AGENTS.md, .cursorrules) for AI coding agents.
- agentlint — Lint AI agent git diffs for risky patterns. Static analysis, no LLM required.
Measure (coderace) → Optimize (agentmd) → Guard (agentlint).
Contributing
- Create a branch.
- Add or update checks/tests/docs together.
- Run
pytest -v --cov=agentlint --cov-report=term-missing. - Open a PR with a short rationale and sample diff cases.
License
MIT. See LICENSE.
Project details
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 ai_agentlint-0.3.0.tar.gz.
File metadata
- Download URL: ai_agentlint-0.3.0.tar.gz
- Upload date:
- Size: 30.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ffcaf171433fad9228ef70bf63bbda6ff200f5de332f8bf6f1805350efc3e665
|
|
| MD5 |
98a7a6c6dd24c012298edc05a311fe0b
|
|
| BLAKE2b-256 |
8c73b6858829938ab97133b738a82f3732b8e147bfc0510353b7809598918127
|
File details
Details for the file ai_agentlint-0.3.0-py3-none-any.whl.
File metadata
- Download URL: ai_agentlint-0.3.0-py3-none-any.whl
- Upload date:
- Size: 24.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f024eced8101b113610e9b15bb9392feea5ecefe86402db979209ef48608c22
|
|
| MD5 |
eee4828d05f1e7d66d1ce55258c0e36b
|
|
| BLAKE2b-256 |
29186687db97afe04ab86fa7d1a9abdb88d1edf7e40640b49f21ad529a45e8f9
|