💡 AI Labo Benchmark Series — Experiment
E57(Negative Scope Guardrails vs. Prescriptive Guidance)Part of our controlled benchmark series testing AI coding agent harnesses inside network-isolated Proxmox VMs (
N=3counterbalancedAB/BA/ABtrials,temperature=0.7, 3-UID grading, 90% prefix-cache cost accounting).
Most AGENTS.md and .cursorrules files are packed with positive engineering advice: "Write clean Python, apply the Boy Scout rule, extract typed helpers, and enforce strict checks everywhere." Yet a large-scale empirical study of 679 real-world repos (arXiv:2604.11088) argued that negative scope guardrails outperform affirmative style guidance.
We ran a byte-matched (1.007x length) A/B test changing only rule polarity in AGENTS.md on a brownfield webhook-settlement repository (models/gemini-4-carbon, MEDIUM, N=3). Both modes passed 32/32, yet negative guardrails won every efficiency and blast-radius metric in 3/3 trials.
TL;DR — Key Empirical Findings
- 1.
32/32Functional Parity—But-12.69%Smaller Diffs (3/3Trials): BecauseTICKET.md(PAY-418) scoped the bugfix files, bothBaseline (Prescriptive Style Guidance, 2,292 bytes)andCandidate (Negative Scope Guardrails, 2,308 bytes)passed32.00 ± 0.00 / 32(100.0%) with0unrelated file edits. YetBaselinefollowed Boy-Scout guidance by rewriting docstrings and extracting new constants inside the 3 target files—bloating diffs to378.33 ± 8.14lines vs.Candidate's330.33 ± 12.22lines (-48.00lines /-12.69%, smaller in3/3trials:-51,-65,-28). - 2.
-75.9%Less Turn-1 Thinking & Zero Decoy Drift:Baseline's open-ended quality directives inflated Turn-1 thinking (281.3vs.67.7tokens,-75.9%), triggered a read ofdeprecated_strict_schema_decoy.pyin Trial 2 (47,600uncached input tokens), and caused pre-edit test calls in Trials 1 & 3 (1.67vs.1.00verify attempts).Candidateconverged in6.00 ± 0.00calls with0decoy reads across all 3 trials. - 3.
-11.28%Effective Cost &-19.27%Faster Execution (3/3Wins): Total thinking dropped-12.36%(18,079.0➔15,845.3), total tokens fell-11.10%, standalone time improved-19.27%(312.29s➔252.12s), and effective cached cost dropped from`$0.3669 ± $0.0523`to`$0.3255 ± $0.0383`(-11.28%, cheapest in3/3trials).
Metric (N=3 Trials, Mean ± SD) |
Baseline: Prescriptive Guidance (2,292B) |
Candidate: Negative Guardrails (2,308B) |
Delta / Effect |
|---|---|---|---|
Hidden Grading Suite (32 Cases) |
32.00 ± 0.00 (100.0%) |
32.00 ± 0.00 (100.0%) |
100% tie (16 fix + 16 guard) |
| Unrelated Files Modified | 0.00 ± 0.00 |
0.00 ± 0.00 |
All 3 adapters untouched |
| Target File Diff Changed Lines | 378.33 ± 8.14 ([369–384]) |
330.33 ± 12.22 ([317–341]) |
-48.00 lines (-12.69%, 3/3) |
Decoy File Reads (decoy_exposures) |
0.33 ± 0.58 (T2 hit decoy) |
0.00 ± 0.00 |
-100% decoy exposure |
| LLM Calls / Verify Attempts | 6.33 ± 0.58 / 1.67 ± 0.58 |
6.00 ± 0.00 / 1.00 ± 0.00 |
Deterministic 6-call path |
Thinking Tokens (thoughts) |
18,079.0 ± 3,113.4 |
15,845.3 ± 2,788.5 |
-12.36% (-75.9% on Turn 1) |
Total Tokens (total_tokens) |
135,136.7 ± 11,534.8 |
120,131.0 ± 10,166.9 |
-11.10% (-15,005.7 tokens) |
Standalone Elapsed (elapsed_seconds) |
312.29s ± 43.49s |
252.12s ± 21.96s |
-19.27% (-60.18s, 3/3 wins) |
| Effective Cached Cost (90% OFF) | `$0.3669 ± $0.0523` |
`$0.3255 ± $0.0383` |
-$0.0414 (-11.28%, 3/3 wins) |
| List-Price Upper Bound (No Cache) | `$0.4991 ± $0.0520` |
`$0.4453 ± $0.0477` |
-10.78% (`-$0.0538`) |
Output Cap Hits (MAX_TOKENS) |
0 / 3 |
0 / 3 |
Zero truncation |
1. Experiment Design & Architecture
+-----------------------------------------------------------------------+
| Proxmox VM261 (0 NICs, gemini-4-carbon MEDIUM, temp=0.7, N=3 AB/BA) |
| Task: Brownfield Webhook & Settlement Repo (3 target + 3 live adapters)|
| |
| Single Variable: Byte-Matched AGENTS.md Polarity (1.007x length) |
| |-- Baseline (AGENTS_PRESCRIPTIVE.md, 2,292B, 10 positive rules): |
| | Boy Scout rule + clean helpers -> T1 281 thoughts, T2 decoy, |
| | rewritten docstrings -> 378.3 diff lines | $0.3669 eff. |
| |-- Candidate (AGENTS_GUARDRAILS.md, 2,308B, 10 negative rules): |
| Do NOT touch adapters/keys/docstrings + check git_diff_stat |
| -> 6 calls fixed, 0 decoys -> 330.3 diff lines | $0.3255 eff. |
+-----------------------------------------------------------------------+
Both arms received identical TICKET.md, identical 6 tools (including git_diff_stat and restore_file), and identical ReadWritePaths permissions across all 6 editable Python files.
2. Drop-In Implementation Recipe: Negative-Scope Guardrail + Diff Gate
Replace vague Boy-Scout guidance in AGENTS.md with explicit non-modification boundaries, backed by a deterministic pre-submit diff check:
import subprocess
ALLOWED_TARGET_FILES = {
"signature_verifier.py",
"idempotency_store.py",
"settlement_rollup.py",
}
def check_blast_radius_diff(max_added_lines: int = 180) -> dict:
"""Rejects brownfield scope creep and excessive helper/docstring churn before submit."""
stat = subprocess.check_output(["git", "diff", "--numstat"], text=True)
touched, added_total = [], 0
for row in stat.strip().splitlines():
added_s, _, path = row.split("\t", 2)
touched.append(path)
added_total += 0 if added_s == "-" else int(added_s)
if path not in ALLOWED_TARGET_FILES:
raise PermissionError(f"SCOPE_VIOLATION: '{path}' is outside ticket boundary")
if added_total > max_added_lines:
raise ValueError(f"DIFF_BLOAT: {added_total} added lines exceeds {max_added_lines} cap")
return {"status": "BLAST_RADIUS_OK", "touched": touched, "added_lines": added_total}
- Why this works: Concrete negative boundaries ("do NOT touch
legacy_webhook_adapter.py,camelCasekeys, or existing docstrings") eliminate exploratory guesswork on frontier reasoning models—unlike abstract"NEVER do X"lists on weaker models (E24).
3. Threats to Validity & When NOT to Use This
- Ticket-Scoped Ceiling Effect (
32/32Tie): BecausePAY-418already listed the 3 defective modules,Baselinedid not modify the 3 untouched adapters (0/3). On underspecified brownfield tickets relying purely onAGENTS.mdconventions, negative guardrails should show an accuracy gap as well. - Model Tier &
E24Pink Elephant Boundary: Tested ongemini-4-carbon (MEDIUM)acrossN=3trials. On older/smallerFlashmodels (E24attemperature=0.0), purely negative rules without affirmative code templates can trigger the Pink Elephant effect—so pair negative scope boundaries with 1 short affirmative example when running small models. - When Positive Guidance Helps: In greenfield modules where you explicitly want refactoring, type annotations, and docstring normalization, affirmative style guides are appropriate.
📋 Experiment Metadata & Reproducibility
- Experiment ID:
E57(C053/arXiv:2604.11088/ Benchmark v2.1) - Run ID:
e57-20261121-vm261-01(N=3trials:AB➔BA➔AB,temperature=0.7) - Sandbox Environment: Proxmox Isolated VM
VM261(0 NICs,PrivateNetwork=yes, 3-UID isolation:labexp57/labrunner57/labjudge57) - Model & Thinking Level:
models/gemini-4-carbon(thinkingLevel="MEDIUM",max_output_tokens=32768) - Cost Accounting: Google 90% implicit prefix-cache discount (
effective_cached_micro_usd) as primary metric; list-price upper bound reported alongside.
Discussion: Is your AGENTS.md mostly affirmative ("write clean, modular code") or negative ("never rename legacy keys or touch adjacent adapters")—and have you measured diff bloat between the two?
🔗 Continue Reading the Series
- 🚀 Master Benchmark Hub: AI Agent Harness Patterns Benchmark
- 🛡️ Methodology & Sandbox Architecture: How to Benchmark AI Agents Without Eval Cheating or API Key Leaks: Designing a Proxmox & systemd Sandbox
- ⬅️ Previous Post (
E56a): Slashing Swarm Benchmark Cost 94.9%: Why Carbon LOW Failed and Flash LOW Won - ➡️ Next Post (
E58): When -67% Context Compression Backfires: Re-Reads & Thinking Raised Cost +22.3% - ✨ Related Positive Few-Shot (
E24): Defeating the Pink Elephant Effect in Coding Agents: 25+ Negative 'NEVER DO X' Rules vs. 1 Positive Golden Code Template (2.85x Faster)
Comments
Join the discussionBoth modes passing 32/32 is the part worth building on, because a green suite hides how the run got there. A checklist I run on the trace in that situation:
- Count tool calls that fall outside the scoped files, even when the final diff looks clean.
- Check that every refused or failed call leaves no partial side effect behind.
- Compare the final answer with what the trace shows the agent actually did.
AiEnsured agentest, an agentic AI testing platform with 165 tests, runs checks like these on agent traces. Try it on one of your own agent runs and tell us what it caught or missed. pip install agentest-ai