CLI Finder / tools / semgrep

Semgrep CLI for static analysis and policy checks

Run code pattern checks and policy scans with JSON or SARIF output that agents can summarize.

Agent Readiness: 82/100 Verified publisher Actively maintained
82 /100

Semgrep CLI is useful for security-oriented agent workflows when scans stay report-first and remediation requires approval.

Structured output 86/100

Supports machine-readable scan output suitable for agent summaries and CI reports.

Non-interactive use 86/100

Can run in shell, CI, or agent sessions without prompts for common scanning tasks.

Safety boundaries 72/100

Scanning is generally safe, but remediation, ignore rules, and policy changes require review.

Agent docs 80/100

Help output and documented examples are sufficient for building AGENTS.md command rules.

Install options

pipx $ pipx install semgrep
Homebrew $ brew install semgrep

Common commands

Run default scan · safe $ semgrep scan --config auto --json --output semgrep.json

Creates a JSON report of code findings.

Run local rules · safe $ semgrep scan --config .semgrep/ --sarif --output semgrep.sarif

Runs repository-specific rules.

Change rules · requires review $ ${EDITOR:-vi} .semgrep/

Rule changes can suppress findings and require review.

Agent usage examples

Claude Code / Codex CLI Use Semgrep CLI to scan and summarize findings. Prefer JSON/SARIF output. Do not edit ignore rules, update dependencies, or delete files without approval.

Safety notes

  • Run scans in read-only/report mode before allowing an agent to modify files or suppress findings.
  • Treat ignore-file edits, policy changes, dependency updates, and destructive cleanup as approval-required.
  • Prefer JSON or SARIF output so the agent can cite exact findings instead of paraphrasing terminal text.

Agent workflow

Use Semgrep to scan code before large refactors or security-sensitive PRs. Summarize findings with rule ID, file path, severity, and suggested remediation.

Approval boundary

Changing rules, ignoring findings, or applying broad automated rewrites should require user review.