記事一覧

Give Your AI the Intent, Not Just the Rule

A short memo on why prohibitions alone don't constrain coding agents.

2026年11月4日

#AI#Software Engineering#ai agents#Prompt Engineering#Developer Tools
Give Your AI the Intent, Not Just the Rule

When you constrain an AI's behavior, a list of prohibitions isn't enough. You, and the AI, have to understand the intent behind each rule. Why? Because AI is clever. It can find many alternate solutions that honor the letter of a rule while defeating its purpose.

Here's a quick example.

Rule: When parsing unstructured human text, do not use regexes.

Before the rule:

import re
re.match(...)

After the rule:

text.startswith(prefixes)

The second solution doesn't use a regex, but it's still string matching. This bites a lot of people. The AI reports, "I solved the problem without using regexes!", and the solution belongs to exactly the same class as the regex it replaced: pattern matching on prose. The rule was obeyed. The problem it was written to prevent is still there.

Rewrite the rule around the problem and the intent

The fix is to tell the AI what the rule protects against, so it can recognize the whole class of bad solutions instead of just the one you named. Here's the rewritten rule:

Why this rule exists (intent): Human-authored prose is highly variable, idiosyncratic, and impossible to predict exhaustively. Trying to infer structure, labels, table headers, or citations from prose via regexes or string/token pattern-matching is a fatal overfitting trap: it creates "pretend-structure" that appears to work on today's fixture and then dies in an endless, unwinnable whack-a-mole of long-tail edge cases across the real corpus. We must generalize, never overfit.

With that in front of it, startswith, in, split on keywords, hardcoded word lists, and fuzzy matching all read as the same mistake, because they are. The model doesn't need a longer list of banned functions. It needs to know which failure you're trying to avoid.

A simple shape for rules

When I write a rule for an agent now, I try to give it four parts:

  1. The rule: what not to do (or what to do).
  2. Why it exists: the failure it prevents, in plain English.
  3. What else counts: the look-alike solutions that break the intent without breaking the letter.
  4. What to do instead: the acceptable path, or when to stop and ask.

The second part does most of the work. A model that knows why a rule exists can usually figure out the third and fourth on its own. A model that only knows the rule will look for the nearest door the rule didn't lock.


AI attribution: 3/4 — Human-originated, AI-shaped. What this means

Jason Vertrees is the founder of Heavy Chain Engineering, which helps lower middle-market vertical SaaS companies and PE firms turn scattered AI usage into measurable delivery leverage — 85% faster feature velocity, six-to-eight-week projects shipped in days. If you want help building an AI-native engineering organization, book an AI Delivery Assessment or email info@heavychain.org.