What it does
AI Guard reports risky patterns wherever the code came from. It does not try to tell whether a person or a model wrote the code. Lint rules run inside ESLint or through the zero-config command npx ai-guard run. The command npx ai-guard init-hooks sets up hooks for Claude Code, Codex and Cursor. It detects the agents a project uses from the .claude/, .cursor/ and .codex/ directories. AI Guard looks up each npm package before it is installed. Lint and the checks on a change run locally with no network access and no telemetry. Every check is deterministic, with no model in the loop.
Capabilities
- 27 lint rules cover secrets, swallowed errors, floating promises, invented imports and placeholder code.
- Checks on an agent's change give one verdict and add checks for skipped tests, new eslint-disable comments and hidden text in agent config. AI Guard says problems that were already there never block.
- Package checks block packages that don't exist on npm, removed malware and suspicious look-alikes before installation, and warn on releases from the last 24 hours. Network use is opt-in and only queries the public npm registry.
- The pre-commit gate runs on every commit through husky, lefthook, simple-git-hooks or pre-commit. Only problems the commit introduces block it.
- The GitHub Action annotates pull requests and writes a job summary and a SARIF file for GitHub Code Scanning.
When to use it
- You want to find swallowed errors, leaked secrets or placeholder code in JavaScript and TypeScript.
- You want to check npm packages before they are installed, including names that don't exist.
- You want pull request annotations and results in GitHub Code Scanning.