𝗪𝗵𝘆 𝗬𝗼𝘂𝗿 𝗔𝗜 𝗔𝗴𝗲𝗻𝘁 𝗜𝗴𝗻𝗼𝗿𝗲𝘀 𝗬𝗼𝘂𝗿 𝗥𝘂𝗹𝗲𝘀
You wrote a rule. The agent read it. It broke the rule anyway.
I saw this in a React Native project. My config said: "Never use pnpm add for native packages."
The agent ran that exact command in the next session. The build broke. The package manager pulled the wrong version of a library. The JS compiled, but the app crashed at runtime. It wasted an hour of my time.
The agent was not being disobedient. The rule was bad. It only said what to avoid. It did not explain why. When a situation looks slightly different, the agent treats your rule as a suggestion.
If you want better results, follow these four steps.
- Provide the mechanism, not just a prohibition An LLM finds gaps in "never use X" rules. If you add the "why," the rule becomes a logic tool instead of a fence.
- Bad: Never use pnpm add for native packages.
- Good: Never use pnpm add for native packages. Why: pnpm pulls the wrong version and breaks the native build. Use npm install --save-exact instead.
When the agent understands the failure mode, it handles cases you did not even write down.
Keep one source of truth If a fact lives in two files, one is wrong. Do not paste types or schemas into your agent config. They go stale quickly. Point the agent to the actual file. Tell it: "Types are in src/types/, read them."
Use specialized agents A mobile engineer and a pipeline engineer have different checklists. Do not put everything in one prompt. You get average results for both. Split your agents by domain. Load the right agent for the right file.
Make "done" a verifiable command "Looks good" is not a finish line. An agent thinks code is done as soon as it looks reasonable. Give it a test to pass.
- Vague: Verify the feature works before finishing.
- Verifiable: Done when npm run typecheck exits 0 and npm test passes.
Stop writing lists of technologies and empty rules. "Always use TypeScript" is useless if the agent types everything as "any." Tell it why the tool matters.
Write fewer rules. Attach a reason to every rule. Use one source of truth. Use specialists. Give it a finish line it can run.
Source: https://dev.to/arseni_1c552e9dc5349dc6b4/why-your-ai-agent-ignores-the-rules-you-wrote-9lf