Skip to content
Proyek

Tentang

Local guardrails for AI coding agents. Check proposed file changes and shell commands, block risky patterns, and return actionable feedback. Works with Claude Code, Codex, Cursor, Gemini CLI, and more

Alat pengembangan

Cara angka ini diukur

226 bintang16 Fork +3 dalam 24 jam

Pertumbuhan bintang terukur

dalam 24 jam
+3
dalam 7 hari
Mengumpulkan riwayat
dalam 15 hari
Mengumpulkan riwayat
dalam 1 bulan
Mengumpulkan riwayat

Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.

README.md

Asli

AgentLint

Catch risky actions while your coding agent works.

AgentLint checks proposed file changes and shell commands locally. It blocks detected secret writes and plain force-pushes to main or master, warns about risky operations, and gives your agent feedback it can act on.

PyPI CI codecov Downloads GitHub stars Python License: MIT

Quickstart · Documentation · Integration coverage · Rules

A proposed credential write is blocked, the agent receives a correction, and a revised proposal is checked again.

Illustration with a supported pre-tool hook and standard policy. AgentLint evaluates the revised proposal again; it does not rewrite your code itself.

See the difference

A coding agent proposes putting a credential in config.py. The no-secrets rule denies the write and returns a reason:

[no-secrets] Secret assignment detected: api_key=...
  -> Use environment variables instead of hard-coded secrets.

The agent can replace the literal with an environment-variable lookup:

import os

api_key = os.environ["SERVICE_API_KEY"]

The credential finding is resolved. The revised action is checked against the active policy, and any other findings still apply.

https://github.com/user-attachments/assets/ae9a6b72-8bf7-4b73-abe3-7f0f3b483d3b

Watch the 53-second product overview. The demonstration evaluates synthetic proposed actions as data; it does not execute dangerous commands.

Get started

Requires Python 3.11+ and pipx or uv.

uv tool install agentlint
cd your-project
agentlint setup claude

Use your agent's name for the last command:

Agent Setup Activate
Claude Code agentlint setup claude Restart Claude Code
Codex agentlint setup codex Restart, then review and trust the hooks in /hooks
Cursor agentlint setup cursor Reload the Cursor window
Gemini CLI agentlint setup gemini Start a new session
Continue · Kimi · Grok agentlint setup continue, kimi, or grok Follow the linked agent guide

Prefer pipx? Use pipx install agentlint instead. Setup adds hooks to your agent's settings and creates agentlint.yml if it does not exist, using packs detected from the project.

Make one tool call in your agent, then run:

agentlint status

Look for a recent observed hook call from this project. A configuration file alone does not prove the hooks are running. If nothing is observed, run agentlint doctor and follow troubleshooting.

The five-minute quickstart completes the first check and correction. Claude Code users can alternatively install the marketplace plugin; use the plugin or native setup to avoid duplicate hooks.

What blocks, what warns

With standard severity and the relevant pre-tool hook:

Outcome Examples Requirement
Block Detected secret writes, .env writes, plain --force/-f pushes to main/master, CI pipeline edits, package publishing Core rules, subject to configuration and each rule's scope
Warn Many destructive commands, direct pushes to main, protected-branch --force-with-lease, test weakening, removed error handling Core rules; some catastrophic destructive patterns block instead
Check your stack SQL interpolation, unsafe Python shell calls, frontend accessibility, React loading states Detected language/framework packs
Opt in Shell file-write restrictions and network exfiltration checks security pack
Opt in, experimental Production targets, cloud deletions, infrastructure mutations autopilot pack

Some rules run after a tool call or at session end and cannot prevent an action that has already happened. Severity settings, approvals, exemptions, and the circuit breaker affect decisions. The rule reference documents the exact behavior.

Integration matters. Native hooks inspect the tools their host reports. The OpenAI Agents SDK adapter must be attached to supported tools. The MCP server provides on-demand checks and is advisory. See coverage and limitations before relying on an integration.

AgentLint includes 77 built-in rules in 8 packs:

Pack Rules Examples
universal 24 secrets, .env writes, force-push, destructive commands, CI/CD edits, package publishing, test weakening
quality 7 oversized diffs, removed error handling, dead imports, commit message format
python 6 SQL built with f-strings, unsafe shell calls, bare except, risky migrations
frontend 8 missing alt text and labels, focus styles, touch targets
react 3 unhandled loading/error states, empty states
seo 4 page metadata, Open Graph, semantic HTML
security 7 shell file-write restrictions and network exfiltration patterns (opt-in)
autopilot 18 production targets, cloud deletions, IAM/firewall changes, infrastructure previews (opt-in, experimental)

The rule catalogue lists each rule's event, severity, and configuration.

Make it fit your project

# agentlint.yml
packs: [python, security]  # explicit selection; core packs are also loaded
rules:
  max-file-size:
    limit: 400
  no-todo-left:
    enabled: false

An explicit packs list replaces stack detection. The universal and quality packs are included unless deliberately excluded. Start with detected defaults and add stricter packs when you need them.

You want to… Start here
Protect a shared branch while keeping normal Git work moving Protect main
Fix a legitimate action that keeps getting flagged Handle a false positive
Run Ruff, ESLint, or a formatter after agent edits Connect your linters
Apply a shared policy across repositories Share required rules
Enforce a convention specific to your codebase Write a custom rule

Use the same checks beyond the agent

agentlint check-patch change.patch       # preview a Codex patch without applying it
agentlint ci --diff origin/main...HEAD   # check the pull request's file changes
agentlint evidence                      # inspect verification receipts
agentlint uninstall claude              # remove Claude Code's native hooks

CI checks file changes; it does not reconstruct or audit every shell command the agent ran. CI setup · CLI reference

Local by default

Hook checks run locally. You do not need an account or a network connection for the offline rules. Optional AgentChute adds threat feeds, team policy, and visibility; feed-backed rules need that data. Cloud event delivery is opt-in and sends redacted summaries rather than file contents or full commands.

AgentLint uses rules and heuristics. It can miss risky behavior, flag legitimate work, and be bypassed by a process with broad access. Keep code review, tests, CI, and least-privilege credentials in place. Security model · Report a vulnerability

Contribute

Start with CONTRIBUTING.md. A regression case for a false positive or a missed detection is a useful first contribution. AgentLint includes 77 built-in rules in 8 packs; the catalogue is generated in part from the code and checked in CI.

Changelog · Issues · Security policy · MIT license

Star history

Jelajahi proyek terkait

Memuat…