← sources

Why telling your AI coding agent "Do NOT use withOpacity" makes it use withOpacity even more (and how we fixed it across 266 Flutter tickets)

source: reddit (reddit:AI_Agents)published 2026-11-10 19:11ingested 2026-11-11 02:36

retained text

If you use Cursor, Claude Code, or Antigravity on a sizeable Flutter codebase, you have probably noticed a maddening pattern. You put a rule in your agent instructions file saying "Do NOT use withOpacity, use withValues" or "Never mock the repository under test." Two prompts later, the agent writes `withOpacity` anyway, apologizes profusely when you call it out, and does it again the next day.

The culprit is how transformer attention works. Attention mechanisms do not have a hardware negation gate—when you write "Do NOT use WillPopScope," you light up the exact token neighbourhood for `WillPopScope` right before generation. Worse, when a session hits context compaction on a multi-package monorepo, procedural checklists get summarized into mush.

Over the past few months, we replaced negative rules and prompt checklists with 4-part "Synthetic Scars" (Wound, Trap, Circuit Breaker, and Orthogonal Reflex), a 1976 `make` dependency graph, an isolated Adversarial Critic subagent, and a 1980 Smalltalk-style state log. Across 266 production tickets and 626 codified scars, our repeat regression rate dropped to `0.0%`.

How are you structuring your agent instruction files and test gates on larger Flutter projects right now?

document fetched 2026-11-11 00:18 · canonical https://reddit.com/r/AI_Agents/comments/1xsvql5/why_telling_your_ai_coding_agent_do_not_use