# How to decide whether an agent constraint is a prompt rule or a code check

Three buckets for every constraint in an agent prompt.

By Ki Moon · 2026-07-31 · technique · current
Canonical: https://kihmoon.com/bench-notes/p/gate-or-rule-procedure/

**Symptom:** Your outbound prompt carries a long must-not list, and per-batch rules such as caps or no-repeat openers still fail.

The outbound email pipeline I built kept accumulating slot rules, phrase bans and per-batch caps. Stacked in the prompt, the cross-item ones failed first in drafts, because no single generation call sees the whole batch.

Every constraint now goes in one of three buckets.

- Procedural micro-rule: one principle in the prompt, plus a deterministic check after the stage.
- Honesty, brand or human-commitment rail: stays hard; its literally checkable part becomes lint.
- Schema, enum or curated menu: stays, and gets stronger.

I write non-negotiables as failing tests rather than sentences. My signal-based selling package is no-send, and a test fails on any send surface in its source. A prose rule degrades quietly, and a failing test can't.

The Claude Code hooks guide describes hooks as shell commands run at fixed points in the lifecycle that give deterministic control, so actions happen without relying on the model to choose them.

I prove a new gate by replay instead of fixtures. Replay on a batch a reviewer already graded caught a softened ask for feedback, a variant of a banned opener that my synthetic fixtures missed.

Incident history stays out of the prompt. When I split a 99K agent prompt into operative rules and a maintainer-only ledger, pure narrative was only about 5.6K. Most explanation that reads like story is mechanism.

The sorting still takes judgment. Telling a rule that compensates for a model weakness from one born of a market defect takes an A/B test at each model change. Overused phrases stay banned whatever the model.

## Check your setup (read-only)

Take the prompt file of each agent that generates text in batches. List the constraints in the file. Mark each constraint as procedure, rail or schema. Look in the code that runs after the prompt's stage for a check on each procedural constraint. Any cross-item rule with no code check is a gap.

**Passes if:** Every cross-item procedural constraint in the prompt has a matching code check after the stage.

**Access needed:** local-config

## If it fails (changes to make later, not part of the check)

1. Sort every prompt constraint into procedure, rail or schema.
2. Move each procedural rule into a check that runs after the stage. Leave one principle in the prompt.
3. Write each non-negotiable as a test that fails, such as no send surface in a no-send package.
4. Validate a new gate by replay. The gate must fire on every finding in a reviewer-graded defect batch. The gate must stay silent on a clean sibling batch.
5. Keep operative rules inline. Move incident history to a file the agent never loads.

**Applies if:** A job in your setup has an agent generate more than one buyer-facing message or CRM value per run.

**Skip if:** Your job config holds every output for a person's review, and the prompt file has under about 10 rules.

Tags: deterministic, evals, agents
