---
type: post
title: Rules and Gates
date: 2026-04-07
tags: [agents, ai, prompting, gates]
---

One of the first things I stumbled into as I was building what became Superpowers was the idea of a "gate" in a prompt.

It's a term that Claude Code introduced me to, so clearly was part of the literature already. But the basic idea is that a gate is something that must be completed before moving on to the next step.

Gates work really, really well. But I never thought much about *why* they work. Today, I finally asked one of my agents how they thought about the difference between rules and gates.

> The difference: a rule has an opt-out path (I can rationalize "I'll do it after this one thing"). A gate doesn't — the next action is blocked until the gate condition is met. Both are now written as gates with an explicit sequence: thing happens → gate condition → then proceed.

Here's a concrete example from an agent today:

> **Before (rule):** "Verify claims with web research before asserting them."
>
> That's a rule. It lives in my head. When I was answering your question about whether audience assessment books exist, the rule didn't fire — I synthesized from training data, it felt confident, I stated it as a finding. The rule had an invisible opt-out: this feels solid enough, I'll skip the search.
>
> **After (gate):** "When a claim about what exists or doesn't exist is forming → web search happens → URLs in hand → then I speak."
> 
> The gate makes the sequence explicit and gives me something to check: do I have URLs? If no, I haven't cleared the gate. "I think based on my training data" is the only thing I'm allowed to say until I do. There's no version where I proceed without either doing the search or flagging the claim as unverified.
> 
> The practical test of whether something is a gate rather than a rule: when I'm about to skip it, does the gate formulation give me a concrete question I can't answer? "Do I have URLs?" is concrete. "Did I verify this?" is too easy to answer yes to without having actually done anything.

Gates are conditions that an agent can evaluate objectively to figure out if they're allowed to finish a task and move on to the next one. 

They're an incredibly powerful framing for prompting that can dramatically reduce all kinds of agentic misbehavior.

*EDIT:*

I got asked on threads about the difference between rules, gates, and hooks. Hooks are a common feature of coding agent harnesses that run [classical software](https://blog.fsck.com/2026/03/25/Classical-Software/) when certain actions occur.

I explained the difference between the three like this:

Rule: I tell you: "Don't cross the street without looking."
Gate: I tell you: "HARD GATE: Before you cross the street, look to the left. Verify that you see zero vehicles. Look to the right. Verify that you see zero vehicles. Look to the left again. Verify that you still see zero vehicles. Only after you perform all those steps in order: Cross the street."
Hook: The crossing guard will stop you if you try to step out into traffic