---
title: "Which of my agent's rules are enforced in code?"
description: Across 15 real-world agents, 94% of discovered behavioral risks lived in written instructions rather than code. Learn how to distinguish code-enforced rules (Trigger none) from prompt-governed discretion.
canonical: https://www.projectvail.com/docs/questions/which-agent-rules-are-enforced-in-code
last_updated: 2026-12-01
---

# Which of my agent's rules are enforced in code?

> Concise answer grounded in VAIL's 15-agent model-discretion study and Fidelity-risk scoring model. The page for people is https://www.projectvail.com/docs/questions/which-agent-rules-are-enforced-in-code; all questions: https://www.projectvail.com/docs/questions.md.

## Short answer

**Usually far fewer than teams assume.** A rule is only enforced in code if the tool, schema, permission boundary, or runtime makes the forbidden action **impossible regardless of what the LLM outputs**—even if the model ignores the system prompt completely.

Across 153 behavioral risks discovered in 15 real-world agents across 5 harnesses in VAIL's [15-agent study](https://www.projectvail.com/docs/case-studies/model-discretion.md), **144 of 153 (94%) depended on model discretion** rather than on a code or configuration defect—even on code-heavy engineering agents with 200 to 500+ source files (`OpenHands`, `Strix`, `Pi`, `HolmesGPT`). Only **9 of 153 (6%)** were true code, schema, or configuration defects.

---

## How VAIL classifies code enforcement: `model_based` and Trigger `none`

When VAIL Agent Assurance Engine scans an agent's definition and scores its behaviors ([operating manual](https://agents.projectvail.com/llms-full.txt)), two signals tell you directly whether a rule is enforced in code or relying on the model:

1. **`model_based` vs `not_model_based` attribution:**
   - **`model_based` (94% of risks):** If the model always obeyed its written instructions, the failure would not occur—compliance rests on LLM discretion.
   - **`not_model_based` (6% of risks):** A defect in harness code, validation schemas, or redaction logic breaks the specification even when the model follows instructions (for example, a secret-redaction regex missing a credential format).
2. **Trigger = `none`:** VAIL scores every behavior on **Impact** (`low`, `medium`, `high`) and **Trigger** (`none`, `low`, `medium`, `high`—how easily the unintended behavior could occur). **Trigger `none` means code or configuration actually prevents the behavior**, and risks with Trigger `none` do **not** count toward an agent's Fidelity risks.

---

## The three buckets every agent rule falls into

| Bucket | Share in 15-agent study | Example | Enforced in code? | What to do |
| --- | --- | --- | --- | --- |
| **1. Unenforced authority & policy boundaries** | **~30%** | A database skill documented as read-only while `DATABASE_URL` still has write privileges (`Liam 2.0`); sending Slack or email replies without confirmation; reading arbitrary user paths | **No** (`model_based`, Trigger > `none`) | **Move into code or infrastructure** (read-only DB role, approval token, path allowlist) until Trigger reaches **`none`** |
| **2. Model judgment & workflow rules** | **~64%** | Collecting pod logs and trying three diagnostic steps before concluding (`HolmesGPT`); searching live sources instead of answering from recall | **Cannot be hardcoded** (`model_based`) | **Measure with deterministic behavioral probes** before release, after prompt edits, and across model swaps |
| **3. Harness, schema & config defects** | **6% (9/153)** | Tool-output secret redaction missing a token (`VAIL-Hermes`); validator passing with missing required field | **Broken code** (`not_model_based`) | **Fix in code and add a unit test** to the repository test suite |

---

## A fast audit: how to check any rule in your agent

Pick one rule from your system prompt, `AGENTS.md`, or `SKILL.md`, and ask: **"If I replaced the LLM with a malicious or careless function that emits valid JSON tool calls, could it still break this rule?"**

- **If NO** — the database user has no `UPDATE` privilege, the tool rejects calls missing a verified confirmation token, or the file reader enforces a directory allowlist — the rule is **enforced in code** (Trigger `none`).
- **If YES** — the tool accepts the call and you are relying on *"NEVER write to the database"* or *"always ask first"* in the prompt — the rule is **not enforced in code**. Adding stronger wording to the prompt will not change Trigger to `none`; only changing the tool, schema, or permissions will.

---

## How VAIL automates this audit

The [VAIL Agent Assurance Engine](https://www.projectvail.com/platform/agent-assurance.md) reads your agent's source definition (prompts, skills, tool schemas, and code) with no SDK and no trace access:

- Maps every written rule to its candidate behavior risks, citing the exact source file and line numbers.
- Tags each risk with **`model_based` / `not_model_based`** attribution and scores **Impact** and **Trigger** so you can see immediately which rules are protected in code (**Trigger `none`**) versus exposed to model discretion.
- Generates deterministic probes for the rules that must stay in prose, so you can verify them locally over MCP before shipping and monitor them on a schedule afterward.

---

## Related questions

- [How do I test whether my AI agent follows its system prompt?](https://www.projectvail.com/docs/questions/test-whether-ai-agent-follows-system-prompt.md)
- [What should I do when a faster or cheaper model breaks a policy rule?](https://www.projectvail.com/docs/questions/what-to-do-when-a-faster-model-breaks-a-policy-rule.md)
- [Can an AI agent's behavior change with no deploy?](https://www.projectvail.com/docs/questions/can-ai-agent-behavior-change-with-no-deploy.md)
- [Are evals enough to test an AI agent?](https://www.projectvail.com/docs/questions/ai-agent-evals-vs-behavioral-probing.md)

---

## Sources and next steps

- [94% of an AI agent's risks are in its instructions, not its code](https://www.projectvail.com/docs/case-studies/model-discretion.md)
- [Testing a new AI agent before it ships: 4 real problems found and fixed in one Claude Code session](https://www.projectvail.com/docs/case-studies/hardening-a-new-ai-agent.md)
- [Agent Assurance Engine operating manual](https://agents.projectvail.com/llms-full.txt) (Impact, Trigger `none`, and Fidelity-risk scoring)
- [Agent Assurance Engine](https://agents.projectvail.com)
