Guide · Comparison

Guardrails for AI coding: approaches and tools compared

Updated 15 Nov 2026 · 6 min read

There is no single switch that makes AI coding agents safe. Each guardrail catches a different failure. Here is what each one does well, what it misses, and how they fit together.

ApproachCatchesMisses
Rules files
AGENTS.md, CLAUDE.md, Cursor rules
Sets intent and conventions up front.Nothing verifies it was followed; goes stale.
Tests and CIBroken behaviour that a test covers.Gaps in coverage; tests edited by the agent; files changed outside the task; runs late.
AI code review botsBugs and style issues in the diff, with explanations.Runs after the fact; can't know which files the task was allowed to touch; probabilistic.
Agent permissions and hooks
built into tools like Claude Code
Blocks risky commands and actions inside that one tool.Tool-specific; not a shared definition of the task or of what must keep working.
StetFiles changed outside the agreed task; locked behaviours that broke; snapshot output that changed; edited approved snapshots. Works across tools.Needs you to set a scope per task and lock the behaviours that matter; it doesn't review code quality.

A layered setup that works

  1. Before the task: a short, current AGENTS.md (Stet generates its block) and an explicit scope: stet scope set "<task>" --allow "<globs>".
  2. During the task: your agent's own permission settings for risky commands; Stet's MCP tools let Claude Code and Cursor check scope and locks themselves.
  3. After the task: stet guard and stet check, then commit (stet scope done --commit).
  4. At commit and in CI: the Stet pre-commit hook and your test suite.
  5. At review: a human or AI reviewer, now looking at a diff that is already in scope and passing its locks.

When Stet is the right fit

Add the missing layer

npx stet-cli init · Setup guide · GitHub