Engineering brief

Why your AI coding agent keeps ignoring your rules—and how to fix

Cole Medin1 min read · saves 22 min

At a glance

Relevance
Practical value
Warnings
None

Rules only guide AI coding agents; they don't guarantee behavior. Hooks—deterministic scripts triggered by agent events—enforce what rules cannot.

Rules are probabilistic; hooks are deterministic. This is the missing governance layer for AI agents.

Summary

The core argument is that engineering teams over-rely on rules for AI coding agents, but rules only guide probabilistic LLMs. Hooks—deterministic scripts triggered by agent events—provide actual guarantees. The speaker demonstrates that bloating rules degrades agent performance, citing a study where self-evolved rules made agents worse.

The practical taxonomy is clear: pre-tool hooks block actions (security gates), post-tool hooks log activity (observability), and stop hooks enforce completion criteria (e.g., mandatory test passes). The most actionable insight is the 'rule audit' framework: classify each rule as encoding judgment (keep as rule) or naming a process/extracting a guarantee (convert to hook).

The speaker walks through concrete implementations: blocking .env file reads, forcing file coupling checks before edits, and running tests on conversation end. These are not speculative—they use exit codes (0=pass, 2=block) that agents interpret as feedback, not crashes.

The tradeoff is clear: hooks add setup complexity but remove failure modes from probabilistic agent behavior. For teams scaling agent usage, the recommendation is to audit rules now, extract process guarantees into hooks, and accept that this requires initial engineering investment.

Watch the video

This video is blocked due to your privacy settings. To watch this video, please accept YouTube marketing cookies.

Related breakdowns

Get TL;DW

Too Long; Didn't Watch.

A concise breakdowns of the AI and devtools videos that actually matter for engineering leaders.

Free. Weekly. No hype.

Video and thumbnails remain the property of their respective creators. tldw.news provides editorial analysis, commentary, and discovery links to original content.